hamlib-1.2.15.3/0000755000175000017500000000000012044564776010215 500000000000000hamlib-1.2.15.3/prm80/0000755000175000017500000000000012044565034011147 500000000000000hamlib-1.2.15.3/prm80/prm8060.c0000644000175000017500000000664512044564477012374 00000000000000/* * Hamlib PRM80 backend - PRM8060 description * Copyright (c) 2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "hamlib/rig.h" #include "idx_builtin.h" #include "prm80.h" #define PRM8060_ALL_MODES (RIG_MODE_FM) #define PRM8060_FUNC (RIG_FUNC_NONE) #define PRM8060_LEVEL_ALL (RIG_LEVEL_AF|RIG_LEVEL_SQL) #define PRM8060_PARM_ALL (RIG_PARM_NONE) #define PRM8060_VFO_OPS (RIG_OP_NONE) #define PRM8060_VFO (RIG_VFO_MEM) /* * PRM 8060 rig capabilities. * http://prm80.sourceforge.net/ * */ const struct rig_caps prm8060_caps = { .rig_model = RIG_MODEL_PRM8060, .model_name = "PRM8060", .mfg_name = "Philips/Simoco", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 7, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_SPACE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 0, .timeout = 2000, .retry = 3, .has_get_func = PRM8060_FUNC, .has_set_func = PRM8060_FUNC, .has_get_level = PRM8060_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(PRM8060_LEVEL_ALL), .has_get_parm = PRM8060_PARM_ALL, .has_set_parm = RIG_PARM_SET(PRM8060_PARM_ALL), .vfo_ops = PRM8060_VFO_OPS, .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 = { { 0, 99, RIG_MTYPE_MEM, PRM80_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {MHz(144),MHz(146)-kHz(12.5),PRM8060_ALL_MODES,-1,-1,PRM8060_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { {MHz(144),MHz(146)-kHz(12.5),PRM8060_ALL_MODES,W(5),W(25),PRM8060_VFO}, RIG_FRNG_END, }, .rx_range_list2 = { {MHz(144),MHz(148)-kHz(12.5),PRM8060_ALL_MODES,-1,-1,PRM8060_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { {MHz(144),MHz(148)-kHz(12.5),PRM8060_ALL_MODES,W(5),W(25),PRM8060_VFO}, RIG_FRNG_END, }, .tuning_steps = { {PRM8060_ALL_MODES,kHz(12.5)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { /* rough guesses */ {PRM8060_ALL_MODES, kHz(12.5)}, RIG_FLT_END, }, .set_freq = prm80_set_freq, .get_freq = prm80_get_freq, .set_channel = prm80_set_channel, .get_channel = prm80_get_channel, .set_mem = prm80_set_mem, .get_mem = prm80_get_mem, .set_level = prm80_set_level, .get_level = prm80_get_level, .reset = prm80_reset, .get_info = prm80_get_info, }; /* * Function definitions below */ hamlib-1.2.15.3/prm80/prm80.c0000644000175000017500000002221012044564477012210 00000000000000/* * Hamlib PRM80 backend - main file * Copyright (c) 2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "cal.h" #include "register.h" #include "idx_builtin.h" #include "prm80.h" #define LF "\x0a" #define PROMPT ">" #define BUFSZ 64 /* [0] = Reset. [C] = Print channels list. [D] = Set system byte. [E] = Show system state (Mode-Chan-Chanstate-Sql-Vol-Lock-RX freq-TX freq). [F] = Set squelch. [H] = Print this help page. [K] = Set lock byte. [N] = Set current channel. [O] = Set volume. [P] = Edit/Add channel. [Q] = Set channels number. [R] = Set synthetiser frequencies. [T] = Set current channel state. [V] = Print firmware version. */ /* * prm80_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! * TODO: error case handling */ static int prm80_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval, i; struct rig_state *rs; rs = &rig->state; serial_flush(&rs->rigport); retval = write_block(&rs->rigport, cmd, cmd_len); if (retval != RIG_OK) return retval; /* no data wanted, but flush it anyway */ if (!data || !data_len) { char retbuf[BUFSZ+1]; retval = read_string(&rs->rigport, retbuf, BUFSZ, LF, strlen(LF)); if (retval < 0) return retval; retbuf[retval] = '\0'; #if 0 /* * Does transceiver sends back ">" ? */ if (strstr(retbuf, PROMPT)) return RIG_OK; else return -RIG_ERJCTED; #else return RIG_OK; #endif } retval = read_string(&rs->rigport, data, BUFSZ, LF, strlen(LF)); if (retval == -RIG_ETIMEOUT) retval = 0; if (retval < 0) return retval; /* Clear possible MSB, because of 7S1 */ for (i=0; i= 2 && data[*data_len-1] == '\x0a') *data_len -= 2; data[*data_len] = '\0'; return RIG_OK; } /* * prm80_reset * Assumes rig!=NULL */ int prm80_reset(RIG *rig, reset_t reset) { int retval; /* * master reset ? */ retval = prm80_transaction (rig, "0", 1, NULL, NULL); if (retval != RIG_OK) return retval; return RIG_OK; } /* * prm80_set_freq * Assumes rig!=NULL */ int prm80_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char freqbuf[BUFSZ]; int freq_len; /* wild guess */ freq_len = sprintf(freqbuf, "R%04X%04X", (unsigned)(freq / 12500.), (unsigned)(freq / 12500.)); return prm80_transaction (rig, freqbuf, freq_len, NULL, NULL); } /* * prm80_get_freq * Assumes rig!=NULL */ int prm80_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { int ret; channel_t chan; memset(&chan, 0, sizeof(chan)); chan.vfo = RIG_VFO_CURR; ret = prm80_get_channel(rig, &chan); if (ret != RIG_OK) return ret; *freq = chan.freq; return RIG_OK; } /* * prm80_set_mem * Assumes rig!=NULL */ int prm80_set_mem(RIG *rig, vfo_t vfo, int ch) { int cmd_len; char cmdbuf[BUFSZ]; /* [N] = Set current channel. */ if (ch < 0 || ch > 99) return -RIG_EINVAL; cmd_len = sprintf(cmdbuf, "N%02u" , ch); return prm80_transaction (rig, cmdbuf, cmd_len, NULL, NULL); } /* * prm80_get_mem * Assumes rig!=NULL */ int prm80_get_mem(RIG *rig, vfo_t vfo, int *ch) { int ret; channel_t chan; memset(&chan, 0, sizeof(chan)); chan.vfo = RIG_VFO_CURR; ret = prm80_get_channel(rig, &chan); if (ret != RIG_OK) return ret; *ch = chan.channel_num; return RIG_OK; } /* * Convert first two hexadecimal digit to integer */ static int hhtoi(const char *p) { char buf[4]; buf[0] = p[0]; buf[1] = p[1]; buf[2] = '\0'; return (int)strtol(buf, NULL, 16); } /* * prm80_get_channel * Assumes rig!=NULL */ int prm80_get_channel(RIG * rig, channel_t * chan) { char statebuf[BUFSZ]; int statebuf_len = BUFSZ; int ret, chanstate; if (chan->vfo == RIG_VFO_MEM) { ret = prm80_set_mem(rig, RIG_VFO_CURR, chan->channel_num); if (ret != RIG_OK) return ret; } /* [E] = Show system state (Mode-Chan-Chanstate-Sql-Vol-Lock-RX freq-TX freq). */ ret = prm80_transaction (rig, "E", 1, statebuf, &statebuf_len); if (ret != RIG_OK) return ret; if (statebuf_len < 20) return -RIG_EPROTO; /* Example: 1240080AFF0033F02D40 */ if (hhtoi(statebuf) != 0x12) rig_debug(RIG_DEBUG_WARN, "%s: Unknown mode 0x%c%c\n", __func__, statebuf[0], statebuf[1]); chan->mode = RIG_MODE_FM; chan->width = rig_passband_normal(rig, chan->mode); chan->channel_num = hhtoi(statebuf+2); chanstate = hhtoi(statebuf+4) & 0x0f; /* is it rptr_shift or split mode ? */ chan->rptr_shift = (chanstate & 0x01) == 0 ? RIG_RPT_SHIFT_NONE : chanstate & 0x02 ? RIG_RPT_SHIFT_MINUS : chanstate & 0x04 ? RIG_RPT_SHIFT_PLUS : RIG_RPT_SHIFT_NONE; chan->flags = chanstate & 0x08 ? RIG_CHFLAG_SKIP : 0; chan->levels[LVL_SQL].f = ((float)(hhtoi(statebuf+6)>>4))/15.; chan->levels[LVL_AF].f = ((float)(hhtoi(statebuf+8)>>4))/15.; /* same as chanstate bit 1 */ chan->flags = hhtoi(statebuf+10) == 0 ? 0 : RIG_CHFLAG_SKIP; chan->freq = ((hhtoi(statebuf+12)<<8) + hhtoi(statebuf+14)) * 12500; chan->tx_freq = ((hhtoi(statebuf+16)<<8) + hhtoi(statebuf+18)) * 12500; chan->rptr_offs = chan->tx_freq - chan->freq; return RIG_OK; } /* * prm80_set_channel * Assumes rig!=NULL */ int prm80_set_channel(RIG * rig, const channel_t * chan) { char statebuf[BUFSZ]; int statebuf_len = BUFSZ; int ret; if (chan->vfo == RIG_VFO_MEM) { ret = prm80_set_mem(rig, RIG_VFO_CURR, chan->channel_num); if (ret != RIG_OK) return ret; } /* [T] = Set current channel state. (Mode-Chan-Chanstate-Sql-Vol-Lock-RX freq-TX freq) ? */ /* Example: 1240080AFF0033F02D40 ? */ statebuf_len = sprintf(statebuf, "T%02X%02X%02X%02X%02X%02X%04X%04X", chan->mode == RIG_MODE_FM ? 0x12 : 0x12, chan->channel_num, chan->flags & RIG_CHFLAG_SKIP ? 0x08 : 0, /* TODO: tx shift */ (unsigned)(chan->levels[LVL_SQL].f*15), (unsigned)(chan->levels[LVL_AF].f*15), chan->flags & RIG_CHFLAG_SKIP ? 0x01 : 0x00, /* Lock */ (unsigned)(chan->freq / 12500.), (unsigned)(chan->tx_freq / 12500.) ); ret = prm80_transaction (rig, statebuf, statebuf_len, NULL, NULL); if (ret != RIG_OK) return ret; return RIG_OK; } /* * prm80_set_level * Assumes rig!=NULL */ int prm80_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { int cmd_len; char cmdbuf[BUFSZ]; switch (level) { case RIG_LEVEL_AF: cmd_len = sprintf(cmdbuf, "O%02u" , (unsigned)(val.f * 15)); return prm80_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_LEVEL_SQL: cmd_len = sprintf(cmdbuf, "F%02u" , (unsigned)(val.f * 15)); return prm80_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_LEVEL_RFPOWER: return -RIG_ENIMPL; default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_level %d\n", level); return -RIG_EINVAL; } return RIG_OK; } /* * prm80_get_level * Assumes rig!=NULL */ int prm80_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int ret; channel_t chan; memset(&chan, 0, sizeof(chan)); chan.vfo = RIG_VFO_CURR; ret = prm80_get_channel(rig, &chan); if (ret != RIG_OK) return ret; switch (level) { case RIG_LEVEL_AF: val->f = chan.levels[LVL_AF].f; return RIG_OK; case RIG_LEVEL_SQL: val->f = chan.levels[LVL_SQL].f; return RIG_OK; default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_level %d\n", level); return -RIG_EINVAL; } return RIG_OK; } /* * prm80_get_info * Assumes rig!=NULL */ const char * prm80_get_info(RIG *rig) { static char buf[BUFSZ]; int ret, buf_len=BUFSZ; /* [V] = Print firmware version. */ ret = prm80_transaction (rig, "V", 1, buf, &buf_len); if (ret < 0) return NULL; return buf; } /* * initrigs_prm80 is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(prm80) { rig_debug(RIG_DEBUG_VERBOSE, "prm80: _init called\n"); rig_register(&prm8060_caps); return RIG_OK; } hamlib-1.2.15.3/prm80/Makefile.in0000644000175000017500000004760112044564555013153 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = prm80 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_prm80_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = prm8060.lo am_hamlib_prm80_la_OBJECTS = $(am__objects_1) prm80.lo hamlib_prm80_la_OBJECTS = $(am_hamlib_prm80_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_prm80_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_prm80_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_prm80_la_SOURCES) DIST_SOURCES = $(hamlib_prm80_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ PRM80SRCLIST = prm8060.c pkglib_LTLIBRARIES = hamlib-prm80.la hamlib_prm80_la_SOURCES = $(PRM80SRCLIST) prm80.c hamlib_prm80_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_prm80_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = prm80.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu prm80/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu prm80/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-prm80.la: $(hamlib_prm80_la_OBJECTS) $(hamlib_prm80_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_prm80_la_LINK) -rpath $(pkglibdir) $(hamlib_prm80_la_OBJECTS) $(hamlib_prm80_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prm80.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prm8060.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/prm80/Makefile.am0000644000175000017500000000040412044564477013133 00000000000000PRM80SRCLIST = prm8060.c pkglib_LTLIBRARIES = hamlib-prm80.la hamlib_prm80_la_SOURCES = $(PRM80SRCLIST) prm80.c hamlib_prm80_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_prm80_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = prm80.h hamlib-1.2.15.3/prm80/prm80.h0000644000175000017500000000333412044564477012223 00000000000000/* * Hamlib PRM80 backend - main header * Copyright (c) 2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _PRM80_H #define _PRM80_H 1 #include #define PRM80_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .rptr_shift = 1, \ .rptr_offs = 1, \ .flags = 1, /* lockout*/ \ .levels = RIG_LEVEL_SQL|RIG_LEVEL_AF, \ } int prm80_reset(RIG *rig, reset_t reset); int prm80_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int prm80_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int prm80_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int prm80_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int prm80_set_mem (RIG *rig, vfo_t vfo, int ch); int prm80_get_mem (RIG *rig, vfo_t vfo, int *ch); int prm80_set_channel(RIG * rig, const channel_t * chan); int prm80_get_channel(RIG * rig, channel_t * chan); const char* prm80_get_info(RIG *rig); extern const struct rig_caps prm8060_caps; #endif /* _PRM80_H */ hamlib-1.2.15.3/py-compile0000755000175000017500000001013512044564550012127 00000000000000#!/bin/sh # py-compile - Compile a Python program scriptversion=2009-04-28.21; # UTC # Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009 Free Software # Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . if [ -z "$PYTHON" ]; then PYTHON=python fi basedir= destdir= files= while test $# -ne 0; do case "$1" in --basedir) basedir=$2 if test -z "$basedir"; then echo "$0: Missing argument to --basedir." 1>&2 exit 1 fi shift ;; --destdir) destdir=$2 if test -z "$destdir"; then echo "$0: Missing argument to --destdir." 1>&2 exit 1 fi shift ;; -h|--h*) cat <<\EOF Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..." Byte compile some python scripts FILES. Use --destdir to specify any leading directory path to the FILES that you don't want to include in the byte compiled file. Specify --basedir for any additional path information you do want to be shown in the byte compiled file. Example: py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py Report bugs to . EOF exit $? ;; -v|--v*) echo "py-compile $scriptversion" exit $? ;; *) files="$files $1" ;; esac shift done if test -z "$files"; then echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 exit 1 fi # if basedir was given, then it should be prepended to filenames before # byte compilation. if [ -z "$basedir" ]; then pathtrans="path = file" else pathtrans="path = os.path.join('$basedir', file)" fi # if destdir was given, then it needs to be prepended to the filename to # byte compile but not go into the compiled file. if [ -z "$destdir" ]; then filetrans="filepath = path" else filetrans="filepath = os.path.normpath('$destdir' + os.sep + path)" fi $PYTHON -c " import sys, os, py_compile files = '''$files''' sys.stdout.write('Byte-compiling python modules...\n') for file in files.split(): $pathtrans $filetrans if not os.path.exists(filepath) or not (len(filepath) >= 3 and filepath[-3:] == '.py'): continue sys.stdout.write(file) sys.stdout.flush() py_compile.compile(filepath, filepath + 'c', path) sys.stdout.write('\n')" || exit $? # this will fail for python < 1.5, but that doesn't matter ... $PYTHON -O -c " import sys, os, py_compile files = '''$files''' sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n') for file in files.split(): $pathtrans $filetrans if not os.path.exists(filepath) or not (len(filepath) >= 3 and filepath[-3:] == '.py'): continue sys.stdout.write(file) sys.stdout.flush() py_compile.compile(filepath, filepath + 'o', path) sys.stdout.write('\n')" 2>/dev/null || : # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: hamlib-1.2.15.3/wj/0000755000175000017500000000000012044565034010621 500000000000000hamlib-1.2.15.3/wj/wj8888.c0000644000175000017500000000743312044564477011706 00000000000000/* * Hamlib Watkins-Johnson backend - WJ-8888 description * Copyright (c) 2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "idx_builtin.h" #include "wj.h" /* modes: what about ISB(Idependant Sideband)? */ #define WJ8888_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_AMS) #define WJ8888_FUNC (RIG_FUNC_NONE) #define WJ8888_LEVEL (RIG_LEVEL_RF|RIG_LEVEL_AGC|RIG_LEVEL_IF|RIG_LEVEL_RAWSTR) #define WJ8888_VFO (RIG_VFO_A) /* FIXME: real measures */ #define WJ8888_STR_CAL { 2, \ { \ { 0x00, -60 }, /* -115.5dBm .. -99.5dBm */ \ { 0x7f, 60 } \ } } /* * WJ-8888 receiver capabilities. * * Needs async I/O board * * * TODO: BFO */ const struct rig_caps wj8888_caps = { .rig_model = RIG_MODEL_WJ8888, .model_name = "WJ-8888", .mfg_name = "Watkins-Johnson", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 75, /* jumper E26 */ .serial_rate_max = 9600, /* jumper E19 */ .serial_data_bits = 8, .serial_stop_bits = 1, /* jumper between E5 & E6 */ .serial_parity = RIG_PARITY_NONE, /* no jumper between E3 & E4 */ .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 5, /* typical 5ms, max 15ms */ .timeout = 2000, .retry = 3, .has_get_func = WJ8888_FUNC, .has_set_func = WJ8888_FUNC, .has_get_level = WJ8888_LEVEL, .has_set_level = RIG_LEVEL_SET(WJ8888_LEVEL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .vfo_ops = RIG_OP_NONE, .preamp = { RIG_DBLST_END }, .attenuator = { RIG_DBLST_END }, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 0x7f } }, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = kHz(8), /* IF at 455kHz */ .targetable_vfo = 0, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .str_cal = WJ8888_STR_CAL, .cfgparams = wj_cfg_params, .chan_list = { RIG_CHAN_END, }, .rx_range_list1 = { {kHz(500),MHz(30),WJ8888_MODES,-1,-1,WJ8888_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30),WJ8888_MODES,-1,-1,WJ8888_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {WJ8888_MODES,10}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {WJ8888_MODES, kHz(2)}, {WJ8888_MODES, Hz(500)}, {WJ8888_MODES, kHz(4)}, {WJ8888_MODES, kHz(8)}, /* option (in spare, to be fixed) */ {WJ8888_MODES, Hz(200)}, {WJ8888_MODES, kHz(1)}, {WJ8888_MODES, kHz(3)}, {WJ8888_MODES, kHz(6)}, {WJ8888_MODES, kHz(12)}, {WJ8888_MODES, kHz(16)}, RIG_FLT_END, }, .rig_init = wj_init, .rig_cleanup = wj_cleanup, .set_conf = wj_set_conf, .get_conf = wj_get_conf, .set_freq = wj_set_freq, .get_freq = wj_get_freq, .set_mode = wj_set_mode, .get_mode = wj_get_mode, .set_level = wj_set_level, .get_level = wj_get_level, }; /* * Function definitions below */ hamlib-1.2.15.3/wj/Makefile.in0000644000175000017500000004745212044564560012625 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = wj DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_wj_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = wj8888.lo am_hamlib_wj_la_OBJECTS = $(am__objects_1) wj.lo hamlib_wj_la_OBJECTS = $(am_hamlib_wj_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_wj_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(hamlib_wj_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_wj_la_SOURCES) DIST_SOURCES = $(hamlib_wj_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ WJSRCLIST = wj8888.c pkglib_LTLIBRARIES = hamlib-wj.la hamlib_wj_la_SOURCES = $(WJSRCLIST) wj.c hamlib_wj_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_wj_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = wj.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu wj/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu wj/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-wj.la: $(hamlib_wj_la_OBJECTS) $(hamlib_wj_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_wj_la_LINK) -rpath $(pkglibdir) $(hamlib_wj_la_OBJECTS) $(hamlib_wj_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wj.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wj8888.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/wj/wj.h0000644000175000017500000000336412044564477011352 00000000000000/* * Hamlib Watkins-Johnson backend - main header * Copyright (c) 2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _WJ_H #define _WJ_H 1 #include #define TOK_RIGID TOKEN_BACKEND(1) extern const struct confparams wj_cfg_params[]; struct wj_priv_data { unsigned receiver_id; freq_t freq; rmode_t mode; pbwidth_t width; value_t agc; value_t rfgain; value_t ifshift; value_t rawstr; }; int wj_set_conf(RIG *rig, token_t token, const char *val); int wj_get_conf(RIG *rig, token_t token, char *val); int wj_init(RIG *rig); int wj_cleanup(RIG *rig); int wj_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int wj_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int wj_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int wj_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int wj_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int wj_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); extern const struct rig_caps wj8888_caps; #endif /* _WJ_H */ hamlib-1.2.15.3/wj/wj.c0000644000175000017500000002041012044564477011334 00000000000000/* * Hamlib Watkins-Johnson backend - main file * Copyright (c) 2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "cal.h" #include "register.h" #include "token.h" #include "wj.h" #define CMDSZ 10 const struct confparams wj_cfg_params[] = { { TOK_RIGID, "receiver_id", "receiver ID", "receiver ID", "0", RIG_CONF_NUMERIC, { .n = { 0, 15, 1 } } }, { RIG_CONF_END, NULL, } }; /* * modes */ #define MD_AM 0 #define MD_FM 1 #define MD_CW 2 #define MD_VCW 3 /* BFO variable */ #define MD_ISB 4 #define MD_LSB 5 #define MD_USB 6 #define MD_AMNL 7 /* * wj_transaction * * I'm not sure how monitor protocol works, whether you have * to send the full frame, or just the modal byte. --SF * * TODO: decode the whole reply, and maybe do some caching */ static int wj_transaction(RIG *rig, int monitor) { struct wj_priv_data *priv = (struct wj_priv_data*)rig->state.priv; unsigned char buf[CMDSZ] = { 0x8, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; unsigned char rxbuf[CMDSZ]; unsigned char freqbuf[4]; unsigned wj_agc, wj_mode, wj_width, wj_bfo, wj_rfgain; int retval; if (monitor) buf[1] |= 0x40; /* Monitor+AGC dump */ else buf[0] |= 0x40; /* Command */ buf[0] |= priv->receiver_id & 0x0f; /* tuned frequency */ to_bcd_be(freqbuf, priv->freq/10, 7); buf[1] |= freqbuf[0] & 0x3f; buf[2] |= freqbuf[1]>>1; buf[3] |= ((freqbuf[1]&0x1)<<6) | (freqbuf[2]>>2); buf[4] |= ((freqbuf[2]&0x2)<<5) | (freqbuf[3]>>3); /* gain mode */ switch (priv->agc.i) { case RIG_AGC_SLOW: wj_agc = 0; break; /* slow, 2s */ case RIG_AGC_OFF: wj_agc = 1; break; /* "not used" */ case RIG_AGC_FAST: wj_agc = 2; break; /* normal, 0.1s */ case RIG_AGC_USER: wj_agc = 3; break; /* manual */ default: return -RIG_EINVAL; } buf[4] |= wj_agc & 0x1; buf[5] |= (wj_agc & 0x2)<<5; /* IF BW */ switch (priv->width) { case 200: case 1000: wj_width = 0; break; /* spare */ case 500: wj_width = 1; break; case 2000: wj_width = 2; break; case 4000: wj_width = 3; break; case 8000: wj_width = 4; break; case 3000: case 6000: case 12000: case 16000: wj_width = 5; break; /* spare */ default: return -RIG_EINVAL; } buf[5] |= (wj_width & 0x2)<<3; /* Detection mode */ switch (priv->mode) { case RIG_MODE_CW: wj_mode = (priv->ifshift.i!=0) ? MD_VCW:MD_CW; break; case RIG_MODE_USB: wj_mode = MD_USB; break; case RIG_MODE_LSB: wj_mode = MD_LSB; break; case RIG_MODE_FM: wj_mode = MD_FM; break; case RIG_MODE_AM: wj_mode = MD_AM; break; case RIG_MODE_AMS: wj_mode = MD_ISB; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %d\n", __FUNCTION__, priv->mode); return -RIG_EINVAL; } buf[5] |= wj_mode & 0x3; /* BFO frequency, not sure though */ wj_bfo = (priv->ifshift.i/10) + 0x400; /* LSBit is 10Hz, +455kHz */ buf[6] |= (wj_bfo >> 5) & 0x3f; buf[7] |= (wj_bfo & 0x1f) << 2; /* RF gain */ wj_rfgain = (unsigned)(priv->rfgain.f * 0x7f); buf[7] |= (wj_rfgain >> 6) & 0x1; buf[8] |= (wj_rfgain & 0x3f) << 1; /* buf[9]: not used if command byte, but must be transmitted */ serial_flush(&rig->state.rigport); retval = write_block(&rig->state.rigport, (char *) buf, CMDSZ); if (retval != RIG_OK) return retval; if (monitor) { /* * Transceiver sends back ">" */ retval = read_block(&rig->state.rigport, (char *) rxbuf, CMDSZ); if (retval < 0 || retval > CMDSZ) return -RIG_ERJCTED; /* * TODO: analyze back the reply, and fill in the priv struct */ priv->rawstr.i = rxbuf[9] & 0x7f; } return retval; } int wj_init(RIG *rig) { struct wj_priv_data *priv; if (!rig || !rig->caps) return -RIG_EINVAL; priv = (struct wj_priv_data*)malloc(sizeof(struct wj_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } rig->state.priv = (void*)priv; priv->receiver_id = 0; priv->freq = kHz(500); priv->mode = RIG_MODE_AM; priv->width = kHz(8); priv->agc.i = RIG_AGC_SLOW; priv->rfgain.f = 1; priv->ifshift.i = 0; return RIG_OK; } /* */ int wj_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * Assumes rig!=NULL, rig->state.priv!=NULL */ int wj_set_conf(RIG *rig, token_t token, const char *val) { struct wj_priv_data *priv = (struct wj_priv_data*)rig->state.priv; switch (token) { case TOK_RIGID: priv->receiver_id = atoi(val); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * assumes rig!=NULL, * Assumes rig!=NULL, rig->state.priv!=NULL * and val points to a buffer big enough to hold the conf value. */ int wj_get_conf(RIG *rig, token_t token, char *val) { struct wj_priv_data *priv = (struct wj_priv_data*)rig->state.priv; switch(token) { case TOK_RIGID: sprintf(val, "%d", priv->receiver_id); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * wj_set_freq * Assumes rig!=NULL */ int wj_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct wj_priv_data *priv = (struct wj_priv_data*)rig->state.priv; priv->freq = freq; return wj_transaction (rig, 0); } /* * wj_get_freq * Assumes rig!=NULL */ int wj_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct wj_priv_data *priv = (struct wj_priv_data*)rig->state.priv; int retval; retval = wj_transaction (rig, 1); if (retval == RIG_OK) return retval; *freq = priv->freq; return RIG_OK; } /* * wj_set_mode * Assumes rig!=NULL */ int wj_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct wj_priv_data *priv = (struct wj_priv_data*)rig->state.priv; priv->mode = mode; if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); priv->width = width; return wj_transaction (rig, 0); } /* * wj_get_mode * Assumes rig!=NULL */ int wj_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct wj_priv_data *priv = (struct wj_priv_data*)rig->state.priv; int retval; retval = wj_transaction (rig, 1); if (retval == RIG_OK) return retval; *mode = priv->mode; *width = priv->width; return RIG_OK; } /* * wj_set_level * Assumes rig!=NULL */ int wj_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct wj_priv_data *priv = (struct wj_priv_data*)rig->state.priv; switch (level) { case RIG_LEVEL_IF: priv->ifshift.i = val.i; break; case RIG_LEVEL_RF: priv->rfgain.f = val.f; break; case RIG_LEVEL_AGC: priv->agc.i = val.i; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported %d\n", __FUNCTION__, level); return -RIG_EINVAL; } return wj_transaction (rig, 0); } /* * wj_get_level * Assumes rig!=NULL */ int wj_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct wj_priv_data *priv = (struct wj_priv_data*)rig->state.priv; int retval = RIG_OK; retval = wj_transaction (rig, 1); if (retval == RIG_OK) return retval; switch (level) { case RIG_LEVEL_RAWSTR: val->i = priv->rawstr.i; break; case RIG_LEVEL_IF: val->i = priv->ifshift.i; break; case RIG_LEVEL_RF: val->f = priv->rfgain.f; break; case RIG_LEVEL_AGC: val->i = priv->agc.i; break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported %d\n", __FUNCTION__, level); return -RIG_EINVAL; } return retval; } /* * initrigs_wj is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(wj) { rig_debug(RIG_DEBUG_VERBOSE, "wj: _init called\n"); rig_register(&wj8888_caps); return RIG_OK; } hamlib-1.2.15.3/wj/Makefile.am0000644000175000017500000000035312044564477012610 00000000000000WJSRCLIST = wj8888.c pkglib_LTLIBRARIES = hamlib-wj.la hamlib_wj_la_SOURCES = $(WJSRCLIST) wj.c hamlib_wj_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_wj_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = wj.h hamlib-1.2.15.3/kit/0000755000175000017500000000000012044565033010767 500000000000000hamlib-1.2.15.3/kit/kit.c0000644000175000017500000000404712044564477011662 00000000000000/* * Hamlib KIT backend - main file * Copyright (c) 2004-2012 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "register.h" #include "kit.h" #include "usrp_impl.h" /* * initrigs_kit is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(kit) { rig_debug(RIG_DEBUG_VERBOSE, "kit: _init called\n"); rig_register(&elektor304_caps); rig_register(&drt1_caps); rig_register(&dds60_caps); rig_register(&miniVNA_caps); rig_register(&hiqsdr_caps); #if (defined(HAVE_LIBUSB) && defined(HAVE_USB_H)) rig_register(&si570avrusb_caps); rig_register(&si570picusb_caps); rig_register(&funcube_caps); rig_register(&fifisdr_caps); #endif #if (defined(HAVE_LIBUSB) && defined(HAVE_USB_H)) || defined(_WIN32) /* rigs with alternate DLL support on Win32 */ rig_register(&dwt_caps); rig_register(&elektor507_caps); #endif #ifdef HAVE_USRP //rig_register(&usrp0_caps); rig_register(&usrp_caps); #endif return RIG_OK; } /* * initrots_kit is called by rot_backend_load */ DECLARE_INITROT_BACKEND(kit) { rig_debug(RIG_DEBUG_VERBOSE, "kit: _init called\n"); rot_register(&pcrotor_caps); return RIG_OK; } hamlib-1.2.15.3/kit/pcrotor.c0000644000175000017500000000653512044564477012567 00000000000000/* * Hamlib Rotator backend - PcRotor/WA6UFQ parallel port * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rotator.h" #include "parallel.h" #include "misc.h" /* ************************************************************************* */ //pcrotor_set_position(ROT *rot, azimuth_t az, elevation_t el) #define PCROTOR_POWER 0x20 #define PCROTOR_CW 0x40 #define PCROTOR_CCW 0x80 #define PCROTOR_MASK (PCROTOR_CCW|PCROTOR_CW|PCROTOR_POWER) static int setDirection(hamlib_port_t *port, unsigned char outputvalue) { int ret; par_lock (port); /* set the data bits. * Should we read before write to not trample the lower significant bits? */ ret = par_write_data(port, outputvalue); par_unlock (port); return ret; } static int pcrotor_stop(ROT *rot) { /* CW=0, CCW=0, Power-up=0 */ return setDirection(&rot->state.rotport, 0); } static int pcrotor_move(ROT *rot, int direction, int speed) { unsigned char outputvalue; rig_debug(RIG_DEBUG_TRACE, "%s called: %d %d\n", __FUNCTION__, direction, speed); switch(direction) { case ROT_MOVE_CCW: outputvalue = PCROTOR_POWER|PCROTOR_CCW; break; case ROT_MOVE_CW: outputvalue = PCROTOR_POWER|PCROTOR_CCW; break; case 0: /* Stop */ outputvalue = 0; break; default: return -RIG_EINVAL; } return setDirection(&rot->state.rotport, outputvalue); } /* ************************************************************************* */ /* * PcRotor rotator capabilities. * * Control Interface schematics from, courtersy of Bob Hillard WA6UFQ: * http://www.dxzone.com/cgi-bin/dir/jump2.cgi?ID=11173 * * DB25-7=Data-5= Power up/Sleep * DB25-8=Data-6= CW * DB25-9=Data-7= CCW * * There's no feedback. */ /** Fodtrack implement essentially only the set position function. * */ const struct rot_caps pcrotor_caps = { .rot_model = ROT_MODEL_PCROTOR, .model_name = "PcRotor", .mfg_name = "WA6UFQ", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rot_type = ROT_TYPE_OTHER, .port_type = RIG_PORT_PARALLEL, .write_delay = 0, .post_write_delay = 0, .timeout = 200, .retry = 3, .min_az = 0, .max_az = 360, .min_el = 0, .max_el = 0, .priv = NULL, /* priv */ .move = pcrotor_move, .stop = pcrotor_stop, //.set_position = pcrotor_set_position, //.get_position = pcrotor_get_position, }; /* end of file */ hamlib-1.2.15.3/kit/elektor507.c0000644000175000017500000007274412044564477013005 00000000000000/* * Hamlib KIT backend - Elektor SDR USB (5/07) receiver description * Copyright (c) 2007-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "hamlib/rig.h" #include "token.h" #include "kit.h" #ifdef _WIN32 #define USE_FTDI_DLL #elif defined(HAVE_LIBUSB) && defined(HAVE_USB_H) #define USE_LIBUSB #endif /* * Compile this model only if libusb is available * or if .DLL is available under Windows */ #if defined(USE_FTDI_DLL) || defined(USE_LIBUSB) static int elektor507_init(RIG *rig); static int elektor507_cleanup(RIG *rig); static int elektor507_open(RIG *rig); static int elektor507_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int elektor507_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int elektor507_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int elektor507_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int elektor507_set_ant(RIG * rig, vfo_t vfo, ant_t ant); static int elektor507_get_ant(RIG * rig, vfo_t vfo, ant_t *ant); static int elektor507_set_conf(RIG *rig, token_t token, const char *val); static int elektor507_get_conf(RIG *rig, token_t token, char *val); static const char * elektor507_get_info(RIG *rig); /* * I2C addresses */ #define CY_I2C_RAM_ADR 210 #define CY_I2C_EEPROM_ADR 208 /* * I2C registers */ #define CLKOE_REG 0x09 #define DIV1_REG 0x0c #define DIV2_REG 0x47 #define XTALCTL_REG 0x12 #define CAPLOAD_REG 0x13 #define PUMPCOUNTERS_REG 0x40 #define CLKSRC_REG 0x44 static int cy_update_pll(RIG *rig, unsigned char IICadr); static int i2c_write_regs(RIG *rig, unsigned char IICadr, int reg_count, unsigned char reg_adr, unsigned char reg_val1, unsigned char reg_val2, unsigned char reg_val3); #define i2c_write_reg(rig, IICadr, reg_adr, reg_val) \ i2c_write_regs(rig, IICadr, 1, reg_adr, reg_val, 0, 0) #ifdef USE_FTDI_DLL #ifdef HAVE_WINDOWS_H #include #endif #ifdef HAVE_WINBASE_H #include #endif #include #define ELEKTOR507_DLL "FTD2XX.dll" /* Some type definitions needed for dll access */ typedef enum { FT_OK = 0, FT_INVALID_HANDLE = 1, FT_DEVICE_NOT_FOUND = 2, FT_DEVICE_NOT_OPENED = 3, FT_IO_ERROR = 4, FT_INSUFFICIENT_RESOURCES = 5, FT_INVALID_PARAMETER = 6, FT_SUCCESS = FT_OK, FT_INVALID_BAUD_RATE = 7, FT_DEVICE_NOT_OPENED_FOR_ERASE = 8, FT_DEVICE_NOT_OPENED_FOR_WRITE = 9, FT_FAILED_TO_WRITE_DEVICE = 10, FT_EEPROM_READ_FAILED = 11, FT_EEPROM_WRITE_FAILED = 12, FT_EEPROM_ERASE_FAILED = 13, FT_EEPROM_NOT_PRESENT = 14, FT_EEPROM_NOT_PROGRAMMED = 15, FT_INVALID_ARGS = 16, FT_OTHER_ERROR = 17, } FT_Result; typedef FT_Result (__stdcall *FNCFT_Open)(int Index, unsigned long *ftHandle); typedef FT_Result (__stdcall *FNCFT_Close)(unsigned long ftHandle); typedef FT_Result (__stdcall *FNCFT_SetBitMode)(unsigned long ftHandle, unsigned char Mask, unsigned char Enable); typedef FT_Result (__stdcall *FNCFT_SetBaudRate)(unsigned long ftHandle, unsigned long BaudRate); typedef FT_Result (__stdcall *FNCFT_Write)(unsigned long ftHandle, void *FTOutBuf, unsigned long BufferSize, int *ResultPtr); struct elektor507_extra_priv_data { HMODULE dll; FNCFT_Open FT_Open; FNCFT_Close FT_Close; FNCFT_SetBitMode FT_SetBitMode; FNCFT_SetBaudRate FT_SetBaudRate; FNCFT_Write FT_Write; unsigned long ftHandle; }; #elif defined(USE_LIBUSB) #include #include #define USB_VID_FTDI 0x0403 /* Future Technology Devices International */ #define USB_PID_FTDI_FT232 0x6001 /* FT232R 8-bit FIFO */ #define FTDI_IN_EP 0x02 #define FTDI_USB_WRITE_TIMEOUT 5000 struct elektor507_extra_priv_data { /* empty with libusb */ }; #endif /* defaults */ #define OSCFREQ 10000 /* kHz unit -> MHz(10) */ #define XTAL_CAL 128 #define TOK_OSCFREQ TOKEN_BACKEND(1) #define TOK_XTALCAL TOKEN_BACKEND(2) static const struct confparams elektor507_cfg_params[] = { { TOK_OSCFREQ, "osc_freq", "Oscillator freq", "Oscillator frequency in Hz", "10000000", RIG_CONF_NUMERIC, { .n = { 0, MHz(30), 1 } } }, { TOK_XTALCAL, "xtal_cal", "Xtal Cal", "Cristal calibration", "132", RIG_CONF_NUMERIC, { .n = { 0, 255, 1 } } }, { RIG_CONF_END, NULL, } }; /* * Common data struct */ struct elektor507_priv_data { struct elektor507_extra_priv_data extra_priv; unsigned xtal_cal; /* 0..255 (-150ppm..150ppm) */ unsigned osc_freq; /* kHz */ #define ANT_AUTO RIG_ANT_1 #define ANT_EXT RIG_ANT_2 #define ANT_TEST_CLK RIG_ANT_3 ant_t ant; /* current antenna */ /* CY PLL stuff. * This is Qtotal & Ptotal values here. */ int P,Q,Div1N; /* FTDI comm stuff */ unsigned char FT_port; int Buf_adr; #define FT_OUT_BUFFER_MAX 1024 unsigned char FT_Out_Buffer[FT_OUT_BUFFER_MAX]; }; #ifdef USE_FTDI_DLL int elektor507_init(RIG *rig) { struct elektor507_priv_data *priv; struct elektor507_extra_priv_data *extra_priv; priv = (struct elektor507_priv_data*)calloc(sizeof(struct elektor507_priv_data), 1); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } priv->xtal_cal = XTAL_CAL; priv->osc_freq = OSCFREQ; priv->ant = ANT_AUTO; /* DIV1N set to safe default */ priv->Div1N = 8; priv->P = 8; priv->Q = 2; extra_priv = &priv->extra_priv; /* Try to load required dll */ extra_priv->dll = LoadLibrary(ELEKTOR507_DLL); if (!extra_priv->dll) { rig_debug(RIG_DEBUG_ERR, "%s: Unable to LoadLibrary %s\n", __FUNCTION__, ELEKTOR507_DLL); free(priv); return -RIG_EIO; /* huh! */ } /* * Get process addresses from dll for function access */ /* Open_USB_Device */ extra_priv->FT_Open = (FNCFT_Open) GetProcAddress(extra_priv->dll, "FT_Open"); /* Close_USB_Device */ extra_priv->FT_Close = (FNCFT_Close) GetProcAddress(extra_priv->dll, "FT_Close"); /* Set_USB_Device_BitMode */ extra_priv->FT_SetBitMode = (FNCFT_SetBitMode) GetProcAddress(extra_priv->dll, "FT_SetBitMode"); /* Set_USB_Device_BaudRate */ extra_priv->FT_SetBaudRate = (FNCFT_SetBaudRate) GetProcAddress(extra_priv->dll, "FT_SetBaudRate"); /* Write_USB_Device_Buffer */ extra_priv->FT_Write = (FNCFT_Write) GetProcAddress(extra_priv->dll, "FT_Write"); rig->state.priv = (void*)priv; return RIG_OK; } int elektor507_ftdi_write_data(RIG *rig, void *FTOutBuf, unsigned long BufferSize) { struct elektor507_extra_priv_data *extra_priv = &((struct elektor507_priv_data *)rig->state.priv)->extra_priv; FT_Result ret; int Result; rig_debug(RIG_DEBUG_TRACE,"%s called, %d bytes\n", __FUNCTION__, BufferSize); /* Open FTDI */ ret = extra_priv->FT_Open(0, &extra_priv->ftHandle); if (ret != FT_OK) return -RIG_EIO; ret = extra_priv->FT_SetBitMode(extra_priv->ftHandle, 0xff, 1); if (ret != FT_OK) return -RIG_EIO; ret = extra_priv->FT_SetBaudRate(extra_priv->ftHandle, 38400); if (ret != FT_OK) return -RIG_EIO; ret = extra_priv->FT_Write(extra_priv->ftHandle, FTOutBuf, BufferSize, &Result); if (ret != FT_OK) { rig_debug(RIG_DEBUG_ERR,"FT_Write failed: %d, Result: %d\n", ret, Result); return -RIG_EIO; } ret = extra_priv->FT_Close(extra_priv->ftHandle); if (ret != FT_OK) return -RIG_EIO; return RIG_OK; } int elektor507_cleanup(RIG *rig) { struct elektor507_priv_data *priv = (struct elektor507_priv_data *)rig->state.priv; /* Clean up the dll access */ FreeLibrary(priv->extra_priv.dll); if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } const char * elektor507_get_info(RIG *rig) { static char buf[64]; sprintf(buf, "Elektor SDR USB w/ FTDI DLL"); return buf; } #elif defined(USE_LIBUSB) /* * The libusb code is inspired by libftdi: * http://www.intra2net.com/de/produkte/opensource/ftdi/ */ int elektor507_init(RIG *rig) { hamlib_port_t *rp = &rig->state.rigport; struct elektor507_priv_data *priv; priv = (struct elektor507_priv_data*)calloc(sizeof(struct elektor507_priv_data), 1); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } priv->xtal_cal = XTAL_CAL; priv->osc_freq = OSCFREQ; priv->ant = ANT_AUTO; /* DIV1N set to safe default */ priv->Div1N = 8; priv->P = 8; priv->Q = 2; rp->parm.usb.vid = USB_VID_FTDI; rp->parm.usb.pid = USB_PID_FTDI_FT232; rp->parm.usb.conf = 1; rp->parm.usb.iface = 0; rp->parm.usb.alt = 0; /* necessary ? */ rig->state.priv = (void*)priv; return RIG_OK; } int elektor507_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } const char * elektor507_get_info(RIG *rig) { static char buf[64]; struct usb_dev_handle *udh = rig->state.rigport.handle; struct usb_device *q = usb_device(udh); sprintf(buf, "USB dev %04d", q->descriptor.bcdDevice); return buf; } int elektor507_libusb_setup(RIG *rig) { struct usb_dev_handle *udh = rig->state.rigport.handle; int ret; unsigned short index=0, usb_val; rig_debug(RIG_DEBUG_TRACE,"%s called\n", __FUNCTION__); /* Reset the ftdi device */ #if 1 ret = usb_control_msg(udh, 0x40, 0, 0, index, NULL, 0, FTDI_USB_WRITE_TIMEOUT); if (ret != 0) { rig_debug (RIG_DEBUG_ERR, "%s: usb_control_msg reset failed: %s\n", __FUNCTION__, usb_strerror ()); return -RIG_EIO; } #endif /* * Enable bitbang mode */ usb_val = 0xff; /* low byte: bitmask */ usb_val |= (0x01 << 8); /* Basic bitbang_mode: 0x01 */ ret = usb_control_msg(udh, 0x40, 0x0B, usb_val, index, NULL, 0, FTDI_USB_WRITE_TIMEOUT); if (ret != 0) { rig_debug (RIG_DEBUG_ERR, "%s: usb_control_msg bitbangmode failed: %s\n", __FUNCTION__, usb_strerror ()); return -RIG_EIO; } /* * Set baudrate * 9600 x4 because of bitbang mode */ usb_val = 49230; /* magic value for 38400 bauds */ index = 0; ret = usb_control_msg(udh, 0x40, 3, usb_val, index, NULL, 0, FTDI_USB_WRITE_TIMEOUT); if (ret != 0) { rig_debug (RIG_DEBUG_ERR, "%s: usb_control_msg baudrate failed: %s\n", __FUNCTION__, usb_strerror ()); return -RIG_EIO; } return RIG_OK; } int elektor507_ftdi_write_data(RIG *rig, void *FTOutBuf, unsigned long BufferSize) { struct usb_dev_handle *udh = rig->state.rigport.handle; int ret; rig_debug(RIG_DEBUG_TRACE,"%s called, %d bytes\n", __FUNCTION__, BufferSize); ret = usb_bulk_write(udh, FTDI_IN_EP, FTOutBuf, BufferSize, FTDI_USB_WRITE_TIMEOUT); if (ret < 0) { /* we get EPIPE if the firmware stalls the endpoint. */ if (errno != EPIPE) rig_debug (RIG_DEBUG_ERR, "usb_bulk_write failed: %s\n", usb_strerror ()); return -RIG_EIO; } return RIG_OK; } #endif /* USE_LIBUSB */ #define ELEKTOR507_MODES (RIG_MODE_USB) /* USB is for SDR */ #define ELEKTOR507_FUNC (RIG_FUNC_NONE) #define ELEKTOR507_LEVEL_ALL (RIG_LEVEL_ATT) #define ELEKTOR507_PARM_ALL (RIG_PARM_NONE) #define ELEKTOR507_VFO (RIG_VFO_A) /* * - Auto-filter antenna (K3) * - External antenna (PC1) * - Internal TEST_CLK (5 MHz) */ #define ELEKTOR507_ANT (RIG_ANT_1|RIG_ANT_2|RIG_ANT_3) /* * Elektor SDR USB (5/07) receiver description * * This kit is a QSD based on a CY27EE16ZE PLL. * The receiver is controlled via USB (through FTDI FT232R). * * Original artical: * http://www.elektor.com/magazines/2007/may/software-defined-radio.91527.lynkx * * Author (Burkhard Kainka) page, in german: * http://www.b-kainka.de/sdrusb.html */ const struct rig_caps elektor507_caps = { .rig_model = RIG_MODEL_ELEKTOR507, .model_name = "Elektor SDR-USB", .mfg_name = "Elektor", .version = "0.3.1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TUNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, #ifdef USE_LIBUSB .port_type = RIG_PORT_USB, #else .port_type = RIG_PORT_NONE, #endif .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 = 0, .has_get_func = ELEKTOR507_FUNC, .has_set_func = ELEKTOR507_FUNC, .has_get_level = ELEKTOR507_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(ELEKTOR507_LEVEL_ALL), .has_get_parm = ELEKTOR507_PARM_ALL, .has_set_parm = RIG_PARM_SET(ELEKTOR507_PARM_ALL), .level_gran = {}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END }, .attenuator = { 10, 20, 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 = { {kHz(30),MHz(30)-kHz(1),ELEKTOR507_MODES,-1,-1,ELEKTOR507_VFO, ELEKTOR507_ANT}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(30)-kHz(1),ELEKTOR507_MODES,-1,-1,ELEKTOR507_VFO, ELEKTOR507_ANT}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {ELEKTOR507_MODES,kHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_USB, kHz(24)}, /* bandpass may be more */ RIG_FLT_END, }, .cfgparams = elektor507_cfg_params, .rig_init = elektor507_init, .rig_cleanup = elektor507_cleanup, .rig_open = elektor507_open, .set_conf = elektor507_set_conf, .get_conf = elektor507_get_conf, .set_freq = elektor507_set_freq, .get_freq = elektor507_get_freq, .set_level = elektor507_set_level, .get_level = elektor507_get_level, .set_ant = elektor507_set_ant, .get_ant = elektor507_get_ant, .get_info = elektor507_get_info, }; int elektor507_set_conf(RIG *rig, token_t token, const char *val) { struct elektor507_priv_data *priv; freq_t freq; priv = (struct elektor507_priv_data*)rig->state.priv; switch(token) { case TOK_OSCFREQ: sscanf(val, "%"SCNfreq, &freq); priv->osc_freq = freq / kHz(1); break; case TOK_XTALCAL: sscanf(val, "%u", &priv->xtal_cal); break; default: return -RIG_EINVAL; } return RIG_OK; } int elektor507_get_conf(RIG *rig, token_t token, char *val) { struct elektor507_priv_data *priv; priv = (struct elektor507_priv_data*)rig->state.priv; switch(token) { case TOK_OSCFREQ: sprintf(val, "%"PRIfreq, priv->osc_freq*kHz(1)); break; case TOK_XTALCAL: sprintf(val, "%u", priv->xtal_cal); break; default: return -RIG_EINVAL; } return RIG_OK; } int elektor507_open(RIG *rig) { struct elektor507_priv_data *priv = (struct elektor507_priv_data *)rig->state.priv; int ret; rig_debug(RIG_DEBUG_TRACE,"%s called\n", __FUNCTION__); /* * Setup the FT232R. */ #ifdef USE_LIBUSB ret = elektor507_libusb_setup(rig); if (ret != RIG_OK) return ret; #endif /* Init the FT232R port to SCL/SDA high, Mux A0, Att 0 */ priv->FT_port = 0x03; /* * Setup the CY27EE16ZE PLL. */ /* Enable only CLOCK5. CLOCK3 will be on demand in set_ant() */ ret = i2c_write_reg(rig, CY_I2C_RAM_ADR, CLKOE_REG, 0x20); if (ret != 0) return ret; /* DIV1N set to safe default */ priv->Div1N = 8; ret = i2c_write_reg(rig, CY_I2C_RAM_ADR, DIV1_REG, priv->Div1N); if (ret != 0) return ret; #if 0 /* Xtal gain setting */ ret = i2c_write_reg(rig, CY_I2C_RAM_ADR, XTALCTL_REG, 0x32); if (ret != 0) return ret; /* CapLoad set to middle */ ret = i2c_write_reg(rig, CY_I2C_RAM_ADR, CAPLOAD_REG, priv->xtal_cal); if (ret != 0) return ret; #endif /* CLKSRC: CLOCK3=DIV2CLK/2, CLOCK5=DIV1CLK/DIV1N */ ret = i2c_write_regs(rig, CY_I2C_RAM_ADR, 3, CLKSRC_REG, 0x02, 0x8e, 0x47); if (ret != 0) return ret; /* DIV2SRC from REF */ ret = i2c_write_reg(rig, CY_I2C_RAM_ADR, DIV2_REG, 0x88); if (ret != 0) return ret; return RIG_OK; } #define FREQ_ALGORITHM 3 /* use AC6SL version 3-Aug-2010 */ #if FREQ_ALGORITHM == 1 /* this used to be ORIG_ALGORITHM */ static void find_P_Q_DIV1N(struct elektor507_priv_data *priv, freq_t freq) { int Freq; double Min, VCO; int p, q, q_max; Freq = freq / kHz(1); if (Freq > 19 && Freq < 60) { priv->Div1N = (2500 + Freq/2) / Freq + 128; priv->P = 1000; priv->Q = 40; return; } else if (Freq > 59 && Freq < 801) { priv->Div1N = 125; priv->P = Freq * 2; priv->Q = 40; return; } else if (Freq > 800 && Freq < 2001) { priv->Div1N = 50; priv->P = Freq; priv->Q = 50; return; } else if (Freq > 2000 && Freq < 4001) priv->Div1N = 25; else if (Freq > 4000 && Freq < 10001) priv->Div1N = 10; else if (Freq > 10000 && Freq < 20001) priv->Div1N = 5; else if (Freq > 20000 && Freq < 30001) priv->Div1N = 4; Min = priv->osc_freq; freq /= kHz(1); /* * Q:2..129 * P:8..2055, best 16..1023 (because of Pump) For stable operation: + REF/Qtotal must not fall below 250kHz ( + P*(REF/Qtotal) must not be above 400 MHz or below 100 MHz */ #if 1 q_max = priv->osc_freq/250; #else q_max = 100; #endif for (q = q_max; q >= 10; q--) { for (p = 500; p <= 2000; p++) { VCO = ((double)priv->osc_freq/q)*p; if (fabs(4*freq-VCO/priv->Div1N) < Min) { Min = fabs(4*freq - VCO/priv->Div1N); priv->Q = q; priv->P = p; } } } VCO = ((double)priv->osc_freq/priv->Q)*priv->P; if (VCO < 100e3 || VCO > 400e3) rig_debug(RIG_DEBUG_VERBOSE, "%s: Unstable parameters for VCO=%.1f\n", __FUNCTION__, VCO); } #endif /* ORIG_ALGORITHM */ #if FREQ_ALGORITHM == 2 /* this used to be default alternative to ORIG_ALGORITHM */ static void find_P_Q_DIV1N(struct elektor507_priv_data *priv, freq_t freq) { double Min, VCO, freq4; int div1n_min, div1n_max; int p, q, div1n, q_max; Min = priv->osc_freq; freq4 = freq*4/kHz(1); #define vco_min 100e3 #define vco_max 500e3 /* * Q:2..129 * P:8..2055, best 16..1023 (because of Pump) For stable operation: + REF/Qtotal must not fall below 250kHz ( + P*(REF/Qtotal) must not be above 400 MHz or below 100 MHz */ #if 1 q_max = priv->osc_freq/250; #else q_max = 100; #endif div1n_min = vco_min/freq4; if (div1n_min < 2) div1n_min = 2; else if (div1n_min > 127) div1n_min = 127; div1n_max = vco_max/freq4; if (div1n_max > 127) div1n_max = 127; else if (div1n_max < 2) div1n_max = 2; for (div1n = div1n_min; div1n <= div1n_max; div1n++) { // P/Qtotal = FREQ4*DIV1N/REF // (Q*int(r) + frac(r)*Q)/Q for (q = q_max; q >= 2; q--) { p = q*freq4*div1n/priv->osc_freq; #if 1 if (p < 16 || p > 1023) continue; #endif VCO = ((double)priv->osc_freq/q)*p; #if 1 if (VCO < vco_min || VCO > vco_max) continue; #endif if (fabs(freq4-VCO/div1n) < Min) { Min = fabs(freq4 - VCO/div1n); priv->Div1N = div1n; priv->Q = q; priv->P = p; } } } VCO = ((double)priv->osc_freq/priv->Q)*priv->P; if (VCO < vco_min || VCO > 400e3) rig_debug(RIG_DEBUG_VERBOSE, "%s: Unstable parameters for VCO=%.1f\n", __FUNCTION__, VCO); } #endif /* default alternative to ORIG_ALGORITHM */ #if FREQ_ALGORITHM == 3 /* AC6SL version 5-Aug-2010 */ /* search valid (P,Q,N) for closest match to requested frequency */ static void find_P_Q_DIV1N( struct elektor507_priv_data *priv, freq_t freq) { #define VCO_MIN 100000000 #define VCO_MAX 400000000 int Ptotal, Pmin, Pmax; int Qtotal, Qmax = 40; int Div1N; double REFdivQ, PmulREFdivQ; double Ref = priv->osc_freq * 1000.0; double freq4 = freq * 4; double newdelta, delta = fabs((priv->P * (Ref / priv->Q) / priv->Div1N) - freq4); /* For stable operation: Ref/Qtotal must not fall below 250kHz */ /* Qmax = (int) ( Ref / 250000); */ for (Qtotal = 2; Qtotal <= Qmax; Qtotal++) { REFdivQ = ( Ref / Qtotal); /* For stable operation: Ptotal*(Ref/Qtotal) must be ... */ Pmin = (int) ( VCO_MIN / REFdivQ); /* ... >= 100mHz */ Pmax = (int) ( VCO_MAX / REFdivQ); /* ... <= 400mHz */ for (Ptotal = Pmin; Ptotal <= Pmax; Ptotal++) { PmulREFdivQ = Ptotal * REFdivQ; Div1N = (int) ((PmulREFdivQ + freq4 / 2) / freq4); if (Div1N < 2) Div1N = 2; if (Div1N > 127) Div1N = 127; newdelta = fabs((PmulREFdivQ / Div1N) - freq4); if (newdelta < delta) { /* save best (P,Q,N) */ delta = newdelta; priv->P = Ptotal; priv->Q = Qtotal; priv->Div1N = Div1N; } } } } #endif /* AC6SL version 5-Aug-2010 */ int elektor507_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct elektor507_priv_data *priv = (struct elektor507_priv_data *)rig->state.priv; freq_t final_freq; int ret=0; int Mux; if (priv->ant == ANT_AUTO) { /* Automatically select appropriate filter */ if (freq <= kHz(1600)) { /* Select A1, low pass, fc=1.6MHz */ Mux = 1; } else { /* Select A2, high pass */ Mux = 2; } priv->FT_port &= 0x63; //0,1 = I2C, 2,3,4=MUX, 5,6=Attenuator priv->FT_port |= Mux << 2; } find_P_Q_DIV1N(priv, freq); /* Compute PLL parameters */ elektor507_get_freq(rig, vfo, &final_freq); rig_debug(RIG_DEBUG_VERBOSE, "%s: Freq=%.0f kHz, delta=%d Hz, Div1N=%d, P=%d, Q=%d, FREQ_ALGORITHM=%d\n", __FUNCTION__, freq/kHz(1), (int)(final_freq-freq), priv->Div1N, priv->P, priv->Q, FREQ_ALGORITHM); if ((double)priv->osc_freq/priv->Q < 250) rig_debug(RIG_DEBUG_WARN, "%s: Unstable parameters for REF/Qtotal=%.1f\n", __FUNCTION__, (double)priv->osc_freq/priv->Q); ret = cy_update_pll(rig, CY_I2C_RAM_ADR); return (ret != 0) ? -RIG_EIO : RIG_OK; } int elektor507_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct elektor507_priv_data *priv = (struct elektor507_priv_data *)rig->state.priv; double VCO; VCO = ((double)priv->osc_freq * kHz(1)) / priv->Q * priv->P; /* Div by 4 because of QSD */ *freq = (VCO / priv->Div1N) / 4; return RIG_OK; } int elektor507_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct elektor507_priv_data *priv = (struct elektor507_priv_data *)rig->state.priv; int ret=0; int att=0; switch(level) { case RIG_LEVEL_ATT: /* val.i */ /* FTDI: DSR, DCD */ switch (val.i) { case 0: att = 0; break; case 10: att = 1; break; case 20: att = 2; break; default: return -RIG_EINVAL; } priv->FT_port &= 0x1f; priv->FT_port |= (att&0x3) << 5; ret = elektor507_ftdi_write_data(rig, &priv->FT_port, 1); break; default: return -RIG_EINVAL; } return (ret != 0) ? -RIG_EIO : RIG_OK; } int elektor507_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct elektor507_priv_data *priv = (struct elektor507_priv_data *)rig->state.priv; int ret=0; switch(level) { case RIG_LEVEL_ATT: switch ((priv->FT_port >> 5) & 3) { case 0: val->i = 0; break; case 1: val->i = 10; break; case 2: val->i = 20; break; default: ret = -RIG_EINVAL; } break; default: return -RIG_EINVAL; } return (ret != 0) ? -RIG_EIO : RIG_OK; } int elektor507_set_ant(RIG * rig, vfo_t vfo, ant_t ant) { struct elektor507_priv_data *priv = (struct elektor507_priv_data *)rig->state.priv; int ret, Mux; rig_debug(RIG_DEBUG_TRACE,"%s called\n", __FUNCTION__); /* * FTDI: RTS, CTS, DTR * * A4,A5,A6 are not connected * * ANT1->A1/A2, ANT2->A3, ANT3->A7 */ switch(ant) { case RIG_ANT_1: Mux = 0; break; /* Mux will be updated upon next set_freq */ case RIG_ANT_2: Mux = 3; break; /* ANT_EXT */ case RIG_ANT_3: Mux = 7; break; /* ANT_TEST_CLK */ default: return -RIG_EINVAL; } priv->ant = ant; priv->FT_port &= 0x63; //0,1 = I2C, 2,3,4=MUX, 5,6=Attenuator priv->FT_port |= Mux << 2; #if 0 ret = elektor507_ftdi_write_data(rig, &priv->FT_port, 1); #else /* Enable CLOCK3 on demand */ ret = i2c_write_reg(rig, CY_I2C_RAM_ADR, CLKOE_REG, 0x20 | (ant==RIG_ANT_3 ? 0x04 : 0)); #endif return (ret != 0) ? -RIG_EIO : RIG_OK; } int elektor507_get_ant(RIG * rig, vfo_t vfo, ant_t *ant) { struct elektor507_priv_data *priv = (struct elektor507_priv_data *)rig->state.priv; *ant = priv->ant; return RIG_OK; } /* * Update the PLL counters */ static int cy_update_pll(RIG *rig, unsigned char IICadr) { struct elektor507_priv_data *priv = (struct elektor507_priv_data *)rig->state.priv; int P0, R40, R41, R42; unsigned char Div1N; unsigned char Clk3_src; int Pump; int ret; /* * PLL Pump setting according to table 9 */ if (priv->P < 45) Pump = 0; else if (priv->P < 480) Pump = 1; else if (priv->P < 640) Pump = 2; else if (priv->P < 800) Pump = 3; else Pump = 4; P0 = priv->P & 0x01; R40 = (((priv->P >> 1) - 4) >> 8) | (Pump << 2) | 0xc0; R41 = ((priv->P >> 1) - 4) & 0xff; R42 = (priv->Q - 2) | (P0<<7); ret = i2c_write_regs(rig, IICadr, 3, PUMPCOUNTERS_REG, R40, R41, R42); if (ret != 0) return ret; switch (priv->Div1N) { case 2: /* Fixed /2 divider option */ Clk3_src = 0x80; Div1N = 8; break; case 3: /* Fixed /3 divider option */ Clk3_src = 0xc0; Div1N = 6; break; default: Div1N = priv->Div1N; Clk3_src = 0x40; } ret = i2c_write_reg(rig, IICadr, DIV1_REG, Div1N); if (ret != 0) return ret; /* Set 2 low bits of CLKSRC for CLOCK5. DIV1CLK is set already */ ret = i2c_write_reg(rig, IICadr, CLKSRC_REG+2, Clk3_src|0x07); if (ret != 0) return ret; return RIG_OK; } static void ftdi_SCL(RIG *rig, int d) { struct elektor507_priv_data *priv = (struct elektor507_priv_data *)rig->state.priv; if (priv->Buf_adr >= FT_OUT_BUFFER_MAX) return; /* * FTDI RXD->SCL */ if (d == 0) priv->FT_port &= ~0x02; else priv->FT_port |= 0x02; priv->FT_Out_Buffer[priv->Buf_adr++] = priv->FT_port; } static void ftdi_SDA(RIG *rig, int d) { struct elektor507_priv_data *priv = (struct elektor507_priv_data *)rig->state.priv; if (priv->Buf_adr >= FT_OUT_BUFFER_MAX) return; /* * FTDI TXD->SDA */ if (d == 0) priv->FT_port &= ~0x01; else priv->FT_port |= 0x01; priv->FT_Out_Buffer[priv->Buf_adr++] = priv->FT_port; } static void ftdi_I2C_Init(RIG *rig) { ftdi_SCL(rig, 1); ftdi_SDA(rig, 1); /* SCL=1, SDA=1 */ } static void ftdi_I2C_Start(RIG *rig) { ftdi_SDA(rig, 0); /* SDA=0 */ ftdi_SCL(rig, 0); /* SCL=0 */ } static void ftdi_I2C_Stop(RIG *rig) { ftdi_SCL(rig, 0); ftdi_SDA(rig, 0); /* SCL=0, SDA=0 */ ftdi_SCL(rig, 1); /* SCL=1 */ ftdi_SDA(rig, 1); /* SDA=1 */ } /* Acknowledge: SCL=0, SDA=0 SCL=1 SCL=0 No Acknowledge: SCL=0, SDA=1 SCL=1 SCL=0 */ static void ftdi_I2C_Write_Byte(RIG *rig, unsigned char c) { int i; for (i=7; i>=0; i--) { ftdi_SDA(rig, c & (1<state.priv; int ret; /* Start with a new buffer */ priv->Buf_adr = 0; ftdi_I2C_Init(rig); ftdi_I2C_Start(rig); ftdi_I2C_Write_Byte (rig, IICadr); ftdi_I2C_Write_Byte (rig, reg_adr); if (reg_count >= 1) ftdi_I2C_Write_Byte (rig, reg_val1); if (reg_count >= 2) ftdi_I2C_Write_Byte (rig, reg_val2); if (reg_count >= 3) ftdi_I2C_Write_Byte (rig, reg_val3); ftdi_I2C_Stop(rig); //usleep(10000); ret = elektor507_ftdi_write_data(rig, priv->FT_Out_Buffer, priv->Buf_adr); if (ret != 0) return -RIG_EIO; return 0; } #if 0 static const unsigned char ftdi_code[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x34, 0x08, 0x5a, 0x24/*0x6f*/, 0x00, 0x14, 0x0a, 0x00, 0x08, 0x88, 0x50, 0x04, 0x32, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x2b, 0x17, 0x00, 0xfe, 0xfe, 0x7f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32, 0x10, 0x32 }; int load_ftdi_code(RIG *rig, unsigned char IICadr, const unsigned char code[]) { struct elektor507_priv_data *priv = (struct elektor507_priv_data *)rig->state.priv; int ret; int i, j; rig_debug(RIG_DEBUG_TRACE,"%s called\n", __FUNCTION__); for (i = 0; i<16; i++) { /* Start with a new buffer */ priv->Buf_adr = 0; ftdi_I2C_Init(rig); ftdi_I2C_Start(rig); ftdi_I2C_Write_Byte (rig, IICadr); ftdi_I2C_Write_Byte (rig, i*16); for (j = 0; j<16; j++) { ftdi_I2C_Write_Byte (rig, code[i*16+j]); } ftdi_I2C_Stop(rig); ret = elektor507_ftdi_write_data(rig, priv->FT_Out_Buffer, priv->Buf_adr); if (ret != 0) return -RIG_EIO; } return RIG_OK; } #endif #endif /* defined(USE_FTDI_DLL) || defined(USE_LIBUSB) */ hamlib-1.2.15.3/kit/usrp_impl.cc0000644000175000017500000000650512044564477013251 00000000000000/* * Hamlib KIT backend - Universal Software Radio Peripheral * Copyright (c) 2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* * Compile only this model if usrp is available */ #if defined(HAVE_USRP) #include #include #include #include #include "usrp_impl.h" #include "token.h" struct usrp_priv_data { usrp_standard_rx *urx; usrp_standard_tx *utx; freq_t if_mix_freq; }; int usrp_init(RIG *rig) { struct usrp_priv_data *priv; priv = (struct usrp_priv_data*)malloc(sizeof(struct usrp_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } rig->state.priv = (void*)priv; //priv->if_mix_freq = IFMIXFREQ; return RIG_OK; } int usrp_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } int usrp_open(RIG *rig) { struct usrp_priv_data *priv = (struct usrp_priv_data*)rig->state.priv; int which_board = 0; int decim = 125; priv->urx = usrp_standard_rx::make (which_board, decim, 1, -1, usrp_standard_rx::FPGA_MODE_NORMAL).get(); if (priv->urx == 0) return -RIG_EIO; return RIG_OK; } int usrp_close(RIG *rig) { struct usrp_priv_data *priv = (struct usrp_priv_data*)rig->state.priv; delete priv->urx; return RIG_OK; } /* * Assumes rig!=NULL, rig->state.priv!=NULL */ int usrp_set_conf(RIG *rig, token_t token, const char *val) { struct usrp_priv_data *priv = (struct usrp_priv_data*)rig->state.priv; switch(token) { case TOK_IFMIXFREQ: sscanf(val, "%"SCNfreq, &priv->if_mix_freq); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * assumes rig!=NULL, * Assumes rig!=NULL, rig->state.priv!=NULL * and val points to a buffer big enough to hold the conf value. */ int usrp_get_conf(RIG *rig, token_t token, char *val) { struct usrp_priv_data *priv = (struct usrp_priv_data*)rig->state.priv; switch(token) { case TOK_IFMIXFREQ: sprintf(val, "%"PRIfreq, priv->if_mix_freq); break; default: return -RIG_EINVAL; } return RIG_OK; } int usrp_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct usrp_priv_data *priv = (struct usrp_priv_data*)rig->state.priv; int chan = 0; if (!priv->urx->set_rx_freq (chan, freq)) return -RIG_EPROTO; return RIG_OK; } int usrp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct usrp_priv_data *priv = (struct usrp_priv_data*)rig->state.priv; int chan = 0; *freq = priv->urx->rx_freq (chan); return RIG_OK; } const char * usrp_get_info(RIG *rig) { return NULL; } #endif /* HAVE_USRP */ hamlib-1.2.15.3/kit/dds60.c0000644000175000017500000002030712044564477012010 00000000000000/* * Hamlib KIT backend - DDS-60 description * Copyright (c) 2007 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "hamlib/rig.h" #include "kit.h" #include "parallel.h" #include "token.h" #define DDS60_MODES (RIG_MODE_AM) #define DDS60_FUNC (RIG_FUNC_NONE) #define DDS60_LEVEL_ALL (RIG_LEVEL_NONE) #define DDS60_PARM_ALL (RIG_PARM_NONE) #define DDS60_VFO (RIG_VFO_A) /* defaults */ #define OSCFREQ MHz(30) #define IFMIXFREQ kHz(0) #define PHASE_INCR 11.25 struct dds60_priv_data { freq_t osc_freq; freq_t if_mix_freq; int multiplier; unsigned phase_step; /* as 11.25 deg steps */ }; #define TOK_OSCFREQ TOKEN_BACKEND(1) #define TOK_IFMIXFREQ TOKEN_BACKEND(2) #define TOK_MULTIPLIER TOKEN_BACKEND(3) #define TOK_PHASE_MOD TOKEN_BACKEND(4) static const struct confparams dds60_cfg_params[] = { { TOK_OSCFREQ, "osc_freq", "Oscillator freq", "Oscillator frequency in Hz", "30000000", RIG_CONF_NUMERIC, { .n = { 0, MHz(180), 1 } } }, { TOK_IFMIXFREQ, "if_mix_freq", "IF", "IF mixing frequency in Hz", "0", RIG_CONF_NUMERIC, { .n = { 0, MHz(180), 1 } } }, { TOK_MULTIPLIER, "multiplier", "Multiplier", "Optional X6 multiplier", "1", RIG_CONF_CHECKBUTTON }, { TOK_IFMIXFREQ, "phase_mod", "Phase Modulation", "Phase modulation in degrees", "0", RIG_CONF_NUMERIC, { .n = { 0, 360, PHASE_INCR } } }, { RIG_CONF_END, NULL, } }; static int dds60_init(RIG *rig); static int dds60_cleanup(RIG *rig); static int dds60_open(RIG *rig); static int dds60_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int dds60_set_conf(RIG *rig, token_t token, const char *val); static int dds60_get_conf(RIG *rig, token_t token, char *val); /* * The DDS-60 kit exists with a AD9851 chip (60 MHz), * as well as with the AD9850 chip (30 MHz) (no multiplier). * There is an option to enable/disable the AD9851 X6 multiplier. * http://www.amqrp.org/kits/dds60/ * http://www.analog.com/en/prod/0,2877,AD9851,00.html * * The receiver is controlled via the parallel port (D0,D1,D2). */ const struct rig_caps dds60_caps = { .rig_model = RIG_MODEL_DDS60, .model_name = "DDS-60", .mfg_name = "AmQRP", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TUNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_PARALLEL, .write_delay = 0, .post_write_delay = 0, .timeout = 200, .retry = 0, .has_get_func = DDS60_FUNC, .has_set_func = DDS60_FUNC, .has_get_level = DDS60_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(DDS60_LEVEL_ALL), .has_get_parm = DDS60_PARM_ALL, .has_set_parm = RIG_PARM_SET(DDS60_PARM_ALL), .level_gran = {}, .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 = { {MHz(1),MHz(60),DDS60_MODES,-1,-1,DDS60_VFO}, /* TBC */ RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {MHz(1),MHz(60),DDS60_MODES,-1,-1,DDS60_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {DDS60_MODES,1}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {DDS60_MODES, kHz(12)}, RIG_FLT_END, }, .cfgparams = dds60_cfg_params, .rig_init = dds60_init, .rig_cleanup = dds60_cleanup, .rig_open = dds60_open, .set_conf = dds60_set_conf, .get_conf = dds60_get_conf, .set_freq = dds60_set_freq, }; int dds60_init(RIG *rig) { struct dds60_priv_data *priv; priv = (struct dds60_priv_data*)malloc(sizeof(struct dds60_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } rig->state.priv = (void*)priv; priv->osc_freq = OSCFREQ; priv->if_mix_freq = IFMIXFREQ; priv->multiplier = 1; priv->phase_step = 0; return RIG_OK; } int dds60_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * Assumes rig!=NULL, rig->state.priv!=NULL */ int dds60_set_conf(RIG *rig, token_t token, const char *val) { struct dds60_priv_data *priv; float phase; priv = (struct dds60_priv_data*)rig->state.priv; switch(token) { case TOK_OSCFREQ: sscanf(val, "%"SCNfreq, &priv->osc_freq); break; case TOK_IFMIXFREQ: sscanf(val, "%"SCNfreq, &priv->if_mix_freq); break; case TOK_MULTIPLIER: sscanf(val, "%d", &priv->multiplier); break; case TOK_PHASE_MOD: sscanf(val, "%f", &phase); priv->phase_step = ((unsigned)((phase+PHASE_INCR/2) / PHASE_INCR))%32; break; default: return -RIG_EINVAL; } return RIG_OK; } /* * assumes rig!=NULL, * Assumes rig!=NULL, rig->state.priv!=NULL * and val points to a buffer big enough to hold the conf value. */ int dds60_get_conf(RIG *rig, token_t token, char *val) { struct dds60_priv_data *priv; priv = (struct dds60_priv_data*)rig->state.priv; switch(token) { case TOK_OSCFREQ: sprintf(val, "%"PRIfreq, priv->osc_freq); break; case TOK_IFMIXFREQ: sprintf(val, "%"PRIfreq, priv->if_mix_freq); break; case TOK_MULTIPLIER: sprintf(val, "%d", priv->multiplier); break; case TOK_PHASE_MOD: sprintf(val, "%f", priv->phase_step*PHASE_INCR); break; default: return -RIG_EINVAL; } return RIG_OK; } #define DATA 0x01 /* d0 */ #define CLOCK 0x02 /* d1 */ #define LOAD 0x03 /* d2 */ static void ad_delay(int delay) { /* none needed, I/O bus should be slow enough */ } static void ad_bit(hamlib_port_t *port, unsigned char bit) { bit &= DATA; par_write_data(port, bit); ad_delay(1); par_write_data(port, bit|CLOCK); ad_delay(1); par_write_data(port, bit); ad_delay(1); } static void ad_write(hamlib_port_t *port, unsigned long word, unsigned char control) { int i; /* lock the parallel port */ par_lock (port); /* shift out the least significant 32 bits of the word */ for(i=0; i<32; i++) { ad_bit(port, word&DATA); word >>= 1; } /* write out the control byte */ for(i=0;i<8;i++) { ad_bit(port, control&DATA); control >>= 1; } /* load the register */ par_write_data(port, LOAD); ad_delay(1); par_write_data(port, 0); /* unlock the parallel port */ par_unlock (port); } int dds60_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned long frg; unsigned char control; struct dds60_priv_data *priv; hamlib_port_t *port = &rig->state.rigport; freq_t osc_ref; priv = (struct dds60_priv_data*)rig->state.priv; if (priv->multiplier) osc_ref = priv->osc_freq * 6; else osc_ref = priv->osc_freq; /* all frequencies are in Hz */ frg = (unsigned long)(((double)freq + priv->if_mix_freq) / osc_ref * 4294967296.0 + 0.5); rig_debug(RIG_DEBUG_VERBOSE, "%s: word %lu, X6 multipler %d, phase %.2f\n", __FUNCTION__, frg, priv->multiplier, priv->phase_step*PHASE_INCR); control = priv->multiplier ? 0x01 : 0x00; control |= (priv->phase_step & 0x1f) << 3; ad_write(port, frg, control); return RIG_OK; } int dds60_open(RIG *rig) { hamlib_port_t *port = &rig->state.rigport; /* lock the parallel port */ par_lock (port); /* Serial load enable sequence W_CLK */ par_write_data(port, 0); ad_delay(1); par_write_data(port, CLOCK); ad_delay(1); par_write_data(port, 0); ad_delay(1); /* Serial load enable sequence FQ_UD */ par_write_data(port, LOAD); ad_delay(1); par_write_data(port, 0); /* unlock the parallel port */ par_unlock (port); return RIG_OK; } hamlib-1.2.15.3/kit/si570avrusb.h0000644000175000017500000000401212044564477013162 00000000000000/*** * SoftRock USB I2C host control program * Copyright (C) 2009 Andrew Nilsson (andrew.nilsson@gmail.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Based on powerSwitch.c by Christian Starkjohann, * and usbtemp.c by Mathias Dalheimer * of Objective Development Software GmbH (2005) * (see http://www.obdev.at/avrusb) * */ #ifndef _SI570AVRUSB_H #define _SI570AVRUSB_H 1 /* DG8SAQ specific values */ #define SI570_I2C_ADDR 0x55 #define SI570_DCO_HIGH 5670.0 #define SI570_DCO_LOW 4850.0 #define SI570_NOMINAL_XTALL_FREQ 114.285 #define SI570_XTALL_DEVIATION_PPM 2000 #define SI570_DEFAULT_STARTUP_FREQ 56.32 #define REQUEST_READ_VERSION 0x00 #define REQUEST_SET_DDRB 0x01 #define REQUEST_SET_PORTB 0x04 #define REQUEST_READ_EEPROM 0x11 #define REQUEST_FILTERS 0x17 #define REQUEST_SET_FREQ 0x30 #define REQUEST_SET_FREQ_BY_VALUE 0x32 #define REQUEST_SET_XTALL_FREQ 0x33 #define REQUEST_SET_STARTUP_FREQ 0x34 #define REQUEST_READ_MULTIPLY_LO 0x39 #define REQUEST_READ_FREQUENCY 0x3A #define REQUEST_READ_SMOOTH_TUNE_PPM 0x3B #define REQUEST_READ_STARTUP 0x3C #define REQUEST_READ_XTALL 0x3D #define REQUEST_READ_REGISTERS 0x3F //#define REQUEST_SET_STARTUP_FREQ 0x41 #define REQUEST_SET_PTT 0x50 #define REQUEST_READ_KEYS 0x51 struct solution { int HS_DIV; int N1; double f0; double RFREQ; }; #endif /* _SI570AVRUSB_H */ hamlib-1.2.15.3/kit/usrp.c0000644000175000017500000000702012044564477012056 00000000000000/* * Hamlib KIT backend - Universal Software Radio Peripheral description * Copyright (c) 2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* * Compile only this model if usrp is available */ #if defined(HAVE_USRP) #include #include #include #include "hamlib/rig.h" #include "usrp_impl.h" #include "token.h" #define USRP_MODES (RIG_MODE_NONE) #define USRP_FUNC (RIG_FUNC_NONE) #define USRP_LEVEL_ALL (RIG_LEVEL_NONE) #define USRP_PARM_ALL (RIG_PARM_NONE) #define USRP_VFO (RIG_VFO_A|RIG_VFO_B|RIG_VFO_C|RIG_VFO_N(3)) static const struct confparams usrp_cfg_params[] = { { TOK_IFMIXFREQ, "if_mix_freq", "IF", "IF mixing frequency in Hz", "45000000", RIG_CONF_NUMERIC, { .n = { 0, MHz(400), 1 } } }, { RIG_CONF_END, NULL } }; /* * GNU Radio Universal Software Radio Peripheral * */ const struct rig_caps usrp_caps = { .rig_model = RIG_MODEL_USRP, .model_name = "USRP", .mfg_name = "GNU Radio", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TUNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_NONE, .serial_rate_min = 9600, /* don't care */ .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 = 0, .has_get_func = USRP_FUNC, .has_set_func = USRP_FUNC, .has_get_level = USRP_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(USRP_LEVEL_ALL), .has_get_parm = USRP_PARM_ALL, .has_set_parm = RIG_PARM_SET(USRP_PARM_ALL), .level_gran = {}, .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 = { {kHz(150),MHz(30),USRP_MODES,-1,-1,USRP_VFO}, {kHz(87.5),MHz(108),RIG_MODE_WFM,-1,-1,USRP_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(150),MHz(30),USRP_MODES,-1,-1,USRP_VFO}, {kHz(87.5),MHz(108),RIG_MODE_WFM,-1,-1,USRP_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {USRP_MODES,1}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {USRP_MODES, kHz(40)}, /* FIXME */ RIG_FLT_END, }, .cfgparams = usrp_cfg_params, .rig_init = usrp_init, .rig_cleanup = usrp_cleanup, .rig_open = usrp_open, .rig_close = usrp_close, .set_conf = usrp_set_conf, .get_conf = usrp_get_conf, .set_freq = usrp_set_freq, .get_freq = usrp_get_freq, .get_info = usrp_get_info, }; #endif /* HAVE_USRP */ hamlib-1.2.15.3/kit/funcube.c0000644000175000017500000003467512044564477012534 00000000000000/* * Hamlib KIT backend - FUNcube Dongle USB tuner description * Copyright (c) 2009-2011 by Stephane Fillod * * Derived from usbsoftrock-0.5: * Copyright (C) 2009 Andrew Nilsson (andrew.nilsson@gmail.com) * * Author: Stefano Speretta, Innovative Solutions In Space BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDINT_H #include #endif #include #include #include #include "hamlib/rig.h" #include "token.h" #include "kit.h" /* * Compile this model only if libusb is available */ #if defined(HAVE_LIBUSB) && defined(HAVE_USB_H) #include #include #include "funcube.h" static int funcube_init(RIG *rig); static int funcube_cleanup(RIG *rig); static int funcube_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int funcube_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int funcube_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int funcube_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static const char *funcube_get_info(RIG *rig); static const struct confparams funcube_cfg_params[] = { { RIG_CONF_END, NULL, } }; // functions used set / read frequency, working on FUNcube version 0 and 1 int set_freq_v0(usb_dev_handle *udh, unsigned int f, int timeout); int set_freq_v1(usb_dev_handle *udh, unsigned int f, int timeout); /* * Common data struct */ struct funcube_priv_data { freq_t freq; /* Hz */ }; /* * FUNcube Dongle description * * Based on Jan Axelson HID examples * http://www.lvr.com/ * */ const struct rig_caps funcube_caps = { .rig_model = RIG_MODEL_FUNCUBEDONGLE, .model_name = "FUNcube Dongle", .mfg_name = "AMSAT-UK", .version = "0.2", .copyright = "GPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TUNER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_USB, .write_delay = 0, .post_write_delay = 0, .timeout = 1000, .retry = 0, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_ATT | RIG_LEVEL_STRENGTH | RIG_LEVEL_PREAMP, .has_set_level = RIG_LEVEL_ATT | RIG_LEVEL_PREAMP, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { 5, 10, 15, 20, 25, 30, RIG_DBLST_END, }, .attenuator = { 2, 5, 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 = { {MHz(50),MHz(2500),RIG_MODE_USB,-1,-1,RIG_VFO_A}, RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_USB,kHz(1)}, RIG_TS_END, }, .filters = { {RIG_MODE_USB, kHz(192)}, RIG_FLT_END, }, .cfgparams = funcube_cfg_params, .rig_init = funcube_init, .rig_cleanup = funcube_cleanup, .set_freq = funcube_set_freq, .get_freq = funcube_get_freq, .get_level = funcube_get_level, .set_level = funcube_set_level, .get_info = funcube_get_info, }; int funcube_init(RIG *rig) { hamlib_port_t *rp = &rig->state.rigport; struct funcube_priv_data *priv; priv = (struct funcube_priv_data*)calloc(sizeof(struct funcube_priv_data), 1); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } priv->freq = 0; rp->parm.usb.vid = VID; rp->parm.usb.pid = PID; rp->parm.usb.conf = FUNCUBE_CONFIGURATION; rp->parm.usb.iface = FUNCUBE_INTERFACE; rp->parm.usb.alt = FUNCUBE_ALTERNATIVE_SETTING; rp->parm.usb.vendor_name = VENDOR_NAME; rp->parm.usb.product = PRODUCT_NAME; rig->state.priv = (void*)priv; return RIG_OK; } int funcube_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } const char * funcube_get_info(RIG *rig) { static char buf[64]; struct usb_dev_handle *udh = rig->state.rigport.handle; struct usb_device *q = usb_device(udh); sprintf(buf, "USB dev %04d", q->descriptor.bcdDevice); return buf; } int set_freq_v0(usb_dev_handle *udh, unsigned int f, int timeout) { int ret; char au8BufOut[64]; // endpoint size char au8BufIn[64]; // endpoint size // frequency is in Hz, while the dongle expects it in kHz f = f / 1e3; au8BufOut[0]=REQUEST_SET_FREQ; // Command to Set Frequency on dongle au8BufOut[1]=(char)f; au8BufOut[2]=(char)(f>>8); au8BufOut[3]=(char)(f>>16); rig_debug(RIG_DEBUG_TRACE, "%s: HID packet set to %02x%02x%02x%02x\n", __func__, (unsigned)au8BufOut[0] & 0xFF, (unsigned)au8BufOut[1] & 0xFF, (unsigned)au8BufOut[2] & 0xFF, (unsigned)au8BufOut[3] & 0xFF); ret = usb_interrupt_write(udh, OUTPUT_ENDPOINT, au8BufOut, sizeof(au8BufOut), timeout); if( ret < 0 ) { rig_debug (RIG_DEBUG_ERR, "%s: usb_interrupt_write failed (%d): %s\n", __func__,ret, usb_strerror ()); return -RIG_EIO; } ret = usb_interrupt_read(udh, INPUT_ENDPOINT, au8BufIn, sizeof(au8BufIn), timeout); if( ret != sizeof(au8BufIn) ) { rig_debug (RIG_DEBUG_ERR, "%s: usb_interrupt_read failed (%d): %s\n", __func__, ret, usb_strerror ()); return -RIG_EIO; } rig_debug(RIG_DEBUG_TRACE, "%s: Answer buf=%02x%02x\n", __func__, (unsigned)au8BufIn[0] & 0xFF, (unsigned)au8BufIn[1] & 0xFF); if (au8BufIn[1] != FUNCUBE_SUCCESS) { rig_debug (RIG_DEBUG_ERR, "%s: REQUEST_SET_FREQ not supported\n", __func__); return -RIG_EIO; } return RIG_OK; } int set_freq_v1(usb_dev_handle *udh, unsigned int f, int timeout) { int ret; char au8BufOut[64]; // endpoint size char au8BufIn[64]; // endpoint size au8BufOut[0]=REQUEST_SET_FREQ_HZ; // Command to Set Frequency in Hz on dongle au8BufOut[1]=(char)f; au8BufOut[2]=(char)(f>>8); au8BufOut[3]=(char)(f>>16); au8BufOut[4]=(char)(f>>24); rig_debug(RIG_DEBUG_TRACE, "%s: HID packet set to %02x%02x%02x%02x%02x\n", __func__, (unsigned)au8BufOut[0] & 0xFF, (unsigned)au8BufOut[1] & 0xFF, (unsigned)au8BufOut[2] & 0xFF, (unsigned)au8BufOut[3] & 0xFF, (unsigned)au8BufOut[4] & 0xFF); ret = usb_interrupt_write(udh, OUTPUT_ENDPOINT, au8BufOut, sizeof(au8BufOut), timeout); if( ret < 0 ) { rig_debug (RIG_DEBUG_ERR, "%s: usb_interrupt_write failed (%d): %s\n", __func__,ret, usb_strerror ()); return -RIG_EIO; } ret = usb_interrupt_read(udh, INPUT_ENDPOINT, au8BufIn, sizeof(au8BufIn), timeout); if( ret != sizeof(au8BufIn) ) { rig_debug (RIG_DEBUG_ERR, "%s: usb_interrupt_read failed (%d): %s\n", __func__, ret, usb_strerror ()); return -RIG_EIO; } rig_debug(RIG_DEBUG_TRACE, "%s: Answer buf=%02x%02x%02x%02x%02x%02x\n", __func__, (unsigned)au8BufIn[0] & 0xFF, (unsigned)au8BufIn[1] & 0xFF, (unsigned)au8BufIn[2] & 0xFF, (unsigned)au8BufIn[3] & 0xFF, (unsigned)au8BufIn[4] & 0xFF, (unsigned)au8BufIn[5] & 0xFF); if (au8BufIn[1] != FUNCUBE_SUCCESS) { rig_debug (RIG_DEBUG_ERR, "%s: REQUEST_SET_FREQ_HZ not supported\n", __func__); return -RIG_EIO; } return RIG_OK; } int funcube_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct funcube_priv_data *priv = (struct funcube_priv_data *)rig->state.priv; struct usb_dev_handle *udh = rig->state.rigport.handle; int ret; if ((ret = set_freq_v1(udh, freq, rig->state.rigport.timeout)) != RIG_OK) { if ((ret = set_freq_v0(udh, freq, rig->state.rigport.timeout)) == RIG_OK) { priv->freq = freq; } } else { priv->freq = freq; } return ret; } int get_freq_v0(RIG *rig, vfo_t vfo, freq_t *freq) { struct funcube_priv_data *priv = (struct funcube_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: frequency is not read from the device, the value shown is the last successfully set.\n",__func__); *freq = priv->freq; return RIG_OK; } int get_freq_v1(RIG *rig, vfo_t vfo, freq_t *freq) { struct usb_dev_handle *udh = rig->state.rigport.handle; int ret; unsigned int f; char au8BufOut[64]; // endpoint size char au8BufIn[64]; // endpoint size au8BufOut[0]=REQUEST_GET_FREQ_HZ; // Command to Set Frequency on dongle rig_debug(RIG_DEBUG_TRACE, "%s: HID packet set to %02x%02x%02x%02x\n", __func__, (unsigned)au8BufOut[0] & 0xFF, (unsigned)au8BufOut[1] & 0xFF, (unsigned)au8BufOut[2] & 0xFF, (unsigned)au8BufOut[3] & 0xFF); ret = usb_interrupt_write(udh, OUTPUT_ENDPOINT, au8BufOut, sizeof(au8BufOut), rig->state.rigport.timeout); if( ret < 0 ) { rig_debug (RIG_DEBUG_ERR, "%s: usb_interrupt_write failed (%d): %s\n", __func__,ret, usb_strerror ()); } ret = usb_interrupt_read(udh, INPUT_ENDPOINT, au8BufIn, sizeof(au8BufIn), rig->state.rigport.timeout); if( ret != sizeof(au8BufIn) ) { rig_debug (RIG_DEBUG_ERR, "%s: usb_interrupt_read failed (%d): %s\n", __func__, ret, usb_strerror ()); } rig_debug(RIG_DEBUG_TRACE, "%s: Answer buf=%02x%02x%02x%02x%02x%02x\n", __func__, (unsigned)au8BufIn[0] & 0xFF, (unsigned)au8BufIn[1] & 0xFF, (unsigned)au8BufIn[2] & 0xFF, (unsigned)au8BufIn[3] & 0xFF, (unsigned)au8BufIn[4] & 0xFF, (unsigned)au8BufIn[5] & 0xFF); if (au8BufIn[1] != FUNCUBE_SUCCESS) { rig_debug (RIG_DEBUG_ERR, "%s: REQUEST_GET_FREQ_HZ not supported\n", __func__); return -RIG_EIO; } f = ((unsigned int)au8BufIn[2] & 0xFF) | (((unsigned int)au8BufIn[3] & 0xFF) << 8) | (((unsigned int)au8BufIn[4] & 0xFF) << 16) | (((unsigned int)au8BufIn[5] & 0xFF) << 24), *freq = f; return RIG_OK; } int funcube_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { int ret; if ((ret = get_freq_v1(rig, vfo, freq)) != RIG_OK) { ret = get_freq_v0(rig, vfo, freq); } return ret; } int funcube_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct usb_dev_handle *udh = rig->state.rigport.handle; int ret; char au8BufOut[64]; // endpoint size char au8BufIn[64]; // endpoint size switch (level) { case RIG_LEVEL_PREAMP: au8BufOut[0]=REQUEST_SET_LNA_GAIN; // Command to Set LNA gain switch (val.i) { case 5: au8BufOut[1]=6; break; case 10: au8BufOut[1]=8; break; case 15: au8BufOut[1]=10; break; case 20: au8BufOut[1]=12; break; case 25: au8BufOut[1]=13; break; case 30: au8BufOut[1]=14; break; default: au8BufOut[1]=4; } break; case RIG_LEVEL_ATT: au8BufOut[0]=REQUEST_SET_LNA_GAIN; // Command to Set LNA gain switch (val.i) { case 2: au8BufOut[1]=1; break; case 5: au8BufOut[1]=0; break; default: au8BufOut[1]=4; } break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported level %d\n", __func__, level); return -RIG_EINVAL; } rig_debug(RIG_DEBUG_TRACE, "%s: HID packet set to %02x%02x%02x%02x\n", __func__, (unsigned)au8BufOut[0] & 0xFF, (unsigned)au8BufOut[1] & 0xFF, (unsigned)au8BufOut[2] & 0xFF, (unsigned)au8BufOut[3] & 0xFF); ret = usb_interrupt_write(udh, OUTPUT_ENDPOINT, au8BufOut, sizeof(au8BufOut), rig->state.rigport.timeout); if( ret < 0 ) { rig_debug (RIG_DEBUG_ERR, "%s: usb_interrupt_write failed (%d): %s\n", __func__,ret, usb_strerror ()); } ret = usb_interrupt_read(udh, INPUT_ENDPOINT, au8BufIn, sizeof(au8BufIn), rig->state.rigport.timeout); if( ret != sizeof(au8BufIn) ) { rig_debug (RIG_DEBUG_ERR, "%s: usb_interrupt_read failed (%d): %s\n", __func__, ret, usb_strerror ()); } rig_debug(RIG_DEBUG_TRACE, "%s: Answer buf=%02x%02x\n", __func__, (unsigned)au8BufIn[0] & 0xFF, (unsigned)au8BufIn[1] & 0xFF); if (au8BufIn[1] != FUNCUBE_SUCCESS) { rig_debug (RIG_DEBUG_ERR, "%s: REQUEST_GET_FREQ_HZ not supported\n", __func__); return -RIG_EIO; } return RIG_OK; } int funcube_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct usb_dev_handle *udh = rig->state.rigport.handle; int ret; char au8BufOut[64]; // endpoint size char au8BufIn[64]; // endpoint size switch (level) { case RIG_LEVEL_ATT: case RIG_LEVEL_PREAMP: au8BufOut[0]=REQUEST_GET_LNA_GAIN; // Command to Get LNA / ATT gain break; case RIG_LEVEL_STRENGTH: au8BufOut[0]=REQUEST_GET_RSSI; break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported level %d\n", __func__, level); return -RIG_EINVAL; } rig_debug(RIG_DEBUG_TRACE, "%s: HID packet set to %02x%02x%02x%02x\n", __func__, (unsigned)au8BufOut[0] & 0xFF, (unsigned)au8BufOut[1] & 0xFF, (unsigned)au8BufOut[2] & 0xFF, (unsigned)au8BufOut[3] & 0xFF); ret = usb_interrupt_write(udh, OUTPUT_ENDPOINT, au8BufOut, sizeof(au8BufOut), rig->state.rigport.timeout); if( ret < 0 ) { rig_debug (RIG_DEBUG_ERR, "%s: usb_interrupt_write failed (%d): %s\n", __func__,ret, usb_strerror ()); } ret = usb_interrupt_read(udh, INPUT_ENDPOINT, au8BufIn, sizeof(au8BufIn), rig->state.rigport.timeout); if( ret != sizeof(au8BufIn) ) { rig_debug (RIG_DEBUG_ERR, "%s: usb_interrupt_read failed (%d): %s\n", __func__, ret, usb_strerror ()); } rig_debug(RIG_DEBUG_TRACE, "%s: Answer buf=%02x%02x%02x\n", __func__, (unsigned)au8BufIn[0] & 0xFF, (unsigned)au8BufIn[1] & 0xFF, (unsigned)au8BufIn[2] & 0xFF); if (au8BufIn[1] != FUNCUBE_SUCCESS) { rig_debug (RIG_DEBUG_ERR, "%s: REQUEST_GET_FREQ_HZ not supported\n", __func__); return -RIG_EIO; } switch (level) { case RIG_LEVEL_PREAMP: switch (au8BufIn[2]) { case 6: val->i = 5; break; case 8: val->i = 10; break; case 10: val->i = 15; break; case 12: val->i = 20; break; case 13: val->i = 25; break; case 14: val->i = 30; break; default: val->i = 0; } break; case RIG_LEVEL_ATT: switch (au8BufIn[2]) { case 0: val->i = 5; break; case 1: val->i = 2; break; default: val->i = 0; } break; case RIG_LEVEL_STRENGTH: val->i = (int)((float)au8BufIn[2] * 2.8 - 35); break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported level %d\n", __func__, level); return -RIG_EINVAL; } return RIG_OK; } #endif /* defined(HAVE_LIBUSB) && defined(HAVE_USB_H) */ hamlib-1.2.15.3/kit/dwt.c0000644000175000017500000004031012044564477011662 00000000000000/* * Hamlib KIT backend - Digital World Traveller DRM receiver description * Copyright (c) 2005-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "hamlib/rig.h" #include "kit.h" /* * Compile only this model if libusb is available * or if .DLL is available under Windows */ #ifdef _WIN32 #ifdef HAVE_WINDOWS_H #include #endif #ifdef HAVE_WINBASE_H #include #endif #include /* * Coding Technologies Digital World Traveller DRM tuner. * * TODO: rig_scan, set/get FM mode (mono/stereo), * get antenna mode (loop/wire), * get low intermediate frequency (LIF) which may vary up to +-667 Hz * and may be additionally increased of up to 2000 Hz */ #define DWTDLL "afgusbfe.dll" /* Some type definitions needed for dll access */ typedef enum _tFrontendMode { eFrontendModeUndefined = 0, eFrontendModeDrm = 1, eFrontendModeAm = 2, eFrontendModeFm = 6, } tFrontendMode; typedef short (__stdcall *FNCFrontendOpen)(void); typedef short (__stdcall *FNCFrontendClose)(void); typedef short (__stdcall *FNCFrontendGetId)(char *id); typedef short (__stdcall *FNCFrontendSetMode)(tFrontendMode mode); typedef tFrontendMode (__stdcall *FNCFrontendGetMode)(void); typedef short (__stdcall *FNCFrontendSetFrequency)(double freq); typedef double (__stdcall *FNCFrontendGetFrequency)(void); typedef short (__stdcall *FNCFrontendGetRfLevel)(void); typedef double (__stdcall *FNCFrontendGetLIF)(void); typedef short (__stdcall *FNCFrontendStartScan)(short ScanMode, double WindowStartFreq, double WindowEndFreq, double DeltaFreq, double StepSize); typedef short (__stdcall *FNCFrontendStopScan)(void); typedef short (__stdcall *FNCFrontendGetScanStatus)(void); typedef short (__stdcall *FNCFrontendSetRfAttenuator)(short n); typedef short (__stdcall *FNCFrontendGetRfAttenuator)(void); typedef short (__stdcall *FNCFrontendSetAntennaMode)(short n); typedef short (__stdcall *FNCFrontendGetAntennaMode)(void); typedef short (__stdcall *FNCFrontendSetFmMode)(short n); typedef short (__stdcall *FNCFrontendGetFmMode)(void); struct dwtdll_priv_data { HMODULE dll; FNCFrontendOpen FrontendOpen; FNCFrontendClose FrontendClose; FNCFrontendGetId FrontendGetId; FNCFrontendSetMode FrontendSetMode; FNCFrontendGetMode FrontendGetMode; FNCFrontendSetFrequency FrontendSetFrequency; FNCFrontendGetFrequency FrontendGetFrequency; FNCFrontendGetRfLevel FrontendGetRfLevel; FNCFrontendGetLIF FrontendGetLIF; FNCFrontendStartScan FrontendStartScan; FNCFrontendStopScan FrontendStopScan; FNCFrontendGetScanStatus FrontendGetScanStatus; FNCFrontendSetRfAttenuator FrontendSetRfAttenuator; FNCFrontendGetRfAttenuator FrontendGetRfAttenuator; FNCFrontendSetAntennaMode FrontendSetAntennaMode; FNCFrontendGetAntennaMode FrontendGetAntennaMode; FNCFrontendSetFmMode FrontendSetFmMode; FNCFrontendGetFmMode FrontendGetFmMode; }; #define DWT_MODES (RIG_MODE_AM|RIG_MODE_USB) /* USB is for DRM */ #define DWT_FUNC (RIG_FUNC_NONE) #define DWT_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_STRENGTH|RIG_LEVEL_RAWSTR) #define DWT_PARM_ALL (RIG_PARM_NONE) #define DWT_VFO (RIG_VFO_A) #define DWT_ANT (RIG_ANT_1) static int dwtdll_init(RIG *rig); static int dwtdll_cleanup(RIG *rig); static int dwtdll_open(RIG *rig); static int dwtdll_close(RIG *rig); static int dwtdll_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int dwtdll_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int dwtdll_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int dwtdll_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int dwtdll_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int dwtdll_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static const char * dwtdll_get_info(RIG *rig); /* * Coding Technologies Digital World Traveller DRM tuner. * * The receiver is controlled via USB, through a Windows DLL. * * see Winradio G303 as an example */ const struct rig_caps dwt_caps = { .rig_model = RIG_MODEL_DWT, .model_name = "Digital World Traveller", .mfg_name = "Coding Technologies", .version = "0.1.1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_PCRECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_NONE, .write_delay = 0, .post_write_delay = 0, .timeout = 200, .retry = 0, .has_get_func = DWT_FUNC, .has_set_func = DWT_FUNC, .has_get_level = DWT_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(DWT_LEVEL_ALL), .has_get_parm = DWT_PARM_ALL, .has_set_parm = RIG_PARM_SET(DWT_PARM_ALL), .level_gran = {}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END }, .attenuator = { 20, RIG_DBLST_END, }, /* TBC */ .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 = { {kHz(150),MHz(30)-kHz(1),DWT_MODES,-1,-1,DWT_VFO,DWT_ANT}, {kHz(87.5),MHz(108),RIG_MODE_WFM,-1,-1,DWT_VFO,DWT_ANT}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(150),MHz(30)-kHz(1),DWT_MODES,-1,-1,DWT_VFO,DWT_ANT}, {kHz(87.5),MHz(108),RIG_MODE_WFM,-1,-1,DWT_VFO,DWT_ANT}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {DWT_MODES,1}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_USB, kHz(22)}, /* FIXME */ {RIG_MODE_AM, kHz(9)}, /* FIXME */ {RIG_MODE_WFM, kHz(230)}, /* FIXME */ RIG_FLT_END, }, .rig_init = dwtdll_init, .rig_cleanup = dwtdll_cleanup, .rig_open = dwtdll_open, .rig_close = dwtdll_close, .set_freq = dwtdll_set_freq, .get_freq = dwtdll_get_freq, .set_mode = dwtdll_set_mode, .get_mode = dwtdll_get_mode, .set_level = dwtdll_set_level, .get_level = dwtdll_get_level, .get_info = dwtdll_get_info, }; int dwtdll_init(RIG *rig) { struct dwtdll_priv_data *priv; priv = (struct dwtdll_priv_data*)malloc(sizeof(struct dwtdll_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } /* Try to load required dll */ priv->dll = LoadLibrary(DWTDLL); if (!priv->dll) { rig_debug(RIG_DEBUG_ERR, "%s: Unable to LoadLibrary %s\n", __FUNCTION__, DWTDLL); free(priv); return -RIG_EIO; /* huh! */ } /* Get process addresses from dll for function access */ priv->FrontendOpen = (FNCFrontendOpen) GetProcAddress(priv->dll, "FrontendOpen"); priv->FrontendClose = (FNCFrontendClose) GetProcAddress(priv->dll, "FrontendClose"); priv->FrontendGetId = (FNCFrontendGetId) GetProcAddress(priv->dll, "FrontendGetId"); priv->FrontendSetMode = (FNCFrontendSetMode) GetProcAddress(priv->dll, "FrontendSetMode"); priv->FrontendGetMode = (FNCFrontendGetMode) GetProcAddress(priv->dll, "FrontendGetMode"); priv->FrontendSetFrequency = (FNCFrontendSetFrequency) GetProcAddress(priv->dll, "FrontendSetFrequency"); priv->FrontendGetFrequency = (FNCFrontendGetFrequency) GetProcAddress(priv->dll, "FrontendGetFrequency"); priv->FrontendGetRfLevel = (FNCFrontendGetRfLevel) GetProcAddress(priv->dll, "FrontendGetRfLevel"); priv->FrontendGetLIF = (FNCFrontendGetLIF) GetProcAddress(priv->dll, "FrontendGetLIF"); priv->FrontendStartScan = (FNCFrontendStartScan) GetProcAddress(priv->dll, "FrontendStartScan"); priv->FrontendStopScan = (FNCFrontendStopScan) GetProcAddress(priv->dll, "FrontendStopScan"); priv->FrontendGetScanStatus = (FNCFrontendGetScanStatus) GetProcAddress(priv->dll, "FrontendGetScanStatus"); priv->FrontendSetRfAttenuator = (FNCFrontendSetRfAttenuator) GetProcAddress(priv->dll, "FrontendSetRfAttenuator"); priv->FrontendGetRfAttenuator = (FNCFrontendGetRfAttenuator) GetProcAddress(priv->dll, "FrontendGetRfAttenuator"); priv->FrontendSetAntennaMode = (FNCFrontendSetAntennaMode) GetProcAddress(priv->dll, "FrontendSetAntennaMode"); priv->FrontendGetAntennaMode = (FNCFrontendGetAntennaMode) GetProcAddress(priv->dll, "FrontendGetAntennaMode"); priv->FrontendSetFmMode = (FNCFrontendSetFmMode) GetProcAddress(priv->dll, "FrontendSetFmMode"); priv->FrontendGetFmMode = (FNCFrontendGetFmMode) GetProcAddress(priv->dll, "FrontendGetFmMode"); rig->state.priv = (void*)priv; return RIG_OK; } int dwtdll_open(RIG *rig) { struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv; short ret; /* Open DWT receiver */ ret = priv->FrontendOpen(); if (ret < 0) return -RIG_EIO; /* huh! */ /* default to DRM mode */ ret = priv->FrontendSetMode(eFrontendModeDrm); if (ret < 0) return -RIG_EIO; /* huh! */ return RIG_OK; } int dwtdll_close(RIG *rig) { struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv; short ret; /* Open DWT receiver */ ret = priv->FrontendClose(); if (ret < 0) return -RIG_EIO; /* huh! */ return RIG_OK; } int dwtdll_cleanup(RIG *rig) { struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv; /* Clean up the dll access */ FreeLibrary(priv->dll); if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } int dwtdll_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv; short ret; ret = priv->FrontendSetFrequency((double) freq); return ret < 0 ? -RIG_EIO : RIG_OK; } int dwtdll_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv; *freq = (freq_t) priv->FrontendGetFrequency(); return RIG_OK; } int dwtdll_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv; tFrontendMode dwtmode; short ret; switch (mode) { case RIG_MODE_USB: dwtmode = eFrontendModeDrm; break; case RIG_MODE_AM: dwtmode = eFrontendModeAm; break; case RIG_MODE_WFM: dwtmode = eFrontendModeFm; break; default: return -RIG_EINVAL; } ret = priv->FrontendSetMode(dwtmode); return ret < 0 ? -RIG_EIO : RIG_OK; } int dwtdll_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv; tFrontendMode dwtmode; dwtmode = priv->FrontendGetMode(); switch (dwtmode) { case eFrontendModeDrm: *mode = RIG_MODE_USB; break; case eFrontendModeAm: *mode = RIG_MODE_AM; break; case eFrontendModeFm: *mode = RIG_MODE_WFM; break; default: return -RIG_EPROTO; } *width = rig_passband_normal(rig, *mode); return RIG_OK; } int dwtdll_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv; short ret=0; switch(level) { case RIG_LEVEL_ATT: ret = priv->FrontendSetRfAttenuator(val.i ? 1 : 0); break; default: return -RIG_EINVAL; } return ret < 0 ? -RIG_EIO : RIG_OK; } int dwtdll_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv; signed short ret=0; switch(level) { case RIG_LEVEL_ATT: ret = priv->FrontendGetRfAttenuator(); if (ret < 0) break; /* local vs. DX mode */ val->i = ret ? 0 : rig->caps->attenuator[0]; break; case RIG_LEVEL_STRENGTH: /* actual RMS signal strength in dBuV */ ret = priv->FrontendGetRfLevel(); if (ret < 0) break; /* return actual RMS signal strength in dBuV, -34 to get dB rel S9 */ val->i = ret - 34; break; case RIG_LEVEL_RAWSTR: /* actual RMS signal strength in dBuV */ ret = priv->FrontendGetRfLevel(); if (ret < 0) break; val->i = ret; break; default: return -RIG_EINVAL; } return ret < 0 ? -RIG_EIO : RIG_OK; } static const char* dwtdll_get_info(RIG *rig) { struct dwtdll_priv_data *priv = (struct dwtdll_priv_data *)rig->state.priv; static char info[22]; if (priv->FrontendGetId(info) < 0) return NULL; info[21] = '\0'; return info; } #elif defined(HAVE_LIBUSB) && defined(HAVE_USB_H) #include #include #include "token.h" #define USB_VID_CT 0x1539 /* AFG Engineering */ #define USB_PID_CT_DWT 0x1730 /* Digital World Traveller */ #define DWT_MODES (RIG_MODE_NONE) #define DWT_FUNC (RIG_FUNC_NONE) #define DWT_LEVEL_ALL (RIG_LEVEL_NONE) #define DWT_PARM_ALL (RIG_PARM_NONE) #define DWT_VFO (RIG_VFO_A) static int dwt_init(RIG *rig); static int dwt_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static const char * dwt_get_info(RIG *rig); /* * Coding Technologies Digital World Traveller DRM tuner. * * The receiver is controlled via USB. * * see dsbr100.c as an example */ const struct rig_caps dwt_caps = { .rig_model = RIG_MODEL_DWT, .model_name = "Digital World Traveller", .mfg_name = "Coding Technologies", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TUNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_USB, .serial_rate_min = 9600, /* don't care */ .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 = 0, .has_get_func = DWT_FUNC, .has_set_func = DWT_FUNC, .has_get_level = DWT_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(DWT_LEVEL_ALL), .has_get_parm = DWT_PARM_ALL, .has_set_parm = RIG_PARM_SET(DWT_PARM_ALL), .level_gran = {}, .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 = { {kHz(150),MHz(30)-kHz(1),DWT_MODES,-1,-1,DWT_VFO}, {kHz(87.5),MHz(108),RIG_MODE_WFM,-1,-1,DWT_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(150),MHz(30)-kHz(1),DWT_MODES,-1,-1,DWT_VFO}, {kHz(87.5),MHz(108),RIG_MODE_WFM,-1,-1,DWT_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {DWT_MODES,kHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_USB, kHz(22)}, /* FIXME */ {RIG_MODE_AM, kHz(9)}, /* FIXME */ {RIG_MODE_WFM, kHz(230)}, /* FIXME */ RIG_FLT_END, }, .rig_init = dwt_init, .set_freq = dwt_set_freq, .get_info = dwt_get_info, }; int dwt_init(RIG *rig) { hamlib_port_t *rp = &rig->state.rigport; rp->parm.usb.vid = USB_VID_CT; rp->parm.usb.pid = USB_PID_CT_DWT; rp->parm.usb.conf = 1; rp->parm.usb.iface = 0; rp->parm.usb.alt = 0; return RIG_OK; } #define MSG_LEN 16 int dwt_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct usb_dev_handle *udh = rig->state.rigport.handle; int request, value, index; unsigned char buf[MSG_LEN] = { 0x4a, 0x00, 0x03, 0x00, 0xff, 0xff, 0x32 }; int requesttype, r; int ifreq = (int)(freq/1000); /* FIXME */ requesttype = 0x00; request = 0x00; value = 0x00; index = 0x00; buf[8] = ifreq & 0xff; buf[7] = (ifreq>>8) & 0xff; r = usb_control_msg (udh, requesttype, request, value, index, (char *) buf, 9, 1000); if (r < 0) { /* we get EPIPE if the firmware stalls the endpoint. */ if (errno != EPIPE) rig_debug (RIG_DEBUG_ERR, "usb_control_msg failed: %s\n", usb_strerror ()); return -RIG_EIO; } return RIG_OK; } const char * dwt_get_info(RIG *rig) { static char buf[64]; struct usb_dev_handle *udh = rig->state.rigport.handle; struct usb_device *q = usb_device(udh); sprintf(buf, "Dev %04d", q->descriptor.bcdDevice); return buf; } #endif /* HAVE_LIBUSB */ hamlib-1.2.15.3/kit/usrp_impl.h0000644000175000017500000000275412044564477013115 00000000000000/* * Hamlib KIT backend - Universal Software Radio Peripheral * Copyright (c) 2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _USRP_IMPL_H #define _USRP_IMPL_H 1 #include #include __BEGIN_DECLS #define TOK_IFMIXFREQ TOKEN_BACKEND(2) int usrp_init(RIG *rig); int usrp_cleanup(RIG *rig); int usrp_open(RIG *rig); int usrp_close(RIG *rig); int usrp_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int usrp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int usrp_set_conf(RIG *rig, token_t token, const char *val); int usrp_get_conf(RIG *rig, token_t token, char *val); const char * usrp_get_info(RIG *rig); extern const struct rig_caps usrp0_caps; extern const struct rig_caps usrp_caps; __END_DECLS #endif /* _USRP_IMPL_H */ hamlib-1.2.15.3/kit/kit.h0000644000175000017500000000301112044564477011655 00000000000000/* * Hamlib KIT backend - main header * Copyright (c) 2004-2012 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _KIT_H #define _KIT_H 1 #include "hamlib/rig.h" extern const struct rig_caps elektor304_caps; extern const struct rig_caps elektor507_caps; extern const struct rig_caps si570avrusb_caps; extern const struct rig_caps si570picusb_caps; extern const struct rig_caps drt1_caps; extern const struct rig_caps dwt_caps; extern const struct rig_caps usrp0_caps; extern const struct rig_caps usrp_caps; extern const struct rig_caps dds60_caps; extern const struct rig_caps miniVNA_caps; extern const struct rig_caps funcube_caps; extern const struct rig_caps fifisdr_caps; extern const struct rig_caps hiqsdr_caps; extern const struct rot_caps pcrotor_caps; #endif /* _KIT_H */ hamlib-1.2.15.3/kit/elektor304.c0000644000175000017500000002007412044564477012765 00000000000000/* * Hamlib KIT backend - Elektor DRM receiver description * Copyright (c) 2004-2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "hamlib/rig.h" #include "kit.h" #include "serial.h" #include "token.h" #define ELEKTOR304_MODES (RIG_MODE_AM) #define ELEKTOR304_FUNC (RIG_FUNC_NONE) #define ELEKTOR304_LEVEL_ALL (RIG_LEVEL_NONE) #define ELEKTOR304_PARM_ALL (RIG_PARM_NONE) #define ELEKTOR304_VFO (RIG_VFO_A) /* defaults */ #define OSCFREQ MHz(50) #define IFMIXFREQ kHz(454.3) struct elektor304_priv_data { freq_t osc_freq; freq_t if_mix_freq; }; #define TOK_OSCFREQ TOKEN_BACKEND(1) #define TOK_IFMIXFREQ TOKEN_BACKEND(2) static const struct confparams elektor304_cfg_params[] = { { TOK_OSCFREQ, "osc_freq", "Oscillatorfreq", "Oscillator frequency in Hz", "50000000", RIG_CONF_NUMERIC, { .n = { 0, GHz(2), 1 } } }, { TOK_IFMIXFREQ, "if_mix_freq", "IF", "IF mixing frequency in Hz", "454300", RIG_CONF_NUMERIC, { .n = { 0, MHz(100), 1 } } }, { RIG_CONF_END, NULL, } }; static int elektor304_init(RIG *rig); static int elektor304_cleanup(RIG *rig); static int elektor304_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int elektor304_set_conf(RIG *rig, token_t token, const char *val); static int elektor304_get_conf(RIG *rig, token_t token, char *val); /* * The Elektor DRM Receiver 3/04 COM interface is based on the Visual Basic * source code by Burkhard Kainka which can be downloaded from www.b-kainka.de * Linux support is based on a code written by Markus März: * http://mitglied.lycos.de/markusmaerz/drm * Linux support is available from DRM Dream project. * * The DDS is a AD9835. * * The receiver is controlled via the TX, RTS and DTR pins of the serial port. */ const struct rig_caps elektor304_caps = { .rig_model = RIG_MODEL_ELEKTOR304, .model_name = "Elektor 3/04", .mfg_name = "Elektor", .version = "0.4", .copyright = "GPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TUNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, /* bit banging */ .serial_rate_min = 9600, /* don't care */ .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 = 0, .has_get_func = ELEKTOR304_FUNC, .has_set_func = ELEKTOR304_FUNC, .has_get_level = ELEKTOR304_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(ELEKTOR304_LEVEL_ALL), .has_get_parm = ELEKTOR304_PARM_ALL, .has_set_parm = RIG_PARM_SET(ELEKTOR304_PARM_ALL), .level_gran = {}, .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 = { {kHz(500),MHz(22),ELEKTOR304_MODES,-1,-1,ELEKTOR304_VFO}, /* TBC */ RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(22),ELEKTOR304_MODES,-1,-1,ELEKTOR304_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {ELEKTOR304_MODES,1}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {ELEKTOR304_MODES, kHz(12)}, RIG_FLT_END, }, .cfgparams = elektor304_cfg_params, .rig_init = elektor304_init, .rig_cleanup = elektor304_cleanup, .set_conf = elektor304_set_conf, .get_conf = elektor304_get_conf, .set_freq = elektor304_set_freq, }; int elektor304_init(RIG *rig) { struct elektor304_priv_data *priv; priv = (struct elektor304_priv_data*)malloc(sizeof(struct elektor304_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } rig->state.priv = (void*)priv; priv->osc_freq = OSCFREQ; priv->if_mix_freq = IFMIXFREQ; return RIG_OK; } int elektor304_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * Assumes rig!=NULL, rig->state.priv!=NULL */ int elektor304_set_conf(RIG *rig, token_t token, const char *val) { struct elektor304_priv_data *priv; priv = (struct elektor304_priv_data*)rig->state.priv; switch(token) { case TOK_OSCFREQ: sscanf(val, "%"SCNfreq, &priv->osc_freq); break; case TOK_IFMIXFREQ: sscanf(val, "%"SCNfreq, &priv->if_mix_freq); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * assumes rig!=NULL, * Assumes rig!=NULL, rig->state.priv!=NULL * and val points to a buffer big enough to hold the conf value. */ int elektor304_get_conf(RIG *rig, token_t token, char *val) { struct elektor304_priv_data *priv; priv = (struct elektor304_priv_data*)rig->state.priv; switch(token) { case TOK_OSCFREQ: sprintf(val, "%"PRIfreq, priv->osc_freq); break; case TOK_IFMIXFREQ: sprintf(val, "%"PRIfreq, priv->if_mix_freq); break; default: return -RIG_EINVAL; } return RIG_OK; } #define AD_DELAY 4000 /* * Introduce delay after changing the bit state * FIXME: This implementation may not work for very fast computers, * or smart compilers. However, nanosleep can have * granularity > 10ms! */ static int ad_delay(int m) { long j; for (j=0; j<=m; j++) {} return j; } static int ad_sdata(hamlib_port_t *port, int i) { int ret; ret = ser_set_rts(port, i); ad_delay(AD_DELAY); if (ret != RIG_OK) rig_debug(RIG_DEBUG_ERR, "%s: unable to set statusbits\n", __FUNCTION__); return ret; } static int ad_sclk(hamlib_port_t *port, int i) { int ret; ret = ser_set_brk(port, i); ad_delay(AD_DELAY); if (ret != RIG_OK) rig_debug(RIG_DEBUG_ERR, "%s: unable to set statusbits\n", __FUNCTION__); return ret; } static int ad_fsync(hamlib_port_t *port, int i) { int ret; ret = ser_set_dtr(port, i); ad_delay(AD_DELAY); if (ret != RIG_OK) rig_debug(RIG_DEBUG_ERR, "%s: unable to set statusbits\n", __FUNCTION__); return ret; } static int ad_write(hamlib_port_t *port, unsigned data) { unsigned mask=0x8000; int i; ad_sclk(port, 0); /* TXD 0 */ ad_fsync(port, 1); /* DTR 1, CE */ for (i=0; i<16; i++) { ad_sdata(port, data & mask ? 0 : 1); /* RTS 0 or 1 */ ad_sclk(port, 1); /* TXD 1, clock */ ad_sclk(port, 0); /* TXD 0 */ mask >>= 1; /* Next bit for masking */ } ad_fsync(port, 0); /* DTR 0 */ return RIG_OK; } int elektor304_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned long frg; unsigned fhl,fhh,fll,flh; struct elektor304_priv_data *priv; hamlib_port_t *port = &rig->state.rigport; priv = (struct elektor304_priv_data*)rig->state.priv; serial_flush(port); /* Initialization */ ad_fsync(port, 0); ad_sdata(port, 0); ad_sclk(port, 0); /* all frequencies are in Hz */ frg = (unsigned long)(((double)freq + priv->if_mix_freq) / priv->osc_freq * 4294967296.0 + 0.5); fll = frg & 0xff; flh = (frg>>8) & 0xff; fhl = (frg>>16)& 0xff; fhh = (frg>>24)& 0xff; rig_debug(RIG_DEBUG_VERBOSE, "%s: %lu=[%02x.%02x.%02x.%02x]\n", __FUNCTION__,frg,fll,flh,fhl,fhh); ad_write(port, 0xF800); /* Reset */ ad_write(port, 0x3000|fll); /* 4 Bytes to FREQ0 */ ad_write(port, 0x2100|flh); ad_write(port, 0x3200|fhl); ad_write(port, 0x2300|fhh); ad_write(port, 0x8000); /* Sync */ ad_write(port, 0xC000); /* Reset end */ return RIG_OK; } hamlib-1.2.15.3/kit/funcube.h0000644000175000017500000000330612044564477012524 00000000000000/* * Hamlib KIT backend - FUNcube Dongle USB tuner description * Copyright (c) 2009-2011 by Stephane Fillod * * Derived from usbsoftrock-0.5: * Copyright (C) 2009 Andrew Nilsson (andrew.nilsson@gmail.com) * * Author: Stefano Speretta, Innovative Solutions In Space BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FUNCUBE_H #define _FUNCUBE_H 1 #define VID 0x04D8 #define PID 0xFB56 #define VENDOR_NAME "Hanlincrest Ltd. " #define PRODUCT_NAME "FunCube Dongle" #define FUNCUBE_INTERFACE 0x02 #define FUNCUBE_CONFIGURATION -1 /* no setup */ #define FUNCUBE_ALTERNATIVE_SETTING 0x00 #define INPUT_ENDPOINT 0x82 #define OUTPUT_ENDPOINT 0x02 // Commands #define REQUEST_SET_FREQ 0x64 #define REQUEST_SET_FREQ_HZ 0x65 #define REQUEST_GET_FREQ_HZ 0x66 #define REQUEST_SET_LNA_GAIN 0x6E #define REQUEST_GET_LNA_GAIN 0x96 #define REQUEST_GET_RSSI 0x68 #define FUNCUBE_SUCCESS 0x01 #endif /* _FUNCUBE_H */ hamlib-1.2.15.3/kit/drt1.c0000644000175000017500000002241412044564477011743 00000000000000/* * Hamlib KIT backend - Sat-Schneider DRT1/SAD1 DRM receiver description * Copyright (c) 2004-2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "hamlib/rig.h" #include "kit.h" #include "serial.h" #include "token.h" #define DRT1_MODES (RIG_MODE_AM) #define DRT1_FUNC (RIG_FUNC_NONE) #define DRT1_LEVEL_ALL (RIG_LEVEL_NONE) #define DRT1_PARM_ALL (RIG_PARM_NONE) #define DRT1_VFO (RIG_VFO_A) /* defaults */ #define OSCFREQ MHz(45.012) #define IFMIXFREQ MHz(45) #define REFMULT 8 #define CHARGE_PUMP_CURRENT 150 struct drt1_priv_data { freq_t osc_freq; freq_t if_mix_freq; unsigned ref_mult; unsigned pump_crrnt; }; #define TOK_OSCFREQ TOKEN_BACKEND(1) #define TOK_IFMIXFREQ TOKEN_BACKEND(2) #define TOK_REFMULT TOKEN_BACKEND(3) #define TOK_PUMPCRNT TOKEN_BACKEND(4) static const struct confparams drt1_cfg_params[] = { { TOK_OSCFREQ, "osc_freq", "Oscillatorfreq", "Oscillator frequency in Hz", "45012000", RIG_CONF_NUMERIC, { .n = { 0, MHz(400), 1 } } }, { TOK_IFMIXFREQ, "if_mix_freq", "IF", "IF mixing frequency in Hz", "45000000", RIG_CONF_NUMERIC, { .n = { 0, MHz(400), 1 } } }, { TOK_REFMULT, "ref_mult", "REFCLK Multiplier", "REFCLK Multiplier", "8", RIG_CONF_NUMERIC, { .n = { 4, 20, 1 } } }, { TOK_PUMPCRNT, "pump_current", "Charge pump current", "Charge pump current in uA", "150", RIG_CONF_NUMERIC, { .n = { 75, 150, 25 } } }, { RIG_CONF_END, NULL, } }; static int drt1_init(RIG *rig); static int drt1_cleanup(RIG *rig); static int drt1_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int drt1_set_conf(RIG *rig, token_t token, const char *val); static int drt1_get_conf(RIG *rig, token_t token, char *val); /* * SAT-Service Schneider DRM tuner. * * The receiver is controlled via the TX, RTS and DTR pins of the serial port. */ const struct rig_caps drt1_caps = { .rig_model = RIG_MODEL_DRT1, .model_name = "DRT1", .mfg_name = "SAT-Schneider", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TUNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, /* bit banging */ .serial_rate_min = 9600, /* don't care */ .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 = 0, .has_get_func = DRT1_FUNC, .has_set_func = DRT1_FUNC, .has_get_level = DRT1_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(DRT1_LEVEL_ALL), .has_get_parm = DRT1_PARM_ALL, .has_set_parm = RIG_PARM_SET(DRT1_PARM_ALL), .level_gran = {}, .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 = { {kHz(50),MHz(30),DRT1_MODES,-1,-1,DRT1_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(50),MHz(30),DRT1_MODES,-1,-1,DRT1_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {DRT1_MODES,1}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {DRT1_MODES, kHz(10)}, /* opt. 20 kHz */ RIG_FLT_END, }, .cfgparams = drt1_cfg_params, .rig_init = drt1_init, .rig_cleanup = drt1_cleanup, .set_conf = drt1_set_conf, .get_conf = drt1_get_conf, .set_freq = drt1_set_freq, }; int drt1_init(RIG *rig) { struct drt1_priv_data *priv; priv = (struct drt1_priv_data*)malloc(sizeof(struct drt1_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } rig->state.priv = (void*)priv; priv->osc_freq = OSCFREQ; priv->ref_mult = REFMULT; priv->if_mix_freq = IFMIXFREQ; priv->pump_crrnt = CHARGE_PUMP_CURRENT; return RIG_OK; } int drt1_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * Assumes rig!=NULL, rig->state.priv!=NULL */ int drt1_set_conf(RIG *rig, token_t token, const char *val) { struct drt1_priv_data *priv; priv = (struct drt1_priv_data*)rig->state.priv; switch(token) { case TOK_OSCFREQ: sscanf(val, "%"SCNfreq, &priv->osc_freq); break; case TOK_REFMULT: sscanf(val, "%d", &priv->ref_mult); break; case TOK_IFMIXFREQ: sscanf(val, "%"SCNfreq, &priv->if_mix_freq); break; case TOK_PUMPCRNT: sscanf(val, "%d", &priv->pump_crrnt); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * assumes rig!=NULL, * Assumes rig!=NULL, rig->state.priv!=NULL * and val points to a buffer big enough to hold the conf value. */ int drt1_get_conf(RIG *rig, token_t token, char *val) { struct drt1_priv_data *priv; priv = (struct drt1_priv_data*)rig->state.priv; switch(token) { case TOK_OSCFREQ: sprintf(val, "%"PRIfreq, priv->osc_freq); break; case TOK_REFMULT: sprintf(val, "%d", priv->ref_mult); break; case TOK_IFMIXFREQ: sprintf(val, "%"PRIfreq, priv->if_mix_freq); break; case TOK_PUMPCRNT: sprintf(val, "%d", priv->pump_crrnt); break; default: return -RIG_EINVAL; } return RIG_OK; } /* DDS is AD9951. The clock input is 45,012 MHz (also 2nd LO frequencie at the same time). The clock multiplier should be set to 8x at start value (possible, that this will change to lower clock multiplier). The charge pump current to 75 µA at start value (possible will change). The VCO gain bit has to be set. The IF offset for LO to the receiving frequency is + 45,000 MHz (fLO = frec + 45,000 MHz) Don't make the data clock too high, there are 1 KOhms decoupling resistors at the input pins of the DDS. Inputs (SDI(O)); SCLK und I/O UPDATE haves 5V TTL level, so that a level converter from RS232 is needed. I will use the attached motorola IC MC1489 as converter for amateur application. This IC inverts the signals ! */ #define AD_DELAY 4000 /* * Introduce delay after changing the bit state * FIXME: This implementation may not work for very fast computers, * or smart compilers. However, nanosleep can have * granularity > 10ms! */ static int ad_delay(int m) { long j; for (j=0; j<=m; j++) {} return j; } static int ad_sdio(hamlib_port_t *port, int i) { int ret; ret = ser_set_rts(port, i); ad_delay(AD_DELAY); if (ret != RIG_OK) rig_debug(RIG_DEBUG_ERR, "%s: unable to set statusbits\n", __FUNCTION__); return ret; } static int ad_sclk(hamlib_port_t *port, int i) { int ret; ret = ser_set_brk(port, i); ad_delay(AD_DELAY); if (ret != RIG_OK) rig_debug(RIG_DEBUG_ERR, "%s: unable to set statusbits\n", __FUNCTION__); return ret; } static int ad_ioupd(hamlib_port_t *port, int i) { int ret; ret = ser_set_dtr(port, i); ad_delay(AD_DELAY); if (ret != RIG_OK) rig_debug(RIG_DEBUG_ERR, "%s: unable to set statusbits\n", __FUNCTION__); return ret; } static int ad_write_reg(hamlib_port_t *port, unsigned addr, unsigned nb_bytes, unsigned data) { int i; ad_sclk(port, 0); /* TXD 0 */ ad_ioupd(port, 1); /* DTR 1, CE */ /* Instruction byte, MSB Logic 0 = write */ addr &= 0x1f; for (i=7; i>=0; i--) { ad_sdio(port, addr & (1U<=0; i--) { ad_sdio(port, data & (1U<state.rigport; priv = (struct drt1_priv_data*)rig->state.priv; serial_flush(port); /* Initialization */ ad_ioupd(port, 0); ad_sdio(port, 0); ad_sclk(port, 0); /* * CFR2: * clock multiplier set to 8x, charge pump current to 75 µA * VCO gain bit has to be set */ cfr2 = ((priv->ref_mult<<3) & 0xf8) | 0x4 | (((priv->pump_crrnt-75)/25)&0x3); ad_write_reg(port, CFR2, 3, cfr2); /* all frequencies are in Hz */ frg = (unsigned long)(((double)freq + priv->if_mix_freq) / (priv->osc_freq * priv->ref_mult) * 4294967296.0); rig_debug(RIG_DEBUG_VERBOSE, "%s: [%#lx]\n", __FUNCTION__,frg); ad_write_reg(port, FTW0, 4, frg); return RIG_OK; } hamlib-1.2.15.3/kit/si570avrusb.c0000644000175000017500000005256412044564477013174 00000000000000/* * Hamlib KIT backend - SoftRock / Si570 AVR USB tuner description * Copyright (c) 2009-2010 by Stephane Fillod * * Derived from usbsoftrock-0.5: * Copyright (C) 2009 Andrew Nilsson (andrew.nilsson@gmail.com) * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDINT_H #include #endif #include #include #include #include "hamlib/rig.h" #include "token.h" #include "kit.h" /* * Compile this model only if libusb is available */ #if defined(HAVE_LIBUSB) && defined(HAVE_USB_H) #include #include #include "si570avrusb.h" static int si570avrusb_init(RIG *rig); static int si570picusb_init(RIG *rig); static int si570xxxusb_cleanup(RIG *rig); static int si570xxxusb_open(RIG *rig); static int si570xxxusb_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int si570xxxusb_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int si570xxxusb_set_freq_by_value(RIG *rig, vfo_t vfo, freq_t freq); static int si570xxxusb_get_freq_by_value(RIG *rig, vfo_t vfo, freq_t *freq); static int si570xxxusb_set_ptt(RIG * rig, vfo_t vfo, ptt_t ptt); static int si570xxxusb_set_conf(RIG *rig, token_t token, const char *val); static int si570xxxusb_get_conf(RIG *rig, token_t token, char *val); static const char *si570xxxusb_get_info(RIG *rig); #define USBDEV_SHARED_VID 0x16C0 /* VOTI */ #define USBDEV_SHARED_PID 0x05DC /* Obdev's free shared PID */ /* Use obdev's generic shared VID/PID pair and follow the rules outlined * in firmware/usbdrv/USBID-License.txt. */ #define VENDOR_NAME "www.obdev.at" #define AVR_PRODUCT_NAME "DG8SAQ-I2C" #define PIC_PRODUCT_NAME "KTH-SDR-KIT" #define TOK_OSCFREQ TOKEN_BACKEND(1) #define TOK_MULTIPLIER TOKEN_BACKEND(3) #define TOK_I2C_ADDR TOKEN_BACKEND(4) #define TOK_BPF TOKEN_BACKEND(5) static const struct confparams si570xxxusb_cfg_params[] = { { TOK_OSCFREQ, "osc_freq", "Oscillator freq", "Oscillator frequency in Hz", "114285000", RIG_CONF_NUMERIC, { .n = { 1, MHz(300), 1 } } }, { TOK_MULTIPLIER, "multiplier", "Freq Multiplier", "Frequency multiplier", "4", RIG_CONF_NUMERIC, { .n = { 0.000001, 100 } } }, { TOK_I2C_ADDR, "i2c_addr", "I2C Address", "Si570 I2C Address", "55", RIG_CONF_NUMERIC, { .n = { 0, 512 } } }, { TOK_BPF, "bpf", "BPF", "Enable Band Pass Filter", "0", RIG_CONF_CHECKBUTTON, { } }, { RIG_CONF_END, NULL, } }; /* * Common data struct */ struct si570xxxusb_priv_data { unsigned short version; /* >=0x0f00 is PE0FKO's */ double osc_freq; /* MHz */ double multiplier; /* default to 4 for QSD/QSE */ int i2c_addr; int bpf; /* enable BPF? */ }; #define SI570AVRUSB_MODES (RIG_MODE_USB) /* USB is for SDR */ #define SI570AVRUSB_FUNC (RIG_FUNC_NONE) #define SI570AVRUSB_LEVEL_ALL (RIG_LEVEL_NONE) /* TODO: BPF as a parm or ext_level? */ #define SI570AVRUSB_PARM_ALL (RIG_PARM_NONE) #define SI570AVRUSB_VFO (RIG_VFO_A) #define SI570AVRUSB_ANT (RIG_ANT_1) /* * SoftRock Si570 AVR-USB description * * Heavily based on SoftRock USB-I2C Utility usbsoftrock-0.5, * author Andrew Nilsson VK6JBL: * http://groups.yahoo.com/group/softrock40/files/VK6JBL/ * */ const struct rig_caps si570avrusb_caps = { .rig_model = RIG_MODEL_SI570AVRUSB, .model_name = "Si570 AVR-USB", .mfg_name = "SoftRock", .version = "0.2", .copyright = "GPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TUNER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_USB, .write_delay = 0, .post_write_delay = 0, .timeout = 500, .retry = 0, .has_get_func = SI570AVRUSB_FUNC, .has_set_func = SI570AVRUSB_FUNC, .has_get_level = SI570AVRUSB_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(SI570AVRUSB_LEVEL_ALL), .has_get_parm = SI570AVRUSB_PARM_ALL, .has_set_parm = RIG_PARM_SET(SI570AVRUSB_PARM_ALL), .level_gran = {}, .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 = { /* probably higher upper range, depending on type (CMOS, LVDS, ..) */ {kHz(800),MHz(53.7),SI570AVRUSB_MODES,-1,-1,SI570AVRUSB_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(800),MHz(53.7),SI570AVRUSB_MODES,-1,-1,SI570AVRUSB_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {SI570AVRUSB_MODES,Hz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { RIG_FLT_END, }, .cfgparams = si570xxxusb_cfg_params, .rig_init = si570avrusb_init, .rig_cleanup = si570xxxusb_cleanup, .rig_open = si570xxxusb_open, .set_conf = si570xxxusb_set_conf, .get_conf = si570xxxusb_get_conf, .set_freq = si570xxxusb_set_freq, .get_freq = si570xxxusb_get_freq, .set_ptt = si570xxxusb_set_ptt, .get_info = si570xxxusb_get_info, }; /* * KTH-SDR-KIT Si570 PIC-USB description * * Same USB interface as AVR-USB, except different product string * and different multiplier. * * http://home.kpn.nl/rw.engberts/sdr_kth.htm */ const struct rig_caps si570picusb_caps = { .rig_model = RIG_MODEL_SI570PICUSB, .model_name = "Si570 PIC-USB", .mfg_name = "KTH-SDR kit", .version = "0.2", .copyright = "GPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TUNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_USB, .write_delay = 0, .post_write_delay = 0, .timeout = 500, .retry = 0, .has_get_func = SI570AVRUSB_FUNC, .has_set_func = SI570AVRUSB_FUNC, .has_get_level = SI570AVRUSB_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(SI570AVRUSB_LEVEL_ALL), .has_get_parm = SI570AVRUSB_PARM_ALL, .has_set_parm = RIG_PARM_SET(SI570AVRUSB_PARM_ALL), .level_gran = {}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END }, .attenuator = { RIG_DBLST_END }, /* TODO */ .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 = { {kHz(800),MHz(550),SI570AVRUSB_MODES,-1,-1,SI570AVRUSB_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(800),MHz(550),SI570AVRUSB_MODES,-1,-1,SI570AVRUSB_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {SI570AVRUSB_MODES,Hz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { RIG_FLT_END, }, .cfgparams = si570xxxusb_cfg_params, .rig_init = si570picusb_init, .rig_cleanup = si570xxxusb_cleanup, .rig_open = si570xxxusb_open, .set_conf = si570xxxusb_set_conf, .get_conf = si570xxxusb_get_conf, .set_freq = si570xxxusb_set_freq, .get_freq = si570xxxusb_get_freq, .get_info = si570xxxusb_get_info, }; /* * AVR-USB model */ int si570avrusb_init(RIG *rig) { hamlib_port_t *rp = &rig->state.rigport; struct si570xxxusb_priv_data *priv; priv = (struct si570xxxusb_priv_data*)calloc(sizeof(struct si570xxxusb_priv_data), 1); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } priv->osc_freq = SI570_NOMINAL_XTALL_FREQ; /* QSD/QSE */ priv->multiplier = 4; priv->i2c_addr = SI570_I2C_ADDR; /* disable BPF, because it may share PTT I/O line */ priv->bpf = 0; rp->parm.usb.vid = USBDEV_SHARED_VID; rp->parm.usb.pid = USBDEV_SHARED_PID; /* no usb_set_configuration() and usb_claim_interface() */ rp->parm.usb.iface = -1; rp->parm.usb.conf = 1; rp->parm.usb.alt = 0; /* necessary ? */ rp->parm.usb.vendor_name = VENDOR_NAME; rp->parm.usb.product = AVR_PRODUCT_NAME; rig->state.priv = (void*)priv; return RIG_OK; } /* * PIC-USB model */ int si570picusb_init(RIG *rig) { hamlib_port_t *rp = &rig->state.rigport; struct si570xxxusb_priv_data *priv; priv = (struct si570xxxusb_priv_data*)calloc(sizeof(struct si570xxxusb_priv_data), 1); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } priv->osc_freq = SI570_NOMINAL_XTALL_FREQ; /* QSD/QSE */ priv->multiplier = 2; priv->i2c_addr = SI570_I2C_ADDR; /* enable BPF, because this is kit is receiver only */ priv->bpf = 1; rp->parm.usb.vid = USBDEV_SHARED_VID; rp->parm.usb.pid = USBDEV_SHARED_PID; /* no usb_set_configuration() and usb_claim_interface() */ rp->parm.usb.iface = -1; rp->parm.usb.conf = 1; rp->parm.usb.alt = 0; /* necessary ? */ rp->parm.usb.vendor_name = VENDOR_NAME; rp->parm.usb.product = PIC_PRODUCT_NAME; rig->state.priv = (void*)priv; return RIG_OK; } int si570xxxusb_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } int si570xxxusb_set_conf(RIG *rig, token_t token, const char *val) { struct si570xxxusb_priv_data *priv; freq_t freq; double multiplier; int i2c_addr; priv = (struct si570xxxusb_priv_data*)rig->state.priv; switch(token) { case TOK_OSCFREQ: if (sscanf(val, "%"SCNfreq, &freq) != 1) return -RIG_EINVAL; priv->osc_freq = (double)freq/1e6; break; case TOK_MULTIPLIER: if (sscanf(val, "%lf", &multiplier) != 1) return -RIG_EINVAL; if (multiplier == 0.) return -RIG_EINVAL; priv->multiplier = multiplier; break; case TOK_I2C_ADDR: if (sscanf(val, "%x", &i2c_addr) != 1) return -RIG_EINVAL; if (i2c_addr < 0 || i2c_addr >= (1<<9)) return -RIG_EINVAL; priv->i2c_addr = i2c_addr; break; case TOK_BPF: if (sscanf(val, "%d", &priv->bpf) != 1) return -RIG_EINVAL; break; default: return -RIG_EINVAL; } return RIG_OK; } int si570xxxusb_get_conf(RIG *rig, token_t token, char *val) { struct si570xxxusb_priv_data *priv; priv = (struct si570xxxusb_priv_data*)rig->state.priv; switch(token) { case TOK_OSCFREQ: sprintf(val, "%"PRIfreq, (freq_t)(priv->osc_freq*1e6)); break; case TOK_MULTIPLIER: sprintf(val, "%f", priv->multiplier); break; case TOK_I2C_ADDR: sprintf(val, "%x", priv->i2c_addr); break; case TOK_BPF: sprintf(val, "%d", priv->bpf); break; default: return -RIG_EINVAL; } return RIG_OK; } static int setBPF(RIG *rig, int enable) { struct usb_dev_handle *udh = rig->state.rigport.handle; /* allocate enough space for up to 16 filters */ unsigned short FilterCrossOver[16]; int nBytes, i; // first find out how may cross over points there are for the 1st bank, use 255 for index nBytes = usb_control_msg(udh, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, REQUEST_FILTERS, 0, 255, (char *) FilterCrossOver, sizeof(FilterCrossOver), rig->state.rigport.timeout); if (nBytes < 0) return -RIG_EIO; if (nBytes > 2) { nBytes = usb_control_msg(udh, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, REQUEST_FILTERS, enable, (nBytes / 2) - 1, (char *) FilterCrossOver, sizeof(FilterCrossOver), rig->state.rigport.timeout); if (nBytes < 0) return -RIG_EIO; rig_debug (RIG_DEBUG_TRACE, "Filter Bank 1:\n"); for (i = 0; i < (nBytes / 2) - 1; i++) { rig_debug (RIG_DEBUG_TRACE, " CrossOver[%d] = %f\n", i, (double) FilterCrossOver[i] / (1UL << 5)); } rig_debug (RIG_DEBUG_TRACE, " BPF Enabled: %d\n", FilterCrossOver[(nBytes / 2) - 1]); } return RIG_OK; } int si570xxxusb_open(RIG *rig) { struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)rig->state.priv; struct usb_dev_handle *udh = rig->state.rigport.handle; int ret; unsigned short version; rig_debug(RIG_DEBUG_TRACE,"%s called\n", __func__); /* * Determine firmware */ ret = usb_control_msg(udh, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, REQUEST_READ_VERSION, 0x0E00, 0, (char *) &version, sizeof(version), rig->state.rigport.timeout); if (ret != 2) { rig_debug (RIG_DEBUG_ERR, "%s: usb_control_msg failed: %s\n", __func__, usb_strerror ()); return -RIG_EIO; } priv->version = version; if (version >= 0x0F00 || rig->caps->rig_model == RIG_MODEL_SI570PICUSB) { unsigned int iFreq; rig_debug(RIG_DEBUG_VERBOSE,"%s: detected PE0FKO-like firmware\n", __func__); ret = usb_control_msg(udh, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, REQUEST_READ_XTALL, 0, 0, (char *) &iFreq, sizeof(iFreq), rig->state.rigport.timeout); if (ret != 4) return -RIG_EIO; priv->osc_freq = (double)iFreq / (1UL<<24); if (priv->bpf) { ret = setBPF(rig, 1); if (ret != RIG_OK) return ret; } } rig_debug(RIG_DEBUG_VERBOSE,"%s: using Xtall at %.3f MHz\n", __func__, priv->osc_freq); return RIG_OK; } const char * si570xxxusb_get_info(RIG *rig) { static char buf[64]; struct usb_dev_handle *udh = rig->state.rigport.handle; struct usb_device *q = usb_device(udh); int ret; unsigned short version; ret = usb_control_msg(udh, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, REQUEST_READ_VERSION, 0x0E00, 0, (char *) &version, sizeof(version), rig->state.rigport.timeout); if (ret != 2) { rig_debug (RIG_DEBUG_ERR, "%s: usb_control_msg failed: %s\n", __func__, usb_strerror ()); return NULL; } sprintf(buf, "USB dev %04d, version: %d.%d", q->descriptor.bcdDevice, (version & 0xFF00) >> 8, version & 0xFF); return buf; } static const int HS_DIV_MAP[] = {4,5,6,7,-1,9,-1,11}; static int calcDividers(RIG *rig, double f, struct solution* solution) { struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)rig->state.priv; struct solution sols[8]; int i; int imin; double fmin; double y; // Count down through the dividers for (i=7;i >= 0;i--) { if (HS_DIV_MAP[i] > 0) { sols[i].HS_DIV = i; y = (SI570_DCO_HIGH + SI570_DCO_LOW) / (2 * f); y = y / HS_DIV_MAP[i]; if (y < 1.5) { y = 1.0; } else { y = 2 * round ( y / 2.0); } if (y > 128) { y = 128; } sols[i].N1 = trunc(y) - 1; sols[i].f0 = f * y * HS_DIV_MAP[i]; } else { sols[i].f0 = 10000000000000000.0; } } imin = -1; fmin = 10000000000000000.0; for (i=0; i < 8; i++) { if ((sols[i].f0 >= SI570_DCO_LOW) && (sols[i].f0 <= SI570_DCO_HIGH)) { if (sols[i].f0 < fmin) { fmin = sols[i].f0; imin = i; } } } if (imin >= 0) { solution->HS_DIV = sols[imin].HS_DIV; solution->N1 = sols[imin].N1; solution->f0 = sols[imin].f0; solution->RFREQ = sols[imin].f0 / priv->osc_freq; rig_debug(RIG_DEBUG_TRACE, "%s: solution: HS_DIV = %d, N1 = %d, f0 = %f, RFREQ = %f\n", __func__, solution->HS_DIV, solution->N1, solution->f0, solution->RFREQ); return 1; } else { solution->HS_DIV = 0; solution->N1 = 0; solution->f0 = 0; solution->RFREQ = 0; rig_debug(RIG_DEBUG_TRACE, "%s: No solution\n", __func__); return 0; } } static void setLongWord(uint32_t value, unsigned char * bytes) { bytes[0] = value & 0xff; bytes[1] = ((value & 0xff00) >> 8) & 0xff; bytes[2] = ((value & 0xff0000) >> 16) & 0xff; bytes[3] = ((value & 0xff000000) >> 24) & 0xff; } int si570xxxusb_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)rig->state.priv; struct usb_dev_handle *udh = rig->state.rigport.handle; int ret; unsigned char buffer[6]; int request = REQUEST_SET_FREQ; int value = 0x700 + priv->i2c_addr; int index = 0; double f; struct solution theSolution; int RFREQ_int; int RFREQ_frac; unsigned char fracBuffer[4]; unsigned char intBuffer[4]; if (priv->version >= 0x0f00 || rig->caps->rig_model == RIG_MODEL_SI570PICUSB) return si570xxxusb_set_freq_by_value(rig, vfo, freq); f = (freq * priv->multiplier)/1e6; calcDividers(rig, f, &theSolution); RFREQ_int = trunc(theSolution.RFREQ); RFREQ_frac = round((theSolution.RFREQ - RFREQ_int)*268435456); setLongWord(RFREQ_int, intBuffer); setLongWord(RFREQ_frac, fracBuffer); buffer[5] = fracBuffer[0]; buffer[4] = fracBuffer[1]; buffer[3] = fracBuffer[2]; buffer[2] = fracBuffer[3]; buffer[2] = buffer[2] | ((intBuffer[0] & 0xf) << 4); buffer[1] = RFREQ_int / 16; buffer[1] = buffer[1] + ((theSolution.N1 & 3) << 6); buffer[0] = theSolution.N1 / 4; buffer[0] = buffer[0] + (theSolution.HS_DIV << 5); ret = usb_control_msg(udh, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, request, value, index, (char*)buffer, sizeof(buffer), rig->state.rigport.timeout); rig_debug(RIG_DEBUG_TRACE, "%s: Freq=%.6f MHz, Real=%.6f MHz, buf=%02x%02x%02x%02x%02x%02x\n", __func__, freq/1e6, f, buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5]); if (!ret) { rig_debug (RIG_DEBUG_ERR, "%s: usb_control_msg failed: %s\n", __func__, usb_strerror ()); return -RIG_EIO; } rig_debug(RIG_DEBUG_TRACE, "%s: Result buf=%02x%02x\n", __func__, buffer[0], buffer[1]); return RIG_OK; } int si570xxxusb_set_freq_by_value(RIG *rig, vfo_t vfo, freq_t freq) { struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)rig->state.priv; struct usb_dev_handle *udh = rig->state.rigport.handle; int ret; unsigned char buffer[4]; int request = REQUEST_SET_FREQ_BY_VALUE; int value = 0x700 + priv->i2c_addr; int index = 0; double f; f = (freq * priv->multiplier)/1e6; setLongWord(round(f * 2097152.0), buffer); rig_debug(RIG_DEBUG_TRACE, "%s: Freq=%.6f MHz, Real=%.6f MHz, buf=%02x%02x%02x%02x\n", __func__, freq/1e6, f, buffer[0], buffer[1], buffer[2], buffer[3]); ret = usb_control_msg(udh, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, request, value, index, (char*)buffer, sizeof(buffer), rig->state.rigport.timeout); if (!ret) { rig_debug (RIG_DEBUG_ERR, "%s: usb_control_msg failed: %s\n", __func__, usb_strerror ()); return -RIG_EIO; } rig_debug(RIG_DEBUG_TRACE, "%s: Result buf=%02x%02x\n", __func__, buffer[0], buffer[1]); return RIG_OK; } static double calculateFrequency(RIG *rig, const unsigned char * buffer) { struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)rig->state.priv; int RFREQ_int = ((buffer[2] & 0xf0) >> 4) + ((buffer[1] & 0x3f) * 16); int RFREQ_frac = (256 * 256 * 256 * (buffer[2] & 0xf)) + (256 * 256 * buffer[3]) + (256 * buffer[4]) + (buffer[5]); double RFREQ = RFREQ_int + (RFREQ_frac / 268435456.0); int N1 = ((buffer[1] & 0xc0 ) >> 6) + ((buffer[0] & 0x1f) * 4); int HS_DIV = (buffer[0] & 0xE0) >> 5; double fout = priv->osc_freq * RFREQ / ((N1 + 1) * HS_DIV_MAP[HS_DIV]); rig_debug (RIG_DEBUG_VERBOSE, "%s: Registers 7..13: %02x%02x%02x%02x%02x%02x\n", __func__, buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5]); rig_debug (RIG_DEBUG_VERBOSE, "%s: RFREQ = %f, N1 = %d, HS_DIV = %d, nHS_DIV = %d, fout = %f\n", __func__, RFREQ, N1, HS_DIV, HS_DIV_MAP[HS_DIV], fout); return fout; } int si570xxxusb_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)rig->state.priv; struct usb_dev_handle *udh = rig->state.rigport.handle; unsigned char buffer[6]; int ret; if (priv->version >= 0x0f00 || rig->caps->rig_model == RIG_MODEL_SI570PICUSB) return si570xxxusb_get_freq_by_value(rig, vfo, freq); ret = usb_control_msg(udh, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, REQUEST_READ_REGISTERS, priv->i2c_addr, 0, (char *)buffer, sizeof(buffer), rig->state.rigport.timeout); if (ret <= 0) { rig_debug (RIG_DEBUG_ERR, "%s: usb_control_msg failed: %s\n", __func__, usb_strerror ()); return -RIG_EIO; } *freq = (calculateFrequency(rig, buffer) / priv->multiplier)*1e6; return RIG_OK; } int si570xxxusb_get_freq_by_value(RIG *rig, vfo_t vfo, freq_t *freq) { struct si570xxxusb_priv_data *priv = (struct si570xxxusb_priv_data *)rig->state.priv; struct usb_dev_handle *udh = rig->state.rigport.handle; int ret; uint32_t iFreq; ret = usb_control_msg(udh, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, REQUEST_READ_FREQUENCY, 0, 0, (char *)&iFreq, sizeof(iFreq), rig->state.rigport.timeout); if (ret != 4) { rig_debug (RIG_DEBUG_ERR, "%s: usb_control_msg failed: %s\n", __func__, usb_strerror ()); return -RIG_EIO; } *freq = (((double)iFreq / (1UL<<21)) / priv->multiplier)*1e6; return RIG_OK; } int si570xxxusb_set_ptt(RIG * rig, vfo_t vfo, ptt_t ptt) { struct usb_dev_handle *udh = rig->state.rigport.handle; int ret; char buffer[3]; rig_debug(RIG_DEBUG_TRACE,"%s called: %d\n", __func__, ptt); buffer[0] = 0; buffer[1] = 0; buffer[2] = 0; ret = usb_control_msg(udh, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, REQUEST_SET_PTT, (ptt == RIG_PTT_ON) ? 1 : 0, 0, (char *)buffer, sizeof(buffer), rig->state.rigport.timeout); if (ret < 0) { rig_debug (RIG_DEBUG_ERR, "%s: usb_control_msg failed: %s\n", __func__, usb_strerror ()); return -RIG_EIO; } return RIG_OK; } #endif /* defined(HAVE_LIBUSB) && defined(HAVE_USB_H) */ hamlib-1.2.15.3/kit/miniVNA.c0000644000175000017500000000506512044564477012375 00000000000000/* * Hamlib miniVNA backend - main file * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #define DDS_RATIO 10.73741824 static int miniVNA_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char fstr[20]; char cmdstr[40]; int retval; sprintf_freq(fstr, freq); rig_debug(RIG_DEBUG_TRACE,"%s called: %s %s\n", __FUNCTION__, rig_strvfo(vfo), fstr); serial_flush(&rig->state.rigport); sprintf(cmdstr,"0\r%lu\r1\r0\r",(unsigned long int)(freq*DDS_RATIO)); retval = write_block(&rig->state.rigport, cmdstr, strlen(cmdstr)); if (retval != RIG_OK) return retval; return RIG_OK; } const struct rig_caps miniVNA_caps = { .rig_model = RIG_MODEL_MINIVNA, .model_name = "miniVNA", .mfg_name = "mRS", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TUNER, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 115200, .serial_rate_max = 115200, .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 = 1000, .retry = 3, .rx_range_list1 = { {.start=kHz(100),.end=MHz(180),.modes=RIG_MODE_NONE, .low_power=-1,.high_power=-1,RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list1 = { {.start=kHz(100),.end=MHz(180),.modes=RIG_MODE_NONE, .low_power=-1,.high_power=-1,RIG_VFO_A}, RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_NONE,1}, RIG_TS_END, }, .set_freq = miniVNA_set_freq, }; hamlib-1.2.15.3/kit/Makefile.in0000644000175000017500000005777112044564553013003 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @HAVE_USRP_TRUE@am__append_1 = usrp_impl.cc subdir = kit DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) am__DEPENDENCIES_1 = hamlib_kit_la_DEPENDENCIES = $(top_builddir)/lib/libmisc.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(top_builddir)/src/libhamlib.la am__hamlib_kit_la_SOURCES_DIST = elektor304.c drt1.c dwt.c usrp.c \ elektor507.c dds60.c miniVNA.c si570avrusb.c funcube.c \ fifisdr.c hiqsdr.c usrp_impl.cc pcrotor.c kit.c @HAVE_USRP_TRUE@am__objects_1 = usrp_impl.lo am__objects_2 = elektor304.lo drt1.lo dwt.lo usrp.lo elektor507.lo \ dds60.lo miniVNA.lo si570avrusb.lo funcube.lo fifisdr.lo \ hiqsdr.lo $(am__objects_1) am__objects_3 = pcrotor.lo am_hamlib_kit_la_OBJECTS = $(am__objects_2) $(am__objects_3) kit.lo hamlib_kit_la_OBJECTS = $(am_hamlib_kit_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_$(V)) am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY)) am__v_CXX_0 = @echo " CXX " $@; CXXLD = $(CXX) CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CXXLD = $(am__v_CXXLD_$(V)) am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY)) am__v_CXXLD_0 = @echo " CXXLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_kit_la_SOURCES) DIST_SOURCES = $(am__hamlib_kit_la_SOURCES_DIST) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = @LIBUSB_CFLAGS@ # FIXME: compile usrp only if CXX available KITSRCLIST = elektor304.c drt1.c dwt.c usrp.c elektor507.c dds60.c \ miniVNA.c si570avrusb.c funcube.c fifisdr.c hiqsdr.c \ $(am__append_1) @HAVE_USRP_TRUE@AM_CXXFLAGS = @USRP_CFLAGS@ @HAVE_USRP_FALSE@hamlib_kit_la_LINK = $(LINK) $(hamlib_kit_la_LDFLAGS) @HAVE_USRP_TRUE@hamlib_kit_la_LINK = $(CXXLINK) $(hamlib_kit_la_LDFLAGS) KITROTSRCLIST = pcrotor.c pkglib_LTLIBRARIES = hamlib-kit.la hamlib_kit_la_SOURCES = $(KITSRCLIST) $(KITROTSRCLIST) kit.c hamlib_kit_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_kit_la_LIBADD = $(top_builddir)/lib/libmisc.la \ $(USRP_LIBS) \ $(LIBUSB_LIBS) \ @MATH_LIBS@ \ $(top_builddir)/src/libhamlib.la noinst_HEADERS = kit.h usrp_impl.h si570avrusb.h funcube.h EXTRA_DIST = README.funcubedongle all: all-am .SUFFIXES: .SUFFIXES: .c .cc .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu kit/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu kit/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-kit.la: $(hamlib_kit_la_OBJECTS) $(hamlib_kit_la_DEPENDENCIES) $(AM_V_GEN)$(hamlib_kit_la_LINK) -rpath $(pkglibdir) $(hamlib_kit_la_OBJECTS) $(hamlib_kit_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dds60.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drt1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elektor304.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elektor507.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fifisdr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/funcube.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hiqsdr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miniVNA.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcrotor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/si570avrusb.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usrp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usrp_impl.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cc.lo: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES @HAVE_USRP_FALSE@ # automake gets confused and invokes the C++ linker via libtool regardless @HAVE_USRP_FALSE@ # of whether or not HAVE_USRP enables the .cc source. This override forces @HAVE_USRP_FALSE@ # automake to invoke the C linker as no C++ is involved: # 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: hamlib-1.2.15.3/kit/fifisdr.c0000644000175000017500000004152612044564477012524 00000000000000/* * Hamlib KIT backend - FiFi-SDR Receiver(/Tuner) description * Copyright (c) 2010 by Rolf Meeser * * Derived from si570avrusb backend: * Copyright (C) 2004-2010 Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDINT_H #include #endif #include #include #include #include "hamlib/rig.h" #include "token.h" #include "kit.h" /* * Compile this model only if libusb is available */ #if defined(HAVE_LIBUSB) && defined(HAVE_USB_H) #include #include /* Selected request codes of the original AVR USB Si570 firmware */ #define REQUEST_SET_FREQ_BY_VALUE (0x32) #define REQUEST_SET_XTALL_FREQ (0x33) #define REQUEST_READ_MULTIPLY_LO (0x39) #define REQUEST_READ_FREQUENCY (0x3A) /* FiFi-SDR specific requests */ #define REQUEST_FIFISDR_READ (0xAB) #define REQUEST_FIFISDR_WRITE (0xAC) /* USB VID/PID, vendor name (idVendor), product name (idProduct). * Use obdev's generic shared VID/PID pair and follow the rules outlined * in firmware/usbdrv/USBID-License.txt. */ #define USBDEV_SHARED_VID 0x16C0 /* VOTI */ #define USBDEV_SHARED_PID 0x05DC /* Obdev's free shared PID */ #define FIFISDR_VENDOR_NAME "www.ov-lennestadt.de" #define FIFISDR_PRODUCT_NAME "FiFi-SDR" /* All level controls */ #define FIFISDR_LEVEL_ALL (0 \ | RIG_LEVEL_PREAMP \ | RIG_LEVEL_STRENGTH \ | RIG_LEVEL_AF \ | RIG_LEVEL_AGC \ | RIG_LEVEL_SQL \ ) static int fifisdr_init(RIG *rig); static int fifisdr_cleanup(RIG *rig); static int fifisdr_open(RIG *rig); static int fifisdr_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int fifisdr_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static const char *fifisdr_get_info(RIG *rig); static int fifisdr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int fifisdr_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t * width); static int fifisdr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int fifisdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int fifisdr_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val); /* Private tokens. */ #define TOK_LVL_FMCENTER TOKEN_BACKEND(1) /* FM center frequency deviation */ /* Extra levels definitions */ static const struct confparams fifisdr_ext_levels[] = { { TOK_LVL_FMCENTER, "fmcenter", "FM center", "Center frequency deviation of FM signal", NULL, RIG_CONF_NUMERIC, { .n = { -kHz(5), kHz(5), Hz(1) } } }, { RIG_CONF_END, NULL, } }; /** Private instance data. */ struct fifisdr_priv_instance_data { double multiplier; }; /** FiFi-SDR receiver description. */ const struct rig_caps fifisdr_caps = { .rig_model = RIG_MODEL_FIFISDR, .model_name = "FiFi-SDR", .mfg_name = "FiFi", .version = "0.5", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_USB, .write_delay = 0, .post_write_delay = 0, .timeout = 500, .retry = 0, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = FIFISDR_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(FIFISDR_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_SET(RIG_PARM_NONE), .level_gran = {}, .parm_gran = {}, .extparms = NULL, .extlevels = fifisdr_ext_levels, .preamp = { 6, RIG_DBLST_END }, .attenuator = { RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .vfo_ops = RIG_OP_NONE, .scan_ops = RIG_SCAN_NONE, .targetable_vfo = 0, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, .rx_range_list1 = { {.start = kHz(39.1), .end = MHz(175.0), .modes = RIG_MODE_AM | RIG_MODE_SSB | RIG_MODE_FM, .low_power = -1, .high_power = -1, .vfo = RIG_VFO_A, .ant = RIG_ANT_1}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {.start = kHz(39.1), .end = MHz(175.0), .modes = RIG_MODE_AM | RIG_MODE_SSB | RIG_MODE_FM, .low_power = -1, .high_power = -1, .vfo = RIG_VFO_A, .ant = RIG_ANT_1}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_SSB, Hz(1)}, {RIG_MODE_SSB, Hz(10)}, {RIG_MODE_SSB, Hz(50)}, {RIG_MODE_AM, Hz(10)}, {RIG_MODE_AM, Hz(50)}, {RIG_MODE_AM, Hz(100)}, {RIG_MODE_FM, kHz(0.1)}, {RIG_MODE_FM, kHz(5)}, {RIG_MODE_FM, kHz(6.25)}, {RIG_MODE_FM, kHz(10)}, {RIG_MODE_FM, kHz(12.5)}, {RIG_MODE_FM, kHz(20)}, {RIG_MODE_FM, kHz(25)}, {RIG_MODE_FM, kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB, kHz(2.7)}, /* normal */ {RIG_MODE_SSB, kHz(2.2)}, {RIG_MODE_SSB, kHz(3.3)}, {RIG_MODE_AM, kHz(8.0)}, /* normal */ {RIG_MODE_AM, kHz(6.2)}, {RIG_MODE_AM, kHz(10.0)}, {RIG_MODE_FM, kHz(9.0)}, /* normal */ {RIG_MODE_FM, kHz(6.0)}, {RIG_MODE_FM, kHz(12.5)}, RIG_FLT_END, }, .cfgparams = NULL, .rig_init = fifisdr_init, .rig_cleanup = fifisdr_cleanup, .rig_open = fifisdr_open, .rig_close = NULL, .set_freq = fifisdr_set_freq, .get_freq = fifisdr_get_freq, .set_mode = fifisdr_set_mode, .get_mode = fifisdr_get_mode, .set_level = fifisdr_set_level, .get_level = fifisdr_get_level, .get_ext_level = fifisdr_get_ext_level, .get_info = fifisdr_get_info, }; /** Convert from host endianness to FiFi-SDR little endian. */ static uint32_t fifisdr_tole32 (uint32_t x) { return (((((x) / 1ul) % 256ul) << 0) | ((((x) / 256ul) % 256ul) << 8) | ((((x) / 65536ul) % 256ul) << 16) | ((((x) / 16777216ul) % 256ul) << 24)); } /** Convert FiFi-SDR little endian to host endianness. */ static uint32_t fifisdr_fromle32 (uint32_t x) { return (((((x) >> 24) & 0xFF) * 16777216ul) + ((((x) >> 16) & 0xFF) * 65536ul) + ((((x) >> 8) & 0xFF) * 256ul) + ((((x) >> 0) & 0xFF) * 1ul)); } /** USB OUT transfer via vendor device command. */ static int fifisdr_usb_write (RIG *rig, int request, int value, int index, char *bytes, int size) { int ret; struct usb_dev_handle *udh = rig->state.rigport.handle; ret = usb_control_msg(udh, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, request, value, index, bytes, size, rig->state.rigport.timeout); if (ret != size) { rig_debug (RIG_DEBUG_ERR, "%s: usb_control_msg (%d/%d) failed: %s\n", __func__, request, value, usb_strerror ()); return -RIG_EIO; } return RIG_OK; } /** USB IN transfer via vendor device command. */ static int fifisdr_usb_read (RIG *rig, int request, int value, int index, char *bytes, int size) { int ret; struct usb_dev_handle *udh = rig->state.rigport.handle; ret = usb_control_msg(udh, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, request, value, index, bytes, size, rig->state.rigport.timeout); if (ret != size) { rig_debug (RIG_DEBUG_ERR, "%s: usb_control_msg (%d/%d) failed: %s\n", __func__, request, value, usb_strerror ()); return -RIG_EIO; } return RIG_OK; } int fifisdr_init (RIG *rig) { hamlib_port_t *rp = &rig->state.rigport; struct fifisdr_priv_instance_data *priv; priv = (struct fifisdr_priv_instance_data*)calloc(sizeof(struct fifisdr_priv_instance_data), 1); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } priv->multiplier = 4; rp->parm.usb.vid = USBDEV_SHARED_VID; rp->parm.usb.pid = USBDEV_SHARED_PID; /* no usb_set_configuration() and usb_claim_interface() */ rp->parm.usb.iface = -1; rp->parm.usb.conf = 1; rp->parm.usb.alt = 0; rp->parm.usb.vendor_name = FIFISDR_VENDOR_NAME; rp->parm.usb.product = FIFISDR_PRODUCT_NAME; rig->state.priv = (void*)priv; return RIG_OK; } int fifisdr_cleanup (RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } int fifisdr_open (RIG *rig) { int ret; uint32_t multiply; struct fifisdr_priv_instance_data *priv; priv = (struct fifisdr_priv_instance_data*)rig->state.priv; /* The VCO is a multiple of the RX frequency. Typically 4 */ ret = fifisdr_usb_read(rig, REQUEST_FIFISDR_READ, 0, 11, /* Read virtual VCO factor */ (char *)&multiply, sizeof(multiply)); if (ret == RIG_OK) { priv->multiplier = fifisdr_fromle32(multiply); } return RIG_OK; } const char * fifisdr_get_info (RIG *rig) { static char buf[64]; int ret; uint32_t svn_version; ret = fifisdr_usb_read(rig, REQUEST_FIFISDR_READ, 0, 0, (char *)&svn_version, sizeof(svn_version)); if (ret != RIG_OK) { return NULL; } snprintf(buf, sizeof(buf), "Firmware version: %d", svn_version); return buf; } int fifisdr_set_freq (RIG *rig, vfo_t vfo, freq_t freq) { struct fifisdr_priv_instance_data *priv = (struct fifisdr_priv_instance_data *)rig->state.priv; int ret; double mhz; uint32_t freq1121; /* Need frequency in 11.21 format */ mhz = (freq * priv->multiplier) / 1e6; freq1121 = fifisdr_tole32(round(mhz * 2097152.0)); ret = fifisdr_usb_write(rig, REQUEST_SET_FREQ_BY_VALUE, 0, 0, (char *)&freq1121, sizeof(freq1121)); if (ret != RIG_OK) { return -RIG_EIO; } return RIG_OK; } int fifisdr_get_freq (RIG *rig, vfo_t vfo, freq_t *freq) { struct fifisdr_priv_instance_data *priv = (struct fifisdr_priv_instance_data *)rig->state.priv; int ret; uint32_t freq1121; ret = fifisdr_usb_read(rig, REQUEST_READ_FREQUENCY, 0, 0, (char *)&freq1121, sizeof(freq1121)); if (ret == RIG_OK) { freq1121 = fifisdr_fromle32(freq1121); *freq = MHz(((double)freq1121 / (1ul << 21)) / priv->multiplier); } return ret; } static int fifisdr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { int ret; uint8_t fifi_mode; uint32_t fifi_width; /* Translate mode into FiFi-SDR language */ fifi_mode = 0; switch (mode) { case RIG_MODE_AM: fifi_mode = 2; break; case RIG_MODE_LSB: fifi_mode = 0; break; case RIG_MODE_USB: fifi_mode = 1; break; case RIG_MODE_FM: fifi_mode = 3; break; default: return -RIG_EINVAL; } ret = fifisdr_usb_write(rig, REQUEST_FIFISDR_WRITE, 0, 15, /* Demodulator mode */ (char *)&fifi_mode, sizeof(fifi_mode)); if (ret != RIG_OK) { return -RIG_EIO; } /* Set filter width */ fifi_width = fifisdr_tole32(width); ret = fifisdr_usb_write(rig, REQUEST_FIFISDR_WRITE, 0, 16, /* Filter width */ (char *)&fifi_width, sizeof(fifi_width)); if (ret != RIG_OK) { return -RIG_EIO; } return RIG_OK; } static int fifisdr_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t * width) { int ret; uint8_t fifi_mode; uint32_t fifi_width; /* Read current mode */ ret = fifisdr_usb_read(rig, REQUEST_FIFISDR_READ, 0, 15, /* Demodulator mode */ (char *)&fifi_mode, sizeof(fifi_mode)); if (ret != RIG_OK) { return -RIG_EIO; } /* Translate mode coding */ *mode = RIG_MODE_NONE; switch (fifi_mode) { case 0: *mode = RIG_MODE_LSB; break; case 1: *mode = RIG_MODE_USB; break; case 2: *mode = RIG_MODE_AM; break; case 3: *mode = RIG_MODE_FM; break; } /* Read current filter width */ ret = fifisdr_usb_read(rig, REQUEST_FIFISDR_READ, 0, 16, /* Filter width */ (char *)&fifi_width, sizeof(fifi_width)); if (ret != RIG_OK) { return -RIG_EIO; } *width = s_Hz(fifisdr_fromle32(fifi_width)); return RIG_OK; } static int fifisdr_set_level (RIG * rig, vfo_t vfo, setting_t level, value_t val) { int ret = RIG_OK; uint8_t fifi_preamp; int16_t fifi_volume; uint8_t fifi_squelch; uint8_t fifi_agc; switch (level) { /* Preamplifier (ADC 0/+6dB switch) */ case RIG_LEVEL_PREAMP: /* Value can be 0 (0 dB) or 1 (+6 dB) */ fifi_preamp = 0; if (val.i == 6) { fifi_preamp = 1; } ret = fifisdr_usb_write(rig, REQUEST_FIFISDR_WRITE, 0, 19, /* Preamp */ (char *)&fifi_preamp, sizeof(fifi_preamp)); break; /* RX volume control */ case RIG_LEVEL_AF: /* Transform Hamlib value (float: 0...1) to an integer range (0...100) */ fifi_volume = (int16_t)(val.f * 100.0f); if (fifi_volume < 0) { fifi_volume = 0; } if (fifi_volume > 100) { fifi_volume = 100; } ret = fifisdr_usb_write(rig, REQUEST_FIFISDR_WRITE, 0, 14, /* Demodulator volume */ (char *)&fifi_volume, sizeof(fifi_volume)); break; /* Squelch level */ case RIG_LEVEL_SQL: /* Transform Hamlib value (float: 0...1) to an integer range (0...100) */ fifi_squelch = (uint8_t)(val.f * 100.0f); if (fifi_squelch < 0) { fifi_squelch = 0; } if (fifi_squelch > 100) { fifi_squelch = 100; } ret = fifisdr_usb_write(rig, REQUEST_FIFISDR_WRITE, 0, 20, /* Squelch control */ (char *)&fifi_squelch, sizeof(fifi_squelch)); break; /* AGC */ case RIG_LEVEL_AGC: /* Transform Hamlib enum value to FiFi-SDR selector */ fifi_agc = 0; switch ((enum agc_level_e)val.i) { case RIG_AGC_OFF: fifi_agc = 0; break; case RIG_AGC_SUPERFAST: fifi_agc = 1; break; case RIG_AGC_FAST: fifi_agc = 2; break; case RIG_AGC_SLOW: fifi_agc = 3; break; case RIG_AGC_USER: fifi_agc = 4; break; case RIG_AGC_MEDIUM: fifi_agc = 5; break; case RIG_AGC_AUTO: fifi_agc = 6; break; } ret = fifisdr_usb_write(rig, REQUEST_FIFISDR_WRITE, 0, 21, /* AGC template */ (char *)&fifi_agc, sizeof(fifi_agc)); break; /* Unsupported option */ default: ret = -RIG_ENIMPL; } return ret; } static int fifisdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int ret = RIG_OK; uint32_t fifi_meter = 0; uint8_t fifi_preamp = 0; int16_t fifi_volume = 0; uint8_t fifi_squelch = 0; uint8_t fifi_agc = 0; switch (level) { /* Preamplifier (ADC 0/+6dB switch) */ case RIG_LEVEL_PREAMP: ret = fifisdr_usb_read(rig, REQUEST_FIFISDR_READ, 0, 19, /* Preamp */ (char *)&fifi_preamp, sizeof(fifi_preamp)); if (ret == RIG_OK) { /* Value can be 0 (0 dB) or 1 (+6 dB) */ val->i = 0; if (fifi_preamp != 0) { val->i = 6; } } break; /* RX volume control */ case RIG_LEVEL_AF: ret = fifisdr_usb_read(rig, REQUEST_FIFISDR_READ, 0, 14, /* Demodulator volume */ (char *)&fifi_volume, sizeof(fifi_volume)); if (ret == RIG_OK) { /* Value is in % (0...100) */ val->f = 0.0f; if ((fifi_volume >=0) && (fifi_volume <= 100)) { val->f = (float)fifi_volume / 100.0f; } } break; /* Squelch level */ case RIG_LEVEL_SQL: ret = fifisdr_usb_read(rig, REQUEST_FIFISDR_READ, 0, 20, /* Squelch control */ (char *)&fifi_squelch, sizeof(fifi_squelch)); if (ret == RIG_OK) { /* Value is in % (0...100) */ val->f = 0.0f; if (fifi_squelch <= 100) { val->f = (float)fifi_squelch / 100.0f; } } break; /* AGC */ case RIG_LEVEL_AGC: ret = fifisdr_usb_read(rig, REQUEST_FIFISDR_READ, 0, 21, /* AGC template */ (char *)&fifi_agc, sizeof(fifi_agc)); if (ret == RIG_OK) { val->i = 0; switch (fifi_agc) { case 0: val->i = RIG_AGC_OFF; break; case 1: val->i = RIG_AGC_SUPERFAST; break; case 2: val->i = RIG_AGC_FAST; break; case 3: val->i = RIG_AGC_SLOW; break; case 4: val->i = RIG_AGC_USER; break; case 5: val->i = RIG_AGC_MEDIUM; break; case 6: val->i = RIG_AGC_AUTO; break; } } break; /* Signal strength */ case RIG_LEVEL_STRENGTH: ret = fifisdr_usb_read(rig, REQUEST_FIFISDR_READ, 0, 17, /* S-Meter */ (char *)&fifi_meter, sizeof(fifi_meter)); if (ret == RIG_OK) { val->i = fifisdr_fromle32(fifi_meter); } break; /* Unsupported option */ default: ret = -RIG_ENIMPL; } return ret; } static int fifisdr_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val) { int ret = RIG_OK; uint32_t u32; switch (token) { /* FM center frequency deviation */ case TOK_LVL_FMCENTER: ret = fifisdr_usb_read(rig, REQUEST_FIFISDR_READ, 0, 18, /* FM center frequency */ (char *)&u32, sizeof(u32)); if (ret == RIG_OK) { val->f = Hz((int32_t)fifisdr_fromle32(u32)); } break; /* Unsupported option */ default: ret = -RIG_ENIMPL; } return ret; } #endif /* defined(HAVE_LIBUSB) && defined(HAVE_USB_H) */ hamlib-1.2.15.3/kit/README.funcubedongle0000644000175000017500000000444212044564477014425 00000000000000+----------------------------------------+ | Hamlib FUNcube dongle Win32 readme | | Written by Wouter Weggelaar PA3WEG | |ISIS - Innovative Solutions In Space BV | +----------------------------------------+ Note: The following only applies for users running Win32 systems. First of all, congratulations on obtaining a FUNcube dongle, the SDR receiver ground segment for the FUNcube satellite! More info on this exciting AMSAT-UK project can be found on http://funcube.org.uk/ more about the dongle on http://www.funcubedongle.com/ The FUNcube dongle driver uses the USB kit backend in hamlib to interface to the dongle via the USB HID interface. For this to work in hamlib, we need LibUSB support (tested with 1.2.3.0 and 1.2.4.0) and LibUSB support compiled into hamlib. This should be the case for all official hamlib releases (hamlib-win32-1.2.13-2 tested). You will need to download and install libusb-win32 from http://sourceforge.net/projects/libusb-win32/ extract the zip archive to a convenient location, change into this directory and run inf-wizard.exe located in the bin directory. Select the proper device in this wizard (Vendor ID 0x04D8, Product ID 0xFB56, interface 2) Click NEXT and accept the defaults, or change the vendor name and product ID as you wish to see it appear in device manager. I've changed this ID to reflect the vendor (hanlincrest ltd) and product name (funcube dongle). You can now suggest a location to store the driver (I suggest creating a directory for this as the wizard creates more than one file). Finally, install the driver as suggested by the wizard. You should be all set up now. Running hamlib from the command line using rigctl -m 2513 -vvvv should provide something like below: ------------------------------------------ >rigctl.exe -m 2513 -v Opened rig model 2513, 'FUNcube Dongle' Rig command: ------------------------------------------ If you made it to here, you are all set up and ready to go. **** PLEASE NOTE: by installing the LibUSB INF driver, other tools accessing the dongle cannot find it anymore as they are looking for the windows HID driver. Just uninstall the hamlib driver if you want to use those tools again! HAMLIB or LibUSB DID NOT BREAK YOUR SYSTEM! **** You could use hardware profiles to easily switch drivers. Happy SDR-ing! Wouter PA3WEG hamlib-1.2.15.3/kit/Makefile.am0000644000175000017500000000206712044564477012763 00000000000000AM_CFLAGS = @LIBUSB_CFLAGS@ # FIXME: compile usrp only if CXX available KITSRCLIST = elektor304.c drt1.c dwt.c usrp.c elektor507.c \ dds60.c miniVNA.c si570avrusb.c funcube.c fifisdr.c hiqsdr.c if HAVE_USRP AM_CXXFLAGS = @USRP_CFLAGS@ KITSRCLIST += usrp_impl.cc hamlib_kit_la_LINK = $(CXXLINK) $(hamlib_kit_la_LDFLAGS) else # automake gets confused and invokes the C++ linker via libtool regardless # of whether or not HAVE_USRP enables the .cc source. This override forces # automake to invoke the C linker as no C++ is involved: hamlib_kit_la_LINK = $(LINK) $(hamlib_kit_la_LDFLAGS) endif KITROTSRCLIST = pcrotor.c pkglib_LTLIBRARIES = hamlib-kit.la hamlib_kit_la_SOURCES = $(KITSRCLIST) $(KITROTSRCLIST) kit.c hamlib_kit_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_kit_la_LIBADD = $(top_builddir)/lib/libmisc.la \ $(USRP_LIBS) \ $(LIBUSB_LIBS) \ @MATH_LIBS@ \ $(top_builddir)/src/libhamlib.la noinst_HEADERS = kit.h usrp_impl.h si570avrusb.h funcube.h EXTRA_DIST = README.funcubedongle hamlib-1.2.15.3/kit/hiqsdr.c0000644000175000017500000004742312044564477012372 00000000000000/* * Hamlib HiQSDR backend * Copyright (c) 20012 by Stephane Fillod * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 #include "hamlib/rig.h" #include "iofunc.h" #include "misc.h" #include "token.h" /* * http://www.hiqsdr.org */ /* From the hardware file hiqsdr/quisk_hardware.py: # want_udp_status is a 14-byte string with numbers in little-endian order: # [0:2] 'St' # [2:6] Rx tune phase # [6:10] Tx tune phase # [10] Tx output level 0 to 255 # [11] Tx control bits: # 0x01 Enable CW transmit # 0x02 Enable all other transmit # 0x04 Use the HiQSDR extended IO pins not present in the 2010 QEX ver 1.0 # 0x08 The key is down (software key) # [12] Rx control bits # Second stage decimation less one, 1-39, six bits # [13] zero or firmware version number # The above is used for firmware version 1.0. # Version 1.1 adds eight more bytes for the HiQSDR conntrol ports: # [14] X1 connector: Preselect pins 69, 68, 65, 64; Preamp pin 63, Tx LED pin 57 # [15] Attenuator pins 84, 83, 82, 81, 80 # [16] More bits: AntSwitch pin 41 is 0x01 # [17:22] The remaining five bytes are sent as zero. # Version 1.2 uses the same format as 1.1, but adds the "Qs" command (see below). # Version 1.3 adds features needed by the new quisk_vna.py program: # [17] This one byte must be zero # [18:20] This is vna_count, the number of VNA data points; or zero for normal operation # [20:22] These two bytes mmust be zero # The "Qs" command is a two-byte UDP packet sent to the control port. It returns the hardware status # as the above string, except that the string starts with "Qs" instead of "St". Do not send the "Qs" command # from Quisk, as it interferes with the "St" command. The "Qs" command is meant to be used from an # external program, such as HamLib or a logging program. */ /* HiQSDR constants */ #define REFCLOCK 122880000 #define DEFAULT_SAMPLE_RATE 48000 /* V1.1 */ #define CTRL_FRAME_LEN 22 struct hiqsdr_priv_data { split_t split; int sample_rate; double ref_clock; unsigned char control_frame[CTRL_FRAME_LEN]; /* control string sent to the hardware */ unsigned char received_frame[CTRL_FRAME_LEN]; /* current control string as received from the hardware */ }; static int hiqsdr_init(RIG *rig); static int hiqsdr_cleanup(RIG *rig); static int hiqsdr_open(RIG *rig); static int hiqsdr_close(RIG *rig); static int hiqsdr_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int hiqsdr_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int hiqsdr_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int hiqsdr_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); static int hiqsdr_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq); static int hiqsdr_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq); static int hiqsdr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int hiqsdr_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int hiqsdr_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); static int hiqsdr_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); static int hiqsdr_set_ant(RIG *rig, vfo_t vfo, ant_t ant); static int hiqsdr_get_ant(RIG *rig, vfo_t vfo, ant_t *ant); static int hiqsdr_set_conf(RIG *rig, token_t token, const char *val); static int hiqsdr_get_conf(RIG *rig, token_t token, char *val); static int hiqsdr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int hiqsdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); #define TOK_OSCFREQ TOKEN_BACKEND(1) #define TOK_SAMPLE_RATE TOKEN_BACKEND(2) const struct confparams hiqsdr_cfg_params[] = { { TOK_OSCFREQ, "osc_freq", "Oscillator freq", "Oscillator frequency of reference clock in Hz", "122880000", RIG_CONF_NUMERIC, { .n = { 0, MHz(256), 1 } } }, { TOK_SAMPLE_RATE, "sample_rate", "Sample rate", "Sample rate", "48000", RIG_CONF_NUMERIC, { /* .n = */ { 48000, 1920000, 1 } } }, { RIG_CONF_END, NULL, } }; /* * HiQSDR rig capabilities. */ #define HIQSDR_FUNC RIG_FUNC_NONE #define HIQSDR_LEVEL (RIG_LEVEL_RFPOWER|RIG_LEVEL_PREAMP|RIG_LEVEL_ATT) #define HIQSDR_PARM RIG_PARM_NONE #define HIQSDR_VFO_OP RIG_OP_NONE #define HIQSDR_SCAN RIG_SCAN_NONE #define HIQSDR_VFO (RIG_VFO_A) #define HIQSDR_ANT (RIG_ANT_1|RIG_ANT_2) #define HIQSDR_MODES (RIG_MODE_CW|RIG_MODE_DSB) const struct rig_caps hiqsdr_caps = { .rig_model = RIG_MODEL_HIQSDR, .model_name = "HiQSDR", .mfg_name = "N2ADR", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TUNER, .targetable_vfo = RIG_TARGETABLE_NONE, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_UDP_NETWORK, .timeout = 500, .has_get_func = HIQSDR_FUNC, .has_set_func = HIQSDR_FUNC, .has_get_level = HIQSDR_LEVEL, .has_set_level = RIG_LEVEL_SET(HIQSDR_LEVEL), .has_get_parm = HIQSDR_PARM, .has_set_parm = RIG_PARM_SET(HIQSDR_PARM), .ctcss_list = NULL, .dcs_list = NULL, .chan_list = { RIG_CHAN_END, }, .scan_ops = HIQSDR_SCAN, .vfo_ops = HIQSDR_VFO_OP, .transceive = RIG_TRN_OFF, .attenuator = { 2, 4, 6, 10, 20, 30, 44, RIG_DBLST_END }, // -2dB steps in fact .preamp = { 10, RIG_DBLST_END, }, // TODO .rx_range_list1 = { {.start=kHz(100),.end=MHz(66),.modes=HIQSDR_MODES, .low_power=-1,.high_power=-1,HIQSDR_VFO,HIQSDR_ANT}, RIG_FRNG_END, }, .tx_range_list1 = { {.start=kHz(100),.end=MHz(66),.modes=HIQSDR_MODES, .low_power=mW(1),.high_power=mW(50),HIQSDR_VFO,HIQSDR_ANT}, RIG_FRNG_END, }, .rx_range_list2 = { {.start=kHz(100),.end=MHz(66),.modes=HIQSDR_MODES, .low_power=-1,.high_power=-1,HIQSDR_VFO,HIQSDR_ANT}, RIG_FRNG_END, }, .tx_range_list2 = { {.start=kHz(100),.end=MHz(66),.modes=HIQSDR_MODES, .low_power=mW(1),.high_power=mW(50),HIQSDR_VFO,HIQSDR_ANT}, RIG_FRNG_END, }, .tuning_steps = { {HIQSDR_MODES,1}, RIG_TS_END, }, .filters = { {RIG_MODE_CW, kHz(2.4)}, {HIQSDR_MODES, RIG_FLT_ANY}, RIG_FLT_END, }, .priv = NULL, .rig_init = hiqsdr_init, .rig_cleanup = hiqsdr_cleanup, .rig_open = hiqsdr_open, .rig_close = hiqsdr_close, .cfgparams = hiqsdr_cfg_params, .set_conf = hiqsdr_set_conf, .get_conf = hiqsdr_get_conf, .set_freq = hiqsdr_set_freq, .get_freq = hiqsdr_get_freq, .set_split_freq = hiqsdr_set_split_freq, .get_split_freq = hiqsdr_get_split_freq, .set_split_vfo = hiqsdr_set_split_vfo, .get_split_vfo = hiqsdr_get_split_vfo, .set_mode = hiqsdr_set_mode, .get_mode = hiqsdr_get_mode, .set_ptt = hiqsdr_set_ptt, .get_ptt = hiqsdr_get_ptt, .set_ant = hiqsdr_set_ant, .get_ant = hiqsdr_get_ant, .set_level = hiqsdr_set_level, .get_level = hiqsdr_get_level, }; static void hiqsdr_discard(RIG *rig) { /* Read the UDP port until no more data remains - limit the number of reads for safety */ struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv; int i, ret, timeout; timeout = rig->state.rigport.timeout; /* save timeout and replace with a smaller value */ rig->state.rigport.timeout = 10; for (i = 0; i < 5; i++) { ret = read_block(&rig->state.rigport, (char*)priv->received_frame, CTRL_FRAME_LEN); if (ret < 0) break; } rig->state.rigport.timeout = timeout; } static int hiqsdr_query(RIG *rig) { /* Send a "Qs" command to the hardware to return the current control string */ struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv; int ret; hiqsdr_discard(rig); priv->received_frame[0] = 'Q'; priv->received_frame[1] = 's'; ret = write_block(&rig->state.rigport, (const char*)priv->received_frame, 2); if (ret != RIG_OK) return ret; ret = read_block(&rig->state.rigport, (char*)priv->received_frame, CTRL_FRAME_LEN); if (ret < 0) return ret; else if (ret != CTRL_FRAME_LEN) return -RIG_EPROTO; return RIG_OK; } static int send_command(RIG *rig) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data*)rig->state.priv; int ret; ret = write_block(&rig->state.rigport, (const char*)priv->control_frame, CTRL_FRAME_LEN); /* All commands send back the current hardware state string */ hiqsdr_discard(rig); /* throw away the response */ return ret; } static unsigned compute_sample_rate(const struct hiqsdr_priv_data *priv) { unsigned rx_control; rx_control = (unsigned)(priv->ref_clock / (8. * 8. * priv->sample_rate)) - 1; if (rx_control > 39) rx_control = 39; return rx_control; } /* * Assumes rig!=NULL, rig->state.priv!=NULL */ int hiqsdr_set_conf(RIG *rig, token_t token, const char *val) { struct hiqsdr_priv_data *priv; struct rig_state *rs; rs = &rig->state; priv = (struct hiqsdr_priv_data*)rs->priv; switch(token) { case TOK_OSCFREQ: priv->ref_clock = atof(val); priv->control_frame[12] = compute_sample_rate(priv); break; case TOK_SAMPLE_RATE: priv->sample_rate = atoi(val); priv->control_frame[12] = compute_sample_rate(priv); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * assumes rig!=NULL, * Assumes rig!=NULL, rig->state.priv!=NULL * and val points to a buffer big enough to hold the conf value. */ int hiqsdr_get_conf(RIG *rig, token_t token, char *val) { struct hiqsdr_priv_data *priv; struct rig_state *rs; rs = &rig->state; priv = (struct hiqsdr_priv_data*)rs->priv; switch(token) { case TOK_OSCFREQ: sprintf(val, "%f", priv->ref_clock); break; case TOK_SAMPLE_RATE: sprintf(val, "%d", priv->sample_rate); break; default: return -RIG_EINVAL; } return RIG_OK; } int hiqsdr_init(RIG *rig) { struct hiqsdr_priv_data *priv; priv = (struct hiqsdr_priv_data*)malloc(sizeof(struct hiqsdr_priv_data)); if (!priv) return -RIG_ENOMEM; rig->state.priv = (void*)priv; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __func__ ); priv->split = RIG_SPLIT_OFF; priv->ref_clock = REFCLOCK; priv->sample_rate = DEFAULT_SAMPLE_RATE; strncpy(rig->state.rigport.pathname, "192.168.2.196:48248", FILPATHLEN - 1); return RIG_OK; } int hiqsdr_open(RIG *rig) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data*)rig->state.priv; #if 0 const char buf_send_to_me[] = { 0x72, 0x72 }; int ret; #endif rig_debug(RIG_DEBUG_TRACE,"%s called\n", __func__); /* magic value */ priv->control_frame[0] = 'S'; priv->control_frame[1] = 't'; /* zero tune phase */ memset(priv->control_frame+2, 0, 8); /* TX output level */ priv->control_frame[10] = 120; /* Tx control: non-CW */ priv->control_frame[11] = 0x02; /* decimation: 48 kSpls */ priv->control_frame[12] = compute_sample_rate(priv); /* firmware version */ priv->control_frame[13] = 0x00; /* X1 connector */ priv->control_frame[14] = 0x00; /* Attenuator */ priv->control_frame[15] = 0x00; /* AntSwitch */ priv->control_frame[16] = 0x00; /* RFU */ memset(priv->control_frame+17, 0, 5); #if 0 /* Send the samples to me. FIXME: send to port 48247 */ ret = write_block(&rig->state.rigport, buf_send_to_me, sizeof(buf_send_to_me)); if (ret != RIG_OK) return RIG_OK; #endif return RIG_OK; } int hiqsdr_close(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __func__); return RIG_OK; } int hiqsdr_cleanup(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __func__); if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* */ int hiqsdr_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data*)rig->state.priv; int ret; double rxphase; uint32_t rxphase32; rig_debug(RIG_DEBUG_TRACE,"%s called\n", __func__); rxphase = (freq/priv->ref_clock) * (1ULL<<32) + 0.5; rxphase32 = (uint32_t)rxphase; priv->control_frame[2] = rxphase32 & 0xff; priv->control_frame[3] = (rxphase32 >> 8) & 0xff; priv->control_frame[4] = (rxphase32 >> 16) & 0xff; priv->control_frame[5] = (rxphase32 >> 24) & 0xff; if (priv->split == RIG_SPLIT_OFF) { priv->control_frame[6] = priv->control_frame[2]; priv->control_frame[7] = priv->control_frame[3]; priv->control_frame[8] = priv->control_frame[4]; priv->control_frame[9] = priv->control_frame[5]; } ret = send_command (rig); return ret; } int hiqsdr_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv; uint32_t rxphase32; int ret; ret = hiqsdr_query(rig); if (ret != RIG_OK) return ret; rxphase32 = (uint32_t)priv->received_frame[2] | (uint32_t)priv->received_frame[3] << 8 | (uint32_t)priv->received_frame[4] << 16 | (uint32_t)priv->received_frame[5] << 24; *freq = (freq_t)((double)rxphase32 * priv->ref_clock / (1ULL<<32) + 0.5); return RIG_OK; } static int hiqsdr_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data*)rig->state.priv; priv->split = split; return RIG_OK; } int hiqsdr_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv; *split = priv->split; return RIG_OK; } int hiqsdr_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data*)rig->state.priv; int ret; double rxphase; uint32_t rxphase32; rig_debug(RIG_DEBUG_TRACE,"%s called\n", __func__); rxphase = (tx_freq/priv->ref_clock) * (1ULL<<32) + 0.5; rxphase32 = (uint32_t)rxphase; priv->control_frame[6] = rxphase32 & 0xff; priv->control_frame[7] = (rxphase32 >> 8) & 0xff; priv->control_frame[8] = (rxphase32 >> 16) & 0xff; priv->control_frame[9] = (rxphase32 >> 24) & 0xff; ret = send_command (rig); return ret; } int hiqsdr_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv; uint32_t txphase32; int ret; ret = hiqsdr_query(rig); if (ret != RIG_OK) return ret; txphase32 = (uint32_t)priv->received_frame[6] | (uint32_t)priv->received_frame[7] << 8 | (uint32_t)priv->received_frame[8] << 16 | (uint32_t)priv->received_frame[9] << 24; *tx_freq = (freq_t)((double)txphase32 * priv->ref_clock / (1ULL<<32) + 0.5); return RIG_OK; } int hiqsdr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv; int ret = RIG_OK; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s\n", __func__, rig_strrmode(mode)); if (mode == RIG_MODE_CW) { priv->control_frame[11] = 0x01; } else { priv->control_frame[11] = 0x02; } ret = send_command (rig); return ret; } int hiqsdr_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv; int ret; ret = hiqsdr_query(rig); if (ret != RIG_OK) return ret; if (priv->received_frame[11] & 0x01) { *mode = RIG_MODE_CW; *width = 500; /* the bandwidth is unknown */ } else { *mode = RIG_MODE_USB; /* We only know that the mode is not CW */ *width = 2800; /* the bandwidth is unknown */ } return RIG_OK; } int hiqsdr_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv; int ret = RIG_OK; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %d\n", __func__, ptt); /* not allowed in CW mode */ if (priv->control_frame[11] & 0x01) return -RIG_ERJCTED; if (ptt == RIG_PTT_ON) { priv->control_frame[11] |= 0x08; } else { priv->control_frame[11] &= ~0x08; } ret = send_command (rig); return ret; } int hiqsdr_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv; int ret; ret = hiqsdr_query(rig); if (ret != RIG_OK) return ret; if (priv->received_frame[11] & 0x08) /* Status of software PTT */ *ptt = RIG_PTT_ON; else if (priv->received_frame[14] & 0x01) /* Status of software PTT and hardware PTT */ *ptt = RIG_PTT_ON; else *ptt = RIG_PTT_OFF; return RIG_OK; } int hiqsdr_set_ant(RIG *rig, vfo_t vfo, ant_t ant) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv; int ret = RIG_OK; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %d\n", __func__, ant); if (ant == RIG_ANT_2) { priv->control_frame[16] |= 0x01; } else { priv->control_frame[16] &= ~0x01; } ret = send_command (rig); return ret; } int hiqsdr_get_ant(RIG *rig, vfo_t vfo, ant_t *ant) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv; int ret; ret = hiqsdr_query(rig); if (ret != RIG_OK) return ret; if (priv->received_frame[16] & 0x01) *ant = RIG_ANT_2; else *ant = RIG_ANT_1; return RIG_OK; } /* */ int hiqsdr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv; int ret = RIG_OK, dB; switch (level) { case RIG_LEVEL_PREAMP: if (val.i) priv->control_frame[14] |= 0x02; else priv->control_frame[14] &= ~0x02; break; case RIG_LEVEL_ATT: /* The attenuator pins provide 2, 4, 8, 10, 20 dB */ dB = val.i; priv->control_frame[15] = 0; if (dB >= 20) { priv->control_frame[15] |= 0x10; dB -= 20; } if (dB >= 10) { priv->control_frame[15] |= 0x08; dB -= 10; } if (dB >= 8) { priv->control_frame[15] |= 0x04; dB -= 8; } if (dB >= 4) { priv->control_frame[15] |= 0x02; dB -= 4; } if (dB >= 2) { priv->control_frame[15] |= 0x01; dB -= 2; } break; case RIG_LEVEL_RFPOWER: /* TX output level */ priv->control_frame[10] = 0xff & (unsigned)(255 * val.f); break; default: return -RIG_EINVAL; } ret = send_command (rig); return ret; } static int hiqsdr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct hiqsdr_priv_data *priv = (struct hiqsdr_priv_data *)rig->state.priv; int ret; ret = hiqsdr_query(rig); if (ret != RIG_OK) return ret; switch (level) { case RIG_LEVEL_PREAMP: if (priv->received_frame[14] & 0x02) val->i = 1; else val->i = 0; break; case RIG_LEVEL_ATT: val->i = 0; if (priv->received_frame[15] & 0x10) val->i += 20; if (priv->received_frame[15] & 0x08) val->i += 10; if (priv->received_frame[15] & 0x04) val->i += 8; if (priv->received_frame[15] & 0x02) val->i += 4; if (priv->received_frame[15] & 0x01) val->i += 2; break; case RIG_LEVEL_RFPOWER: /* TX output level */ val->f = (unsigned)priv->received_frame[10] / 255.0; break; default: return -RIG_EINVAL; } return RIG_OK; } hamlib-1.2.15.3/TODO0000644000175000017500000000436112044564477010627 00000000000000hamlib - (C) Frank Singleton 2000 GENERAL PROJECT TODO -------------------- 1. Implement more interfaces/backends [ongoing] 2. Write More extensive Test Suites [ongoing] 3. Document API's [ongoing] 4. Document Limitations/Assumptions. 6. Encourage people to build cool GUI's using our libs. (any GTK wiz's out here ..) 8. More safe checking during function calls (in rig_* wrappers). 13. ~/.hamlibrc and /etc/hamlibrc preferences file 14. Write the list of all functions that should be in the API 18. rewrite the post_write_delay. Active delay is a waste of cycles! [need test] 23. add support in the API for additional filters, DSP bandpass control 25. Write aclocal .m4 macro helpers for autoconf support [need test] 26. Write rig protocol simulator so no hardware is involved with Hamlib testing 27. complete memory bank support 28. add rig_srch_ctcss, rig_srch_dcs, etc. 29. emulate get_stuff (caching) if backend has no support for it 30. Write perl/python/etc. modules [ongoing] DONE ---- 5. Build top level Makefile for maintenance 7. Move common routines to a common area and avoid duplication. 9. If read from rig takes > "n" seconds, then no longer block on read, just return error. 10. Improve Makefiles (autoconf?) 12. Add general rig capabilities handling. see rig.h 15. Handle retransmissions (no more than n) if timeout (->backends) 16. Write .spec (rpm) and .deb (debian) package files 17a. Add support for a configurable debug level (none, function calls, packet traces) 17b. In serial.c (and non serial too), use buffered IO instead of read/write, for better performance. Use flushing with fwrite. 18. Get Git updates mailed to our hamlib-cvs-digest list 19. specify how to access Reverse modes (CWR, RTTYR). through set_mode? 22. handle nicely different versions of same rig coming for ITU region1/region2 ham band (-> freq ranges in capabilities) 11. Add some scanning routines [ 1.1.2? ] 20. adapt API include files to support C++ (__BEGIN_DECLS/__END_DECLS, etc.) 21. grab cygwin and test portability under Win32 (what about MacOS?) 24. Should Hamlib (the library itself) be LGPL'ed ? 31. Add some antenna tuner support 33. Merge dumpmem/dumpcaps into rigctl 32. Document C++/tcltk bindings, complete Hamlib API documentation using doxygen hamlib-1.2.15.3/skanti/0000755000175000017500000000000012044565033011471 500000000000000hamlib-1.2.15.3/skanti/trp8255.c0000644000175000017500000002730512044564477012730 00000000000000/* * Hamlib Skanti backend - TRP8255 description * Copyright (c) 2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "idx_builtin.h" #include "skanti.h" #include "iofunc.h" #define TRP8255_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY) #define TRP8255_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY) #define TRP8255_AM_TX_MODES RIG_MODE_AM #define TRP8255_FUNC (RIG_FUNC_MUTE) #define TRP8255_LEVEL_ALL (RIG_LEVEL_RFPOWER|RIG_LEVEL_AGC|\ RIG_LEVEL_ATT|RIG_LEVEL_PREAMP|RIG_LEVEL_SQL) #define TRP8255_PARM_ALL (RIG_PARM_TIME|RIG_PARM_BACKLIGHT) #define TRP8255_VFO_OPS (RIG_OP_TUNE|RIG_OP_TO_VFO|RIG_OP_FROM_VFO|RIG_OP_CPY) #define TRP8255_VFO (RIG_VFO_A) #define TRP8255_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .tx_freq = 1, \ } /* * Private data */ struct cu_priv_data { split_t split; /* current emulated split state */ int ch; /* current memorized memory channel */ }; static int cu_transaction(RIG *rig, const char *cmd, int cmd_len); static int cu_open(RIG *rig); static int cu_close(RIG *rig); static int cu_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int cu_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int cu_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq); static int cu_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int cu_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int cu_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static int cu_set_parm(RIG * rig, setting_t parm, value_t val); static int cu_set_ts(RIG * rig, vfo_t vfo, shortfreq_t ts); static int cu_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); static int cu_set_mem(RIG *rig, vfo_t vfo, int ch); static int cu_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); /* * TRP 8255 rig capabilities. * The protocol is different than TRP8000, * because the TRP8255 has the "CU" (Control Unit). * */ const struct rig_caps trp8255_caps = { .rig_model = RIG_MODEL_TRP8255, .model_name = "TRP 8255 S R", .mfg_name = "Skanti", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 2400, .serial_data_bits = 7, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_ODD, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 0, .timeout = 2000, .retry = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = TRP8255_FUNC, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_SET(TRP8255_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_SET(TRP8255_PARM_ALL), .vfo_ops = TRP8255_VFO_OPS, .preamp = { 10, RIG_DBLST_END }, /* TBC */ .attenuator = { 20, RIG_DBLST_END }, /* TBC */ .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 = { { 0, 76, RIG_MTYPE_MEM, TRP8255_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30),TRP8255_ALL_MODES,-1,-1,TRP8255_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { {MHz(2),MHz(30),TRP8255_AM_TX_MODES,W(4),W(40),TRP8255_VFO}, {MHz(2),MHz(30),TRP8255_OTHER_TX_MODES,W(10),W(100),TRP8255_VFO}, RIG_FRNG_END, }, .tuning_steps = { {TRP8255_ALL_MODES,10}, {TRP8255_ALL_MODES,100}, {TRP8255_ALL_MODES,kHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { /* rough guesses */ {TRP8255_ALL_MODES, kHz(2.7)}, /* intermit */ {TRP8255_ALL_MODES, kHz(2.1)}, /* narrow */ {TRP8255_ALL_MODES, kHz(6)}, /* wide */ {TRP8255_ALL_MODES, Hz(500)}, /* very narrow */ RIG_FLT_END, }, .rig_open = cu_open, .rig_close = cu_close, .set_freq = cu_set_freq, .set_mode = cu_set_mode, .set_split_freq = cu_set_split_freq, .set_split_vfo = cu_set_split_vfo, .set_ptt = cu_set_ptt, .set_mem = cu_set_mem, .vfo_op = cu_vfo_op, .set_level = cu_set_level, .set_func = cu_set_func, .set_parm = cu_set_parm, .set_ts = cu_set_ts, }; /* * Function definitions below */ #define ACK 0x06 #define NACK 0x15 #define CR "\x0d" /* TODO: retry */ static int cu_transaction(RIG *rig, const char *cmd, int cmd_len) { int i, ret; char retchar; for (i = 0; i < cmd_len; i++) { ret = write_block(&rig->state.rigport, &cmd[i], 1); if (ret != RIG_OK) return ret; ret = read_block(&rig->state.rigport, &retchar, 1); switch(retchar) { case ACK: continue; case NACK: return -RIG_ERJCTED; default: return -RIG_EPROTO; } } return RIG_OK; } static int cu_open(RIG *rig) { char cmd[] = { 0x01, 0x02 }; /* SOH, STX */ struct cu_priv_data *priv; rig_debug(RIG_DEBUG_TRACE, "%s called\n",__func__); rig->state.priv = malloc(sizeof (struct cu_priv_data)); if (!rig->state.priv) return -RIG_ENOMEM; priv = (struct cu_priv_data *)rig->state.priv; memset(priv, 0, sizeof(struct cu_priv_data)); priv->split = RIG_SPLIT_OFF; priv->ch = 0; return cu_transaction(rig, cmd, 2); } static int cu_close(RIG *rig) { char cmd[] = { 0x16 }; /* DLE */ struct cu_priv_data *priv = (struct cu_priv_data *)rig->state.priv; free(priv); return cu_transaction(rig, cmd, 1); } int cu_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct cu_priv_data *priv = (struct cu_priv_data *)rig->state.priv; char cmdbuf[16]; int cmd_len; int ret; if (freq >= MHz(100)) return -RIG_EINVAL; /* RX freq */ cmd_len = sprintf(cmdbuf, ":%06u"CR, (unsigned)(freq/Hz(100))); ret = cu_transaction(rig, cmdbuf, cmd_len); if (ret != RIG_OK) return ret; if (priv->split != RIG_SPLIT_ON) return cu_vfo_op(rig, vfo, RIG_OP_CPY); return RIG_OK; } static int cu_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { struct cu_priv_data *priv = (struct cu_priv_data *)rig->state.priv; priv->split = split; return RIG_OK; } int cu_set_split_freq(RIG *rig, vfo_t vfo, freq_t freq) { char cmdbuf[16]; int cmd_len; if (freq >= MHz(100)) return -RIG_EINVAL; /* TX freq */ cmd_len = sprintf(cmdbuf, ";%06u"CR, (unsigned)(freq/Hz(100))); return cu_transaction(rig, cmdbuf, cmd_len); } int cu_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { char cmd; int ret; switch (mode) { case RIG_MODE_USB: cmd = 'X'; break; case RIG_MODE_LSB: cmd = 'Y'; break; case RIG_MODE_AM: cmd = 'Z'; break; case RIG_MODE_RTTY: cmd = '['; break; /* case RIG_MODE_R3E: cmd = '\\'; break; */ case RIG_MODE_CW: cmd = ']'; break; /* case RIG_MODE_MCW: cmd = '^'; break; */ default: return -RIG_EINVAL; } ret = cu_transaction(rig, &cmd, 1); if (ret != RIG_OK) return ret; if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); if (width < rig_passband_normal(rig, mode)) cmd = 'D'; else if (width > rig_passband_normal(rig, mode)) cmd = 'B'; else cmd = 'C'; return cu_transaction(rig, &cmd, 1); } int cu_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { char cmdbuf[16]; int cmd_len; cmd_len = 1; switch (level) { case RIG_LEVEL_PREAMP: cmdbuf[0] = val.i ? 'm' : 'n'; break; case RIG_LEVEL_ATT: cmdbuf[0] = val.i ? 'o' : 'p'; break; case RIG_LEVEL_AGC: switch (val.i) { case RIG_AGC_AUTO: cmdbuf[0] = 'J'; break; case RIG_AGC_FAST: cmdbuf[0] = 'K'; break; case RIG_AGC_SLOW: cmdbuf[0] = 'L'; break; case RIG_AGC_OFF: cmdbuf[0] = 'M'; break; default: return -RIG_EINVAL; } break; case RIG_LEVEL_SQL: cmdbuf[0] = val.i ? 'o' : 'p'; break; case RIG_LEVEL_RFPOWER: if (val.f < 0.4) cmdbuf[0] = 'S'; /* low */ if (val.f < 0.6) cmdbuf[0] = 'U'; /* medium */ else cmdbuf[0] = 'W'; /* high */ break; case RIG_LEVEL_AF: cmd_len = sprintf(cmdbuf, "y%02u"CR, (unsigned)(99-val.f*99)); break; default: return -RIG_EINVAL; } return cu_transaction(rig, cmdbuf, cmd_len); } int cu_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { char cmdbuf[16]; int cmd_len; cmd_len = 1; switch (func) { case RIG_FUNC_MUTE: cmdbuf[0] = status ? 'l' : 'k'; break; default: return -RIG_EINVAL; } return cu_transaction(rig, cmdbuf, cmd_len); } int cu_set_ts(RIG * rig, vfo_t vfo, shortfreq_t ts) { char cmdbuf[16]; int cmd_len; cmd_len = sprintf(cmdbuf, "w%c"CR, ts >= s_kHz(1) ? '2' : ts >= s_Hz(100) ? '1' : '0'); return cu_transaction(rig, cmdbuf, cmd_len); } int cu_set_parm(RIG * rig, setting_t parm, value_t val) { char cmdbuf[16]; int cmd_len; cmd_len = 1; switch (parm) { case RIG_PARM_TIME: /* zap seconds */ val.i /= 60; cmd_len = sprintf(cmdbuf, "f%02u%02u"CR, val.i/60, val.i%60); break; case RIG_PARM_BACKLIGHT: cmd_len = sprintf(cmdbuf, "z%1u"CR, (unsigned)(val.f*5)); break; default: return -RIG_EINVAL; } return cu_transaction(rig, cmdbuf, cmd_len); } int cu_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { char cmd; cmd = ptt == RIG_PTT_ON ? 'u' : 'v'; return cu_transaction(rig, &cmd, 1); } static int cu_set_mem(RIG *rig, vfo_t vfo, int ch) { struct cu_priv_data *priv = (struct cu_priv_data *)rig->state.priv; /* memorize channel for RIG_OP_TO_VFO & RIG_OP_FROM_VFO */ priv->ch = ch; return RIG_OK; } int cu_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { struct cu_priv_data *priv = (struct cu_priv_data *)rig->state.priv; char cmdbuf[16]; int cmd_len; switch (op) { case RIG_OP_TUNE: cmdbuf[0] = 'R'; cmd_len = 1; break; case RIG_OP_CPY: cmdbuf[0] = ':'; cmdbuf[1] = ';'; cmdbuf[2] = 0x0d; cmd_len = 3; break; case RIG_OP_TO_VFO: cmd_len = sprintf(cmdbuf, "<%02u"CR, (unsigned)priv->ch); break; case RIG_OP_FROM_VFO: cmd_len = sprintf(cmdbuf, "d%02u"CR, (unsigned)priv->ch); break; default: return -RIG_EINVAL; } return cu_transaction(rig, cmdbuf, cmd_len); } hamlib-1.2.15.3/skanti/Makefile.in0000644000175000017500000004777112044564556013507 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = skanti DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_skanti_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = trp8000.lo trp8255.lo am_hamlib_skanti_la_OBJECTS = $(am__objects_1) skanti.lo hamlib_skanti_la_OBJECTS = $(am_hamlib_skanti_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_skanti_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_skanti_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_skanti_la_SOURCES) DIST_SOURCES = $(hamlib_skanti_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SKANTISRCLIST = trp8000.c trp8255.c pkglib_LTLIBRARIES = hamlib-skanti.la hamlib_skanti_la_SOURCES = $(SKANTISRCLIST) skanti.c hamlib_skanti_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_skanti_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = skanti.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu skanti/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu skanti/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-skanti.la: $(hamlib_skanti_la_OBJECTS) $(hamlib_skanti_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_skanti_la_LINK) -rpath $(pkglibdir) $(hamlib_skanti_la_OBJECTS) $(hamlib_skanti_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skanti.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trp8000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trp8255.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/skanti/trp8000.c0000644000175000017500000000715512044564477012715 00000000000000/* * Hamlib Skanti backend - TRP8000 description * Copyright (c) 2004-2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "idx_builtin.h" #include "skanti.h" /* modes: what about MCW, R3E ? */ #define TRP8000_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY) #define TRP8000_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY) #define TRP8000_AM_TX_MODES RIG_MODE_AM #define TRP8000_FUNC (RIG_FUNC_NONE) #define TRP8000_LEVEL_ALL (RIG_LEVEL_RFPOWER|RIG_LEVEL_AGC|RIG_LEVEL_ATT|RIG_LEVEL_PREAMP) #define TRP8000_PARM_ALL (RIG_PARM_NONE) #define TRP8000_VFO (RIG_VFO_A) /* TBC */ /* * trp8000 rig capabilities. * * * TODO: TUNING, BFO, SENSITIVITY(RF gain?) */ const struct rig_caps trp8000_caps = { .rig_model = RIG_MODEL_TRP8000, .model_name = "TRP8000", .mfg_name = "Skanti", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 300, .serial_data_bits = 7, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_ODD, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 0, .timeout = 2000, .retry = 3, .has_get_func = TRP8000_FUNC, .has_set_func = TRP8000_FUNC, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_SET(TRP8000_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_SET(TRP8000_PARM_ALL), .vfo_ops = RIG_OP_TUNE, .preamp = { 10, RIG_DBLST_END }, /* TBC */ .attenuator = { 20, RIG_DBLST_END }, /* TBC */ .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(500),MHz(30),TRP8000_ALL_MODES,-1,-1,TRP8000_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { {MHz(2),MHz(30),TRP8000_AM_TX_MODES,W(4),W(40),TRP8000_VFO}, {MHz(2),MHz(30),TRP8000_OTHER_TX_MODES,W(10),W(100),TRP8000_VFO}, RIG_FRNG_END, }, .tuning_steps = { {TRP8000_ALL_MODES,100}, {TRP8000_ALL_MODES,10}, {TRP8000_ALL_MODES,kHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { /* rough guesses */ {TRP8000_ALL_MODES, kHz(2.7)}, /* intermit */ {TRP8000_ALL_MODES, kHz(2.1)}, /* narrow */ {TRP8000_ALL_MODES, kHz(6)}, /* wide */ {TRP8000_ALL_MODES, Hz(500)}, /* very narrow */ RIG_FLT_END, }, .set_freq = skanti_set_freq, .set_mode = skanti_set_mode, .set_split_freq = skanti_set_split_freq, .set_ptt = skanti_set_ptt, .vfo_op = skanti_vfo_op, .set_level = skanti_set_level, .reset = skanti_reset, }; /* * Function definitions below */ hamlib-1.2.15.3/skanti/skanti.h0000644000175000017500000000265712044564477013100 00000000000000/* * Hamlib Skanti backend - main header * Copyright (c) 2004-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _SKANTI_H #define _SKANTI_H 1 #include int skanti_reset(RIG *rig, reset_t reset); int skanti_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int skanti_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int skanti_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq); int skanti_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int skanti_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); int skanti_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); extern const struct rig_caps trp8000_caps; extern const struct rig_caps trp8255_caps; #endif /* _SKANTI_H */ hamlib-1.2.15.3/skanti/Makefile.am0000644000175000017500000000042612044564477013462 00000000000000SKANTISRCLIST = trp8000.c trp8255.c pkglib_LTLIBRARIES = hamlib-skanti.la hamlib_skanti_la_SOURCES = $(SKANTISRCLIST) skanti.c hamlib_skanti_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_skanti_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = skanti.h hamlib-1.2.15.3/skanti/skanti.c0000644000175000017500000001462112044564477013065 00000000000000/* * Hamlib Skanti backend - main file * Copyright (c) 2004-2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include #include #include #include #include "skanti.h" /* Line Feed */ #define EOM "\x0d" #define LF "\x0a" #define PROMPT ">" #define BUFSZ 32 /* * modes */ #define MD_LSB "L" #define MD_USB "J" #define MD_CW "A1" #define MD_MCW "A2" #define MD_AM "H" #define MD_RTTY "F" #define MD_R3E "R" /* * skanti_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! * TODO: error case handling */ static int skanti_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval; struct rig_state *rs; char retbuf[BUFSZ+1]; rs = &rig->state; serial_flush(&rs->rigport); retval = write_block(&rs->rigport, cmd, cmd_len); if (retval != RIG_OK) return retval; /* no data expected, check for OK returned */ if (!data || !data_len) { /* * Transceiver sends back ">" */ retval = read_string(&rs->rigport, retbuf, BUFSZ, PROMPT, strlen(PROMPT)); if (retval < 0) return retval; retbuf[retval] = '\0'; if (strstr(retbuf, PROMPT)) return RIG_OK; else return -RIG_ERJCTED; } retval = read_string(&rs->rigport, data, BUFSZ, LF, strlen(LF)); if (retval == -RIG_ETIMEOUT) retval = 0; if (retval < 0) return retval; *data_len = retval; /* strip CR/LF from string */ *data_len -= 2; data[*data_len] = 0; return RIG_OK; } /* * skanti_reset * Assumes rig!=NULL */ int skanti_reset(RIG *rig, reset_t reset) { int retval; /* * master reset * * returned data: *x1A345SF * whatever this means? unit serial #? */ retval = skanti_transaction (rig, "0" EOM, strlen("0" EOM), NULL, NULL); if (retval != RIG_OK) return retval; return RIG_OK; } /* * skanti_set_freq * Assumes rig!=NULL */ int skanti_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char freqbuf[BUFSZ]; int freq_len; /* 6 digits */ freq_len = sprintf(freqbuf, "Z%06ld" EOM, (long)(freq/100)); return skanti_transaction (rig, freqbuf, freq_len, NULL, NULL); } /* * skanti_set_mode * Assumes rig!=NULL */ int skanti_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { int retval; char *sk_mode, *sk_filter; pbwidth_t passband_normal; switch (mode) { /* TODO: MCW, R3E */ case RIG_MODE_CW: sk_mode = MD_CW EOM; break; case RIG_MODE_USB: sk_mode = MD_USB EOM; break; case RIG_MODE_LSB: sk_mode = MD_LSB EOM; break; case RIG_MODE_RTTY: sk_mode = MD_RTTY EOM; break; case RIG_MODE_AM: sk_mode = MD_AM EOM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %d\n", __FUNCTION__, mode); return -RIG_EINVAL; } retval = skanti_transaction (rig, sk_mode, strlen(sk_mode), NULL, NULL); if (retval != RIG_OK) return retval; /* * TODO: please sk8000 owners, check this, I'm not sure * which passband is default! */ passband_normal = rig_passband_normal(rig, mode); if (width == RIG_PASSBAND_NORMAL || width == passband_normal) sk_filter = "I" EOM; else if (width < passband_normal) sk_filter = width < 1000 ? "V" EOM : "N" EOM; else sk_filter = "W" EOM; retval = skanti_transaction (rig, sk_filter, strlen(sk_filter), NULL, NULL); return retval; } /* * skanti_set_split_freq * Assumes rig!=NULL */ int skanti_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) { char freqbuf[BUFSZ]; int freq_len; /* 6 digits */ freq_len = sprintf(freqbuf, "T%06ld" EOM, (long)(tx_freq/100)); return skanti_transaction (rig, freqbuf, freq_len, NULL, NULL); } /* * skanti_set_level * Assumes rig!=NULL * FIXME: cannot support PREAMP and ATT both at same time (make sense though) */ int skanti_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { int cmd_len; char cmdbuf[BUFSZ], *agc; /* Optimize: * sort the switch cases with the most frequent first */ switch (level) { case RIG_LEVEL_PREAMP: cmd_len = sprintf(cmdbuf, "R%c" EOM, val.i?'F':'O'); return skanti_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_LEVEL_ATT: cmd_len = sprintf(cmdbuf, "A%c" EOM, val.i?'T':'O'); return skanti_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_LEVEL_RFPOWER: cmd_len = sprintf(cmdbuf, "M%cO" EOM, val.f<0.33?'L':(val.f<0.66?'M':'F')); return skanti_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_LEVEL_AGC: switch (val.i) { case RIG_AGC_SLOW: agc = "AS"EOM; break; case RIG_AGC_FAST: agc = "AA"EOM; break; case RIG_AGC_OFF: agc = "AF"EOM; break; default: return -RIG_EINVAL; } return skanti_transaction (rig, agc, strlen(agc), NULL, NULL); default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_level %d\n", level); return -RIG_EINVAL; } return RIG_OK; } /* * skanti_set_ptt * Assumes rig!=NULL, ptt!=NULL */ int skanti_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { char cmdbuf[BUFSZ]; int cmd_len; cmd_len = sprintf(cmdbuf, "X%c" EOM, ptt == RIG_PTT_ON?'N':'F'); return skanti_transaction (rig, cmdbuf, cmd_len, NULL, NULL); } int skanti_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { if (op != RIG_OP_TUNE) return -RIG_EINVAL; return skanti_transaction (rig, "XT"EOM, strlen("XT"EOM), NULL, NULL); } /* * initrigs_skanti is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(skanti) { rig_debug(RIG_DEBUG_VERBOSE, "skanti: _init called\n"); rig_register(&trp8000_caps); rig_register(&trp8255_caps); return RIG_OK; } hamlib-1.2.15.3/tapr/0000755000175000017500000000000012044565032011145 500000000000000hamlib-1.2.15.3/tapr/tapr.h0000644000175000017500000000212512044564477012220 00000000000000/* * Hamlib TAPR backend - main header * Copyright (c) 2003 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _TAPR_H #define _TAPR_H 1 #include int tapr_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int tapr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); extern const struct rig_caps dsp10_caps; #endif /* _TAPR_H */ hamlib-1.2.15.3/tapr/dsp10.c0000644000175000017500000000644712044564477012207 00000000000000/* * Hamlib TAPR backend - DSP-10 description * Copyright (c) 2003 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "tapr.h" #define DSP10_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define DSP10_FUNC (RIG_FUNC_NONE) #define DSP10_LEVEL_ALL (RIG_LEVEL_NONE) #define DSP10_PARM_ALL (RIG_PARM_NONE) #define DSP10_VFO (RIG_VFO_A) /* * DSP-10 rig capabilities. * * This backend is not working, and is just a call for someone motivated. * Note: The DSP has to be loaded beforehand! * * protocol is documented at (version 2) * http://www.proaxis.com/~boblark/pc_dsp2.txt * * See also: * http://home.teleport.com/~oldaker/dsp10_repository.htm * http://www.proaxis.com/~boblark/dsp10.htm * http://www.tapr.org/tapr/html/Fdsp10.html * * */ const struct rig_caps dsp10_caps = { .rig_model = RIG_MODEL_DSP10, .model_name = "DSP-10", .mfg_name = "TAPR", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .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 = 3, .has_get_func = DSP10_FUNC, .has_set_func = DSP10_FUNC, .has_get_level = DSP10_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(DSP10_LEVEL_ALL), .has_get_parm = DSP10_PARM_ALL, .has_set_parm = RIG_PARM_SET(DSP10_PARM_ALL), .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 = { {MHz(144),kHz(148),DSP10_MODES,-1,-1,DSP10_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { {MHz(144),kHz(148),DSP10_MODES,mW(20),mW(20),DSP10_VFO}, RIG_FRNG_END, }, .tuning_steps = { {DSP10_MODES,1}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.7)}, {RIG_MODE_FM, kHz(8)}, RIG_FLT_END, }, .priv = (void*)NULL, .set_freq = tapr_set_freq, .set_mode = tapr_set_mode, }; hamlib-1.2.15.3/tapr/Makefile.in0000644000175000017500000004754012044564557013157 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = tapr DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_tapr_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = dsp10.lo am_hamlib_tapr_la_OBJECTS = $(am__objects_1) tapr.lo hamlib_tapr_la_OBJECTS = $(am_hamlib_tapr_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_tapr_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_tapr_la_LDFLAGS) $(LDFLAGS) -o \ $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_tapr_la_SOURCES) DIST_SOURCES = $(hamlib_tapr_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ TAPRSRCLIST = dsp10.c pkglib_LTLIBRARIES = hamlib-tapr.la hamlib_tapr_la_SOURCES = $(TAPRSRCLIST) tapr.c hamlib_tapr_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_tapr_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = tapr.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tapr/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tapr/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-tapr.la: $(hamlib_tapr_la_OBJECTS) $(hamlib_tapr_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_tapr_la_LINK) -rpath $(pkglibdir) $(hamlib_tapr_la_OBJECTS) $(hamlib_tapr_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dsp10.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tapr.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/tapr/tapr.c0000644000175000017500000000512512044564477012216 00000000000000/* * Hamlib TAPR backend - main file * Copyright (c) 2003 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "register.h" #include "serial.h" #include "tapr.h" #define ESC '$' #define CMD_LEN 6 #define CMD7 7 #define NU1 1 #define NU2 2 #define NU3 3 #define NU4 4 /* * tapr_cmd * We assume that rig!=NULL, rig->state!= NULL, data!=NULL * Otherwise, you'll get a nice seg fault. You've been warned! * TODO: error case handling */ static int tapr_cmd(RIG *rig, unsigned char cmd, unsigned char c1, unsigned char c2, unsigned char c3, unsigned char c4) { int retval; struct rig_state *rs; unsigned char cmdbuf[CMD_LEN]; rs = &rig->state; serial_flush(&rs->rigport); cmdbuf[0] = ESC; cmdbuf[1] = cmd; cmdbuf[2] = c1; cmdbuf[3] = c2; cmdbuf[4] = c3; cmdbuf[5] = c4; retval = write_block(&rs->rigport, (char *) cmdbuf, 6); if (retval != RIG_OK) return retval; return RIG_OK; } /* * tapr_set_freq * Assumes rig!=NULL */ int tapr_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned int dsp_dph, dsp_deltap_lo, dsp_deltap_hi; int retval; return -RIG_ENIMPL; /* FIXME! */ dsp_dph=(unsigned int) (1.365333333*(double)(freq-MHz(144)+15000UL)); dsp_deltap_lo = 0xff & dsp_dph; dsp_deltap_hi = 0xff & (dsp_dph >> 8); retval = tapr_cmd (rig, CMD7, 0, NU1, dsp_deltap_lo, dsp_deltap_hi); return retval; } /* * tapr_set_mode * Assumes rig!=NULL */ int tapr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { return -RIG_ENIMPL; } /* * initrigs_tapr is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(tapr) { rig_debug(RIG_DEBUG_VERBOSE, "tapr: _init called\n"); rig_register(&dsp10_caps); return RIG_OK; } hamlib-1.2.15.3/tapr/Makefile.am0000644000175000017500000000037212044564477013137 00000000000000TAPRSRCLIST = dsp10.c pkglib_LTLIBRARIES = hamlib-tapr.la hamlib_tapr_la_SOURCES = $(TAPRSRCLIST) tapr.c hamlib_tapr_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_tapr_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = tapr.h hamlib-1.2.15.3/icom/0000755000175000017500000000000012044565012011124 500000000000000hamlib-1.2.15.3/icom/ic92d.c0000644000175000017500000001513112044564477012141 00000000000000/* * Hamlib CI-V backend - description of IC-E92D/IC-92AD and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "idx_builtin.h" #include "icom.h" #include "frame.h" #include "icom_defs.h" /* TODO: DV (GMSK 4.8 kbps voice) */ #define IC92D_MODES (RIG_MODE_FM) #define IC92D_MODES_TX (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define IC92D_FUNC_ALL (RIG_FUNC_MUTE|RIG_FUNC_MON|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_LOCK|RIG_FUNC_AFC) #define IC92D_LEVEL_ALL (RIG_LEVEL_AF|RIG_LEVEL_SQL|RIG_LEVEL_RFPOWER|RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_RAWSTR) #define IC92D_PARM_ALL (RIG_PARM_BEEP|RIG_PARM_BACKLIGHT) #define IC92D_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC92D_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL) #define IC92D_SCAN_OPS (RIG_SCAN_VFO|RIG_SCAN_MEM) /* * FIXME: real measurement */ #define IC92D_STR_CAL UNKNOWN_IC_STR_CAL /* FIXME */ #define IC92D_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .rptr_offs = 1, \ .rptr_shift = 1, \ .funcs = IC92D_FUNC_ALL, \ .levels = RIG_LEVEL_SET(IC92D_LEVEL_ALL), \ } static const char *ic92d_get_info(RIG *rig); /* FIXME: tuning step sub-commands */ const struct ts_sc_list ic92d_ts_sc_list[] = { { kHz(5), 0x00 }, { kHz(6.25), 0x01 }, { kHz(8.33), 0x02 }, { kHz(9), 0x03 }, { kHz(10), 0x04 }, { kHz(12.5), 0x05 }, { kHz(15), 0x06 }, { kHz(20), 0x07 }, { kHz(25), 0x08 }, { kHz(30), 0x09 }, { kHz(50), 0x0a }, { kHz(100), 0x0b }, { kHz(125), 0x0c }, { kHz(200), 0x0d }, { 0, 0 }, }; /* */ static const struct icom_priv_caps ic92d_priv_caps = { 0x01, /* default address */ 0, /* 731 mode */ ic92d_ts_sc_list, .serial_full_duplex = 1 }; const struct rig_caps ic92d_caps = { .rig_model = RIG_MODEL_IC92D, .model_name = "IC-92D", /* IC-E92D/IC-92AD */ .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_HANDHELD, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 38400, .serial_rate_max = 38400, .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 = IC92D_FUNC_ALL, .has_set_func = IC92D_FUNC_ALL, .has_get_level = IC92D_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(IC92D_LEVEL_ALL), .has_get_parm = IC92D_PARM_ALL, .has_set_parm = IC92D_PARM_ALL, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = full_dcs_list, .preamp = { RIG_DBLST_END, }, .attenuator = { 10, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC92D_VFO_OPS, .scan_ops = IC92D_SCAN_OPS, .transceive = RIG_TRN_OFF, .bank_qty = 26, .chan_desc_sz = 8, /* The IC-E92D has a total 1304 memory channels with 26 memory banks. * The VFO A has 800 regular channels, 50 scan edges and 2 call channels, * while the VFO B has 400 regular, 50 scan edges and 2 call channels. */ .chan_list = { { 1,1200, RIG_MTYPE_MEM, IC92D_MEM_CAP }, { 1201,1300, RIG_MTYPE_EDGE, IC92D_MEM_CAP }, { 1301,1304, RIG_MTYPE_CALL, IC92D_MEM_CAP }, RIG_CHAN_END, }, /* IC-E92D */ .rx_range_list1 = { {kHz(495),MHz(999.99),RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM,-1,-1,RIG_VFO_A}, {MHz(118),MHz(174),RIG_MODE_AM|RIG_MODE_FM,-1,-1,RIG_VFO_B}, // TODO: MODE_DV {MHz(350),MHz(470),RIG_MODE_AM|RIG_MODE_FM,-1,-1,RIG_VFO_B}, // TODO: MODE_DV RIG_FRNG_END, }, .tx_range_list1 = { {MHz(144),MHz(146)-1,IC92D_MODES_TX,mW(100),W(5),IC92D_VFO_ALL}, {MHz(430),MHz(440)-1,IC92D_MODES_TX,mW(100),W(5),IC92D_VFO_ALL}, RIG_FRNG_END, }, /* IC-92AD */ .rx_range_list2 = { {kHz(495),MHz(999.99),RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM,-1,-1,RIG_VFO_A}, {MHz(118),MHz(174),RIG_MODE_AM|RIG_MODE_FM,-1,-1,RIG_VFO_B}, // TODO: MODE_DV {MHz(350),MHz(470),RIG_MODE_AM|RIG_MODE_FM,-1,-1,RIG_VFO_B}, // TODO: MODE_DV RIG_FRNG_END, }, .tx_range_list2 = { {MHz(144),MHz(148)-1,IC92D_MODES_TX,mW(100),W(5),IC92D_VFO_ALL}, {MHz(430),MHz(440)-1,IC92D_MODES_TX,mW(100),W(5),IC92D_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {IC92D_MODES,kHz(5)}, {IC92D_MODES,kHz(6.25)}, {IC92D_MODES,kHz(8.33)}, {IC92D_MODES,kHz(9)}, {IC92D_MODES,kHz(10)}, {IC92D_MODES,12500}, {IC92D_MODES,kHz(15)}, {IC92D_MODES,kHz(20)}, {IC92D_MODES,kHz(25)}, {IC92D_MODES,kHz(50)}, {IC92D_MODES,kHz(100)}, {IC92D_MODES,kHz(125)}, {IC92D_MODES,kHz(200)}, RIG_TS_END, }, /* FIXME: mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_FM, kHz(12)}, {RIG_MODE_FM|RIG_MODE_AM, kHz(9)}, /* N-FM & AM */ {RIG_MODE_WFM, kHz(230)}, RIG_FLT_END, }, .str_cal = IC92D_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic92d_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .get_info = ic92d_get_info, }; const char *ic92d_get_info(RIG *rig) { struct icom_priv_data *priv; struct rig_state *rs; unsigned char ackbuf[16]; int ack_len, retval; static char info[64]; rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; // 018019fd priv->re_civ_addr = 0x01; retval = icom_transaction (rig, C_RD_TRXID, -1, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return NULL; if (ack_len <= 3) { rig_debug(RIG_DEBUG_ERR,"%s: ack NG (%#.2x), " "len=%d\n", __func__, ackbuf[0], ack_len); return NULL; } sprintf(info, "ID %02x%02x%02x\n", ackbuf[1], ackbuf[2], ackbuf[3]); return info; } hamlib-1.2.15.3/icom/ic781.c0000644000175000017500000001351012044564477012061 00000000000000/* * Hamlib CI-V backend - description of IC-781 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "bandplan.h" #include "icom.h" #define IC781_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) /* * IC-781 * specs: http://www.qsl.net/sm7vhs/radio/icom/ic781/specs.htm * * TODO: selected memory scan, delta-f scan, dual watch */ #define IC781_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define IC781_AM_TX_MODES (RIG_MODE_AM) #define IC781_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC781_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_CPY|RIG_OP_MCL|RIG_OP_XCHG) #define IC781_SCAN_OPS (RIG_SCAN_VFO|RIG_SCAN_MEM) /* TBC */ #define IC781_ANTS RIG_ANT_1 /* */ static const struct icom_priv_caps ic781_priv_caps = { 0x26, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic781_caps = { .rig_model = RIG_MODEL_IC781, .model_name = "IC-781", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .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 = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC781_VFO_OPS, .scan_ops = IC781_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, { 100, 101, RIG_MTYPE_EDGE, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100),MHz(30),IC781_ALL_RX_MODES,-1,-1,IC781_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC781_OTHER_TX_MODES, W(10),W(150),IC781_VFO_ALL,IC781_ANTS), FRQ_RNG_HF(1,IC781_AM_TX_MODES, W(10),W(75),IC781_VFO_ALL,IC781_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(30),IC781_ALL_RX_MODES,-1,-1,IC781_VFO_ALL}, RIG_FRNG_END, }, /* weird transmit ranges ... --sf */ .tx_range_list2 = { {kHz(1800),1999999,IC781_OTHER_TX_MODES,5000,150000,IC781_VFO_ALL}, /* 150W class */ {kHz(1800),1999999,IC781_AM_TX_MODES,2000,75000,IC781_VFO_ALL}, /* 75W class */ {kHz(3400),4099999,IC781_OTHER_TX_MODES,5000,150000,IC781_VFO_ALL}, {kHz(3400),4099999,IC781_AM_TX_MODES,2000,75000,IC781_VFO_ALL}, {MHz(6.9),kHz(7499.99),IC781_OTHER_TX_MODES,5000,150000,IC781_VFO_ALL}, {MHz(6.9),kHz(7499.99),IC781_AM_TX_MODES,2000,75000,IC781_VFO_ALL}, {MHz(9.9),MHz(1049999),IC781_OTHER_TX_MODES,5000,150000,IC781_VFO_ALL}, {MHz(9.9),MHz(1049999),IC781_AM_TX_MODES,2000,75000,IC781_VFO_ALL}, {MHz(13.9),kHz(14.49999),IC781_OTHER_TX_MODES,5000,150000,IC781_VFO_ALL}, {MHz(13.9),kHz(14.49999),IC781_AM_TX_MODES,2000,75000,IC781_VFO_ALL}, {kHz(17900),kHz(18499.99),IC781_OTHER_TX_MODES,5000,150000,IC781_VFO_ALL}, {kHz(17900),kHz(18499.99),IC781_AM_TX_MODES,2000,75000,IC781_VFO_ALL}, {MHz(20.9),kHz(21499.99),IC781_OTHER_TX_MODES,5000,150000,IC781_VFO_ALL}, {MHz(20.9),kHz(21499.99),IC781_AM_TX_MODES,2000,75000,IC781_VFO_ALL}, {kHz(24400),kHz(25099.99),IC781_OTHER_TX_MODES,5000,150000,IC781_VFO_ALL}, {kHz(24400),kHz(25099.99),IC781_AM_TX_MODES,2000,75000,IC781_VFO_ALL}, {MHz(27.9),MHz(30),IC781_OTHER_TX_MODES,5000,150000,IC781_VFO_ALL}, {MHz(27.9),MHz(30),IC781_AM_TX_MODES,2000,75000,IC781_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {IC781_ALL_RX_MODES,10}, /* basic resolution, there's no set_ts */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_AM, kHz(6)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_CW|RIG_MODE_RTTY, Hz(500)}, /* narrow */ {RIG_MODE_CW|RIG_MODE_RTTY, Hz(250)}, /* narrow, with [CW250Hz] ON */ {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic781_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_split_vfo = icom_set_split_vfo, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .scan = icom_scan, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, /* TODO: more capabilities */ }; hamlib-1.2.15.3/icom/icr9000.c0000644000175000017500000001212112044564477012311 00000000000000/* * Hamlib CI-V backend - IC-R9000 descriptions * Copyright (c) 2000-2011 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "serial.h" #include "misc.h" #include "idx_builtin.h" #include "icom.h" #include "icom_defs.h" #include "frame.h" #define ICR9000_MODES (RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_CW|RIG_MODE_WFM) #define ICR9000_OPS (RIG_OP_FROM_VFO|RIG_OP_MCL) #define ICR9000_FUNCS (RIG_FUNC_VSC) #define ICR9000_LEVELS (RIG_LEVEL_ATT|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR) #define ICR9000_PARMS (RIG_PARM_ANN) #define ICR9000_SCAN_OPS (RIG_SCAN_MEM) /* TBC */ #define ICR9000_ANTS (RIG_ANT_1|RIG_ANT_2) /* selectable by CI-V ? */ #define ICR9000_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .levels = RIG_LEVEL_ATT, \ } /* TODO: S-Meter measurements */ #define ICR9000_STR_CAL UNKNOWN_IC_STR_CAL static const struct icom_priv_caps icr9000_priv_caps = { 0x2a, /* default address */ 0, /* 731 mode */ r9000_ts_sc_list }; static int icr9000_open(RIG *rig); /* * ICR9000A rig capabilities. */ const struct rig_caps icr9000_caps = { .rig_model = RIG_MODEL_ICR9000, .model_name = "IC-R9000", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .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 = 1000, .retry = 3, .has_get_func = ICR9000_FUNCS, .has_set_func = ICR9000_FUNCS, .has_get_level = ICR9000_LEVELS, .has_set_level = RIG_LEVEL_SET(ICR9000_LEVELS), .has_get_parm = ICR9000_PARMS, .has_set_parm = RIG_PARM_SET(ICR9000_PARMS), .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END }, .attenuator = { 10, 20, 30, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = ICR9000_OPS, .scan_ops = ICR9000_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 999, RIG_MTYPE_MEM, ICR9000_MEM_CAP }, /* TBC */ { 1000, 1009, RIG_MTYPE_EDGE, IC_MIN_MEM_CAP }, /* 2 by 2 */ { 1010, 1019, RIG_MTYPE_EDGE, IC_MIN_MEM_CAP }, /* 2 by 2 */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100),MHz(1999.8),ICR9000_MODES,-1,-1, RIG_VFO_A, ICR9000_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(1999.8),ICR9000_MODES,-1,-1, RIG_VFO_A, ICR9000_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, /* no TX ranges, this is a receiver */ .tuning_steps = { {ICR9000_MODES,10}, /* resolution */ {ICR9000_MODES,100}, {ICR9000_MODES,kHz(1)}, {ICR9000_MODES,kHz(5)}, {ICR9000_MODES,kHz(9)}, {ICR9000_MODES,kHz(10)}, {ICR9000_MODES,12500}, {ICR9000_MODES,kHz(20)}, {ICR9000_MODES,kHz(25)}, {ICR9000_MODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.4)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_WFM, kHz(150)}, RIG_FLT_END, }, .str_cal = ICR9000_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&icr9000_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = icr9000_open, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .set_ts = icom_set_ts, .get_ts = icom_get_ts, .set_func = icom_set_func, .get_func = icom_get_func, .set_level = icom_set_level, .get_level = icom_get_level, #if 0 .set_parm = icom_set_parm, .get_parm = icom_get_parm, #endif .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .get_dcd = icom_get_dcd, }; /* * Function definitions below */ int icr9000_open(RIG *rig) { return icom_scan(rig, RIG_VFO_CURR, RIG_SCAN_STOP, 0); } hamlib-1.2.15.3/icom/ic821h.c0000644000175000017500000001216612044564477012232 00000000000000/* * Hamlib CI-V backend - description of IC-821H (VHF/UHF All-Mode Tranceiver) * Contributed by Francois Retief * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "icom.h" #define IC821H_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_FM) #define IC821H_VFO_ALL (RIG_VFO_A|RIG_VFO_C|RIG_VFO_MEM) /* FIXME: What about MAIN/SUB mode? And satellite mode? */ #define IC821H_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_CPY|RIG_OP_MCL) #define IC821H_SCAN_OPS (RIG_SCAN_MEM) /* FIXME: Manual talks about 3 modes: Programmed scan, Memory scan and * Mode select memory scan operation. How do i encode these? */ #define IC821H_STR_CAL { 0, { } } /* */ static const struct icom_priv_caps ic821h_priv_caps = { 0x4c, /* default address */ 1, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic821h_caps = { .rig_model = RIG_MODEL_IC821H, .model_name = "IC-821H", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, /* Attanuator 15dB for each band. manual button */ .max_rit = Hz(0), /* SSB,CW: +-1.0kHz FM: +-5.0kHz */ .max_xit = Hz(0), .max_ifshift = Hz(0), /* 1.2kHz manual knob */ .targetable_vfo = 0, .vfo_ops = IC821H_VFO_OPS, .scan_ops = IC821H_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { /* FIXME: Each band has 80 channels (2*80) */ { 1, 80, RIG_MTYPE_MEM }, { 81, 82, RIG_MTYPE_EDGE }, RIG_CHAN_END, }, .rx_range_list1 = { {MHz(136),MHz(174),IC821H_MODES,-1,-1,IC821H_VFO_ALL}, {MHz(430),MHz(450),IC821H_MODES,-1,-1,IC821H_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { {MHz(144),MHz(146),RIG_MODE_SSB,W(6),W(35),IC821H_VFO_ALL}, {MHz(144),MHz(146),RIG_MODE_FM|RIG_MODE_CW,W(6),W(45),IC821H_VFO_ALL}, {MHz(430),MHz(440),RIG_MODE_SSB,W(6),W(30),IC821H_VFO_ALL}, {MHz(430),MHz(440),RIG_MODE_FM|RIG_MODE_CW,W(6),W(40),IC821H_VFO_ALL}, RIG_FRNG_END, }, .rx_range_list2 = { {MHz(136),MHz(174),IC821H_MODES,-1,-1,IC821H_VFO_ALL}, {MHz(430),MHz(450),IC821H_MODES,-1,-1,IC821H_VFO_ALL}, RIG_FRNG_END, }, /* * From manual: VHF UHF * USA 144.0-148.0 MHz 430.0-450.0 MHz * Europe 144.0-146.0 MHz 430.0-440.0 MHz * Australia 144.0-148.0 MHz 430.0-450.0 MHz * Sweden 144.0-146.0 MHz 432.0-438.0 MHz */ .tx_range_list2 = { {MHz(144),MHz(148),RIG_MODE_SSB,W(6),W(35),IC821H_VFO_ALL}, {MHz(144),MHz(148),RIG_MODE_FM|RIG_MODE_CW,W(6),W(45),IC821H_VFO_ALL}, {MHz(430),MHz(450),RIG_MODE_SSB,W(6),W(30),IC821H_VFO_ALL}, {MHz(430),MHz(450),RIG_MODE_FM|RIG_MODE_CW,W(6),W(40),IC821H_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_SSB|RIG_MODE_CW,1}, {RIG_MODE_SSB|RIG_MODE_CW,10}, {RIG_MODE_SSB|RIG_MODE_CW,50}, {RIG_MODE_SSB|RIG_MODE_CW,100}, {RIG_MODE_FM,kHz(5)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_CW|RIG_MODE_SSB, kHz(2.3)}, /* buildin */ {RIG_MODE_FM, kHz(15)}, /* buildin */ RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic821h_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, }; hamlib-1.2.15.3/icom/ic970.c0000644000175000017500000001046512044564477012067 00000000000000/* * Hamlib CI-V backend - description of IC-970 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "icom.h" #define IC970_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define IC970_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC970_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO) #define IC970_STR_CAL { 0, { } } /* * FIXME: this appears to be the IC-970A/E * what about the IC-970H ? please give it a fix. --SF */ static const struct icom_priv_caps ic970_priv_caps = { 0x2e, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic970_caps = { .rig_model = RIG_MODEL_IC970, .model_name = "IC-970", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 19200, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC970_VFO_OPS, .scan_ops = RIG_SCAN_NONE, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM }, { 100, 101, RIG_MTYPE_EDGE }, { 102, 102, RIG_MTYPE_CALL }, RIG_CHAN_END, }, .rx_range_list1 = { {MHz(144),MHz(146),IC970_MODES,-1,-1,IC970_VFO_ALL}, {MHz(430),MHz(440),IC970_MODES,-1,-1,IC970_VFO_ALL}, /* 1200MHz band module is optional */ // {MHz(1240),MHz(1300),IC970_MODES,-1,-1,IC970_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { {MHz(144),MHz(146),IC970_MODES,W(3.5),W(25),IC970_VFO_ALL}, {MHz(430),MHz(440),IC970_MODES,W(3.5),W(25),IC970_VFO_ALL}, // {MHz(1240),MHz(1300),IC970_MODES,W(1),W(10),IC970_VFO_ALL}, RIG_FRNG_END, }, .rx_range_list2 = { {MHz(144),MHz(150),IC970_MODES,-1,-1,IC970_VFO_ALL}, {MHz(430),MHz(450),IC970_MODES,-1,-1,IC970_VFO_ALL}, /* 1200MHz band module is optional */ // {MHz(1240),MHz(1300),IC970_MODES,-1,-1,IC970_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { {MHz(144),MHz(150),IC970_MODES,W(3.5),W(25),IC970_VFO_ALL}, {MHz(430),MHz(450),IC970_MODES,W(3.5),W(25),IC970_VFO_ALL}, // {MHz(1240),MHz(1300),IC970_MODES,W(1),W(10),IC970_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {IC970_MODES,10}, /* TBC: does this rig supports settin tuning step? */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.3)}, // {RIG_MODE_FM, Hz(500)}, /* optional CW NARROW FILTER */ {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic970_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/ic7410.c0000644000175000017500000001731012044564477012137 00000000000000/* * Hamlib CI-V backend - description of IC-7410 * Copyright (c) 2011 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include #include "token.h" #include "idx_builtin.h" #include "icom.h" #include "icom_defs.h" #include "frame.h" #include "misc.h" #include "bandplan.h" /* * TODO: PSK and PSKR */ #define IC7410_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC7410_1HZ_TS_MODES IC7410_ALL_RX_MODES #define IC7410_OTHER_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC7410_AM_TX_MODES (RIG_MODE_AM) #define IC7410_FUNCS (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_NR|RIG_FUNC_MON|RIG_FUNC_MN|RIG_FUNC_ANF|RIG_FUNC_VSC|RIG_FUNC_LOCK) #define IC7410_LEVELS (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_COMP|RIG_LEVEL_BKINDL|RIG_LEVEL_BALANCE|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY|RIG_LEVEL_SWR|RIG_LEVEL_ALC) #define IC7410_VFOS (RIG_VFO_MAIN|RIG_VFO_SUB|RIG_VFO_MEM) #define IC7410_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT) #define IC7410_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL|RIG_OP_TUNE) #define IC7410_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO|RIG_SCAN_PROG|RIG_SCAN_DELTA|RIG_SCAN_PRIO) #define IC7410_ANTS (RIG_ANT_1|RIG_ANT_2) /* * Guess from IC7600 */ #define IC7410_STR_CAL { 16, \ { \ { 0, -54 }, /* S0 */ \ { 124, 0 }, /* S9 */ \ { 246, 60 } /* S9+60dB */ \ } } /* * IC-7410 rig capabilities. * * TODO: complete command set (esp. the $1A bunch!) and testing.. */ static const struct icom_priv_caps ic7410_priv_caps = { 0x80, /* default address */ 0, /* 731 mode */ ic756pro_ts_sc_list }; const struct rig_caps ic7410_caps = { .rig_model = RIG_MODEL_IC7410, .model_name = "IC-7410", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC7410_FUNCS, .has_set_func = IC7410_FUNCS, .has_get_level = IC7410_LEVELS, .has_set_level = RIG_LEVEL_SET(IC7410_LEVELS), .has_get_parm = IC7410_PARMS, .has_set_parm = RIG_PARM_SET(IC7410_PARMS), /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, 20, RIG_DBLST_END, }, /* FIXME: TBC */ .attenuator = { 6, 12, 18, RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC7410_VFO_OPS, .scan_ops = IC7410_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM }, { 100, 101, RIG_MTYPE_EDGE }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(60),IC7410_ALL_RX_MODES,-1,-1,IC7410_VFOS,IC7410_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC7410_OTHER_TX_MODES, W(2),W(100),IC7410_VFOS,IC7410_ANTS), FRQ_RNG_6m(1,IC7410_OTHER_TX_MODES, W(2),W(100),IC7410_VFOS,IC7410_ANTS), FRQ_RNG_HF(1,IC7410_AM_TX_MODES, W(1),W(27),IC7410_VFOS,IC7410_ANTS), /* AM class */ FRQ_RNG_6m(1,IC7410_AM_TX_MODES, W(1),W(27),IC7410_VFOS,IC7410_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(60),IC7410_ALL_RX_MODES,-1,-1,IC7410_VFOS,IC7410_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC7410_OTHER_TX_MODES, W(2),W(100),IC7410_VFOS,IC7410_ANTS), FRQ_RNG_6m(2,IC7410_OTHER_TX_MODES, W(2),W(100),IC7410_VFOS,IC7410_ANTS), FRQ_RNG_HF(2,IC7410_AM_TX_MODES, W(1),W(27),IC7410_VFOS,IC7410_ANTS), /* AM class */ FRQ_RNG_6m(2,IC7410_AM_TX_MODES, W(1),W(27),IC7410_VFOS,IC7410_ANTS), /* AM class */ /* USA only, TBC: end of range and modes */ {MHz(5.33050),MHz(5.33350),IC7410_OTHER_TX_MODES,W(2),W(100),IC7410_VFOS,IC7410_ANTS}, /* USA only */ {MHz(5.34650),MHz(5.34950),IC7410_OTHER_TX_MODES,W(2),W(100),IC7410_VFOS,IC7410_ANTS}, /* USA only */ {MHz(5.36650),MHz(5.36950),IC7410_OTHER_TX_MODES,W(2),W(100),IC7410_VFOS,IC7410_ANTS}, /* USA only */ {MHz(5.37150),MHz(5.37450),IC7410_OTHER_TX_MODES,W(2),W(100),IC7410_VFOS,IC7410_ANTS}, /* USA only */ {MHz(5.40350),MHz(5.40650),IC7410_OTHER_TX_MODES,W(2),W(100),IC7410_VFOS,IC7410_ANTS}, /* USA only */ RIG_FRNG_END, }, .tuning_steps = { {IC7410_1HZ_TS_MODES,1}, {IC7410_ALL_RX_MODES,Hz(100)}, {IC7410_ALL_RX_MODES,kHz(1)}, {IC7410_ALL_RX_MODES,kHz(5)}, {IC7410_ALL_RX_MODES,kHz(9)}, {IC7410_ALL_RX_MODES,kHz(10)}, {IC7410_ALL_RX_MODES,kHz(12.5)}, {IC7410_ALL_RX_MODES,kHz(20)}, {IC7410_ALL_RX_MODES,kHz(25)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(2.4)}, {RIG_MODE_CW|RIG_MODE_CWR, Hz(500)}, {RIG_MODE_CW|RIG_MODE_CWR, Hz(350)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_FM, kHz(12)}, {RIG_MODE_FM, kHz(8)}, /* TBC */ RIG_FLT_END, }, .str_cal = IC7410_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic7410_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .set_rit = icom_set_rit, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_parm = icom_set_parm, .get_parm = icom_get_parm, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ptt = icom_set_ptt, .get_ptt = icom_get_ptt, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .get_ts = icom_get_ts, .set_rptr_shift = icom_set_rptr_shift, .get_rptr_shift = icom_get_rptr_shift, .set_rptr_offs = icom_set_rptr_offs, .get_rptr_offs = icom_get_rptr_offs, .set_ctcss_tone = icom_set_ctcss_tone, .get_ctcss_tone = icom_get_ctcss_tone, .set_ctcss_sql = icom_set_ctcss_sql, .get_ctcss_sql = icom_get_ctcss_sql, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, .get_split_vfo = icom_mem_get_split_vfo, }; hamlib-1.2.15.3/icom/ic7000.c0000644000175000017500000002263212044564477012135 00000000000000/* * Hamlib CI-V backend - description of IC-7000 and variations * Adapted from IC-7800 code 2006 by Kent Hill * Copyright (c) 2004-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include #include "token.h" #include "idx_builtin.h" #include "icom.h" #include "icom_defs.h" #include "frame.h" #include "misc.h" #include "bandplan.h" #define IC7000_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM|RIG_MODE_WFM) #define IC7000_1HZ_TS_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define IC7000_NOT_TS_MODES (IC7000_ALL_RX_MODES &~IC7000_1HZ_TS_MODES) #define IC7000_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC7000_AM_TX_MODES (RIG_MODE_AM) #define IC7000_FUNCS (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_NR|RIG_FUNC_MON|RIG_FUNC_MN|RIG_FUNC_ANF|RIG_FUNC_VSC|RIG_FUNC_LOCK|RIG_FUNC_ARO) #define IC7000_LEVELS (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_COMP|RIG_LEVEL_BKINDL|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY|RIG_LEVEL_SWR|RIG_LEVEL_ALC) #define IC7000_VFOS (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC7000_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT|RIG_PARM_APO|RIG_PARM_TIME|RIG_PARM_BEEP) #define IC7000_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL|RIG_OP_TUNE) #define IC7000_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_PROG|RIG_SCAN_SLCT|RIG_SCAN_PRIO) #define IC7000_ANTS (RIG_ANT_1|RIG_ANT_2) /* ant-1 is Hf-6m, ant-2 is 2m-70cm */ /* * Measurement by Mark, WA0TOP * * s/n 0503103. * Preamp off, ATT off, mode AM, f=10 MHz */ #define IC7000_STR_CAL { 14, \ { \ { 0, -54 }, /* first one is made up */ \ { 5, -29 }, \ { 15, -27 }, \ { 43, -22 }, \ { 68, -17 }, \ { 92, -12 }, \ { 120, -6 }, \ { 141, 2 }, \ { 162, 13 }, \ { 182, 25 }, \ { 202, 38 }, \ { 222, 47 }, \ { 241, 57 }, \ { 255, 63 } \ } } /* * * IC7000 channel caps. */ #define IC7000_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .split = 1, \ .tx_freq = 1, \ .tx_mode = 1, \ .tx_width = 1, \ .rptr_offs = 1, \ .rptr_shift = 1, \ .ctcss_tone = 1, \ .ctcss_sql = 1, \ .funcs = IC7000_FUNCS, \ .levels = RIG_LEVEL_SET(IC7000_LEVELS), \ } /* * IC-7000 rig capabilities. * * TODO: complete command set (esp. the $1A bunch!) and testing.. */ static const struct icom_priv_caps IC7000_priv_caps = { 0x70, /* default address */ 0, /* 731 mode */ ic7000_ts_sc_list }; const struct rig_caps ic7000_caps = { .rig_model = RIG_MODEL_IC7000, .model_name = "IC-7000", .mfg_name = "Icom", .version = BACKEND_VER ".2", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC7000_FUNCS, .has_set_func = IC7000_FUNCS, .has_get_level = IC7000_LEVELS, .has_set_level = RIG_LEVEL_SET(IC7000_LEVELS), .has_get_parm = IC7000_PARMS, .has_set_parm = RIG_PARM_SET(IC7000_PARMS), .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = common_dcs_list, .preamp = { 10, RIG_DBLST_END, }, /* FIXME: TBC it's a guess*/ .attenuator = { 12, RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(0), /* TODO */ .targetable_vfo = 0, .vfo_ops = IC7000_VFO_OPS, .scan_ops = IC7000_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 5, .chan_desc_sz = 0, /* TODO */ .chan_list = { { 1, 99, RIG_MTYPE_MEM, IC7000_MEM_CAP }, { 100, 105, RIG_MTYPE_EDGE, IC7000_MEM_CAP }, /* two by two */ { 106, 107, RIG_MTYPE_CALL, IC7000_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(199.999999),IC7000_ALL_RX_MODES,-1,-1,IC7000_VFOS}, {MHz(400),MHz(470), IC7000_ALL_RX_MODES,-1,-1,IC7000_VFOS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC7000_OTHER_TX_MODES, W(2),W(100),IC7000_VFOS,RIG_ANT_1), FRQ_RNG_6m(1,IC7000_OTHER_TX_MODES, W(2),W(100),IC7000_VFOS,RIG_ANT_1), FRQ_RNG_2m(1,IC7000_OTHER_TX_MODES, W(2),W(50),IC7000_VFOS,RIG_ANT_2), FRQ_RNG_70cm(1,IC7000_OTHER_TX_MODES, W(2), W(35), IC7000_VFOS, RIG_ANT_2), FRQ_RNG_HF(1,IC7000_AM_TX_MODES, W(1),W(40),IC7000_VFOS,RIG_ANT_1), /* AM class */ FRQ_RNG_6m(1,IC7000_AM_TX_MODES, W(1),W(40),IC7000_VFOS,RIG_ANT_1), /* AM class */ FRQ_RNG_2m(1,IC7000_AM_TX_MODES, W(2),W(20),IC7000_VFOS,RIG_ANT_2), FRQ_RNG_70cm(1,IC7000_OTHER_TX_MODES, W(2), W(14), IC7000_VFOS, RIG_ANT_2), RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(199.999999),IC7000_ALL_RX_MODES,-1,-1,IC7000_VFOS}, {MHz(400),MHz(470), IC7000_ALL_RX_MODES,-1,-1,IC7000_VFOS}, RIG_FRNG_END, }, .tx_range_list2 = { /* needs the 5 mhz channels added */ FRQ_RNG_HF(2,IC7000_OTHER_TX_MODES, W(2),W(100),IC7000_VFOS,RIG_ANT_1), FRQ_RNG_6m(2,IC7000_OTHER_TX_MODES, W(2),W(100),IC7000_VFOS,RIG_ANT_1), FRQ_RNG_2m(2,IC7000_OTHER_TX_MODES, W(2),W(50),IC7000_VFOS,RIG_ANT_2), FRQ_RNG_70cm(2,IC7000_OTHER_TX_MODES, W(2), W(35), IC7000_VFOS, RIG_ANT_2), FRQ_RNG_HF(2,IC7000_AM_TX_MODES, W(1),W(40),IC7000_VFOS,RIG_ANT_1), /* AM class */ FRQ_RNG_6m(2,IC7000_AM_TX_MODES, W(1),W(40),IC7000_VFOS,RIG_ANT_1), /* AM class */ FRQ_RNG_2m(2,IC7000_AM_TX_MODES, W(2),W(20),IC7000_VFOS,RIG_ANT_2), FRQ_RNG_70cm(2,IC7000_OTHER_TX_MODES, W(2), W(14), IC7000_VFOS, RIG_ANT_2), RIG_FRNG_END, }, .tuning_steps = { {IC7000_1HZ_TS_MODES,1}, {IC7000_NOT_TS_MODES,10}, {IC7000_ALL_RX_MODES,Hz(100)}, {IC7000_ALL_RX_MODES,kHz(1)}, {IC7000_ALL_RX_MODES,kHz(5)}, {IC7000_ALL_RX_MODES,kHz(9)}, {IC7000_ALL_RX_MODES,kHz(10)}, {IC7000_ALL_RX_MODES,kHz(12.5)}, {IC7000_ALL_RX_MODES,kHz(20)}, {IC7000_ALL_RX_MODES,kHz(25)}, {IC7000_ALL_RX_MODES,kHz(100)}, {IC7000_NOT_TS_MODES,MHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! But duplication may speed up search. Put the most commonly used modes first! Remember these are defaults, with dsp rigs you can change them to anything you want except FM and WFM which are fixed */ .filters = { {RIG_MODE_SSB, kHz(2.4)}, {RIG_MODE_SSB, kHz(1.8)}, {RIG_MODE_SSB, kHz(3)}, {RIG_MODE_FM, kHz(10)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_FM, kHz(7)}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(500)}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(250)}, {RIG_MODE_CW|RIG_MODE_CWR, kHz(1.2)}, {RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(2.4)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_AM, kHz(3)}, {RIG_MODE_AM, kHz(9)}, {RIG_MODE_WFM, kHz(280)}, RIG_FLT_END, }, .str_cal = IC7000_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&IC7000_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = NULL, /*automatically set by rig depending band */ .get_ant = NULL, .set_rit = icom_set_rit, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_parm = NULL, .get_parm = NULL, .set_mem = icom_set_mem, .set_bank = icom_set_bank, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ptt = icom_set_ptt, .get_ptt = icom_get_ptt, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .get_ts = NULL, .set_rptr_shift = icom_set_rptr_shift, .get_rptr_shift = NULL, .set_rptr_offs = icom_set_rptr_offs, .get_rptr_offs = icom_get_rptr_offs, .set_ctcss_tone = icom_set_ctcss_tone, .get_ctcss_tone = icom_get_ctcss_tone, .set_ctcss_sql = icom_set_ctcss_sql, .get_ctcss_sql = icom_get_ctcss_sql, .set_dcs_code = icom_set_dcs_code, .get_dcs_code = icom_get_dcs_code, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, .get_split_vfo = NULL, }; hamlib-1.2.15.3/icom/ic738.c0000644000175000017500000001171112044564477012064 00000000000000/* * Hamlib CI-V backend - description of IC-738 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "icom.h" /* * IC-738, like the IC-736 but without 6m */ #define IC738_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) /* * 100W in all modes but AM (40W) */ #define IC738_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define IC738_AM_TX_MODES (RIG_MODE_AM) #define IC738_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC738_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_CPY) #define IC738_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_PROG|RIG_SCAN_VFO) #define IC738_ANTS 0 /* TODO: declare both antenna connectors? */ #define IC738_STR_CAL { 0, { } } /* */ static const struct icom_priv_caps ic738_priv_caps = { 0x44, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic738_caps = { .rig_model = RIG_MODEL_IC738, .model_name = "IC-738", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 19200, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC738_VFO_OPS, .scan_ops = IC738_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 89, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, { 90, 99, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, /* FIXME: split */ { 100, 101, RIG_MTYPE_EDGE, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(500),MHz(30),IC738_ALL_RX_MODES,-1,-1,IC738_VFO_ALL,IC738_ANTS}, {MHz(50),MHz(54),IC738_ALL_RX_MODES,-1,-1,IC738_VFO_ALL,IC738_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC738_OTHER_TX_MODES, W(5),W(100),IC738_VFO_ALL,IC738_ANTS), FRQ_RNG_HF(1,IC738_AM_TX_MODES, W(4),W(40),IC738_VFO_ALL,IC738_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30),IC738_ALL_RX_MODES,-1,-1,IC738_VFO_ALL,IC738_ANTS}, {MHz(50),MHz(54),IC738_ALL_RX_MODES,-1,-1,IC738_VFO_ALL,IC738_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC738_OTHER_TX_MODES, W(5),W(100),IC738_VFO_ALL,IC738_ANTS), FRQ_RNG_HF(2,IC738_AM_TX_MODES, W(4),W(40),IC738_VFO_ALL,IC738_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { /* TBC */ {IC738_ALL_RX_MODES,10}, {IC738_ALL_RX_MODES,kHz(1)}, {IC738_ALL_RX_MODES,kHz(2)}, {IC738_ALL_RX_MODES,kHz(3)}, {IC738_ALL_RX_MODES,kHz(4)}, {IC738_ALL_RX_MODES,kHz(5)}, {IC738_ALL_RX_MODES,kHz(6)}, {IC738_ALL_RX_MODES,kHz(7)}, {IC738_ALL_RX_MODES,kHz(8)}, {IC738_ALL_RX_MODES,kHz(9)}, {IC738_ALL_RX_MODES,kHz(10)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.1)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic738_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ts = icom_set_ts, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, }; hamlib-1.2.15.3/icom/ic1275.c0000644000175000017500000000731312044564477012144 00000000000000/* * Hamlib CI-V backend - description of IC-1275 and variations * Copyright (c) 2000-2012 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "icom.h" #define IC1275_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define IC1275_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC1275_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO) static const struct icom_priv_caps ic1275_priv_caps = { 0x18, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic1275_caps = { .rig_model = RIG_MODEL_IC1275, .model_name = "IC-1275", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .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 = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC1275_VFO_OPS, .scan_ops = RIG_SCAN_NONE, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, { 100, 101, RIG_MTYPE_EDGE, IC_MIN_MEM_CAP }, { 102, 102, RIG_MTYPE_CALL, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {MHz(1240),MHz(1300),IC1275_MODES,-1,-1,IC1275_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { {MHz(1240),MHz(1300),IC1275_MODES,W(1),W(10),IC1275_VFO_ALL}, RIG_FRNG_END, }, .rx_range_list2 = { {MHz(1240),MHz(1300),IC1275_MODES,-1,-1,IC1275_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { {MHz(1240),MHz(1300),IC1275_MODES,W(1),W(10),IC1275_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {IC1275_MODES,10}, /* TBC: does this rig supports settin tuning step? */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.3)}, {RIG_MODE_CW, Hz(500)}, /* optional FL-83 CW narrow filter */ {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic1275_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/ic471.c0000644000175000017500000000737212044564477012066 00000000000000/* * Hamlib CI-V backend - description of IC-471 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "icom.h" #define IC471_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define IC471_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC471_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO) #define IC471_STR_CAL { 0, { } } /* * IC-471 A/E * IC-471 H is high power (75W) * specs: http://www.qsl.net/sm7vhs/radio/icom/ic471/specs.htm * * Please report testing / patches. Some capabilities may be missing too. --sf */ static const struct icom_priv_caps ic471_priv_caps = { 0x22, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic471_caps = { .rig_model = RIG_MODEL_IC471, .model_name = "IC-471", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .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 = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC471_VFO_OPS, .scan_ops = RIG_SCAN_NONE, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 38, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {MHz(430),MHz(450),IC471_MODES,-1,-1,IC471_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { {MHz(430),MHz(440),IC471_MODES,W(2.5),W(25),IC471_VFO_ALL}, RIG_FRNG_END, }, .rx_range_list2 = { {MHz(430),MHz(450),IC471_MODES,-1,-1,IC471_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { {MHz(430),MHz(450),IC471_MODES,W(2.5),W(25),IC471_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {IC471_MODES,10}, /* TBC: does this rig supports settin tuning step? */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.3)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic471_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/ic7800.c0000644000175000017500000002164112044564477012144 00000000000000/* * Hamlib CI-V backend - description of IC-7800 and variations * Copyright (c) 2009-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include #include "token.h" #include "idx_builtin.h" #include "icom.h" #include "icom_defs.h" #include "frame.h" #include "misc.h" #include "bandplan.h" /* * TODO: PSK and PSKR */ #define IC7800_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC7800_1HZ_TS_MODES IC7800_ALL_RX_MODES #define IC7800_OTHER_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC7800_AM_TX_MODES (RIG_MODE_AM) #define IC7800_FUNCS (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_NR|RIG_FUNC_MON|RIG_FUNC_MN|RIG_FUNC_ANF|RIG_FUNC_VSC|RIG_FUNC_LOCK) #define IC7800_LEVELS (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_COMP|RIG_LEVEL_BKINDL|RIG_LEVEL_BALANCE|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_APF|RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY|RIG_LEVEL_SWR|RIG_LEVEL_ALC) #define IC7800_VFOS (RIG_VFO_MAIN|RIG_VFO_SUB|RIG_VFO_MEM) #define IC7800_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT) #define IC7800_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL|RIG_OP_TUNE) #define IC7800_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO|RIG_SCAN_PROG|RIG_SCAN_DELTA|RIG_SCAN_PRIO) #define IC7800_ANTS (RIG_ANT_1|RIG_ANT_2|RIG_ANT_3|RIG_ANT_4) /* * FIXME: real measures! */ #define IC7800_STR_CAL { 3, \ { \ { 0, -54 }, /* S0 */ \ { 120, 0 }, /* S9 */ \ { 241, 60 } /* S9+60 */ \ } } static int ic7800_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int ic7800_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); /* * IC-7800 rig capabilities. * * TODO: complete command set (esp. the $1A bunch!) and testing.. */ static const struct icom_priv_caps ic7800_priv_caps = { 0x6a, /* default address */ 0, /* 731 mode */ ic756pro_ts_sc_list }; const struct rig_caps ic7800_caps = { .rig_model = RIG_MODEL_IC7800, .model_name = "IC-7800", .mfg_name = "Icom", .version = BACKEND_VER ".2", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC7800_FUNCS, .has_set_func = IC7800_FUNCS, .has_get_level = IC7800_LEVELS, .has_set_level = RIG_LEVEL_SET(IC7800_LEVELS), .has_get_parm = IC7800_PARMS, .has_set_parm = RIG_PARM_SET(IC7800_PARMS), /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, 20, RIG_DBLST_END, }, /* FIXME: TBC */ .attenuator = { 3, 6, 9, 12, 15, 18, 21, RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC7800_VFO_OPS, .scan_ops = IC7800_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM }, { 100, 101, RIG_MTYPE_EDGE }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(60),IC7800_ALL_RX_MODES,-1,-1,IC7800_VFOS,IC7800_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC7800_OTHER_TX_MODES, W(5),W(200),IC7800_VFOS,IC7800_ANTS), FRQ_RNG_6m(1,IC7800_OTHER_TX_MODES, W(5),W(200),IC7800_VFOS,IC7800_ANTS), FRQ_RNG_HF(1,IC7800_AM_TX_MODES, W(5),W(50),IC7800_VFOS,IC7800_ANTS), /* AM class */ FRQ_RNG_6m(1,IC7800_AM_TX_MODES, W(5),W(50),IC7800_VFOS,IC7800_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(60),IC7800_ALL_RX_MODES,-1,-1,IC7800_VFOS,IC7800_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC7800_OTHER_TX_MODES, W(5),W(200),IC7800_VFOS,IC7800_ANTS), FRQ_RNG_6m(2,IC7800_OTHER_TX_MODES, W(5),W(200),IC7800_VFOS,IC7800_ANTS), FRQ_RNG_HF(2,IC7800_AM_TX_MODES, W(5),W(50),IC7800_VFOS,IC7800_ANTS), /* AM class */ FRQ_RNG_6m(2,IC7800_AM_TX_MODES, W(5),W(50),IC7800_VFOS,IC7800_ANTS), /* AM class */ /* USA only, TBC: end of range and modes */ {MHz(5.33050),MHz(5.33350),IC7800_OTHER_TX_MODES,W(2),W(100),IC7800_VFOS,IC7800_ANTS}, /* USA only */ {MHz(5.34650),MHz(5.34950),IC7800_OTHER_TX_MODES,W(2),W(100),IC7800_VFOS,IC7800_ANTS}, /* USA only */ {MHz(5.36650),MHz(5.36950),IC7800_OTHER_TX_MODES,W(2),W(100),IC7800_VFOS,IC7800_ANTS}, /* USA only */ {MHz(5.37150),MHz(5.37450),IC7800_OTHER_TX_MODES,W(2),W(100),IC7800_VFOS,IC7800_ANTS}, /* USA only */ {MHz(5.40350),MHz(5.40650),IC7800_OTHER_TX_MODES,W(2),W(100),IC7800_VFOS,IC7800_ANTS}, /* USA only */ RIG_FRNG_END, }, .tuning_steps = { {IC7800_1HZ_TS_MODES,1}, {IC7800_ALL_RX_MODES,Hz(100)}, {IC7800_ALL_RX_MODES,kHz(1)}, {IC7800_ALL_RX_MODES,kHz(5)}, {IC7800_ALL_RX_MODES,kHz(9)}, {IC7800_ALL_RX_MODES,kHz(10)}, {IC7800_ALL_RX_MODES,kHz(12.5)}, {IC7800_ALL_RX_MODES,kHz(20)}, {IC7800_ALL_RX_MODES,kHz(25)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(2.4)}, {RIG_MODE_CW|RIG_MODE_CWR, Hz(500)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_FM, kHz(8)}, RIG_FLT_END, }, .str_cal = IC7800_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic7800_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .set_rit = icom_set_rit, .decode_event = icom_decode_event, .set_level = ic7800_set_level, .get_level = ic7800_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_parm = icom_set_parm, .get_parm = icom_get_parm, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ptt = icom_set_ptt, .get_ptt = icom_get_ptt, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .get_ts = icom_get_ts, .set_rptr_shift = icom_set_rptr_shift, .get_rptr_shift = icom_get_rptr_shift, .set_rptr_offs = icom_set_rptr_offs, .get_rptr_offs = icom_get_rptr_offs, .set_ctcss_tone = icom_set_ctcss_tone, .get_ctcss_tone = icom_get_ctcss_tone, .set_ctcss_sql = icom_set_ctcss_sql, .get_ctcss_sql = icom_get_ctcss_sql, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, .get_split_vfo = icom_mem_get_split_vfo, }; /* * IC-7800 has 0x11 command using index instead of backend's real dB value * * c.f. http://www.plicht.de/ekki/civ/civ-p42.html */ int ic7800_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { int i; if (level == RIG_LEVEL_ATT && val.i != 0) { /* Convert dB to index */ for (i=0; i < 7; i++) { if (val.i == rig->state.attenuator[i]) { val.i = i+1; break; } } /* TODO: Should fail when not found? */ } return icom_set_level(rig, vfo, level, val); } /* * IC-7800 has 0x11 command using index instead of backend's real dB value */ int ic7800_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int ret; ret = icom_get_level(rig, vfo, level, val); if (ret != RIG_OK) return ret; /* Convert index to dB * Rem: ATT index 0 means attenuator Off */ if (level == RIG_LEVEL_ATT && val->i > 0 && val->i <= 7) val->i = rig->state.attenuator[val->i - 1]; return RIG_OK; } hamlib-1.2.15.3/icom/icr75.c0000644000175000017500000002504112044564477012161 00000000000000/* * Hamlib CI-V backend - description of IC-R75 * Copyright (c) 2000-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "hamlib/rig.h" #include "misc.h" #include "idx_builtin.h" #include "icom.h" #include "icom_defs.h" #include "frame.h" /* * IC-R75 * * TODO: * $1A command: * - set_parm, set_trn, IF filter setting, etc. */ #define ICR75_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_AMS) #define ICR75_FUNC_ALL (RIG_FUNC_NB|RIG_FUNC_ANF|RIG_FUNC_NR) #define ICR75_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_PREAMP|RIG_LEVEL_AGC|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH) #define ICR75_PARM_ALL (RIG_PARM_ANN|RIG_PARM_APO|RIG_PARM_BACKLIGHT|RIG_PARM_BEEP|RIG_PARM_TIME) #define ICR75_VFO_ALL (RIG_VFO_VFO|RIG_VFO_MEM) #define ICR75_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL) #define ICR75_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO) #define ICR75_ANTS (RIG_ANT_1|RIG_ANT_2) #define ICR75_STR_CAL { 17, { \ { 0, -60 }, \ { 37, -54 }, \ { 52, -48 }, \ { 61, -42 }, \ { 72, -36 }, \ { 86, -30 }, \ { 95, -24 }, \ { 109, -18 }, \ { 124, -12 }, \ { 128, -6 }, \ { 146, 0 }, \ { 166, 10 }, \ { 186, 20 }, \ { 199, 30 }, \ { 225, 40 }, \ { 233, 50 }, \ { 255, 60 }, \ } } /* * channel caps. */ #define ICR75_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .ant = 1, \ .levels = RIG_LEVEL_ATT|RIG_LEVEL_PREAMP, \ .channel_desc = 1, \ .flags = 1, \ } static int icr75_set_channel(RIG *rig, const channel_t *chan); static int icr75_get_channel(RIG *rig, channel_t *chan); static const struct icom_priv_caps icr75_priv_caps = { 0x5a, /* default address */ 0, /* 731 mode */ r75_ts_sc_list }; const struct rig_caps icr75_caps = { .rig_model = RIG_MODEL_ICR75, .model_name = "IC-R75", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = ICR75_FUNC_ALL, .has_set_func = ICR75_FUNC_ALL, .has_get_level = ICR75_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(ICR75_LEVEL_ALL), .has_get_parm = ICR75_PARM_ALL, .has_set_parm = RIG_PARM_SET(ICR75_PARM_ALL), .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, [LVL_PBT_IN] = { .min = { .f = -1280 }, .max = { .f = +1280 }, .step = { .f = 15 } }, [LVL_PBT_OUT] = { .min = { .f = -1280 }, .max = { .f = +1280 }, .step = { .f = 15 } }, [LVL_CWPITCH] = { .min = { .i = 300 }, .max = { .i = 900 }, .step = { .i = 10 } }, [LVL_NR] = { .min = { .f = 0.0 }, .max = { .f = 1.0 }, .step = { .f = 0.066666667 } }, }, .parm_gran = { [PARM_APO] = { .min = { .i = 1 }, .max = { .i = 1439} }, [PARM_TIME] = { .min = { .i = 0 }, .max = { .i = 86399} }, }, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { 10, 20, RIG_DBLST_END, }, /* TBC */ .attenuator = { 20, RIG_DBLST_END, }, /* TBC */ .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = ICR75_VFO_OPS, .scan_ops = ICR75_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 8, .chan_list = { { 1, 99, RIG_MTYPE_MEM, ICR75_MEM_CAP }, { 100, 101, RIG_MTYPE_EDGE, ICR75_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(60),ICR75_MODES,-1,-1,ICR75_VFO_ALL,ICR75_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(60),ICR75_MODES,-1,-1,ICR75_VFO_ALL,ICR75_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {ICR75_MODES,Hz(10)}, {ICR75_MODES,Hz(100)}, {ICR75_MODES,kHz(1)}, {ICR75_MODES,kHz(5)}, {ICR75_MODES,kHz(6.25)}, {ICR75_MODES,kHz(9)}, {ICR75_MODES,kHz(10)}, {ICR75_MODES,kHz(12.5)}, {ICR75_MODES,kHz(20)}, {ICR75_MODES,kHz(25)}, {ICR75_MODES,kHz(100)}, {ICR75_MODES,MHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(2.4)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(1.9)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(6)}, {RIG_MODE_AM|RIG_MODE_AMS, kHz(6)}, {RIG_MODE_AM|RIG_MODE_AMS, kHz(2.4)}, {RIG_MODE_AM|RIG_MODE_AMS, kHz(15)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_FM, kHz(6)}, RIG_FLT_END, }, .str_cal = ICR75_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&icr75_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .decode_event = icom_decode_event, .set_func = icom_set_func, .get_func = icom_get_func, .set_level = icom_set_level, .get_level = icom_get_level, .set_parm = icom_set_parm, .get_parm = icom_get_parm, .get_dcd = icom_get_dcd, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ts = icom_set_ts, .set_powerstat = icom_set_powerstat, .get_powerstat = icom_get_powerstat, .set_channel = icr75_set_channel, .get_channel = icr75_get_channel, }; /* * icr75_set_channel * Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL * TODO: still a WIP --SF */ int icr75_set_channel(RIG *rig, const channel_t *chan) { struct icom_priv_data *priv; struct rig_state *rs; unsigned char chanbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int chan_len, freq_len, ack_len, retval; unsigned char icmode; signed char icmode_ext; int err; rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; to_bcd_be(chanbuf,chan->channel_num,4); chanbuf[2] = S_MEM_CNTNT_SLCT; freq_len = priv->civ_731_mode ? 4:5; /* * to_bcd requires nibble len */ to_bcd(chanbuf+3, chan->freq, freq_len*2); chan_len = 2+freq_len+1; err = rig2icom_mode(rig, chan->mode, chan->width, &icmode, &icmode_ext); if (err != RIG_OK) return err; chanbuf[chan_len++] = icmode; chanbuf[chan_len++] = icmode_ext; to_bcd_be(chanbuf+chan_len++, chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i, 2); to_bcd_be(chanbuf+chan_len++, chan->levels[rig_setting2idx(RIG_LEVEL_PREAMP)].i, 2); to_bcd_be(chanbuf+chan_len++,chan->ant,2); memset(chanbuf+chan_len, 0, 8); strncpy((char *) (chanbuf+chan_len), chan->channel_desc, 8); chan_len += 8; retval = icom_transaction (rig, C_CTL_MEM, S_MEM_CNTNT, chanbuf, chan_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_channel: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icr75_get_channel * Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL * TODO: still a WIP --SF */ int icr75_get_channel(RIG *rig, channel_t *chan) { struct icom_priv_data *priv; struct rig_state *rs; unsigned char chanbuf[24]; int chan_len, freq_len, retval; rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; to_bcd_be(chanbuf,chan->channel_num,4); chan_len = 2; freq_len = priv->civ_731_mode ? 4:5; retval = icom_transaction (rig, C_CTL_MEM, S_MEM_CNTNT, chanbuf, chan_len, chanbuf, &chan_len); if (retval != RIG_OK) return retval; chan->vfo = RIG_VFO_MEM; chan->ant = RIG_ANT_NONE; chan->freq = 0; chan->mode = RIG_MODE_NONE; chan->width = RIG_PASSBAND_NORMAL; chan->tx_freq = 0; chan->tx_mode = RIG_MODE_NONE; chan->tx_width = RIG_PASSBAND_NORMAL; chan->split = RIG_SPLIT_OFF; chan->tx_vfo = RIG_VFO_NONE; chan->rptr_shift = RIG_RPT_SHIFT_NONE; chan->rptr_offs = 0; chan->tuning_step = 0; chan->rit = 0; chan->xit = 0; chan->funcs = 0; chan->levels[rig_setting2idx(RIG_LEVEL_PREAMP)].i = 0; chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i = 0; chan->levels[rig_setting2idx(RIG_LEVEL_AF)].f = 0; chan->levels[rig_setting2idx(RIG_LEVEL_RF)].f = 0; chan->levels[rig_setting2idx(RIG_LEVEL_SQL)].f = 0; chan->levels[rig_setting2idx(RIG_LEVEL_NR)].f = 0; chan->levels[rig_setting2idx(RIG_LEVEL_PBT_IN)].f = 0; chan->levels[rig_setting2idx(RIG_LEVEL_PBT_OUT)].f = 0; chan->levels[rig_setting2idx(RIG_LEVEL_CWPITCH)].i = 0; chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i = RIG_AGC_OFF; chan->ctcss_tone = 0; chan->ctcss_sql = 0; chan->dcs_code = 0; chan->dcs_sql = 0; chan->scan_group = 0; chan->flags = RIG_CHFLAG_SKIP; strcpy(chan->channel_desc, " "); /* * freqbuf should contain Cn,Data area */ if ((chan_len != freq_len+18) && (chan_len != 5)) { rig_debug(RIG_DEBUG_ERR,"icr75_get_channel: wrong frame len=%d\n", chan_len); return -RIG_ERJCTED; } /* do this only if not a blank channel */ if (chan_len != 5) { /* * from_bcd requires nibble len */ chan->flags = RIG_CHFLAG_NONE; chan->freq = from_bcd(chanbuf+5, freq_len*2); chan_len = 4+freq_len+1; icom2rig_mode(rig, chanbuf[chan_len], chanbuf[chan_len+1], &chan->mode, &chan->width); chan_len += 2; if (from_bcd_be(chanbuf+chan_len++,2) != 0) chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i = 20; if (from_bcd_be(chanbuf+chan_len++,2) != 0) chan->levels[rig_setting2idx(RIG_LEVEL_PREAMP)].i = 20; chan->ant = from_bcd_be(chanbuf+chan_len++,2); strncpy(chan->channel_desc, (char *) (chanbuf+chan_len), 8); } return RIG_OK; } hamlib-1.2.15.3/icom/ic765.c0000644000175000017500000001317612044564477012073 00000000000000/* * Hamlib CI-V backend - description of IC-765 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "bandplan.h" #include "icom.h" #define IC765_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) /* * IC-765 * specs: http://www.qsl.net/sm7vhs/radio/icom/ic765/specs.htm * */ #define IC765_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define IC765_AM_TX_MODES (RIG_MODE_AM) #define IC765_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC765_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_CPY|RIG_OP_MCL) #define IC765_SCAN_OPS (RIG_SCAN_PROG|RIG_SCAN_MEM) #define IC765_ANTS RIG_ANT_1 /* */ static const struct icom_priv_caps ic765_priv_caps = { 0x2c, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic765_caps = { .rig_model = RIG_MODEL_IC765, .model_name = "IC-765", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .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 = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC765_VFO_OPS, .scan_ops = IC765_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, { 100, 101, RIG_MTYPE_EDGE, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100),MHz(30),IC765_ALL_RX_MODES,-1,-1,IC765_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC765_OTHER_TX_MODES, W(10),W(100),IC765_VFO_ALL,IC765_ANTS), FRQ_RNG_HF(1,IC765_AM_TX_MODES, W(10),W(40),IC765_VFO_ALL,IC765_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(30),IC765_ALL_RX_MODES,-1,-1,IC765_VFO_ALL}, RIG_FRNG_END, }, /* weird transmit ranges ... --sf */ .tx_range_list2 = { {kHz(1800),1999999,IC765_OTHER_TX_MODES,5000,100000,IC765_VFO_ALL}, /* 100W class */ {kHz(1800),1999999,IC765_AM_TX_MODES,2000,40000,IC765_VFO_ALL}, /* 40W class */ {kHz(3400),4099999,IC765_OTHER_TX_MODES,5000,100000,IC765_VFO_ALL}, {kHz(3400),4099999,IC765_AM_TX_MODES,2000,40000,IC765_VFO_ALL}, {MHz(6.9),kHz(7499.99),IC765_OTHER_TX_MODES,5000,100000,IC765_VFO_ALL}, {MHz(6.9),kHz(7499.99),IC765_AM_TX_MODES,2000,40000,IC765_VFO_ALL}, {MHz(9.9),MHz(1049999),IC765_OTHER_TX_MODES,5000,100000,IC765_VFO_ALL}, {MHz(9.9),MHz(1049999),IC765_AM_TX_MODES,2000,40000,IC765_VFO_ALL}, {MHz(13.9),kHz(14.49999),IC765_OTHER_TX_MODES,5000,100000,IC765_VFO_ALL}, {MHz(13.9),kHz(14.49999),IC765_AM_TX_MODES,2000,40000,IC765_VFO_ALL}, {kHz(17900),kHz(18499.99),IC765_OTHER_TX_MODES,5000,100000,IC765_VFO_ALL}, {kHz(17900),kHz(18499.99),IC765_AM_TX_MODES,2000,40000,IC765_VFO_ALL}, {MHz(20.9),kHz(21499.99),IC765_OTHER_TX_MODES,5000,100000,IC765_VFO_ALL}, {MHz(20.9),kHz(21499.99),IC765_AM_TX_MODES,2000,40000,IC765_VFO_ALL}, {kHz(24400),kHz(25099.99),IC765_OTHER_TX_MODES,5000,100000,IC765_VFO_ALL}, {kHz(24400),kHz(25099.99),IC765_AM_TX_MODES,2000,40000,IC765_VFO_ALL}, {MHz(28),MHz(30),IC765_OTHER_TX_MODES,5000,100000,IC765_VFO_ALL}, {MHz(28),MHz(30),IC765_AM_TX_MODES,2000,40000,IC765_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {IC765_ALL_RX_MODES,10}, /* basic resolution, there's no set_ts */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.2)}, {RIG_MODE_CW|RIG_MODE_RTTY, Hz(500)}, /* narrow */ {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic765_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_split_vfo = icom_set_split_vfo, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .scan = icom_scan, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/icr7000.c0000644000175000017500000001720112044564477012313 00000000000000/* * Hamlib CI-V backend - IC-R7000 and IC-R7100 descriptions * Copyright (c) 2000-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "serial.h" #include "misc.h" #include "idx_builtin.h" #include "icom.h" #include "icom_defs.h" #include "frame.h" #define ICR7000_MODES (RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_WFM) #define ICR7000_OPS (RIG_OP_FROM_VFO|RIG_OP_MCL) static int r7000_set_freq(RIG *rig, vfo_t vfo, freq_t freq); #define ICR7100_FUNCS (RIG_FUNC_VSC) #define ICR7100_LEVELS (RIG_LEVEL_ATT|RIG_LEVEL_AF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR) #define ICR7100_PARMS (RIG_PARM_ANN) #define ICR7100_SCAN_OPS (RIG_SCAN_MEM) /* TBC */ /* FIXME: S-Meter measurements */ #define ICR7100_STR_CAL UNKNOWN_IC_STR_CAL static const struct icom_priv_caps icr7000_priv_caps = { 0x08, /* default address */ 0, /* 731 mode */ r7100_ts_sc_list }; /* * ICR7000 rigs capabilities. */ const struct rig_caps icr7000_caps = { .rig_model = RIG_MODEL_ICR7000, .model_name = "IC-R7000", .mfg_name = "Icom", .version = BACKEND_VER ".0", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = ICR7000_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM }, RIG_CHAN_END, }, .rx_range_list1 = { {MHz(25),MHz(1000),ICR7000_MODES,-1,-1, RIG_VFO_A}, {MHz(1025),MHz(2000),ICR7000_MODES,-1,-1, RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {MHz(25),MHz(1000),ICR7000_MODES,-1,-1, RIG_VFO_A}, {MHz(1025),MHz(2000),ICR7000_MODES,-1,-1, RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, /* no TX ranges, this is a receiver */ .tuning_steps = { {ICR7000_MODES,100}, /* resolution */ #if 0 {ICR7000_MODES,kHz(1)}, {ICR7000_MODES,kHz(5)}, {ICR7000_MODES,kHz(10)}, {ICR7000_MODES,12500}, {ICR7000_MODES,kHz(25)}, #endif RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB, kHz(2.8)}, {RIG_MODE_FM|RIG_MODE_AM, kHz(15)}, {RIG_MODE_FM|RIG_MODE_AM, kHz(6)}, /* narrow */ {RIG_MODE_WFM, kHz(150)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&icr7000_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = r7000_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; static const struct icom_priv_caps icr7100_priv_caps = { 0x34, /* default address */ 0, /* 731 mode */ r7100_ts_sc_list }; /* * ICR7100A rig capabilities. */ const struct rig_caps icr7100_caps = { .rig_model = RIG_MODEL_ICR7100, .model_name = "IC-R7100", .mfg_name = "Icom", .version = BACKEND_VER ".0", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .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 = ICR7100_FUNCS, .has_set_func = ICR7100_FUNCS, .has_get_level = ICR7100_LEVELS, .has_set_level = RIG_LEVEL_SET(ICR7100_LEVELS), .has_get_parm = ICR7100_PARMS, .has_set_parm = RIG_PARM_SET(ICR7100_PARMS), .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END }, .attenuator = { 20, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = ICR7000_OPS, .scan_ops = ICR7100_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM }, /* TBC */ { 0x0900, 0x0909, RIG_MTYPE_EDGE }, /* 2 by 2 */ { 0x0910, 0x0919, RIG_MTYPE_EDGE }, /* 2 by 2 */ RIG_CHAN_END, }, .rx_range_list1 = { {MHz(25),MHz(1999.9999),ICR7000_MODES,-1,-1, RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {MHz(25),MHz(1999.9999),ICR7000_MODES,-1,-1, RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, /* no TX ranges, this is a receiver */ .tuning_steps = { {ICR7000_MODES,100}, /* resolution */ {ICR7000_MODES,kHz(1)}, {ICR7000_MODES,kHz(5)}, {ICR7000_MODES,kHz(10)}, {ICR7000_MODES,12500}, {ICR7000_MODES,kHz(20)}, {ICR7000_MODES,kHz(25)}, {ICR7000_MODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB, kHz(2.4)}, {RIG_MODE_FM|RIG_MODE_AM, kHz(15)}, {RIG_MODE_FM|RIG_MODE_AM, kHz(6)}, /* narrow */ {RIG_MODE_WFM, kHz(150)}, RIG_FLT_END, }, .str_cal = ICR7100_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&icr7100_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = r7000_set_freq, /* TBC for R7100 */ .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ts = icom_set_ts, .get_ts = icom_get_ts, .set_func = icom_set_func, .get_func = icom_get_func, .set_level = icom_set_level, .get_level = icom_get_level, #if 0 .set_parm = icom_set_parm, .get_parm = icom_get_parm, #endif .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .get_dcd = icom_get_dcd, }; /* * Function definitions below */ /* * r7000_set_freq */ static int r7000_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { long long f = (long long)freq; /* * The R7000 cannot set freqencies higher than 1GHz, * this is done by flipping a switch on the front panel and * stripping the most significant digit. * This is the only change with the common icom_set_freq */ f %= (long long)GHz(1); return icom_set_freq(rig, vfo, (freq_t)f); } hamlib-1.2.15.3/icom/ic751.c0000644000175000017500000001724612044564477012070 00000000000000/* * Hamlib CI-V backend - description of IC-751 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "bandplan.h" #include "icom.h" #include "idx_builtin.h" /* * FM is an option on the Icom IC-751, and built-in in the Icom IC-751A */ #define IC751_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FM) /* * 200W in all modes but AM (40W) */ #define IC751_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FM) #define IC751_AM_TX_MODES (RIG_MODE_AM) #define IC751_VFO_ALL (RIG_VFO_A|RIG_VFO_MEM) #define IC751_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO) #define IC751_SCAN_OPS (RIG_SCAN_NONE) #define IC751_ANTS RIG_ANT_1 /* * S-Meter measurements * (Only the Piexx UX-14px rev.2 and up has an S-meter option.) * Values based on the readings of my IC-751A S-meter, i.e. not * actual signal strength. -- Lars, sm6rpz */ #define IC751_STR_CAL { 16, { \ { 3, -52 }, /* S0.5 */ \ { 12, -48 }, /* S1 */ \ { 33, -42 }, /* S2 */ \ { 45, -36 }, /* S3 */ \ { 60, -30 }, /* S4 */ \ { 73, -24 }, /* S5 */ \ { 86, -18 }, /* S6 */ \ { 100, -12 }, /* S7 */ \ { 115, -6 }, /* S8 */ \ { 129, 0 }, /* S9 */ \ { 160, 10 }, /* S9+10 */ \ { 186, 20 }, /* S9+20 */ \ { 208, 30 }, /* S9+30 */ \ { 226, 40 }, /* S9+40 */ \ { 241, 50 }, /* S9+50 */ \ { 255, 60 } /* S9+60 */ \ } } /* */ static const struct icom_priv_caps ic751_priv_caps = { 0x1c, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic751_caps = { .rig_model = RIG_MODEL_IC751, .model_name = "IC-751", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, /* Piexx UX-14px has a PTT option */ .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 9600, /* Piexx UX-14px can use 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 = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, /* Piexx UX-14px has an S-meter option */ .has_get_level = (RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH), .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .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, .vfo_ops = IC751_VFO_OPS, .scan_ops = IC751_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 32, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100),MHz(30),IC751_ALL_RX_MODES,-1,-1,IC751_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { {MHz(1.8),MHz(1.99999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, /* 100W class */ {MHz(1.8),MHz(1.99999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, /* 40W class */ {MHz(3.45),MHz(4.09999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(3.45),MHz(4.09999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, {MHz(6.95),MHz(7.49999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(6.95),MHz(7.49999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, {MHz(9.95),MHz(10.49999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(9.95),MHz(10.49999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, {MHz(13.95),MHz(14.49999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(13.95),MHz(14.49999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, {MHz(17.95),MHz(18.49999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(17.95),MHz(18.49999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, {MHz(20.95),MHz(21.49999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(20.95),MHz(21.49999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, {MHz(24.45),MHz(25.09999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(24.45),MHz(25.09999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, {MHz(27.95),MHz(30),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(27.95),MHz(30),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(30),IC751_ALL_RX_MODES,-1,-1,IC751_VFO_ALL}, RIG_FRNG_END, }, /* weird transmit ranges ... --sf */ .tx_range_list2 = { {MHz(1.8),MHz(1.99999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, /* 100W class */ {MHz(1.8),MHz(1.99999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, /* 40W class */ {MHz(3.45),MHz(4.09999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(3.45),MHz(4.09999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, {MHz(6.95),MHz(7.49999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(6.95),MHz(7.49999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, {MHz(9.95),MHz(10.49999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(9.95),MHz(10.49999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, {MHz(13.95),MHz(14.49999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(13.95),MHz(14.49999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, {MHz(17.95),MHz(18.49999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(17.95),MHz(18.49999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, {MHz(20.95),MHz(21.49999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(20.95),MHz(21.49999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, {MHz(24.45),MHz(25.09999),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(24.45),MHz(25.09999),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, {MHz(27.95),MHz(30),IC751_OTHER_TX_MODES,W(10),W(200),IC751_VFO_ALL}, {MHz(27.95),MHz(30),IC751_AM_TX_MODES,W(10),W(40),IC751_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {IC751_ALL_RX_MODES,10}, /* basic resolution, there's no set_ts */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB, kHz(2.3)}, {RIG_MODE_RTTY|RIG_MODE_CW, Hz(500)}, {RIG_MODE_RTTY|RIG_MODE_CW, Hz(250)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .str_cal = IC751_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic751_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .get_level = icom_get_level, .set_ptt = icom_set_ptt,/* Piexx UX-14px has no get_ptt only set_ptt */ }; hamlib-1.2.15.3/icom/icr10.c0000644000175000017500000000757512044564477012162 00000000000000/* * Hamlib CI-V backend - description of IC-R10 * Copyright (c) 2000-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "icom.h" #include "idx_builtin.h" #define ICR10_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_WFM) #define ICR10_FUNC_ALL (RIG_FUNC_NONE) #define ICR10_LEVEL_ALL (RIG_LEVEL_RAWSTR) #define ICR10_VFO_ALL (RIG_VFO_A) #define ICR10_VFO_OPS (RIG_OP_NONE) #define ICR10_SCAN_OPS (RIG_SCAN_NONE) /* * FIXME: S-meter measurement */ #define ICR10_STR_CAL UNKNOWN_IC_STR_CAL static const struct icom_priv_caps icr10_priv_caps = { 0x52, /* default address */ 0, /* 731 mode */ r8500_ts_sc_list /* wrong, but don't have set_ts anyway */ }; const struct rig_caps icr10_caps = { .rig_model = RIG_MODEL_ICR10, .model_name = "IC-R10", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER|RIG_FLAG_HANDHELD, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = ICR10_FUNC_ALL, .has_set_func = ICR10_FUNC_ALL, .has_get_level = ICR10_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(ICR10_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .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, .vfo_ops = ICR10_VFO_OPS, .scan_ops = ICR10_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, .rx_range_list1 = { {kHz(500),GHz(1.3),ICR10_MODES,-1,-1,ICR10_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(823.9999),ICR10_MODES,-1,-1,ICR10_VFO_ALL}, {MHz(849),MHz(868.9999),ICR10_MODES,-1,-1,ICR10_VFO_ALL}, {MHz(894),GHz(1.3),ICR10_MODES,-1,-1,ICR10_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {ICR10_MODES,Hz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(4)}, {RIG_MODE_AM|RIG_MODE_FM, kHz(15)}, {RIG_MODE_WFM, kHz(150)}, RIG_FLT_END, }, .str_cal = ICR10_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&icr10_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, /* TODO: do not pass bandwidth data */ .get_mode = icom_get_mode, /* .set_vfo = icom_set_vfo, */ .decode_event = icom_decode_event, .get_level = icom_get_level, .get_dcd = icom_get_dcd, }; hamlib-1.2.15.3/icom/ic726.c0000644000175000017500000001133412044564477012062 00000000000000/* * Hamlib CI-V backend - description of IC-726 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "bandplan.h" #include "icom.h" #define IC726_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) /* * IC-726 * specs: http://www.qsl.net/sm7vhs/radio/icom/ic726/specs.htm * */ #define IC726_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define IC726_AM_TX_MODES (RIG_MODE_AM) #define IC726_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC726_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_CPY|RIG_OP_MCL) #define IC726_SCAN_OPS (RIG_SCAN_VFO|RIG_SCAN_MEM) /* TBC */ #define IC726_ANTS RIG_ANT_1 /* */ static const struct icom_priv_caps ic726_priv_caps = { 0x30, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic726_caps = { .rig_model = RIG_MODEL_IC726, .model_name = "IC-726", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC726_VFO_OPS, .scan_ops = IC726_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 26, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(500),MHz(30),IC726_ALL_RX_MODES,-1,-1,IC726_VFO_ALL}, {MHz(50),MHz(54),IC726_ALL_RX_MODES,-1,-1,IC726_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC726_OTHER_TX_MODES, W(10),W(100),IC726_VFO_ALL,IC726_ANTS), FRQ_RNG_HF(1,IC726_AM_TX_MODES, W(10),W(40),IC726_VFO_ALL,IC726_ANTS), /* AM class */ FRQ_RNG_6m(1,IC726_OTHER_TX_MODES, W(1),W(10),IC726_VFO_ALL,IC726_ANTS), FRQ_RNG_6m(1,IC726_AM_TX_MODES, W(1),W(4),IC726_VFO_ALL,IC726_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30),IC726_ALL_RX_MODES,-1,-1,IC726_VFO_ALL}, {MHz(50),MHz(54),IC726_ALL_RX_MODES,-1,-1,IC726_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC726_OTHER_TX_MODES, W(10),W(100),IC726_VFO_ALL,IC726_ANTS), FRQ_RNG_HF(2,IC726_AM_TX_MODES, W(10),W(40),IC726_VFO_ALL,IC726_ANTS), /* AM class */ FRQ_RNG_6m(2,IC726_OTHER_TX_MODES, W(1),W(10),IC726_VFO_ALL,IC726_ANTS), FRQ_RNG_6m(2,IC726_AM_TX_MODES, W(1),W(4),IC726_VFO_ALL,IC726_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {IC726_ALL_RX_MODES,10}, /* basic resolution, there's no set_ts */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.3)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic726_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_split_vfo = icom_set_split_vfo, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .scan = icom_scan, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/ic707.c0000644000175000017500000001057712044564477012071 00000000000000/* * Hamlib CI-V backend - description of IC-707 * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "bandplan.h" #include "icom.h" #define IC707_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) /* * IC-707 * specs: http://www.qsl.net/sm7vhs/radio/icom/ic707/specs.htm * */ #define IC707_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define IC707_AM_TX_MODES (RIG_MODE_AM) #define IC707_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC707_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_CPY|RIG_OP_MCL) #define IC707_SCAN_OPS (RIG_SCAN_VFO|RIG_SCAN_MEM) /* TBC */ #define IC707_ANTS RIG_ANT_1 /* */ static const struct icom_priv_caps ic707_priv_caps = { 0x3e, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic707_caps = { .rig_model = RIG_MODEL_IC707, .model_name = "IC-707", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 9600, .serial_data_bits = 8, .serial_stop_bits = 2, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC707_VFO_OPS, .scan_ops = IC707_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 26, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, { 27, 30, RIG_MTYPE_EDGE, IC_MIN_MEM_CAP }, { 31, 35, RIG_MTYPE_SAT, IC_MIN_MEM_CAP }, /* split ? */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(500),MHz(30),IC707_ALL_RX_MODES,-1,-1,IC707_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC707_OTHER_TX_MODES, W(5),W(100),IC707_VFO_ALL,IC707_ANTS), FRQ_RNG_HF(1,IC707_AM_TX_MODES, W(5),W(25),IC707_VFO_ALL,IC707_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30),IC707_ALL_RX_MODES,-1,-1,IC707_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC707_OTHER_TX_MODES, W(5),W(100),IC707_VFO_ALL,IC707_ANTS), FRQ_RNG_HF(2,IC707_AM_TX_MODES, W(5),W(25),IC707_VFO_ALL,IC707_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {IC707_ALL_RX_MODES,10}, /* basic resolution, there's no set_ts */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.1)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic707_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_split_vfo = icom_set_split_vfo, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .scan = icom_scan, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/ic706.c0000644000175000017500000004674112044564477012072 00000000000000/* * Hamlib CI-V backend - description of IC-706 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "icom.h" #include "icom_defs.h" #include "frame.h" #include "idx_builtin.h" #include "bandplan.h" /* * This function does the special bandwidth coding for IC-706, IC-706MKII * and IC-706MKIIG * (0 - wide, 1 - normal, 2 - narrow) */ static int ic706_r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd) { int err; err = rig2icom_mode(rig, mode, width, md, pd); if (err != RIG_OK) return err; if (*pd == -1) *pd = PD_MEDIUM_2; else (*pd)--; return RIG_OK; } #define IC706_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FM|RIG_MODE_WFM) #define IC706_1MHZ_TS_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define IC706_1HZ_TS_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY) /* tx doesn't have WFM. * 100W in all modes but AM (40W) */ #define IC706_OTHER_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB|RIG_MODE_RTTY|RIG_MODE_FM) #define IC706_AM_TX_MODES (RIG_MODE_AM) #define IC706IIG_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN) #define IC706IIG_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_RAWSTR) #define IC706_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC706_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL) #define IC706_SCAN_OPS (RIG_SCAN_MEM) /* * IC706IIG_REAL_STR_CAL is accurate measurements * IC706IIG_STR_CAL is what the S-meter displays * * calibration data was obtained from W8WWV * http://www.seed-solutions.com/gregordy/ */ #define IC706IIG_REAL_STR_CAL { 16, \ { \ { 46, -27 }, /* S0 */ \ { 54, -25 }, \ { 64, -24 }, \ { 76, -23 }, \ { 84, -22 }, \ { 94, -20 }, \ { 104, -16 }, \ { 113, -11 }, \ { 123, -5 }, \ { 133, 0 }, /* S9 */ \ { 144, 5 }, /* +10 */ \ { 156, 10 }, /* +20 */ \ { 170, 16 }, /* +30 */ \ { 181, 21 }, /* +40 */ \ { 192, 26 }, /* +50 */ \ { 204, 35 } /* +60 */ \ } } #define IC706IIG_STR_CAL { 17, \ { \ { 45, -60 }, \ { 46, -54 }, /* S0 */ \ { 54, -48 }, \ { 64, -42 }, \ { 76, -36 }, \ { 84, -30 }, \ { 94, -24 }, \ { 104, -18 }, \ { 113, -12 }, \ { 123, -6 }, \ { 133, 0 }, /* S9 */ \ { 144, 10 }, /* +10 */ \ { 156, 20 }, /* +20 */ \ { 170, 30 }, /* +30 */ \ { 181, 40 }, /* +40 */ \ { 192, 50 }, /* +50 */ \ { 204, 60 } /* +60 */ \ } } /* * ic706 rigs capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! */ static const struct icom_priv_caps ic706_priv_caps = { 0x48, /* default address */ 0, /* 731 mode */ ic706_ts_sc_list, .r2i_mode = ic706_r2i_mode }; const struct rig_caps ic706_caps = { .rig_model = RIG_MODEL_IC706, .model_name = "IC-706", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_MOBILE, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* granularity */ .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { 10, RIG_DBLST_END, }, .attenuator = { 20, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, /* FIXME: memory channel list */ .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),199999999,IC706_ALL_RX_MODES,-1,-1,IC706_VFO_ALL},RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {kHz(1800),1999999,IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, /* 100W class */ {kHz(1800),1999999,IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, /* 40W class */ {kHz(3500),3999999,IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {kHz(3500),3999999,IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(7),kHz(7300),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {MHz(7),kHz(7300),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {kHz(10100),kHz(10150),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {kHz(10100),kHz(10150),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(14),kHz(14350),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {MHz(14),kHz(14350),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {kHz(18068),kHz(18168),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {kHz(18068),kHz(18168),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(21),kHz(21450),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {MHz(21),kHz(21450),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {kHz(24890),kHz(24990),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {kHz(24890),kHz(24990),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(28),kHz(29700),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {MHz(28),kHz(29700),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(50),MHz(54),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {MHz(50),MHz(54),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(144),MHz(148),IC706_OTHER_TX_MODES,5000,20000,IC706_VFO_ALL}, /* not sure.. */ {MHz(144),MHz(148),IC706_AM_TX_MODES,2000,8000,IC706_VFO_ALL}, /* anyone? */ RIG_FRNG_END, }, .tuning_steps = {{IC706_1HZ_TS_MODES,1}, {IC706_ALL_RX_MODES,10}, {IC706_ALL_RX_MODES,100}, {IC706_ALL_RX_MODES,kHz(1)}, {IC706_ALL_RX_MODES,kHz(5)}, {IC706_ALL_RX_MODES,kHz(9)}, {IC706_ALL_RX_MODES,kHz(10)}, {IC706_ALL_RX_MODES,12500}, {IC706_ALL_RX_MODES,kHz(20)}, {IC706_ALL_RX_MODES,kHz(25)}, {IC706_ALL_RX_MODES,kHz(100)}, {IC706_1MHZ_TS_MODES,MHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.4)}, /* bultin FL-272 */ {RIG_MODE_AM, kHz(8)}, /* mid w/ bultin FL-94 */ {RIG_MODE_AM, kHz(2.4)}, /* narrow w/ bultin FL-272 */ {RIG_MODE_FM, kHz(15)}, /* ?? TBC, mid w/ bultin FL-23+SFPC455E */ {RIG_MODE_FM, kHz(8)}, /* narrow w/ bultin FL-94 */ {RIG_MODE_WFM, kHz(230)}, /* WideFM, filter FL?? */ RIG_FLT_END, }, .str_cal = IC706IIG_STR_CAL, .priv = (void*)&ic706_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ts = icom_set_ts, .set_rptr_shift = icom_set_rptr_shift, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, }; static const struct icom_priv_caps ic706mkii_priv_caps = { 0x4e, /* default address */ 0, /* 731 mode */ ic706_ts_sc_list, .r2i_mode = ic706_r2i_mode }; const struct rig_caps ic706mkii_caps = { .rig_model = RIG_MODEL_IC706MKII, .model_name = "IC-706MkII", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_MOBILE, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* granularity */ .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { 10, RIG_DBLST_END, }, .attenuator = { 20, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, /* FIXME: memory channel list */ .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),199999999,IC706_ALL_RX_MODES,-1,-1,IC706_VFO_ALL}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {kHz(1800),1999999,IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, /* 100W class */ {kHz(1800),1999999,IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, /* 40W class */ {kHz(3500),3999999,IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {kHz(3500),3999999,IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(7),kHz(7300),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {MHz(7),kHz(7300),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {kHz(10100),kHz(10150),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {kHz(10100),kHz(10150),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(14),kHz(14350),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {MHz(14),kHz(14350),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {kHz(18068),kHz(18168),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {kHz(18068),kHz(18168),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(21),kHz(21450),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {MHz(21),kHz(21450),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {kHz(24890),kHz(24990),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {kHz(24890),kHz(24990),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(28),kHz(29700),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {MHz(28),kHz(29700),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(50),MHz(54),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {MHz(50),MHz(54),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(144),MHz(148),IC706_OTHER_TX_MODES,5000,20000,IC706_VFO_ALL}, /* not sure.. */ {MHz(144),MHz(148),IC706_AM_TX_MODES,2000,8000,IC706_VFO_ALL}, /* anyone? */ RIG_FRNG_END, }, .tuning_steps = { {IC706_1HZ_TS_MODES,1}, {IC706_ALL_RX_MODES,10}, {IC706_ALL_RX_MODES,100}, {IC706_ALL_RX_MODES,kHz(1)}, {IC706_ALL_RX_MODES,kHz(5)}, {IC706_ALL_RX_MODES,kHz(9)}, {IC706_ALL_RX_MODES,kHz(10)}, {IC706_ALL_RX_MODES,12500}, {IC706_ALL_RX_MODES,kHz(20)}, {IC706_ALL_RX_MODES,kHz(25)}, {IC706_ALL_RX_MODES,kHz(100)}, {IC706_1MHZ_TS_MODES,MHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.4)}, /* bultin FL-272 */ {RIG_MODE_AM, kHz(8)}, /* mid w/ bultin FL-94 */ {RIG_MODE_AM, kHz(2.4)}, /* narrow w/ bultin FL-272 */ {RIG_MODE_FM, kHz(15)}, /* ?? TBC, mid w/ bultin FL-23+SFPC455E */ {RIG_MODE_FM, kHz(8)}, /* narrow w/ bultin FL-94 */ {RIG_MODE_WFM, kHz(230)}, /* WideFM, filter FL?? */ RIG_FLT_END, }, .str_cal = IC706IIG_STR_CAL, .priv = (void*)&ic706mkii_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ts = icom_set_ts, .set_rptr_shift = icom_set_rptr_shift, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, }; /* * IC706MkIIG channel caps. */ #define IC706MKIIG_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .split = 1, \ .tx_freq = 1, \ .tx_mode = 1, \ .tx_width = 1, \ .rptr_offs = 1, \ .rptr_shift = 1, /* only set */ \ .funcs = IC706IIG_FUNC_ALL, \ .levels = RIG_LEVEL_SET(IC706IIG_LEVEL_ALL), \ } /* * Basically, the IC706MKIIG is an IC706MKII plus UHF, a DSP * and 50W VHF */ static const struct icom_priv_caps ic706mkiig_priv_caps = { 0x58, /* default address */ 0, /* 731 mode */ ic706_ts_sc_list, .r2i_mode = ic706_r2i_mode }; const struct rig_caps ic706mkiig_caps = { .rig_model = RIG_MODEL_IC706MKIIG, .model_name = "IC-706MkIIG", .mfg_name = "Icom", .version = BACKEND_VER ".2", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_MOBILE, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC706IIG_FUNC_ALL, .has_set_func = IC706IIG_FUNC_ALL, .has_get_level = IC706IIG_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(IC706IIG_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, RIG_DBLST_END, }, .attenuator = { 20, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC706_VFO_OPS, .scan_ops = IC706_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM, IC706MKIIG_MEM_CAP }, { 100, 105, RIG_MTYPE_EDGE, IC706MKIIG_MEM_CAP }, /* two by two */ { 106, 107, RIG_MTYPE_CALL, IC706MKIIG_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(200)-1,IC706_ALL_RX_MODES,-1,-1,IC706_VFO_ALL}, /* this trx also has UHF */ {MHz(400),MHz(470),IC706_ALL_RX_MODES,-1,-1,IC706_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1, IC706_OTHER_TX_MODES, W(5),W(100),IC706_VFO_ALL,RIG_ANT_1), FRQ_RNG_HF(1, IC706_AM_TX_MODES, W(2),W(40), IC706_VFO_ALL,RIG_ANT_1), /* AM class */ FRQ_RNG_6m(1, IC706_OTHER_TX_MODES, W(5),W(100),IC706_VFO_ALL,RIG_ANT_1), FRQ_RNG_6m(1, IC706_AM_TX_MODES, W(2),W(40), IC706_VFO_ALL,RIG_ANT_1), /* AM class */ FRQ_RNG_2m(1, IC706_OTHER_TX_MODES, W(5),W(50),IC706_VFO_ALL,RIG_ANT_1), FRQ_RNG_2m(1, IC706_AM_TX_MODES, W(2),W(20), IC706_VFO_ALL,RIG_ANT_1), /* AM class */ FRQ_RNG_70cm(1, IC706_OTHER_TX_MODES, W(5),W(20),IC706_VFO_ALL,RIG_ANT_1), FRQ_RNG_70cm(1, IC706_AM_TX_MODES, W(2),W(8), IC706_VFO_ALL,RIG_ANT_1), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(200)-1,IC706_ALL_RX_MODES,-1,-1,IC706_VFO_ALL}, /* this trx also has UHF */ {MHz(400),MHz(470),IC706_ALL_RX_MODES,-1,-1,IC706_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { {kHz(1800),MHz(2)-1,IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, /* 100W class */ {kHz(1800),MHz(2)-1,IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, /* 40W class */ {kHz(3500),MHz(4)-1,IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {kHz(3500),MHz(4)-1,IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(7),kHz(7300),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {MHz(7),kHz(7300),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {kHz(10100),kHz(10150),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {kHz(10100),kHz(10150),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(14),kHz(14350),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {MHz(14),kHz(14350),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {kHz(18068),kHz(18168),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {kHz(18068),kHz(18168),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(21),kHz(21450),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {MHz(21),kHz(21450),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {kHz(24890),kHz(24990),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {kHz(24890),kHz(24990),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(28),kHz(29700),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {MHz(28),kHz(29700),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(50),MHz(54),IC706_OTHER_TX_MODES,5000,100000,IC706_VFO_ALL}, {MHz(50),MHz(54),IC706_AM_TX_MODES,2000,40000,IC706_VFO_ALL}, {MHz(144),MHz(148),IC706_OTHER_TX_MODES,5000,50000,IC706_VFO_ALL}, /* 50W */ {MHz(144),MHz(148),IC706_AM_TX_MODES,2000,20000,IC706_VFO_ALL}, /* AM VHF is 20W */ {MHz(430),MHz(450),IC706_OTHER_TX_MODES,5000,20000,IC706_VFO_ALL}, {MHz(430),MHz(450),IC706_AM_TX_MODES,2000,8000,IC706_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {IC706_1HZ_TS_MODES,1}, {IC706_ALL_RX_MODES,10}, {IC706_ALL_RX_MODES,100}, {IC706_ALL_RX_MODES,kHz(1)}, {IC706_ALL_RX_MODES,kHz(5)}, {IC706_ALL_RX_MODES,kHz(9)}, {IC706_ALL_RX_MODES,kHz(10)}, {IC706_ALL_RX_MODES,12500}, {IC706_ALL_RX_MODES,kHz(20)}, {IC706_ALL_RX_MODES,kHz(25)}, {IC706_ALL_RX_MODES,kHz(100)}, {IC706_1MHZ_TS_MODES,MHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.4)}, /* bultin FL-272 */ {RIG_MODE_AM, kHz(8)}, /* mid w/ bultin FL-94 */ {RIG_MODE_AM, kHz(2.4)}, /* narrow w/ bultin FL-272 */ {RIG_MODE_FM, kHz(15)}, /* ?? TBC, mid w/ bultin FL-23+SFPC455E */ {RIG_MODE_FM, kHz(8)}, /* narrow w/ bultin FL-94 */ {RIG_MODE_WFM, kHz(230)}, /* WideFM, filter FL?? */ RIG_FLT_END, }, .str_cal = IC706IIG_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic706mkiig_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ptt = icom_set_ptt, .get_ptt = icom_get_ptt, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .set_rptr_shift = icom_set_rptr_shift, .set_rptr_offs = icom_set_rptr_offs, .get_rptr_offs = icom_get_rptr_offs, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, .get_split_vfo = icom_mem_get_split_vfo, }; hamlib-1.2.15.3/icom/optoscan.c0000644000175000017500000004472212044564477013065 00000000000000/* * Hamlib CI-V backend - OptoScan extensions * Copyright (c) 2000-2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "cal.h" #include "token.h" #include "icom.h" #include "icom_defs.h" #include "frame.h" #include "optoscan.h" const struct confparams opto_ext_parms[] = { { TOK_TAPECNTL, "tapecntl", "Toggle Tape Switch", "Toggles built in tape switch", 0, RIG_CONF_CHECKBUTTON, {} }, { TOK_5KHZWIN, "5khzwin", "Toggle 5kHz Search Window", "Toggles 5kHz search window", 0, RIG_CONF_CHECKBUTTON, {} }, { TOK_SPEAKER, "speaker", "Toggle speaker audio", "Toggles speaker audio", 0, RIG_CONF_CHECKBUTTON, {} }, { TOK_AUDIO, "audio", "Audio present", "Audio present", NULL, RIG_CONF_CHECKBUTTON, {} }, { TOK_DTMFPEND, "dtmfpend", "DTMF Digit Pending", "DTMF Digit Pending", NULL, RIG_CONF_CHECKBUTTON, {} }, { TOK_DTMFOVRR, "dtmfovrr", "DTMF Buffer Overflow", "DTMF Buffer Overflow", NULL, RIG_CONF_CHECKBUTTON, {} }, { TOK_CTCSSACT, "ctcssact", "CTCSS Tone Active", "CTCSS Tone Active", NULL, RIG_CONF_CHECKBUTTON, {} }, { TOK_DCSACT, "dcsact", "DCS Code Active", "DCS Code Active", NULL, RIG_CONF_CHECKBUTTON, {} }, { RIG_CONF_END, NULL, } }; static int optoscan_get_status_block(RIG *rig, struct optostat *status_block); static int optoscan_send_freq(RIG *rig,pltstate_t *state); static int optoscan_RTS_toggle(RIG *rig); static int optoscan_start_timer(RIG *rig, pltstate_t *state); static int optoscan_wait_timer(RIG *rig, pltstate_t *state); /* * optoscan_open * Assumes rig!=NULL, rig->state.priv!=NULL */ int optoscan_open(RIG *rig) { struct icom_priv_data *priv; struct rig_state *rs; pltstate_t *pltstate; unsigned char ackbuf[16]; int ack_len, retval; rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; pltstate = malloc(sizeof(pltstate_t)); if (!pltstate) { return -RIG_ENOMEM; } memset(pltstate, 0, sizeof(pltstate_t)); priv->pltstate = pltstate; /* select REMOTE control */ retval = icom_transaction (rig, C_CTL_MISC, S_OPTO_REMOTE, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) { free(pltstate); return retval; } if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"optoscan_open: ack NG (%#.2x), " "len=%d\n", ackbuf[0], ack_len); free(pltstate); return -RIG_ERJCTED; } return RIG_OK; } /* * optoscan_close * Assumes rig!=NULL, rig->state.priv!=NULL */ int optoscan_close(RIG *rig) { struct icom_priv_data *priv; struct rig_state *rs; unsigned char ackbuf[16]; int ack_len, retval; rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; /* select LOCAL control */ retval = icom_transaction (rig, C_CTL_MISC, S_OPTO_LOCAL, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"optoscan_close: ack NG (%#.2x), " "len=%d\n", ackbuf[0], ack_len); return -RIG_ERJCTED; } free(priv->pltstate); return RIG_OK; } /* * optoscan_get_info * Assumes rig!=NULL, rig->state.priv!=NULL */ const char* optoscan_get_info(RIG *rig) { unsigned char ackbuf[16]; int ack_len, retval; static char info[64]; /* select LOCAL control */ retval = icom_transaction (rig, C_CTL_MISC, S_OPTO_RDID, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return NULL; if (ack_len != 7) { rig_debug(RIG_DEBUG_ERR,"optoscan_get_info: ack NG (%#.2x), " "len=%d\n", ackbuf[0], ack_len); return NULL; } sprintf(info, "OptoScan%c%c%c, software version %d.%d, " "interface version %d.%d\n", ackbuf[2], ackbuf[3], ackbuf[4], ackbuf[5] >> 4, ackbuf[5] & 0xf, ackbuf[6] >> 4, ackbuf[6] & 0xf); return info; } /* * optoscan_get_ctcss_tone * Assumes rig!=NULL, rig->state.priv!=NULL */ int optoscan_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone) { unsigned char tonebuf[MAXFRAMELEN]; int tone_len, retval; retval = icom_transaction(rig, C_CTL_MISC, S_OPTO_RDCTCSS, NULL, 0, tonebuf, &tone_len); if (retval != RIG_OK) return retval; if (tone_len != 4) { rig_debug(RIG_DEBUG_ERR,"optoscan_get_ctcss_tone: ack NG (%#.2x), " "len=%d\n", tonebuf[0], tone_len); return -RIG_ERJCTED; } tone_len -= 2; *tone = from_bcd_be(tonebuf+2, tone_len*2); rig_debug(RIG_DEBUG_ERR,"optoscan_get_ctcss_tone: *tone=%d\n",*tone); return RIG_OK; } /* * optoscan_get_dcs_code * Assumes rig!=NULL, rig->state.priv!=NULL */ int optoscan_get_dcs_code(RIG * rig, vfo_t vfo, tone_t *code) { unsigned char tonebuf[MAXFRAMELEN]; int tone_len, retval; retval = icom_transaction(rig, C_CTL_MISC, S_OPTO_RDDCS, NULL, 0, tonebuf, &tone_len); if (retval != RIG_OK) return retval; if (tone_len != 4) { rig_debug(RIG_DEBUG_ERR,"optoscan_get_dcs_code: ack NG (%#.2x), " "len=%d\n", tonebuf[0], tone_len); return -RIG_ERJCTED; } tone_len -= 2; *code = from_bcd_be(tonebuf+2, tone_len*2); rig_debug(RIG_DEBUG_ERR,"optoscan_get_dcs_code: *code=%d\n",*code); return RIG_OK; } int optoscan_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length) { unsigned char dtmfbuf[MAXFRAMELEN],digit; int len, retval, digitpos; unsigned char xlate[] = {'0','1','2','3','4','5','6', '7','8','9','A','B','C','D', '*','#'}; digitpos=0; do { retval = icom_transaction(rig, C_CTL_MISC, S_OPTO_RDDTMF, NULL,0,dtmfbuf, &len); if (retval != RIG_OK) return retval; if (len != 3) { rig_debug(RIG_DEBUG_ERR,"optoscan_recv_dtmf: ack NG (%#.2x), len=%d\n", dtmfbuf[0], len); return -RIG_ERJCTED; } digit = dtmfbuf[2]; if( digit < 0x16 ) { digits[digitpos] = xlate[digit]; digitpos++; } } while( (digit != 0x99) && (digitpos < *length) ); *length = digitpos; digits[digitpos]=0; if(*length > 0) { rig_debug(RIG_DEBUG_ERR,"optoscan_recv_dtmf: %d digits - %s\n",*length,digits); } else { rig_debug(RIG_DEBUG_ERR,"optoscan_recv_dtmf: no digits to read.\n"); } return RIG_OK; } /* * Assumes rig!=NULL, rig->state.priv!=NULL */ int optoscan_set_ext_parm(RIG *rig, token_t token, value_t val) { unsigned char epbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int ack_len; int retval,subcode; memset(epbuf,0,MAXFRAMELEN); memset(ackbuf,0,MAXFRAMELEN); switch(token) { case TOK_TAPECNTL: if( val.i == 0 ) { subcode = S_OPTO_TAPE_OFF; } else { subcode = S_OPTO_TAPE_ON; } break; case TOK_5KHZWIN: if( val.i == 0 ) { subcode = S_OPTO_5KSCOFF; } else { subcode = S_OPTO_5KSCON; } break; case TOK_SPEAKER: if( val.i == 0 ) { subcode = S_OPTO_SPKROFF; } else { subcode = S_OPTO_SPKRON; } break; default: return -RIG_EINVAL; } retval = icom_transaction (rig, C_CTL_MISC, subcode, epbuf, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR, "%s: ack NG (%#.2x), " "len=%d\n", __FUNCTION__, ackbuf[0], ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * Assumes rig!=NULL, rig->state.priv!=NULL * and val points to a buffer big enough to hold the conf value. */ int optoscan_get_ext_parm(RIG *rig, token_t token, value_t *val) { struct optostat status_block; int retval; retval = optoscan_get_status_block(rig,&status_block); if (retval != RIG_OK) return retval; switch(token) { case TOK_TAPECNTL: val->i = status_block.tape_enabled; break; case TOK_5KHZWIN: val->i = status_block.fivekhz_enabled; break; case TOK_SPEAKER: val->i = status_block.speaker_enabled; break; case TOK_AUDIO: val->i = status_block.audio_present; break; case TOK_DTMFPEND: val->i = status_block.DTMF_pending; break; case TOK_DTMFOVRR: val->i = status_block.DTMF_overrun; break; case TOK_CTCSSACT: val->i = status_block.CTCSS_active; break; case TOK_DCSACT: val->i = status_block.DCS_active; break; default: return -RIG_ENIMPL; } return RIG_OK; } /* * optoscan_set_level * Assumes rig!=NULL, rig->state.priv!=NULL */ int optoscan_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { unsigned char lvlbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int ack_len; int lvl_cn, lvl_sc; /* Command Number, Subcommand */ int icom_val; int retval; memset(lvlbuf,0,MAXFRAMELEN); /* * So far, levels of float type are in [0.0..1.0] range */ if (RIG_LEVEL_IS_FLOAT(level)) icom_val = val.f * 255; else icom_val = val.i; switch (level) { case RIG_LEVEL_AF: lvl_cn = C_CTL_MISC; if( icom_val == 0 ) { lvl_sc = S_OPTO_SPKROFF; } else { lvl_sc = S_OPTO_SPKRON; } break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_level %d", level); return -RIG_EINVAL; } retval = icom_transaction (rig, lvl_cn, lvl_sc, lvlbuf, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"optoscan_set_level: ack NG (%#.2x), " "len=%d\n", ackbuf[0], ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * optoscan_get_level * Assumes rig!=NULL, rig->state.priv!=NULL, val!=NULL */ int optoscan_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct optostat status_block; unsigned char lvlbuf[MAXFRAMELEN]; int lvl_len; int lvl_cn, lvl_sc; /* Command Number, Subcommand */ int icom_val; int cmdhead; int retval; if( level != RIG_LEVEL_AF ) { switch (level) { case RIG_LEVEL_RAWSTR: lvl_cn = C_RD_SQSM; lvl_sc = S_SML; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_level %d", level); return -RIG_EINVAL; } retval = icom_transaction (rig, lvl_cn, lvl_sc, NULL, 0, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; /* * strbuf should contain Cn,Sc,Data area */ cmdhead = (lvl_sc == -1) ? 1:2; lvl_len -= cmdhead; if (lvlbuf[0] != ACK && lvlbuf[0] != lvl_cn) { rig_debug(RIG_DEBUG_ERR,"optoscan_get_level: ack NG (%#.2x), " "len=%d\n", lvlbuf[0],lvl_len); return -RIG_ERJCTED; } /* * The result is a 3 digit BCD, but in *big endian* order: 0000..0255 * (from_bcd is little endian) */ icom_val = from_bcd_be(lvlbuf+cmdhead, lvl_len*2); } else /* level == RIG_LEVEL_AF */ { retval = optoscan_get_status_block(rig,&status_block); if (retval != RIG_OK) return retval; icom_val = 0; if( status_block.speaker_enabled == 1 ) icom_val = 255; } switch (level) { case RIG_LEVEL_RAWSTR: val->i = icom_val; break; default: if (RIG_LEVEL_IS_FLOAT(level)) val->f = (float)icom_val/255; else val->i = icom_val; } rig_debug(RIG_DEBUG_TRACE,"optoscan_get_level: %d %d %d %f\n", lvl_len, icom_val, val->i, val->f); return RIG_OK; } /* OS456 Pipeline tuning algorithm: * Step 2: Send the next frequency and mode to the receiver using the * TRANSFER NEXT FREQUENCY/MODE command. * * Step 3: Change the state of the RTS interface signal to cause the * next frequency and mode to become the current frequency and * mode, and the receiver to begin settling. * * Step 4: While the receiver is still settling on the current * frequency and mode, send the next frequency and mode to the * receiver using the TRANSFER NEXT FREQUENCY/MODE command. * * Step 5: Wait for the receiver to finish settling. The total * settling time, including sending the next frequency and * mode, is 20 milliseconds (0.02 seconds). * * Step 6: Check the squelch status by reading the DCD interface * signal. If the squelch is open, scanning is stopped. * Otherwise, scanning continues. Optionally, the status of * the CTCSS/DCS/DTMF decoder can be checked, and the * appropriate action taken. * * Step 7: Continuously repeat steps 3 through 6 above. */ int optoscan_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) { pltstate_t *state; pltune_cb_t cb; int rc, pin_state; struct rig_state *rs; if(scan != RIG_SCAN_PLT) return -RIG_ENAVAIL; rs=&rig->state; cb = rig->callbacks.pltune; state = ((struct icom_priv_data*)rs->priv)->pltstate; if(state==NULL) return -RIG_EINTERNAL; if(state->freq==0) /* pltstate_t is not initialized - perform setup */ { /* time for CIV command to be sent. this is subtracted from */ /* rcvr settle time */ state->usleep_time = (1000000 / (rig->state.rigport.parm.serial.rate)) * 13 * 9; rc=cb(rig,vfo,&(state->next_freq),&(state->next_mode), &(state->next_width),rig->callbacks.pltune_arg); if(rc==RIG_SCAN_STOP) return RIG_OK; /* callback halted loop */ /* Step 1 is implicit, since hamlib does this when it opens the device */ optoscan_send_freq(rig,state); /*Step 2*/ } rc=!RIG_SCAN_STOP; while(rc!=RIG_SCAN_STOP) { optoscan_RTS_toggle(rig); /*Step 3*/ state->freq = state->next_freq; state->mode = state->next_mode; optoscan_start_timer(rig,state); rc=cb(rig,vfo,&(state->next_freq),&(state->next_mode), &(state->next_width),rig->callbacks.pltune_arg); if(rc!=RIG_SCAN_STOP) { optoscan_send_freq(rig,state); /*Step 4*/ } optoscan_wait_timer(rig,state); /*Step 5*/ ser_get_car(&rs->rigport,&pin_state); if( pin_state ) /*Step 6*/ { return RIG_OK; /* we've broken squelch - return(). caller can */ /* get current freq & mode out of state str */ } } /* exiting pipeline loop - force state init on next call */ state->freq=0; return RIG_OK; } /* * Assumes rig!=NULL, status_block !=NULL */ static int optoscan_get_status_block(RIG *rig, struct optostat *status_block) { int retval, ack_len, expected_len; unsigned char ackbuf[MAXFRAMELEN]; memset(status_block,0,sizeof(struct optostat)); retval = icom_transaction (rig, C_CTL_MISC, S_OPTO_RDSTAT, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; switch( rig->caps->rig_model ) { case RIG_MODEL_OS456: expected_len=4; break; case RIG_MODEL_OS535: expected_len=5; break; default: rig_debug(RIG_DEBUG_ERR,"optoscan_get_status_block: unknown rig model"); return -RIG_ERJCTED; break; } if (ack_len != expected_len ) { rig_debug(RIG_DEBUG_ERR,"optoscan_get_status_block: ack NG (%#.2x), " "len=%d\n", ackbuf[0], ack_len); return -RIG_ERJCTED; } if( ackbuf[2] & 1 ) status_block->remote_control = 1; if( ackbuf[2] & 2 ) status_block->DTMF_pending = 1; if( ackbuf[2] & 4 ) status_block->DTMF_overrun = 1; if( ackbuf[2] & 16 ) status_block->squelch_open = 1; if( ackbuf[2] & 32 ) status_block->CTCSS_active = 1; if( ackbuf[2] & 64 ) status_block->DCS_active = 1; if( ackbuf[3] & 1 ) status_block->tape_enabled = 1; if( ackbuf[3] & 2 ) status_block->speaker_enabled = 1; if( ackbuf[3] & 4 ) status_block->fivekhz_enabled = 1; if( ackbuf[3] & 16 ) status_block->audio_present = 1; rig_debug(RIG_DEBUG_VERBOSE,"remote_control = %d\n",status_block->remote_control); rig_debug(RIG_DEBUG_VERBOSE,"DTMF_pending = %d\n",status_block->DTMF_pending); rig_debug(RIG_DEBUG_VERBOSE,"DTMF_overrun = %d\n",status_block->DTMF_overrun); rig_debug(RIG_DEBUG_VERBOSE,"squelch_open = %d\n",status_block->squelch_open); rig_debug(RIG_DEBUG_VERBOSE,"CTCSS_active = %d\n",status_block->CTCSS_active); rig_debug(RIG_DEBUG_VERBOSE,"DCS_active = %d\n",status_block->DCS_active); rig_debug(RIG_DEBUG_VERBOSE,"tape_enabled = %d\n",status_block->tape_enabled ); rig_debug(RIG_DEBUG_VERBOSE,"speaker_enabled = %d\n",status_block->speaker_enabled); rig_debug(RIG_DEBUG_VERBOSE,"fivekhz_enabled = %d\n",status_block->fivekhz_enabled); rig_debug(RIG_DEBUG_VERBOSE,"audio_present = %d\n",status_block->audio_present); return RIG_OK; } static int optoscan_send_freq(RIG *rig,pltstate_t *state) { unsigned char buff[OPTO_BUFF_SIZE]; char md,pd; freq_t freq; rmode_t mode; freq=state->next_freq; mode=state->next_mode; memset(buff,0,OPTO_BUFF_SIZE); to_bcd(buff,freq,5*2); /* to_bcd requires nibble len */ rig2icom_mode(rig,mode,0,(unsigned char *) &md, (signed char *) &pd); buff[5]=md; /* read echo'd chars only...there will be no ACK from this command * * Note: * It may have waited fro pltstate->usleep_time before reading the echo'd * chars, but the read will be blocking anyway. --SF * */ return icom_transaction (rig, C_CTL_MISC, S_OPTO_NXT, buff, 6, NULL, NULL); return RIG_OK; } static int optoscan_RTS_toggle(RIG *rig) { struct rig_state *rs; int state=0; rs=&rig->state; ser_get_rts(&rs->rigport,&state); ser_set_rts(&rs->rigport,!state); return RIG_OK; } static int optoscan_start_timer(RIG *rig, pltstate_t *state) { gettimeofday(&(state->timer_start),NULL); return RIG_OK; } static int optoscan_wait_timer(RIG *rig, pltstate_t *state) { struct icom_priv_caps *priv_caps; int usec_diff; int settle_usec; priv_caps = (struct icom_priv_caps *)rig->caps->priv; settle_usec = priv_caps->settle_time * 1000; /*convert settle time (ms) to */ /* settle time (usec) */ gettimeofday(&(state->timer_current),NULL); usec_diff = abs( (state->timer_current.tv_usec) - (state->timer_start.tv_usec) ); if( usec_diff < settle_usec ) { usleep( settle_usec - usec_diff ); /* sleep balance of settle_time */ } return RIG_OK; } hamlib-1.2.15.3/icom/ic820h.c0000644000175000017500000001217012044564477012224 00000000000000/* * Hamlib CI-V backend - description of IC-820H (VHF/UHF All-Mode Tranceiver) * Contributed by Francois Retief * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "icom.h" #define IC820H_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_FM) #define IC820H_VFO_ALL (RIG_VFO_A|RIG_VFO_C|RIG_VFO_MEM) /* FIXME: What about MAIN/SUB mode? And satellite mode? */ #define IC820H_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_CPY|RIG_OP_MCL) #define IC820H_SCAN_OPS (RIG_SCAN_MEM) /* FIXME: Manual talks about 3 modes: Programmed scan, Memory scan and * Mode select memory scan operation. How do i encode these? */ #define IC820H_STR_CAL { 0, { } } /* */ static const struct icom_priv_caps ic820h_priv_caps = { 0x42, /* default address */ 1, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic820h_caps = { .rig_model = RIG_MODEL_IC820, .model_name = "IC-820H", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, /* Attanuator 15dB for each band. manual button */ .max_rit = Hz(0), /* SSB,CW: +-1.0kHz FM: +-5.0kHz */ .max_xit = Hz(0), .max_ifshift = Hz(0), /* 1.2kHz manual knob */ .targetable_vfo = 0, .vfo_ops = IC820H_VFO_OPS, .scan_ops = IC820H_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { /* FIXME: Each band has 80 channels (2*80) ?? */ { 1, 80, RIG_MTYPE_MEM }, { 81, 82, RIG_MTYPE_EDGE }, RIG_CHAN_END, }, .rx_range_list1 = { {MHz(136),MHz(174),IC820H_MODES,-1,-1,IC820H_VFO_ALL}, {MHz(430),MHz(450),IC820H_MODES,-1,-1,IC820H_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { {MHz(144),MHz(146),RIG_MODE_SSB,W(6),W(35),IC820H_VFO_ALL}, {MHz(144),MHz(146),RIG_MODE_FM|RIG_MODE_CW,W(6),W(45),IC820H_VFO_ALL}, {MHz(430),MHz(440),RIG_MODE_SSB,W(6),W(30),IC820H_VFO_ALL}, {MHz(430),MHz(440),RIG_MODE_FM|RIG_MODE_CW,W(6),W(40),IC820H_VFO_ALL}, RIG_FRNG_END, }, .rx_range_list2 = { {MHz(136),MHz(174),IC820H_MODES,-1,-1,IC820H_VFO_ALL}, {MHz(430),MHz(450),IC820H_MODES,-1,-1,IC820H_VFO_ALL}, RIG_FRNG_END, }, /* * From manual: VHF UHF * USA 144.0-148.0 MHz 430.0-450.0 MHz * Europe 144.0-146.0 MHz 430.0-440.0 MHz * Australia 144.0-148.0 MHz 430.0-450.0 MHz * Sweden 144.0-146.0 MHz 432.0-438.0 MHz */ .tx_range_list2 = { {MHz(144),MHz(148),RIG_MODE_SSB,W(6),W(35),IC820H_VFO_ALL}, {MHz(144),MHz(148),RIG_MODE_FM|RIG_MODE_CW,W(6),W(45),IC820H_VFO_ALL}, {MHz(430),MHz(450),RIG_MODE_SSB,W(6),W(30),IC820H_VFO_ALL}, {MHz(430),MHz(450),RIG_MODE_FM|RIG_MODE_CW,W(6),W(40),IC820H_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_SSB|RIG_MODE_CW,1}, {RIG_MODE_SSB|RIG_MODE_CW,10}, {RIG_MODE_SSB|RIG_MODE_CW,50}, {RIG_MODE_SSB|RIG_MODE_CW,100}, {RIG_MODE_FM,kHz(5)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_CW|RIG_MODE_SSB, kHz(2.3)}, /* builtin */ {RIG_MODE_FM, kHz(15)}, /* builtin */ RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic820h_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, }; hamlib-1.2.15.3/icom/ic761.c0000644000175000017500000001506212044564477012063 00000000000000/* * Hamlib CI-V backend - description of IC-761 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "bandplan.h" #include "icom.h" #define IC761_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FM) /* * 100W in all modes but AM (40W) */ #define IC761_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FM) #define IC761_AM_TX_MODES (RIG_MODE_AM) #define IC761_VFO_ALL (RIG_VFO_A|RIG_VFO_MEM) #define IC761_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO) #define IC761_SCAN_OPS (RIG_SCAN_NONE) #define IC761_ANTS RIG_ANT_1 /* */ static const struct icom_priv_caps ic761_priv_caps = { 0x1e, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic761_caps = { .rig_model = RIG_MODEL_IC761, .model_name = "IC-761", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .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 = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC761_VFO_OPS, .scan_ops = IC761_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 26, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, /* TBC */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100),MHz(30),IC761_ALL_RX_MODES,-1,-1,IC761_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { {MHz(1.8),MHz(1.99999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, /* 100W class */ {MHz(1.8),MHz(1.99999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, /* 40W class */ {MHz(3.45),MHz(4.09999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(3.45),MHz(4.09999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, {MHz(6.95),MHz(7.49999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(6.95),MHz(7.49999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, {MHz(9.95),MHz(10.49999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(9.95),MHz(10.49999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, {MHz(13.95),MHz(14.49999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(13.95),MHz(14.49999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, {MHz(17.95),MHz(18.49999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(17.95),MHz(18.49999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, {MHz(20.95),MHz(21.49999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(20.95),MHz(21.49999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, {MHz(24.45),MHz(25.09999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(24.45),MHz(25.09999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, {MHz(27.95),MHz(30),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(27.95),MHz(30),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(30),IC761_ALL_RX_MODES,-1,-1,IC761_VFO_ALL}, RIG_FRNG_END, }, /* weird transmit ranges ... --sf */ .tx_range_list2 = { {MHz(1.8),MHz(1.99999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, /* 100W class */ {MHz(1.8),MHz(1.99999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, /* 40W class */ {MHz(3.45),MHz(4.09999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(3.45),MHz(4.09999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, {MHz(6.95),MHz(7.49999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(6.95),MHz(7.49999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, {MHz(9.95),MHz(10.49999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(9.95),MHz(10.49999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, {MHz(13.95),MHz(14.49999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(13.95),MHz(14.49999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, {MHz(17.95),MHz(18.49999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(17.95),MHz(18.49999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, {MHz(20.95),MHz(21.49999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(20.95),MHz(21.49999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, {MHz(24.45),MHz(25.09999),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(24.45),MHz(25.09999),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, {MHz(27.95),MHz(30),IC761_OTHER_TX_MODES,W(10),W(100),IC761_VFO_ALL}, {MHz(27.95),MHz(30),IC761_AM_TX_MODES,W(10),W(40),IC761_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {IC761_ALL_RX_MODES,10}, /* basic resolution, there's no set_ts */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.4)}, {RIG_MODE_RTTY|RIG_MODE_CW, Hz(500)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic761_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/os456.c0000644000175000017500000001205412044564477012110 00000000000000/* * Hamlib CI-V backend - description of the OptoScan456 * Copyright (c) 2000-2004 by Stephane Fillod and Michael Smith * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * This backend is currently being maintained by Michael Smith, KE4RJQ. * Email: james (dot) m (dot) smith (at) earthlink (dot) net */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "idx_builtin.h" #include "icom.h" #include "tones.h" #include "token.h" #include "optoscan.h" extern struct confparams opto_ext_parms[]; #define OS456_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define OS456_VFO_ALL (RIG_VFO_A) #define OS456_LEVELS (RIG_LEVEL_RAWSTR|RIG_LEVEL_AF) #define OS456_SCAN_OPS (RIG_SCAN_PLT) /* * The signal strength data is in the form of two bytes, each consisting * of two BCD digits. The signal strength is reported in units of absolute * dBm as measured at the antenna connector. The reported signal strength * ranges from a maximum signal of 0 dBm to a minimum signal of - 125 dBm. * A minus sign is implied. */ #define OS456_STR_CAL { 2, { \ { 0, 60 }, \ { 125, -60 }, \ } } /* TBC */ /* * The OptoScan is not actually a rig. This is an add-in circuit board * for the Realistic PRO-2006 and PRO-2005 Scanning VHF-UHF Receivers. * http://www.optoelectronics.com/tech/pdf/os535/os535_ci5_spec_v10.pdf * * TODO: srch_dcs, srch_ctcss, rcv_dtmf, and make icom_probe opto aware */ static const struct icom_priv_caps os456_priv_caps = { 0x80, /* default address */ 0, /* 731 mode */ NULL, .settle_time = 20, }; const struct rig_caps os456_caps = { .rig_model = RIG_MODEL_OS456, .model_name = "OptoScan456", .mfg_name = "Optoelectronics", .version = "0.3", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_SCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_SERIAL_CAR, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 38400, .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 = OS456_LEVELS, .has_set_level = RIG_LEVEL_AF, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = full_ctcss_list, .dcs_list = full_dcs_list, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = RIG_OP_NONE, .scan_ops = OS456_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, .rx_range_list1 = { { MHz(25),MHz(520),OS456_MODES,-1,-1,OS456_VFO_ALL}, { MHz(760),MHz(1300),OS456_MODES,-1,-1,OS456_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, /* this is a scanner */ .rx_range_list2 = { { MHz(25),MHz(520),OS456_MODES,-1,-1,OS456_VFO_ALL}, { MHz(760),MHz(823.995),OS456_MODES,-1,-1,OS456_VFO_ALL}, { MHz(849),MHz(868.995),OS456_MODES,-1,-1,OS456_VFO_ALL}, { MHz(894),MHz(1300),OS456_MODES,-1,-1,OS456_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, /* this is a scanner */ .tuning_steps = { {OS456_MODES,kHz(5)}, {OS456_MODES,kHz(12.5)}, {OS456_MODES,kHz(50)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM, kHz(15)}, /* TBC */ RIG_FLT_END, }, .str_cal = OS456_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&os456_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = optoscan_open, .rig_close = optoscan_close, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .get_dcd = icom_get_dcd, .decode_event = icom_decode_event, .get_info = optoscan_get_info, .get_ctcss_tone = optoscan_get_ctcss_tone, .get_dcs_code = optoscan_get_dcs_code, .recv_dtmf = optoscan_recv_dtmf, .extparms = opto_ext_parms, .set_ext_parm = optoscan_set_ext_parm, .get_ext_parm = optoscan_get_ext_parm, .set_level = optoscan_set_level, .get_level = optoscan_get_level, .scan = optoscan_scan, }; hamlib-1.2.15.3/icom/ic756.c0000644000175000017500000006557712044564477012107 00000000000000/* * Hamlib CI-V backend - description of IC-756 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include #include "token.h" #include "idx_builtin.h" #include "icom.h" #include "icom_defs.h" #include "frame.h" #include "misc.h" #include "bandplan.h" #define IC756_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FM) #define IC756_1HZ_TS_MODES IC756_ALL_RX_MODES /* * 100W in all modes but AM (40W) */ #define IC756_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FM) #define IC756_AM_TX_MODES (RIG_MODE_AM) #define IC756PRO_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_NR|RIG_FUNC_MON|RIG_FUNC_MN|RIG_FUNC_RF) #define IC756PRO_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_COMP|RIG_LEVEL_BKINDL|RIG_LEVEL_BALANCE|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_NOTCHF|RIG_LEVEL_RAWSTR|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_COMP|RIG_LEVEL_BALANCE) /* Note that RIG_LEVEL_VOXGAIN and RIG_LEVEL_ANTIVOX are incorrectly handled in icom.c for * this model. */ #define IC756_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC756_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL) #define IC756_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO|RIG_SCAN_PROG|RIG_SCAN_DELTA|RIG_SCAN_PRIO) #define IC756_ANTS (RIG_ANT_1|RIG_ANT_2) #define IC756PRO_STR_CAL { 16, \ { \ { 0, -18 }, \ { 10, -16 }, \ { 27, -14 }, \ { 45, -12 }, \ { 60, -10 }, \ { 76, -8 }, \ { 89, -6 }, \ { 100, -4 }, \ { 110, -2 }, \ { 120, 0 }, \ { 125, 2 }, \ { 129, 4 }, \ { 133, 6 }, \ { 138, 8 }, \ { 142, 10 }, \ { 146, 12 } \ } } /* * ic756 rig capabilities. */ static const struct icom_priv_caps ic756_priv_caps = { 0x50, /* default address */ 0, /* 731 mode */ ic756_ts_sc_list }; const struct rig_caps ic756_caps = { .rig_model = RIG_MODEL_IC756, .model_name = "IC-756", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, RIG_DBLST_END, }, /* FIXME: TBC */ .attenuator = { 20, RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC756_VFO_OPS, .scan_ops = IC756_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM }, { 100, 101, RIG_MTYPE_EDGE }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(60),IC756_ALL_RX_MODES,-1,-1,IC756_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC756_OTHER_TX_MODES, W(5),W(100),IC756_VFO_ALL,IC756_ANTS), FRQ_RNG_6m(1,IC756_OTHER_TX_MODES, W(5),W(100),IC756_VFO_ALL,IC756_ANTS), FRQ_RNG_HF(1,IC756_AM_TX_MODES, W(2),W(40),IC756_VFO_ALL,IC756_ANTS), /* AM class */ FRQ_RNG_6m(1,IC756_AM_TX_MODES, W(2),W(40),IC756_VFO_ALL,IC756_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(60),IC756_ALL_RX_MODES,-1,-1,IC756_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC756_OTHER_TX_MODES, W(5),W(100),IC756_VFO_ALL,IC756_ANTS), FRQ_RNG_6m(2,IC756_OTHER_TX_MODES, W(5),W(100),IC756_VFO_ALL,IC756_ANTS), FRQ_RNG_HF(2,IC756_AM_TX_MODES, W(2),W(40),IC756_VFO_ALL,IC756_ANTS), /* AM class */ FRQ_RNG_6m(2,IC756_AM_TX_MODES, W(2),W(40),IC756_VFO_ALL,IC756_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {IC756_1HZ_TS_MODES,1}, {IC756_ALL_RX_MODES,kHz(1)}, {IC756_ALL_RX_MODES,kHz(5)}, {IC756_ALL_RX_MODES,kHz(9)}, {IC756_ALL_RX_MODES,kHz(10)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_RTTY, kHz(2.4)}, {RIG_MODE_CW, Hz(500)}, {RIG_MODE_AM, kHz(8)}, {RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_FM, kHz(8)}, RIG_FLT_END, }, .str_cal = IC756PRO_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic756_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .get_ts = icom_get_ts, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, .get_split_vfo = icom_mem_get_split_vfo, }; /* * ic756pro rig capabilities. * TODO: check every paramters, * add antenna capabilities */ static const struct icom_priv_caps ic756pro_priv_caps = { 0x5c, /* default address */ 0, /* 731 mode */ ic756pro_ts_sc_list }; const struct rig_caps ic756pro_caps = { .rig_model = RIG_MODEL_IC756PRO, .model_name = "IC-756PRO", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC756PRO_FUNC_ALL, .has_set_func = IC756PRO_FUNC_ALL, .has_get_level = IC756PRO_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(IC756PRO_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, 20, RIG_DBLST_END, }, /* FIXME: TBC */ .attenuator = { 6, 12, 18, 20, RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC756_VFO_OPS, .scan_ops = IC756_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM }, { 100, 101, RIG_MTYPE_EDGE }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(60),IC756_ALL_RX_MODES,-1,-1,IC756_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC756_OTHER_TX_MODES, W(5),W(100),IC756_VFO_ALL,IC756_ANTS), FRQ_RNG_6m(1,IC756_OTHER_TX_MODES, W(5),W(100),IC756_VFO_ALL,IC756_ANTS), FRQ_RNG_HF(1,IC756_AM_TX_MODES, W(2),W(40),IC756_VFO_ALL,IC756_ANTS), /* AM class */ FRQ_RNG_6m(1,IC756_AM_TX_MODES, W(2),W(40),IC756_VFO_ALL,IC756_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(60),IC756_ALL_RX_MODES,-1,-1,IC756_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC756_OTHER_TX_MODES, W(5),W(100),IC756_VFO_ALL,IC756_ANTS), FRQ_RNG_6m(2,IC756_OTHER_TX_MODES, W(5),W(100),IC756_VFO_ALL,IC756_ANTS), FRQ_RNG_HF(2,IC756_AM_TX_MODES, W(2),W(40),IC756_VFO_ALL,IC756_ANTS), /* AM class */ FRQ_RNG_6m(2,IC756_AM_TX_MODES, W(2),W(40),IC756_VFO_ALL,IC756_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {IC756_1HZ_TS_MODES,1}, {IC756_ALL_RX_MODES,kHz(1)}, {IC756_ALL_RX_MODES,kHz(5)}, {IC756_ALL_RX_MODES,kHz(9)}, {IC756_ALL_RX_MODES,kHz(10)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_RTTY, kHz(2.4)}, {RIG_MODE_CW, Hz(500)}, {RIG_MODE_AM, kHz(8)}, {RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_FM, kHz(8)}, RIG_FLT_END, }, .str_cal = IC756PRO_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic756pro_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ptt = icom_set_ptt, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .get_ts = icom_get_ts, .set_rptr_shift = icom_set_rptr_shift, .get_rptr_shift = icom_get_rptr_shift, .set_rptr_offs = icom_set_rptr_offs, .get_rptr_offs = icom_get_rptr_offs, .set_ctcss_tone = icom_set_ctcss_tone, .get_ctcss_tone = icom_get_ctcss_tone, .set_ctcss_sql = icom_set_ctcss_sql, .get_ctcss_sql = icom_get_ctcss_sql, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, .get_split_vfo = icom_mem_get_split_vfo, }; /* * ic756proII rig capabilities. * TODO: check every paramters, * add antenna capabilities */ static const struct icom_priv_caps ic756pro2_priv_caps = { 0x64, /* default address */ 0, /* 731 mode */ ic756pro_ts_sc_list }; /* * These TOKEN_BACKEND's are on a different name space than conf's */ #define TOK_MEMNAME TOKEN_BACKEND(1) #define TOK_MYCALL TOKEN_BACKEND(2) static const struct confparams ic756pro2_ext_parms[] = { { TOK_SSBBASS, "ssbbass", "SSB Tx Tone (Bass)", "SSB Tx Tone (Bass)", NULL, RIG_CONF_NUMERIC, { .n = { 0, 10, 1 } } }, { TOK_MEMNAME, "showmem", "Show mem name", "Show memory name", NULL, RIG_CONF_CHECKBUTTON, { } }, { TOK_SQLCTRL, "sqlctrl", "RF/Sql control", "set RF/Squelch control", NULL, RIG_CONF_COMBO, { .c = {{ "Auto", "Sql", "RF+Sql", NULL }} } }, { TOK_MYCALL, "mycall", "Callsign", "My call sign", NULL, RIG_CONF_STRING, { } }, { TOK_RTTY_FLTR, "rttyfltr", "RTTY Fltr Width preset", "Set/Read RTTY preset filter width", "350", RIG_CONF_COMBO, { .c = {{"250", "300", "350", "500", "1000", NULL }} } }, { RIG_CONF_END, NULL, } }; /* * NUMERIC: val.f * COMBO: val.i, starting from 0 * STRING: val.cs for set, val.s for get * CHECKBUTTON: val.i 0/1 */ /*IC-756Pro Rig parameters Only available in this namespace*/ #define S_MEM_SC_LEN 2 /* 756PRO S_MEM subcmd length */ #define S_MEM_SBASS 0x501 /* SSB TX tone bass level */ #define S_MEM_NAME 0x514 /* send/read memory name */ #define S_MEM_MYCALL 0x515 #define S_MEM_BEEP 0x520 /* Button confirmation */ #define S_MEM_SQL_CTL 0x522 /* RF/SQL ctl set 0=auto; 1 = sql; 2 = RF+SQL */ #define S_MEM_QSPLT 0x524 /* enable quick split mode */ #define S_MEM_TRCV 0x532 /* CI-V trancieve mode */ #define S_MEM_LANG 0x536 /* 0=English 1=Japanese for voice announcer */ #define S_MEM_SCN_SPD 0x556 /* 0 = low; 1 = high */ #define S_MEM_RTTY_FL_PB 0x561 /* 0=250 Hz, 1=300' 2 = 350, 3 = 500, 4 = 1 KHz */ #define S_MEM_RTTY_TWNPK 0x562 /* rtty twin peak filter off/on */ static int ic756pro2_set_ext_parm(RIG *rig, token_t token, value_t val); static int ic756pro2_get_ext_parm(RIG *rig, token_t token, value_t *val); #define IC756PROII_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC756PROII_1HZ_TS_MODES IC756PROII_ALL_RX_MODES #define IC756PROII_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC756PROII_AM_TX_MODES (RIG_MODE_AM) const struct rig_caps ic756pro2_caps = { .rig_model = RIG_MODEL_IC756PROII, .model_name = "IC-756PROII", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC756PRO_FUNC_ALL, .has_set_func = IC756PRO_FUNC_ALL, .has_get_level = IC756PRO_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(IC756PRO_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .extparms = ic756pro2_ext_parms, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, 20, RIG_DBLST_END, }, /* FIXME: TBC */ .attenuator = { 6, 12, 18, 20, RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC756_VFO_OPS, .scan_ops = IC756_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM }, { 100, 101, RIG_MTYPE_EDGE }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(60),IC756PROII_ALL_RX_MODES,-1,-1,IC756_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC756PROII_OTHER_TX_MODES, W(5),W(100),IC756_VFO_ALL,IC756_ANTS), FRQ_RNG_6m(1,IC756PROII_OTHER_TX_MODES, W(5),W(100),IC756_VFO_ALL,IC756_ANTS), FRQ_RNG_HF(1,IC756PROII_AM_TX_MODES, W(2),W(40),IC756_VFO_ALL,IC756_ANTS), /* AM class */ FRQ_RNG_6m(1,IC756PROII_AM_TX_MODES, W(2),W(40),IC756_VFO_ALL,IC756_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(60),IC756PROII_ALL_RX_MODES,-1,-1,IC756_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC756PROII_OTHER_TX_MODES, W(5),W(100),IC756_VFO_ALL,IC756_ANTS), FRQ_RNG_6m(2,IC756PROII_OTHER_TX_MODES, W(5),W(100),IC756_VFO_ALL,IC756_ANTS), FRQ_RNG_HF(2,IC756PROII_AM_TX_MODES, W(2),W(40),IC756_VFO_ALL,IC756_ANTS), /* AM class */ FRQ_RNG_6m(2,IC756PROII_AM_TX_MODES, W(2),W(40),IC756_VFO_ALL,IC756_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {IC756PROII_1HZ_TS_MODES,1}, {IC756PROII_ALL_RX_MODES,kHz(1)}, {IC756PROII_ALL_RX_MODES,kHz(5)}, {IC756PROII_ALL_RX_MODES,kHz(9)}, {IC756PROII_ALL_RX_MODES,kHz(10)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_RTTY, kHz(2.4)}, {RIG_MODE_CW, Hz(500)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_FM, kHz(8)}, RIG_FLT_END, }, .str_cal = IC756PRO_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic756pro2_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ptt = icom_set_ptt, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .get_ts = icom_get_ts, .set_rptr_shift = icom_set_rptr_shift, .get_rptr_shift = icom_get_rptr_shift, .set_rptr_offs = icom_set_rptr_offs, .get_rptr_offs = icom_get_rptr_offs, .set_ctcss_tone = icom_set_ctcss_tone, .get_ctcss_tone = icom_get_ctcss_tone, .set_ctcss_sql = icom_set_ctcss_sql, .get_ctcss_sql = icom_get_ctcss_sql, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, .get_split_vfo = icom_mem_get_split_vfo, .set_ext_parm = ic756pro2_set_ext_parm, .get_ext_parm = ic756pro2_get_ext_parm, }; /* * Assumes rig!=NULL, rig->state.priv!=NULL */ static int ic756pro2_set_ext_parm(RIG *rig, token_t token, value_t val) { unsigned char epbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int ack_len, ep_len, val_len; int ep_cmd = C_CTL_MEM; int ep_sc; /* Subcommand in $1A $05xx */ int icom_val = 0; int retval; ep_len = 0; /* 0 implies BCD data */ val_len = 1; switch(token) { case TOK_SSBBASS: ep_sc = S_MEM_SBASS ; icom_val = val.f; break; case TOK_MEMNAME: ep_sc = S_MEM_NAME; icom_val = val.i ? 1 : 0; break; case TOK_SQLCTRL: ep_sc = S_MEM_SQL_CTL; /* TODO: check range this actually doesn't decode the input type 'string' */ icom_val = val.i; break; case TOK_MYCALL: /* max 10 ASCII char */ ep_len = strlen(val.cs); if (ep_len > 10) return -RIG_EINVAL; ep_sc = S_MEM_MYCALL; memcpy(epbuf, val.cs, ep_len); break; case TOK_RTTY_FLTR: /* RTTY filter mode 0 - 4 = 250, 300, 350, 500, 1000 */ if (val.i < 0 || val.i > 4) return -RIG_EINVAL; ep_sc = S_MEM_RTTY_FL_PB; icom_val = val.i; break; default: return -RIG_EINVAL; } if (ep_len == 0) { to_bcd_be(epbuf, (long long)icom_val, val_len*2); ep_len += val_len; } retval = icom_transaction (rig, ep_cmd, ep_sc, epbuf, ep_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR, "%s: ack NG (%#.2x), " "len=%d\n", __FUNCTION__, ackbuf[0], ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * Assumes rig!=NULL, rig->state.priv!=NULL * and val points to a buffer big enough to hold the conf value. */ static int ic756pro2_get_ext_parm(RIG *rig, token_t token, value_t *val) { const struct confparams *cfp; unsigned char resbuf[MAXFRAMELEN]; int res_len, icom_val=0; int cmdhead; int retval; int ep_cmd = C_CTL_MEM; int ep_sc; /* Subcommand in $1A $05xx */ switch(token) { case TOK_SSBBASS: ep_sc = S_MEM_SBASS ; break; case TOK_MEMNAME: ep_sc = S_MEM_NAME; break; case TOK_SQLCTRL: ep_sc = S_MEM_SQL_CTL; break; case TOK_MYCALL: /* max 10 ASCII char */ ep_sc = S_MEM_MYCALL; break; case TOK_RTTY_FLTR: /* RTTY filter mode 0 - 4 */ ep_sc = S_MEM_RTTY_FL_PB; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_ext_parm %d", token); return -RIG_EINVAL; } retval = icom_transaction (rig, ep_cmd, ep_sc, NULL, 0, resbuf, &res_len); if (retval != RIG_OK) return retval; /* * strbuf should contain Cn,Sc,Data area */ cmdhead = (ep_sc == -1) ? 1:S_MEM_SC_LEN + 1; res_len -= cmdhead; /* should echo cmd, subcmd and then data, if you get an ack something is wrong */ if (resbuf[0] != ep_cmd) { if (resbuf[0] == ACK) { rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), " "len=%d\n", __FUNCTION__,resbuf[0],res_len); return -RIG_EPROTO; } else { rig_debug(RIG_DEBUG_ERR,"%s: ack NG (%#.2x), " "len=%d\n", __FUNCTION__,resbuf[0],res_len); return -RIG_ERJCTED; } } cfp = rig_ext_lookup_tok(rig, token); switch(cfp->type) { case RIG_CONF_STRING: memcpy(val->s, resbuf, res_len); break; case RIG_CONF_CHECKBUTTON: case RIG_CONF_COMBO: val->i = from_bcd_be(resbuf+cmdhead, res_len*2); break; case RIG_CONF_NUMERIC: val->f = from_bcd_be(resbuf+cmdhead, res_len*2); break; default: rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), " "len=%d\n", __FUNCTION__,resbuf[0],res_len); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE,"%s: %d %d %d %f\n", __FUNCTION__, res_len, icom_val, val->i, val->f); return RIG_OK; } /* * ic756proIII rig capabilities. * * TODO: check every paramters, * add antenna capabilities */ static const struct icom_priv_caps ic756pro3_priv_caps = { 0x6e, /* default address */ 0, /* 731 mode */ ic756pro_ts_sc_list }; #define IC756PROIII_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC756PROIII_1HZ_TS_MODES IC756PROIII_ALL_RX_MODES #define IC756PROIII_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC756PROIII_AM_TX_MODES (RIG_MODE_AM) #define IC756PROIII_VFO_ALL (RIG_VFO_MAIN|RIG_VFO_SUB|RIG_VFO_MEM) #define IC756PROIII_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT|RIG_PARM_APO|RIG_PARM_TIME|RIG_PARM_BEEP) /* * TODO: check whether all func and levels are stored in memory * * No memory split support. * .rptr_offs = 1, to be done for FM special mode * * Channel description should be possible through: 0x1a 0x00 * c.f. http://www.plicht.de/ekki/civ/civ-p4305-756pro.html */ #define IC756PROIII_MEM_CAP { \ .ant = 1, \ .tuning_step = 1, \ .freq = 1, \ .mode = 1, \ .width = 1, \ .ctcss_tone = 1, \ .ctcss_sql = 1, \ .funcs = IC756PRO_FUNC_ALL, \ .levels = RIG_LEVEL_SET(IC756PRO_LEVEL_ALL), \ } const struct rig_caps ic756pro3_caps = { .rig_model = RIG_MODEL_IC756PROIII, .model_name = "IC-756PROIII", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC756PRO_FUNC_ALL, .has_set_func = IC756PRO_FUNC_ALL, .has_get_level = IC756PRO_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(IC756PRO_LEVEL_ALL), .has_get_parm = IC756PROIII_PARMS, .has_set_parm = RIG_PARM_SET(IC756PROIII_PARMS), .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .extparms = ic756pro2_ext_parms, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, 20, RIG_DBLST_END, }, /* FIXME: TBC values */ .attenuator = { 6, 12, 18, RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC756_VFO_OPS|RIG_OP_TUNE, .scan_ops = IC756_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 10, /* TODO */ .chan_list = { { 1, 99, RIG_MTYPE_MEM, IC756PROIII_MEM_CAP }, { 100, 101, RIG_MTYPE_EDGE, IC756PROIII_MEM_CAP }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(60),IC756PROIII_ALL_RX_MODES,-1,-1,IC756PROIII_VFO_ALL,IC756_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC756PROIII_OTHER_TX_MODES, W(5),W(100),IC756PROIII_VFO_ALL,IC756_ANTS), FRQ_RNG_6m(1,IC756PROIII_OTHER_TX_MODES, W(5),W(100),IC756PROIII_VFO_ALL,IC756_ANTS), FRQ_RNG_HF(1,IC756PROIII_AM_TX_MODES, W(5),W(40),IC756PROIII_VFO_ALL,IC756_ANTS), /* AM class */ FRQ_RNG_6m(1,IC756PROIII_AM_TX_MODES, W(5),W(40),IC756PROIII_VFO_ALL,IC756_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(60),IC756PROIII_ALL_RX_MODES,-1,-1,IC756PROIII_VFO_ALL,IC756_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC756PROIII_OTHER_TX_MODES, W(5),W(100),IC756PROIII_VFO_ALL,IC756_ANTS), FRQ_RNG_6m(2,IC756PROIII_OTHER_TX_MODES, W(5),W(100),IC756PROIII_VFO_ALL,IC756_ANTS), FRQ_RNG_HF(2,IC756PROIII_AM_TX_MODES, W(5),W(40),IC756PROIII_VFO_ALL,IC756_ANTS), /* AM class */ FRQ_RNG_6m(2,IC756PROIII_AM_TX_MODES, W(5),W(40),IC756PROIII_VFO_ALL,IC756_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {IC756PROIII_1HZ_TS_MODES,1}, {IC756PROIII_1HZ_TS_MODES,100}, {IC756PROIII_ALL_RX_MODES,kHz(1)}, {IC756PROIII_ALL_RX_MODES,kHz(5)}, {IC756PROIII_ALL_RX_MODES,kHz(9)}, {IC756PROIII_ALL_RX_MODES,kHz(10)}, {IC756PROIII_ALL_RX_MODES,kHz(12.5)}, {IC756PROIII_ALL_RX_MODES,kHz(20)}, {IC756PROIII_ALL_RX_MODES,kHz(25)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(2.4)}, {RIG_MODE_CW|RIG_MODE_CWR, Hz(500)}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(3.6)}, /* wide */ {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(50)}, /* narrow */ {RIG_MODE_AM, kHz(6)}, {RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_FM, kHz(8)}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR, RIG_FLT_ANY}, /* almost any filter */ RIG_FLT_END, }, .str_cal = IC756PRO_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic756pro3_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .decode_event = icom_decode_event, .set_parm = icom_set_parm, .get_parm = icom_get_parm, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ptt = icom_set_ptt, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .get_ts = icom_get_ts, .set_ctcss_tone = icom_set_ctcss_tone, .get_ctcss_tone = icom_get_ctcss_tone, .set_ctcss_sql = icom_set_ctcss_sql, .get_ctcss_sql = icom_get_ctcss_sql, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, .get_split_vfo = icom_mem_get_split_vfo, .set_ext_parm = ic756pro2_set_ext_parm, .get_ext_parm = ic756pro2_get_ext_parm, }; hamlib-1.2.15.3/icom/ic775.c0000644000175000017500000001347712044564477012100 00000000000000/* * Hamlib CI-V backend - description of IC-775 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "icom.h" #include "bandplan.h" #define IC775_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FM) #define IC775_1MHZ_TS_MODES (RIG_MODE_AM|RIG_MODE_FM) #define IC775_1HZ_TS_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY) /* * 100W in all modes but AM (40W) */ #define IC775_OTHER_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FM) #define IC775_AM_TX_MODES (RIG_MODE_AM) #define IC775_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC775_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO) #define IC775_ANTS RIG_ANT_1 /* */ static const struct icom_priv_caps ic775_priv_caps = { 0x46, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic775_caps = { .rig_model = RIG_MODEL_IC775, .model_name = "IC-775", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 19200, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC775_VFO_OPS, .scan_ops = RIG_SCAN_NONE, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 10, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, { 11, 12, RIG_MTYPE_EDGE, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(30),IC775_ALL_RX_MODES,-1,-1,IC775_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC775_OTHER_TX_MODES, W(10),W(100),IC775_VFO_ALL,IC775_ANTS), FRQ_RNG_HF(1,IC775_AM_TX_MODES, W(10),W(40),IC775_VFO_ALL,IC775_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(30),IC775_ALL_RX_MODES,-1,-1,IC775_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { {kHz(1800),MHz(2)-1,IC775_OTHER_TX_MODES,5000,100000,IC775_VFO_ALL}, /* 100W class */ {kHz(1800),MHz(2)-1,IC775_AM_TX_MODES,2000,40000,IC775_VFO_ALL}, /* 40W class */ {kHz(3500),MHz(4)-1,IC775_OTHER_TX_MODES,5000,100000,IC775_VFO_ALL}, {kHz(3500),MHz(4)-1,IC775_AM_TX_MODES,2000,40000,IC775_VFO_ALL}, {MHz(7),kHz(7300),IC775_OTHER_TX_MODES,5000,100000,IC775_VFO_ALL}, {MHz(7),kHz(7300),IC775_AM_TX_MODES,2000,40000,IC775_VFO_ALL}, {kHz(10100),kHz(10150),IC775_OTHER_TX_MODES,5000,100000,IC775_VFO_ALL}, {kHz(10100),kHz(10150),IC775_AM_TX_MODES,2000,40000,IC775_VFO_ALL}, {MHz(14),kHz(14350),IC775_OTHER_TX_MODES,5000,100000,IC775_VFO_ALL}, {MHz(14),kHz(14350),IC775_AM_TX_MODES,2000,40000,IC775_VFO_ALL}, {kHz(18068),kHz(18168),IC775_OTHER_TX_MODES,5000,100000,IC775_VFO_ALL}, {kHz(18068),kHz(18168),IC775_AM_TX_MODES,2000,40000,IC775_VFO_ALL}, {MHz(21),kHz(21450),IC775_OTHER_TX_MODES,5000,100000,IC775_VFO_ALL}, {MHz(21),kHz(21450),IC775_AM_TX_MODES,2000,40000,IC775_VFO_ALL}, {kHz(24890),kHz(24990),IC775_OTHER_TX_MODES,5000,100000,IC775_VFO_ALL}, {kHz(24890),kHz(24990),IC775_AM_TX_MODES,2000,40000,IC775_VFO_ALL}, {MHz(28),kHz(29700),IC775_OTHER_TX_MODES,5000,100000,IC775_VFO_ALL}, {MHz(28),kHz(29700),IC775_AM_TX_MODES,2000,40000,IC775_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {IC775_1HZ_TS_MODES,1}, {IC775_ALL_RX_MODES,10}, {IC775_ALL_RX_MODES,100}, {IC775_ALL_RX_MODES,kHz(1)}, {IC775_ALL_RX_MODES,kHz(5)}, {IC775_ALL_RX_MODES,kHz(9)}, {IC775_ALL_RX_MODES,kHz(10)}, {IC775_ALL_RX_MODES,12500}, {IC775_ALL_RX_MODES,kHz(20)}, {IC775_ALL_RX_MODES,kHz(25)}, {IC775_ALL_RX_MODES,kHz(100)}, {IC775_1MHZ_TS_MODES,MHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.4)}, /* bultin FL-272 */ {RIG_MODE_AM, kHz(8)}, /* mid w/ bultin FL-94 */ {RIG_MODE_AM, kHz(2.4)}, /* narrow w/ bultin FL-272 */ {RIG_MODE_FM, kHz(15)}, /* ?? TBC, mid w/ bultin FL-23+SFPC455E */ {RIG_MODE_FM, kHz(8)}, /* narrow w/ bultin FL-94 */ RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic775_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/ic271.c0000644000175000017500000000740212044564477012056 00000000000000/* * Hamlib CI-V backend - description of IC-271 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "icom.h" #define IC271_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define IC271_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC271_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO) /* * IC-271 A/E * IC-271 H is high power (75W) * * Independant transmit/receive * * specs: http://www.qsl.net/sm7vhs/radio/icom/Ic271/specs.htm * * Please report testing / patches. Some capabilities may be missing too. --sf */ static const struct icom_priv_caps ic271_priv_caps = { 0x20, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic271_caps = { .rig_model = RIG_MODEL_IC271, .model_name = "IC-271", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .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 = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC271_VFO_OPS, .scan_ops = RIG_SCAN_NONE, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 32, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {MHz(144),MHz(146),IC271_MODES,-1,-1,IC271_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { {MHz(144),MHz(146),IC271_MODES,W(2.5),W(25),IC271_VFO_ALL}, RIG_FRNG_END, }, .rx_range_list2 = { {MHz(143.8),MHz(148.2),IC271_MODES,-1,-1,IC271_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { {MHz(144),MHz(148),IC271_MODES,W(2.5),W(25),IC271_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {IC271_MODES,10}, /* TBC: does this rig supports settin tuning step? */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.4)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic271_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/icr8500.c0000644000175000017500000001255012044564477012323 00000000000000/* * Hamlib CI-V backend - IC-R8500 description * Copyright (c) 2000-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "idx_builtin.h" #include "icom.h" #define ICR8500_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FM|RIG_MODE_WFM) #define ICR8500_1MHZ_TS_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define ICR8500_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_TSQL|RIG_FUNC_APF) #define ICR8500_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_APF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR) #define ICR8500_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL) #define ICR8500_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO|RIG_SCAN_SLCT|RIG_SCAN_PRIO) /* FIXME: real measure */ #define ICR8500_STR_CAL { 16, { \ { 0, -54 }, /* S0 */ \ { 10, -48 }, \ { 32, -42 }, \ { 46, -36 }, \ { 62, -30 }, \ { 82, -24 }, \ { 98, -18 }, \ { 112, -12 }, \ { 124, -6 }, \ { 134, 0 }, /* S9 */ \ { 156, 10 }, \ { 177, 20 }, \ { 192, 30 }, \ { 211, 40 }, \ { 228, 50 }, \ { 238, 60 }, \ } } static const struct icom_priv_caps icr8500_priv_caps = { 0x4a, /* default address */ 0, /* 731 mode */ r8500_ts_sc_list }; /* * ICR8500 rigs capabilities. */ const struct rig_caps icr8500_caps = { .rig_model = RIG_MODEL_ICR8500, .model_name = "ICR-8500", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = ICR8500_FUNC_ALL, .has_get_level = ICR8500_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(ICR8500_LEVEL_ALL|RIG_LEVEL_AF), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = NULL, /* FIXME: CTCSS/DCS list */ .dcs_list = NULL, .preamp = { 10, RIG_DBLST_END, }, .attenuator = { 20, RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = ICR8500_OPS, .scan_ops = ICR8500_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 12, .chan_desc_sz = 0, .str_cal = ICR8500_STR_CAL, .chan_list = { /* FIXME: memory channel list */ { 1, 999, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100),MHz(824)-10,ICR8500_MODES,-1,-1, RIG_VFO_A}, {MHz(849)+10,MHz(869)-10,ICR8500_MODES,-1,-1, RIG_VFO_A}, {MHz(894)+10,GHz(2)-10,ICR8500_MODES,-1,-1, RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(824)-10,ICR8500_MODES,-1,-1, RIG_VFO_A}, {MHz(849)+10,MHz(869)-10,ICR8500_MODES,-1,-1, RIG_VFO_A}, {MHz(894)+10,GHz(2)-10,ICR8500_MODES,-1,-1, RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, /* no TX ranges, this is a receiver */ .tuning_steps = { {ICR8500_MODES,10}, {ICR8500_MODES,50}, {ICR8500_MODES,100}, {ICR8500_MODES,kHz(1)}, {ICR8500_MODES,2500}, {ICR8500_MODES,kHz(5)}, {ICR8500_MODES,kHz(9)}, {ICR8500_MODES,kHz(10)}, {ICR8500_MODES,12500}, {ICR8500_MODES,kHz(20)}, {ICR8500_MODES,kHz(25)}, {ICR8500_MODES,kHz(100)}, {ICR8500_1MHZ_TS_MODES,MHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { /* FIXME: To be confirmed! --SF */ {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.4)}, {RIG_MODE_AM, kHz(8)}, {RIG_MODE_AM, kHz(2.4)}, /* narrow */ {RIG_MODE_AM, kHz(15)}, /* wide */ {RIG_MODE_FM, kHz(15)}, {RIG_MODE_FM, kHz(8)}, /* narrow */ {RIG_MODE_WFM, kHz(230)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&icr8500_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ts = icom_set_ts, .get_ts = icom_get_ts, .get_dcd = icom_get_dcd, }; /* * Function definitions below */ hamlib-1.2.15.3/icom/ic275.c0000644000175000017500000000733712044564477012071 00000000000000/* * Hamlib CI-V backend - description of IC-275 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "icom.h" #define IC275_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define IC275_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC275_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO) /* * FIXME: this appears to be the IC-275A/E * what about the IC-275H ? please give it a fix. --SF */ static const struct icom_priv_caps ic275_priv_caps = { 0x10, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic275_caps = { .rig_model = RIG_MODEL_IC275, .model_name = "IC-275", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .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 = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC275_VFO_OPS, .scan_ops = RIG_SCAN_NONE, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, { 100, 101, RIG_MTYPE_EDGE, IC_MIN_MEM_CAP }, { 102, 102, RIG_MTYPE_CALL, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {MHz(138),MHz(174),IC275_MODES,-1,-1,IC275_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { {MHz(144),MHz(146),IC275_MODES,W(2.5),W(25),IC275_VFO_ALL}, RIG_FRNG_END, }, .rx_range_list2 = { {MHz(138),MHz(174),IC275_MODES,-1,-1,IC275_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { {MHz(144),MHz(148),IC275_MODES,W(2.5),W(25),IC275_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {IC275_MODES,10}, /* TBC: does this rig supports settin tuning step? */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.2)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic275_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/ic737.c0000644000175000017500000001122012044564477012056 00000000000000/* * Hamlib CI-V backend - description of IC-737 * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "icom.h" /* * IC-737 */ #define IC737_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) /* * 100W in all modes but AM (40W) */ #define IC737_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define IC737_AM_TX_MODES (RIG_MODE_AM) #define IC737_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC737_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_CPY) #define IC737_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_PROG|RIG_SCAN_VFO) #define IC737_ANTS (RIG_ANT_1|RIG_ANT_2) static const struct icom_priv_caps ic737_priv_caps = { 0x3c, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic737_caps = { .rig_model = RIG_MODEL_IC737, .model_name = "IC-737", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 19200, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC737_VFO_OPS, .scan_ops = IC737_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 100, RIG_MTYPE_MEM }, { 101, 101, RIG_MTYPE_EDGE }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(30),IC737_ALL_RX_MODES,-1,-1,IC737_VFO_ALL,IC737_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC737_OTHER_TX_MODES, W(10),W(100),IC737_VFO_ALL,IC737_ANTS), FRQ_RNG_HF(1,IC737_AM_TX_MODES, W(10),W(40),IC737_VFO_ALL,IC737_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(30),IC737_ALL_RX_MODES,-1,-1,IC737_VFO_ALL,IC737_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC737_OTHER_TX_MODES, W(10),W(100),IC737_VFO_ALL,IC737_ANTS), FRQ_RNG_HF(2,IC737_AM_TX_MODES, W(10),W(40),IC737_VFO_ALL,IC737_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {IC737_ALL_RX_MODES,10}, {IC737_ALL_RX_MODES,kHz(1)}, {IC737_ALL_RX_MODES,kHz(2)}, {IC737_ALL_RX_MODES,kHz(3)}, {IC737_ALL_RX_MODES,kHz(4)}, {IC737_ALL_RX_MODES,kHz(5)}, {IC737_ALL_RX_MODES,kHz(6)}, {IC737_ALL_RX_MODES,kHz(7)}, {IC737_ALL_RX_MODES,kHz(8)}, {IC737_ALL_RX_MODES,kHz(9)}, {IC737_ALL_RX_MODES,kHz(10)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.1)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic737_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ts = icom_set_ts, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, }; hamlib-1.2.15.3/icom/ic78.c0000644000175000017500000001154612044564477012007 00000000000000/* * Hamlib CI-V backend - description of IC-78 * Copyright (c) 2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "icom.h" #include "bandplan.h" #include "idx_builtin.h" #define IC78_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define IC78_OTHER_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define IC78_AM_TX_MODES (RIG_MODE_AM) #define IC78_FUNC_ALL (RIG_FUNC_NB|RIG_FUNC_COMP) #define IC78_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_RAWSTR|RIG_LEVEL_RF|RIG_LEVEL_AF|RIG_LEVEL_SQL) #define IC78_VFO_ALL (RIG_VFO_A|RIG_VFO_MEM) #define IC78_VFO_OPS (RIG_OP_NONE) #define IC78_SCAN_OPS (RIG_SCAN_VFO|RIG_SCAN_MEM) #define IC78_ANTS (RIG_ANT_1) /* * IC78_STR_CAL is what the S-meter displays * * FIXME: real measures! */ #define IC78_STR_CAL { 2, \ { \ { 0, -60 }, \ { 255, 60 } \ } } /* * ic78 rigs capabilities. */ static const struct icom_priv_caps ic78_priv_caps = { 0x62, /* default address */ 0, /* 731 mode */ ic706_ts_sc_list }; const struct rig_caps ic78_caps = { .rig_model = RIG_MODEL_IC78, .model_name = "IC-78", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC78_FUNC_ALL, .has_set_func = IC78_FUNC_ALL, .has_get_level = IC78_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(IC78_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .preamp = { 10, 20, RIG_DBLST_END, }, .attenuator = { 20, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC78_VFO_OPS, .scan_ops = IC78_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM }, { 100, 100, RIG_MTYPE_CALL }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(30)-1,IC78_ALL_RX_MODES,-1,-1,IC78_VFO_ALL,IC78_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC78_OTHER_TX_MODES, W(2),W(100),IC78_VFO_ALL,IC78_ANTS), FRQ_RNG_HF(1,IC78_AM_TX_MODES, W(2),W(40),IC78_VFO_ALL,IC78_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(30)-1,IC78_ALL_RX_MODES,-1,-1,IC78_VFO_ALL,IC78_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC78_OTHER_TX_MODES, W(2),W(100),IC78_VFO_ALL,IC78_ANTS), FRQ_RNG_HF(2,IC78_AM_TX_MODES, W(2),W(40),IC78_VFO_ALL,IC78_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {IC78_ALL_RX_MODES,10}, {IC78_ALL_RX_MODES,100}, {IC78_ALL_RX_MODES,kHz(1)}, {IC78_ALL_RX_MODES,kHz(5)}, {IC78_ALL_RX_MODES,kHz(9)}, {IC78_ALL_RX_MODES,kHz(10)}, {IC78_ALL_RX_MODES,12500}, {IC78_ALL_RX_MODES,kHz(20)}, {IC78_ALL_RX_MODES,kHz(25)}, {IC78_ALL_RX_MODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_AM, kHz(6)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_CWR|RIG_MODE_RTTYR|RIG_MODE_AM, kHz(2.4)}, RIG_FLT_END, }, .str_cal = IC78_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic78_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_mem = icom_set_mem, .scan = icom_scan, .get_dcd = icom_get_dcd, }; hamlib-1.2.15.3/icom/icr72.c0000644000175000017500000001000012044564477012143 00000000000000/* * Hamlib CI-V backend - description of IC-R72 * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "icom.h" #define ICR72_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define ICR72_FUNC_ALL (RIG_FUNC_NONE) #define ICR72_LEVEL_ALL (RIG_LEVEL_NONE) #define ICR72_VFO_OPS (RIG_OP_TO_VFO|RIG_OP_FROM_VFO|RIG_OP_MCL) #define ICR72_VFO_ALL (RIG_VFO_A|RIG_VFO_MEM) #define ICR71_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL) #define ICR72_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO|RIG_SCAN_SLCT|RIG_SCAN_PRIO) static const struct icom_priv_caps icr72_priv_caps = { 0x32, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps icr72_caps = { .rig_model = RIG_MODEL_ICR72, .model_name = "IC-R72", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .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 = 3, .has_get_func = ICR72_FUNC_ALL, .has_set_func = ICR72_FUNC_ALL, .has_get_level = ICR72_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(ICR72_LEVEL_ALL), .has_get_parm = RIG_PARM_ANN, .has_set_parm = RIG_PARM_ANN, .level_gran = {}, /* 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, .vfo_ops = ICR72_VFO_OPS, .scan_ops = ICR72_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100),MHz(30),ICR72_MODES,-1,-1,ICR72_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(30),ICR72_MODES,-1,-1,ICR72_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {ICR72_MODES,Hz(10)}, {ICR72_MODES,kHz(1)}, {ICR72_MODES,kHz(2)}, {ICR72_MODES,kHz(3)}, {ICR72_MODES,kHz(4)}, {ICR72_MODES,kHz(5)}, {ICR72_MODES,kHz(6)}, {ICR72_MODES,kHz(7)}, {ICR72_MODES,kHz(8)}, {ICR72_MODES,kHz(9)}, {ICR72_MODES,kHz(10)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.3)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&icr72_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .get_level = icom_get_level, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .get_ts = icom_get_ts, .scan = icom_scan, }; hamlib-1.2.15.3/icom/ic910.c0000644000175000017500000002736512044564477012070 00000000000000/* * Hamlib CI-V backend - description of IC-910 (VHF/UHF All-Mode Tranceiver) * Contributed by Francois Retief * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "icom.h" #include "icom_defs.h" #include "frame.h" #include "idx_builtin.h" /* * It seems some IC910 out there have weird firmware. Uncomment the following * if your modes are wrong, and please report to hamlib-developer maillist * with firmware number. That'd be interesting to have a word from Icom * on this subject, and if firmware updates are possible. */ #ifdef HAVE_WEIRD_IC910_MODES static int ic910_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { /* FIX: The IC-910 has "Set FM" = 4, which is RTTY in for other radios */ if (mode == RIG_MODE_FM) { mode = RIG_MODE_RTTY; } return icom_set_mode(rig, vfo, mode, width); } static int ic910_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { /* FIX: The IC-910 has "Set FM" = 4, which is RTTY in for other radios */ int retval = icom_get_mode(rig, vfo, mode, width); if (*mode == RIG_MODE_RTTY) { *mode = RIG_MODE_FM; } return retval; } #endif /* HAVE_WEIRD_IC910_MODES */ /* this function compares 2 frequencies * returns 1 if they are in the same band * returns 0 if they are in different bands */ static int compareFrequencies (RIG* rig, freq_t freq1, freq_t freq2) { int freq1band=0, freq2band=0; freq_range_t noband = RIG_FRNG_END; while (rig->caps->rx_range_list1[freq1band].start!=noband.start) { if (freq1 >= rig->caps->rx_range_list1[freq1band].start && freq1 <= rig->caps->rx_range_list1[freq1band].end) break; ++freq1band; //fprintf(stderr, "%i\n", freq1band); } while (rig->caps->rx_range_list1[freq2band].start!=noband.start) { if (freq2 >= rig->caps->rx_range_list1[freq2band].start && freq2 <= rig->caps->rx_range_list1[freq2band].end) break; ++freq2band; } if (freq2band == freq1band) return 1; else return 0; } /* swaps main and sub band - but preserves PREAMP, MODE * they are also exchanged, but we do not want that */ static int icom_swap_bands(RIG* rig) { /* TODO: actually use retval! */ int retval=0; rmode_t mmode, smode; /* used to store the mode */ pbwidth_t mwidth, swidth; /* used to store the width */ value_t mpreamp, spreamp; /* used to store preamp */ value_t matt, satt; /* used to store attenuation */ /* main band get values */ icom_set_vfo(rig, RIG_VFO_MAIN); /* get the mode, width, preamp */ icom_get_mode(rig, RIG_VFO_CURR, &mmode, &mwidth); icom_get_level(rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, &mpreamp); icom_get_level(rig, RIG_VFO_CURR, RIG_LEVEL_ATT, &matt); /* sub band get values */ icom_set_vfo(rig, RIG_VFO_SUB); /* get the mode, width, preamp, att */ icom_get_mode(rig, RIG_VFO_CURR, &smode, &swidth); icom_get_level(rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, &spreamp); icom_get_level(rig, RIG_VFO_CURR, RIG_LEVEL_ATT, &satt); /* now, we can exchange the bands */ icom_vfo_op(rig, RIG_VFO_CURR, RIG_OP_XCHG); /* restore the sub vales NOTE: sub band is still active */ /* set the mode, width, preamp */ icom_set_mode(rig, RIG_VFO_CURR, smode, swidth); icom_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, spreamp); icom_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_ATT, satt); /* restore main band values */ icom_set_vfo(rig, RIG_VFO_MAIN); /* set the mode, width, preamp */ icom_set_mode(rig, RIG_VFO_CURR, mmode, mwidth); icom_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, mpreamp); icom_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_ATT, matt); return retval; } static int ic910_set_freq(RIG* rig, vfo_t vfo, freq_t freq) { int retval; freq_t otherfreq; freq_t oldfreq; if (vfo==RIG_VFO_CURR) { /* try to detect active subband */ retval=icom_get_freq(rig, RIG_VFO_CURR, &oldfreq); if (retval!=RIG_OK) return retval; icom_set_vfo(rig, RIG_VFO_SUB); retval=icom_get_freq(rig, RIG_VFO_CURR, &otherfreq); if (retval!=RIG_OK) return retval; if (otherfreq == oldfreq) { /* were already in subband */ vfo = RIG_VFO_SUB; icom_set_vfo(rig, RIG_VFO_MAIN); retval=icom_get_freq(rig, RIG_VFO_CURR, &otherfreq); if (retval!=RIG_OK) return retval; } else { /* we were in mainband */ vfo = RIG_VFO_MAIN; } } else { /* get the freq of the other band */ if (vfo==RIG_VFO_MAIN) icom_set_vfo(rig, RIG_VFO_SUB); else icom_set_vfo(rig, RIG_VFO_MAIN); retval=icom_get_freq(rig, RIG_VFO_CURR, &otherfreq); if (retval!=RIG_OK) return retval; } if (compareFrequencies(rig, freq, otherfreq) == 0) icom_swap_bands(rig); icom_set_vfo(rig, vfo); return icom_set_freq(rig, RIG_VFO_CURR, freq); } /* * This function does the special bandwidth coding for IC-910 * (1 - normal, 2 - narrow) */ static int ic910_r2i_mode(RIG *rig, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd) { int err; err = rig2icom_mode(rig, mode, width, md, pd); if (*pd == PD_NARROW_3) *pd = PD_NARROW_2; return err; } #define IC910_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_FM) #define IC910_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_FM) #define IC910_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MAIN|RIG_VFO_SUB|RIG_VFO_MEM) #define IC910_SCAN_OPS (RIG_SCAN_MEM) #define IC910_VFO_OPS (RIG_OP_FROM_VFO| \ RIG_OP_TO_VFO| \ RIG_OP_CPY| \ RIG_OP_MCL| \ RIG_OP_XCHG) #define IC910_FUNC_ALL (RIG_FUNC_FAGC| \ RIG_FUNC_NB| \ RIG_FUNC_NR| \ RIG_FUNC_ANF| \ RIG_FUNC_TONE| \ RIG_FUNC_TSQL| \ RIG_FUNC_COMP| \ RIG_FUNC_VOX| \ RIG_FUNC_FBKIN| \ RIG_FUNC_AFC| \ RIG_FUNC_SATMODE| \ RIG_FUNC_SCOPE) #define IC910_LEVEL_ALL (RIG_LEVEL_AF| \ RIG_LEVEL_RF| \ RIG_LEVEL_SQL| \ RIG_LEVEL_IF| \ RIG_LEVEL_NR| \ RIG_LEVEL_CWPITCH| \ RIG_LEVEL_RFPOWER| \ RIG_LEVEL_MICGAIN| \ RIG_LEVEL_KEYSPD| \ RIG_LEVEL_COMP| \ RIG_LEVEL_VOXGAIN| \ RIG_LEVEL_VOXDELAY| \ RIG_LEVEL_ANTIVOX| \ RIG_LEVEL_ATT| \ RIG_LEVEL_PREAMP) #define IC910_STR_CAL UNKNOWN_IC_STR_CAL /* FIXME */ /* */ static const struct icom_priv_caps ic910_priv_caps = { 0x60, /* default address */ 0, /* 731 mode */ ic910_ts_sc_list, .r2i_mode = ic910_r2i_mode }; const struct rig_caps ic910_caps = { .rig_model = RIG_MODEL_IC910, .model_name = "IC-910", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC910_FUNC_ALL, .has_set_func = IC910_FUNC_ALL | RIG_FUNC_RESUME, .has_get_level = IC910_LEVEL_ALL | (RIG_LEVEL_RAWSTR), .has_set_level = IC910_LEVEL_ALL, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = {20, RIG_DBLST_END, }, .attenuator = {20, RIG_DBLST_END, }, .max_rit = Hz(0), /* SSB,CW: +-1.0kHz FM: +-5.0kHz */ .max_xit = Hz(0), .max_ifshift = Hz(0), /* 1.2kHz manual knob */ .targetable_vfo = 0, .vfo_ops = IC910_VFO_OPS, .scan_ops = IC910_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM }, { 100, 105, RIG_MTYPE_EDGE }, { 106, 106, RIG_MTYPE_CALL }, RIG_CHAN_END, }, .rx_range_list1 = { /* USA */ {MHz(144),MHz(148),IC910_MODES,-1,-1,IC910_VFO_ALL}, {MHz(430),MHz(450),IC910_MODES,-1,-1,IC910_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { {MHz(144),MHz(148),IC910_MODES,W(5),W(100),IC910_VFO_ALL}, {MHz(430),MHz(450),IC910_MODES,W(5),W(75),IC910_VFO_ALL}, RIG_FRNG_END, }, .rx_range_list2 = { /* Europe */ {MHz(144),MHz(146),IC910_MODES,-1,-1,IC910_VFO_ALL}, {MHz(430),MHz(440),IC910_MODES,-1,-1,IC910_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { {MHz(144),MHz(146),IC910_MODES,W(5),W(100),IC910_VFO_ALL}, {MHz(430),MHz(440),IC910_MODES,W(5),W(75),IC910_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_SSB|RIG_MODE_CW,1}, {RIG_MODE_SSB|RIG_MODE_CW,10}, {RIG_MODE_SSB|RIG_MODE_CW,50}, {RIG_MODE_SSB|RIG_MODE_CW,100}, {RIG_MODE_FM,kHz(0.1)}, {RIG_MODE_FM,kHz(5)}, {RIG_MODE_FM,kHz(6.25)}, {RIG_MODE_FM,kHz(10)}, {RIG_MODE_FM,kHz(12.5)}, {RIG_MODE_FM,kHz(20)}, {RIG_MODE_FM,kHz(25)}, {RIG_MODE_FM,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_CW | RIG_MODE_SSB, kHz(2.3)}, /* builtin */ {RIG_MODE_CW, Hz(600)}, /* with optional FL-132/Fl133 CW filters */ {RIG_MODE_FM, kHz(15)}, /* builtin */ {RIG_MODE_FM, kHz(6)}, /* builtin */ RIG_FLT_END, }, .str_cal = IC910_STR_CAL, .priv = (void*)&ic910_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .get_freq = icom_get_freq, .set_freq = ic910_set_freq, #ifdef HAVE_WEIRD_IC910_MODES .get_mode = ic910_get_mode, .set_mode = ic910_set_mode, #else .get_mode = icom_get_mode, .set_mode = icom_set_mode, #endif .get_vfo = NULL, .set_vfo = icom_set_vfo, .get_ts = icom_get_ts, .set_ts = icom_set_ts, .get_func = icom_get_func, .set_func = icom_set_func, .get_level = icom_get_level, .set_level = icom_set_level, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .get_dcd = icom_get_dcd, .decode_event = icom_decode_event, .set_split_vfo = icom_set_split_vfo, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, }; /* end of file */ hamlib-1.2.15.3/icom/optoscan.h0000644000175000017500000000424012044564477013061 00000000000000/* * Hamlib CI-V backend - main header * Copyright (c) 2000-2003 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _OPTOSCAN_H #define _OPTOSCAN_H 1 #include #include #include #define TOK_TAPECNTL TOKEN_BACKEND(1) #define TOK_5KHZWIN TOKEN_BACKEND(2) #define TOK_SPEAKER TOKEN_BACKEND(3) #define TOK_AUDIO TOKEN_BACKEND(4) #define TOK_DTMFPEND TOKEN_BACKEND(5) #define TOK_DTMFOVRR TOKEN_BACKEND(6) #define TOK_CTCSSACT TOKEN_BACKEND(7) #define TOK_DCSACT TOKEN_BACKEND(8) #define OPTO_BUFF_SIZE 64 int optoscan_open(RIG *rig); int optoscan_close(RIG *rig); const char* optoscan_get_info(RIG *rig); int optoscan_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone); int optoscan_get_dcs_code(RIG * rig, vfo_t vfo, tone_t *code); int optoscan_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length); int optoscan_set_ext_parm(RIG *rig, token_t token, value_t val); int optoscan_get_ext_parm(RIG *rig, token_t token, value_t *val); int optoscan_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int optoscan_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int optoscan_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch); struct optostat { int remote_control; int DTMF_pending; int DTMF_overrun; int squelch_open; int CTCSS_active; int DCS_active; int tape_enabled; int speaker_enabled; int fivekhz_enabled; int audio_present; }; #endif /* _OPTOSCAN_H */ hamlib-1.2.15.3/icom/ic725.c0000644000175000017500000001040512044564477012057 00000000000000/* * Hamlib CI-V backend - description of IC-725 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "bandplan.h" #include "icom.h" #define IC725_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) /* * 100W in all modes but AM (40W) */ #define IC725_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define IC725_AM_TX_MODES (RIG_MODE_AM) #define IC725_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC725_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_CPY|RIG_OP_MCL) #define IC725_SCAN_OPS (RIG_SCAN_VFO|RIG_SCAN_MEM) /* TBC */ #define IC725_ANTS RIG_ANT_1 /* */ static const struct icom_priv_caps ic725_priv_caps = { 0x28, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic725_caps = { .rig_model = RIG_MODEL_IC725, .model_name = "IC-725", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .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 = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC725_VFO_OPS, .scan_ops = IC725_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 26, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(33)-10,IC725_ALL_RX_MODES,-1,-1,IC725_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(2,IC725_OTHER_TX_MODES, W(10),W(100),IC725_VFO_ALL,IC725_ANTS), FRQ_RNG_HF(2,IC725_AM_TX_MODES, W(10),W(40),IC725_VFO_ALL,IC725_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(33)-10,IC725_ALL_RX_MODES,-1,-1,IC725_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC725_OTHER_TX_MODES, W(10),W(100),IC725_VFO_ALL,IC725_ANTS), FRQ_RNG_HF(2,IC725_AM_TX_MODES, W(10),W(40),IC725_VFO_ALL,IC725_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {IC725_ALL_RX_MODES,10}, /* basic resolution, there's no set_ts */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.3)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic725_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_split_vfo = icom_set_split_vfo, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .scan = icom_scan, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/TODO.icom0000644000175000017500000000012512044564477012476 00000000000000hamlib - (C) 2008 Hamlib Group TODO.icom Test and verify each and every model! hamlib-1.2.15.3/icom/ic718.c0000644000175000017500000001410712044564477012064 00000000000000/* * Hamlib CI-V backend - description of IC-718 caps * Copyright (c) 2000-2010 by Stephane Fillod * Caps submitted by Chuck Gilkes WD0FCL/4 * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "icom.h" #include "idx_builtin.h" #include "bandplan.h" #define IC718_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define IC718_1MHZ_TS_MODES (RIG_MODE_AM) #define IC718_1HZ_TS_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR) /* tx doesn't have WFM. * 100W in all modes but AM (40W) */ #define IC718_OTHER_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define IC718_AM_TX_MODES (RIG_MODE_AM) #define IC718_FUNC_ALL (RIG_FUNC_NR|RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_ANF) #define IC718_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_MICGAIN|RIG_LEVEL_NR|RIG_LEVEL_CWPITCH|RIG_LEVEL_KEYSPD|RIG_LEVEL_RFPOWER|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_RAWSTR|RIG_LEVEL_SQL) #define IC718_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC718_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL) #define IC718_SCAN_OPS (RIG_SCAN_MEM) /* * TODO: check whether func and levels are stored in memory */ #define IC718_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .tx_freq = 1, \ .tx_mode = 1, \ .tx_width = 1, \ } #define IC718_STR_CAL UNKNOWN_IC_STR_CAL static const struct icom_priv_caps IC718_priv_caps = { 0x5e, /* default address */ 0, /* 731 mode */ ic718_ts_sc_list }; const struct rig_caps ic718_caps = { .rig_model = RIG_MODEL_IC718, .model_name = "IC-718", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC718_FUNC_ALL, .has_set_func = IC718_FUNC_ALL, .has_get_level = IC718_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(IC718_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .str_cal = IC718_STR_CAL, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { 10, RIG_DBLST_END, }, .attenuator = { 20, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC718_VFO_OPS, .scan_ops = IC718_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM, IC718_MEM_CAP }, { 100, 101, RIG_MTYPE_EDGE, IC718_MEM_CAP }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(30)-1,IC718_ALL_RX_MODES,-1,-1,IC718_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1, IC718_OTHER_TX_MODES, W(5),W(100),IC718_VFO_ALL,RIG_ANT_1), FRQ_RNG_HF(1, IC718_AM_TX_MODES, W(2),W(40), IC718_VFO_ALL,RIG_ANT_1), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(30)-1,IC718_ALL_RX_MODES,-1,-1,IC718_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2, IC718_OTHER_TX_MODES, W(5),W(100),IC718_VFO_ALL,RIG_ANT_1), FRQ_RNG_HF(2, IC718_AM_TX_MODES, W(2),W(40), IC718_VFO_ALL,RIG_ANT_1), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {IC718_1HZ_TS_MODES,1}, {IC718_ALL_RX_MODES,10}, {IC718_ALL_RX_MODES,100}, {IC718_ALL_RX_MODES,kHz(1)}, {IC718_ALL_RX_MODES,kHz(5)}, {IC718_ALL_RX_MODES,kHz(9)}, {IC718_ALL_RX_MODES,kHz(10)}, {IC718_ALL_RX_MODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.1)}, /* bultin */ {RIG_MODE_CW|RIG_MODE_RTTY, Hz(500)}, /* FL-52A */ {RIG_MODE_CW|RIG_MODE_RTTY, Hz(250)}, /* FL-53A */ {RIG_MODE_SSB, kHz(2.8)}, /* FL-96 */ {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(1.8)}, /* FL-222 */ {RIG_MODE_AM, kHz(6)}, /* mid w/ bultin FL-94 */ {RIG_MODE_AM, kHz(2.4)}, /* narrow w/ bultin FL-272 */ RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&IC718_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .get_ts = icom_get_ts, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, .get_split_vfo = icom_mem_get_split_vfo, }; hamlib-1.2.15.3/icom/ic7200.c0000644000175000017500000001730712044564477012142 00000000000000/* * Hamlib CI-V backend - description of IC-7200 and variations * Adapted by J.Watson from IC-7000 code (c) 2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * 26Mar09: Corrected tuning steps and added data modes. * 25Mar09: Initial release */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include #include "token.h" #include "idx_builtin.h" #include "icom.h" #include "icom_defs.h" #include "frame.h" #include "misc.h" #include "bandplan.h" /* AM Data mode needs adding - this would require one more mode 'RIG_MODE_PKTAM' to rig.h */ #define IC7200_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB) #define IC7200_1HZ_TS_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB) #define IC7200_NOT_TS_MODES (IC7200_ALL_RX_MODES &~IC7200_1HZ_TS_MODES) #define IC7200_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define IC7200_AM_TX_MODES (RIG_MODE_AM) #define IC7200_FUNCS (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_NR|RIG_FUNC_MON|RIG_FUNC_MN|RIG_FUNC_ANF|RIG_FUNC_VSC|RIG_FUNC_LOCK|RIG_FUNC_ARO) #define IC7200_LEVELS (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_COMP|RIG_LEVEL_BKINDL|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY|RIG_LEVEL_SWR|RIG_LEVEL_ALC) #define IC7200_VFOS (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC7200_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT|RIG_PARM_APO|RIG_PARM_TIME|RIG_PARM_BEEP) #define IC7200_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL|RIG_OP_TUNE) #define IC7200_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_PROG|RIG_SCAN_SLCT|RIG_SCAN_PRIO) #define IC7200_ANTS (RIG_ANT_1) /* ant-1 is Hf-6m */ /* * FIXME: This is a guess real measures please! */ #define IC7200_STR_CAL { 2, \ { \ { 0, -60 }, \ { 255, 60 } \ } } /* * IC-7200 rig capabilities. * * TODO: complete command set (esp. the $1A bunch!) and testing.. */ static const struct icom_priv_caps IC7200_priv_caps = { 0x76, /* default address */ 0, /* 731 mode */ ic7200_ts_sc_list }; const struct rig_caps ic7200_caps = { .rig_model = RIG_MODEL_IC7200, .model_name = "IC-7200", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC7200_FUNCS, .has_set_func = IC7200_FUNCS, .has_get_level = IC7200_LEVELS, .has_set_level = RIG_LEVEL_SET(IC7200_LEVELS), .has_get_parm = IC7200_PARMS, .has_set_parm = RIG_PARM_SET(IC7200_PARMS), .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { 10, RIG_DBLST_END, }, /* FIXME: TBC it's a guess*/ .attenuator = { 20, RIG_DBLST_END, }, /* value taken from p.45 of manual*/ .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC7200_VFO_OPS, .scan_ops = IC7200_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 1, .chan_desc_sz = 0, .chan_list = { { 1, 199, RIG_MTYPE_MEM }, { 200, 201, RIG_MTYPE_EDGE }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(60),IC7200_ALL_RX_MODES,-1,-1,IC7200_VFOS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC7200_OTHER_TX_MODES, W(2),W(100),IC7200_VFOS,RIG_ANT_1), FRQ_RNG_6m(1,IC7200_OTHER_TX_MODES, W(2),W(100),IC7200_VFOS,RIG_ANT_1), FRQ_RNG_HF(1,IC7200_AM_TX_MODES, W(1),W(40),IC7200_VFOS,RIG_ANT_1), /* AM class */ FRQ_RNG_6m(1,IC7200_AM_TX_MODES, W(1),W(40),IC7200_VFOS,RIG_ANT_1), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(60),IC7200_ALL_RX_MODES,-1,-1,IC7200_VFOS}, RIG_FRNG_END, }, .tx_range_list2 = { /* needs the 5 mhz channels added */ FRQ_RNG_HF(2,IC7200_OTHER_TX_MODES, W(2),W(100),IC7200_VFOS,RIG_ANT_1), FRQ_RNG_6m(2,IC7200_OTHER_TX_MODES, W(2),W(100),IC7200_VFOS,RIG_ANT_1), FRQ_RNG_HF(2,IC7200_AM_TX_MODES, W(1),W(40),IC7200_VFOS,RIG_ANT_1), /* AM class */ FRQ_RNG_6m(2,IC7200_AM_TX_MODES, W(1),W(40),IC7200_VFOS,RIG_ANT_1), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {IC7200_1HZ_TS_MODES,1}, {IC7200_NOT_TS_MODES,10}, {IC7200_ALL_RX_MODES,Hz(100)}, {IC7200_ALL_RX_MODES,kHz(1)}, {IC7200_ALL_RX_MODES,kHz(5)}, {IC7200_ALL_RX_MODES,kHz(9)}, {IC7200_ALL_RX_MODES,kHz(10)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! But duplication may speed up search. Put the most commonly used modes first! Remember these are defaults, with dsp rigs you can change them to anything you want except FM and WFM which are fixed */ .filters = { {RIG_MODE_SSB, kHz(2.4)}, {RIG_MODE_SSB, kHz(1.8)}, {RIG_MODE_SSB, kHz(3)}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(500)}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(250)}, {RIG_MODE_CW|RIG_MODE_CWR, kHz(1.2)}, {RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(2.4)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_AM, kHz(3)}, {RIG_MODE_AM, kHz(9)}, RIG_FLT_END, }, .str_cal = IC7200_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&IC7200_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = NULL, /*automatically set by rig depending band */ .get_ant = NULL, .set_rit = icom_set_rit, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_parm = NULL, .get_parm = NULL, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ptt = icom_set_ptt, .get_ptt = icom_get_ptt, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .get_ts = NULL, .set_rptr_shift = icom_set_rptr_shift, .get_rptr_shift = NULL, .set_rptr_offs = icom_set_rptr_offs, .get_rptr_offs = icom_get_rptr_offs, .set_ctcss_tone = icom_set_ctcss_tone, .get_ctcss_tone = icom_get_ctcss_tone, .set_ctcss_sql = icom_set_ctcss_sql, .get_ctcss_sql = icom_get_ctcss_sql, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, .get_split_vfo = NULL, }; hamlib-1.2.15.3/icom/ic7600.c0000644000175000017500000002001112044564477012130 00000000000000/* * Hamlib CI-V backend - description of IC-7600 * Copyright (c) 2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include #include "token.h" #include "idx_builtin.h" #include "icom.h" #include "icom_defs.h" #include "frame.h" #include "misc.h" #include "bandplan.h" /* * TODO: PSK and PSKR */ #define IC7600_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC7600_1HZ_TS_MODES IC7600_ALL_RX_MODES #define IC7600_OTHER_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC7600_AM_TX_MODES (RIG_MODE_AM) #define IC7600_FUNCS (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_NR|RIG_FUNC_MON|RIG_FUNC_MN|RIG_FUNC_ANF|RIG_FUNC_VSC|RIG_FUNC_LOCK) #define IC7600_LEVELS (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_COMP|RIG_LEVEL_BKINDL|RIG_LEVEL_BALANCE|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY|RIG_LEVEL_SWR|RIG_LEVEL_ALC) #define IC7600_VFOS (RIG_VFO_MAIN|RIG_VFO_SUB|RIG_VFO_MEM) #define IC7600_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT) #define IC7600_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL|RIG_OP_TUNE) #define IC7600_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO|RIG_SCAN_PROG|RIG_SCAN_DELTA|RIG_SCAN_PRIO) #define IC7600_ANTS (RIG_ANT_1|RIG_ANT_2) /* * Measurement by Roeland, PA3MET */ #define IC7600_STR_CAL { 16, \ { \ { 0, -54 }, /* S0 */ \ { 11, -48 }, \ { 21, -42 }, \ { 34, -36 }, \ { 50, -30 }, \ { 59, -24 }, \ { 75, -18 }, \ { 93, -12 }, \ { 103, -6 }, \ { 124, 0 }, /* S9 */ \ { 145, 10 }, \ { 160, 20 }, \ { 183, 30 }, \ { 204, 40 }, \ { 222, 50 }, \ { 246, 60 } /* S9+60dB */ \ } } /* * IC-7600 rig capabilities. * * TODO: complete command set (esp. the $1A bunch!) and testing.. */ static const struct icom_priv_caps ic7600_priv_caps = { 0x7a, /* default address */ 0, /* 731 mode */ ic756pro_ts_sc_list }; const struct rig_caps ic7600_caps = { .rig_model = RIG_MODEL_IC7600, .model_name = "IC-7600", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC7600_FUNCS, .has_set_func = IC7600_FUNCS, .has_get_level = IC7600_LEVELS, .has_set_level = RIG_LEVEL_SET(IC7600_LEVELS), .has_get_parm = IC7600_PARMS, .has_set_parm = RIG_PARM_SET(IC7600_PARMS), /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, 20, RIG_DBLST_END, }, /* FIXME: TBC */ .attenuator = { 6, 12, 18, RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC7600_VFO_OPS, .scan_ops = IC7600_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM }, { 100, 101, RIG_MTYPE_EDGE }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(60),IC7600_ALL_RX_MODES,-1,-1,IC7600_VFOS,IC7600_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC7600_OTHER_TX_MODES, W(2),W(100),IC7600_VFOS,IC7600_ANTS), FRQ_RNG_6m(1,IC7600_OTHER_TX_MODES, W(2),W(100),IC7600_VFOS,IC7600_ANTS), FRQ_RNG_HF(1,IC7600_AM_TX_MODES, W(1),W(30),IC7600_VFOS,IC7600_ANTS), /* AM class */ FRQ_RNG_6m(1,IC7600_AM_TX_MODES, W(1),W(30),IC7600_VFOS,IC7600_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(60),IC7600_ALL_RX_MODES,-1,-1,IC7600_VFOS,IC7600_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC7600_OTHER_TX_MODES, W(2),W(100),IC7600_VFOS,IC7600_ANTS), FRQ_RNG_6m(2,IC7600_OTHER_TX_MODES, W(2),W(100),IC7600_VFOS,IC7600_ANTS), FRQ_RNG_HF(2,IC7600_AM_TX_MODES, W(1),W(30),IC7600_VFOS,IC7600_ANTS), /* AM class */ FRQ_RNG_6m(2,IC7600_AM_TX_MODES, W(1),W(30),IC7600_VFOS,IC7600_ANTS), /* AM class */ /* USA only, TBC: end of range and modes */ {MHz(5.33050),MHz(5.33350),IC7600_OTHER_TX_MODES,W(2),W(100),IC7600_VFOS,IC7600_ANTS}, /* USA only */ {MHz(5.34650),MHz(5.34950),IC7600_OTHER_TX_MODES,W(2),W(100),IC7600_VFOS,IC7600_ANTS}, /* USA only */ {MHz(5.36650),MHz(5.36950),IC7600_OTHER_TX_MODES,W(2),W(100),IC7600_VFOS,IC7600_ANTS}, /* USA only */ {MHz(5.37150),MHz(5.37450),IC7600_OTHER_TX_MODES,W(2),W(100),IC7600_VFOS,IC7600_ANTS}, /* USA only */ {MHz(5.40350),MHz(5.40650),IC7600_OTHER_TX_MODES,W(2),W(100),IC7600_VFOS,IC7600_ANTS}, /* USA only */ RIG_FRNG_END, }, .tuning_steps = { {IC7600_1HZ_TS_MODES,1}, {IC7600_ALL_RX_MODES,Hz(100)}, {IC7600_ALL_RX_MODES,kHz(1)}, {IC7600_ALL_RX_MODES,kHz(5)}, {IC7600_ALL_RX_MODES,kHz(9)}, {IC7600_ALL_RX_MODES,kHz(10)}, {IC7600_ALL_RX_MODES,kHz(12.5)}, {IC7600_ALL_RX_MODES,kHz(20)}, {IC7600_ALL_RX_MODES,kHz(25)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(2.4)}, {RIG_MODE_CW|RIG_MODE_CWR, Hz(500)}, {RIG_MODE_CW|RIG_MODE_CWR, Hz(350)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_FM, kHz(12)}, {RIG_MODE_FM, kHz(8)}, /* TBC */ RIG_FLT_END, }, .str_cal = IC7600_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic7600_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .set_rit = icom_set_rit, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_parm = icom_set_parm, .get_parm = icom_get_parm, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ptt = icom_set_ptt, .get_ptt = icom_get_ptt, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .get_ts = icom_get_ts, .set_rptr_shift = icom_set_rptr_shift, .get_rptr_shift = icom_get_rptr_shift, .set_rptr_offs = icom_set_rptr_offs, .get_rptr_offs = icom_get_rptr_offs, .set_ctcss_tone = icom_set_ctcss_tone, .get_ctcss_tone = icom_get_ctcss_tone, .set_ctcss_sql = icom_set_ctcss_sql, .get_ctcss_sql = icom_get_ctcss_sql, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, .get_split_vfo = icom_mem_get_split_vfo, }; hamlib-1.2.15.3/icom/ic703.c0000644000175000017500000001540112044564477012054 00000000000000/* * Hamlib CI-V backend - description of IC-703 * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "icom.h" #include "bandplan.h" #include "idx_builtin.h" #define IC703_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC703_OTHER_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC703_AM_TX_MODES (RIG_MODE_AM) #define IC703_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_NR|RIG_FUNC_ANF|RIG_FUNC_MON) #define IC703_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_RAWSTR|RIG_LEVEL_ALC|RIG_LEVEL_SWR|RIG_LEVEL_METER|RIG_LEVEL_COMP|RIG_LEVEL_RF|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_RF|RIG_LEVEL_AF|RIG_LEVEL_SQL|RIG_LEVEL_NR|RIG_LEVEL_IF|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT) #define IC703_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC703_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL) #define IC703_SCAN_OPS (RIG_SCAN_VFO|RIG_SCAN_MEM) #define IC703_ANTS (RIG_ANT_1) /* * IC703_REAL_STR_CAL is accurate measurements * IC703_STR_CAL is what the S-meter displays * * FIXME: calibration data cloned from IC706 */ #define IC703_STR_CAL { 17, \ { \ { 45, -60 }, \ { 46, -54 }, /* S0 */ \ { 54, -48 }, \ { 64, -42 }, \ { 76, -36 }, \ { 84, -30 }, \ { 94, -24 }, \ { 104, -18 }, \ { 113, -12 }, \ { 123, -6 }, \ { 133, 0 }, /* S9 */ \ { 144, 10 }, /* +10 */ \ { 156, 20 }, /* +20 */ \ { 170, 30 }, /* +30 */ \ { 181, 40 }, /* +40 */ \ { 192, 50 }, /* +50 */ \ { 204, 60 } /* +60 */ \ } } /* * ic703 rigs capabilities. */ static const struct icom_priv_caps ic703_priv_caps = { 0x68, /* default address */ 0, /* 731 mode */ ic706_ts_sc_list }; const struct rig_caps ic703_caps = { .rig_model = RIG_MODEL_IC703, .model_name = "IC-703", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_MOBILE, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC703_FUNC_ALL, .has_set_func = IC703_FUNC_ALL, .has_get_level = IC703_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(IC703_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, 20, RIG_DBLST_END, }, /* FIXME: 2 levels */ .attenuator = { 20, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC703_VFO_OPS, .scan_ops = IC703_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM }, { 100, 105, RIG_MTYPE_EDGE }, /* two by two */ { 106, 107, RIG_MTYPE_CALL }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(60),IC703_ALL_RX_MODES,-1,-1,IC703_VFO_ALL,IC703_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC703_OTHER_TX_MODES, W(0.1),W(10),IC703_VFO_ALL,IC703_ANTS), FRQ_RNG_6m(1,IC703_OTHER_TX_MODES, W(0.1),W(10),IC703_VFO_ALL,IC703_ANTS), FRQ_RNG_HF(1,IC703_AM_TX_MODES, W(0.1),W(4),IC703_VFO_ALL,IC703_ANTS), /* AM class */ FRQ_RNG_6m(1,IC703_AM_TX_MODES, W(0.1),W(4),IC703_VFO_ALL,IC703_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(60),IC703_ALL_RX_MODES,-1,-1,IC703_VFO_ALL,IC703_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC703_OTHER_TX_MODES, W(0.1),W(10),IC703_VFO_ALL,IC703_ANTS), FRQ_RNG_6m(2,IC703_OTHER_TX_MODES, W(0.1),W(10),IC703_VFO_ALL,IC703_ANTS), FRQ_RNG_HF(2,IC703_AM_TX_MODES, W(0.1),W(4),IC703_VFO_ALL,IC703_ANTS), /* AM class */ FRQ_RNG_6m(2,IC703_AM_TX_MODES, W(0.1),W(4),IC703_VFO_ALL,IC703_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {IC703_ALL_RX_MODES,10}, {IC703_ALL_RX_MODES,100}, {IC703_ALL_RX_MODES,kHz(1)}, {IC703_ALL_RX_MODES,kHz(5)}, {IC703_ALL_RX_MODES,kHz(9)}, {IC703_ALL_RX_MODES,kHz(10)}, {IC703_ALL_RX_MODES,12500}, {IC703_ALL_RX_MODES,kHz(20)}, {IC703_ALL_RX_MODES,kHz(25)}, {IC703_ALL_RX_MODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_CWR|RIG_MODE_RTTYR, kHz(2.4)}, /* bultin FL-272 */ {RIG_MODE_AM, kHz(9)}, /* mid w/ bultin FL-94 */ {RIG_MODE_AM, kHz(2.4)}, /* narrow w/ bultin FL-272 */ {RIG_MODE_FM, kHz(15)}, /* ?? TBC, mid w/ bultin FL-23+SFPC455E */ {RIG_MODE_FM, kHz(9)}, /* narrow w/ bultin FL-94 */ RIG_FLT_END, }, .str_cal = IC703_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic703_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ptt = icom_set_ptt, .get_ptt = icom_get_ptt, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .set_rptr_shift = icom_set_rptr_shift, .set_rptr_offs = icom_set_rptr_offs, .get_rptr_offs = icom_get_rptr_offs, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, }; hamlib-1.2.15.3/icom/id1.c0000644000175000017500000001153612044564477011711 00000000000000/* * Hamlib CI-V backend - description of ID-1 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "idx_builtin.h" #include "icom.h" #define ID1_MODES (RIG_MODE_FM /* |RIG_MODE_DIGVOICE|RIG_MODE_DIGDATA*/ ) #define ID1_FUNC_ALL (RIG_FUNC_MUTE|RIG_FUNC_MON|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_LOCK|RIG_FUNC_AFC) #define ID1_LEVEL_ALL (RIG_LEVEL_AF|RIG_LEVEL_SQL|RIG_LEVEL_RFPOWER|RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_RAWSTR) #define ID1_PARM_ALL (RIG_PARM_BEEP|RIG_PARM_BACKLIGHT /* |RIG_PARM_FAN */) #define ID1_VFO_ALL (RIG_VFO_A|RIG_VFO_MEM) #define ID1_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL) #define ID1_SCAN_OPS (RIG_SCAN_VFO|RIG_SCAN_MEM) /* * FIXME: real measurement */ #define ID1_STR_CAL UNKNOWN_IC_STR_CAL const struct ts_sc_list id1_ts_sc_list[] = { { kHz(5), 0x00 }, { kHz(10), 0x01 }, { 12500, 0x02 }, { kHz(20), 0x03 }, { kHz(25), 0x04 }, { kHz(50), 0x05 }, { kHz(100), 0x06 }, { kHz(6.25), 0x07 }, { 0, 0 }, }; /* */ static const struct icom_priv_caps id1_priv_caps = { 0x01, /* default address */ 0, /* 731 mode */ id1_ts_sc_list }; const struct rig_caps id1_caps = { .rig_model = RIG_MODEL_ICID1, .model_name = "IC ID-1", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_MOBILE, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 19200, .serial_rate_max = 19200, .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 = ID1_FUNC_ALL, .has_set_func = ID1_FUNC_ALL, .has_get_level = ID1_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(ID1_LEVEL_ALL), .has_get_parm = ID1_PARM_ALL, .has_set_parm = ID1_PARM_ALL, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = full_dcs_list, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = ID1_VFO_OPS, .scan_ops = ID1_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM }, { 100, 101, RIG_MTYPE_EDGE }, /* two by two */ { 102, 104, RIG_MTYPE_CALL }, RIG_CHAN_END, }, .rx_range_list1 = { {GHz(1.240),GHz(1.3),ID1_MODES,-1,-1,ID1_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { {GHz(1.240),GHz(1.3),ID1_MODES,W(1),W(10),ID1_VFO_ALL}, RIG_FRNG_END, }, .rx_range_list2 = { {GHz(1.240),GHz(1.3),ID1_MODES,-1,-1,ID1_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { {GHz(1.240),GHz(1.3),ID1_MODES,W(1),W(10),ID1_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {ID1_MODES,kHz(5)}, {ID1_MODES,kHz(10)}, {ID1_MODES,12500}, {ID1_MODES,kHz(20)}, {ID1_MODES,kHz(25)}, {ID1_MODES,kHz(25)}, {ID1_MODES,kHz(100)}, {ID1_MODES,kHz(6.25)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_FM, kHz(12)}, #if 0 {RIG_MODE_DIGVOICE, kHz(6)}, {RIG_MODE_DIGDATA, kHz(140)}, #endif RIG_FLT_END, }, .str_cal = ID1_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&id1_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ptt = icom_set_ptt, .get_ptt = icom_get_ptt, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .set_rptr_shift = icom_set_rptr_shift, .set_rptr_offs = icom_set_rptr_offs, .get_rptr_offs = icom_get_rptr_offs, }; hamlib-1.2.15.3/icom/ic9100.c0000644000175000017500000002222712044564477012140 00000000000000/* * Hamlib CI-V backend - description of IC-9100 (HF/VHF/UHF All-Mode Tranceiver) * Copyright (c) 2000-2011 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "icom.h" #include "icom_defs.h" #include "frame.h" #include "idx_builtin.h" #include "bandplan.h" #define IC9100_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR|\ RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define IC9100_OTHER_TX_MODES ((IC9100_MODES) & ~RIG_MODE_AM) #define IC9100_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MAIN|RIG_VFO_SUB|RIG_VFO_MEM) #define IC9100_SCAN_OPS (RIG_SCAN_VFO|RIG_SCAN_MEM|RIG_SCAN_SLCT|RIG_SCAN_PRIO) #define IC9100_VFO_OPS (RIG_OP_FROM_VFO| \ RIG_OP_TO_VFO| \ RIG_OP_CPY| \ RIG_OP_MCL| \ RIG_OP_XCHG| \ RIG_OP_TUNE) #define IC9100_FUNC_ALL (RIG_FUNC_FAGC| \ RIG_FUNC_NB| \ RIG_FUNC_NR| \ RIG_FUNC_ANF| \ RIG_FUNC_TONE| \ RIG_FUNC_TSQL| \ RIG_FUNC_COMP| \ RIG_FUNC_VOX| \ RIG_FUNC_FBKIN| \ RIG_FUNC_AFC| \ RIG_FUNC_SATMODE| \ RIG_FUNC_VSC| \ RIG_FUNC_MN| \ RIG_FUNC_LOCK| \ RIG_FUNC_SCOPE) #define IC9100_LEVEL_ALL (RIG_LEVEL_AF| \ RIG_LEVEL_RF| \ RIG_LEVEL_SQL| \ RIG_LEVEL_IF| \ RIG_LEVEL_NR| \ RIG_LEVEL_CWPITCH| \ RIG_LEVEL_RFPOWER| \ RIG_LEVEL_MICGAIN| \ RIG_LEVEL_KEYSPD| \ RIG_LEVEL_COMP| \ RIG_LEVEL_VOXGAIN| \ RIG_LEVEL_VOXDELAY| \ RIG_LEVEL_ANTIVOX| \ RIG_LEVEL_APF| \ RIG_LEVEL_AGC| \ RIG_LEVEL_PBT_IN| \ RIG_LEVEL_PBT_OUT| \ RIG_LEVEL_NOTCHF| \ RIG_LEVEL_ATT| \ RIG_LEVEL_PREAMP) #define IC9100_PARM_ALL (RIG_PARM_ANN|RIG_PARM_BACKLIGHT) #define IC9100_STR_CAL UNKNOWN_IC_STR_CAL /* FIXME */ #define IC9100_HF_ANTS (RIG_ANT_1|RIG_ANT_2) /* */ static const struct icom_priv_caps ic9100_priv_caps = { 0x7c, /* default address */ 0, /* 731 mode */ ic910_ts_sc_list, /* FIXME */ }; const struct rig_caps ic9100_caps = { .rig_model = RIG_MODEL_IC9100, .model_name = "IC-9100", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC9100_FUNC_ALL, .has_set_func = IC9100_FUNC_ALL | RIG_FUNC_RESUME, .has_get_level = IC9100_LEVEL_ALL | RIG_LEVEL_RAWSTR| RIG_LEVEL_SWR, .has_set_level = IC9100_LEVEL_ALL, .has_get_parm = IC9100_PARM_ALL, .has_set_parm = IC9100_PARM_ALL, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = common_dcs_list, .preamp = {20, RIG_DBLST_END, }, .attenuator = {20, RIG_DBLST_END, }, .max_rit = kHz(9.999), .max_xit = kHz(9.999), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC9100_VFO_OPS, .scan_ops = IC9100_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 9, /* TODO */ .chan_list = { /* TBC */ { 1, 396, RIG_MTYPE_MEM }, { 397, 400, RIG_MTYPE_CALL }, { 401, 424, RIG_MTYPE_EDGE }, RIG_CHAN_END, }, .rx_range_list1 = { /* Europe */ {kHz(30),MHz(60),IC9100_MODES,-1,-1,IC9100_VFO_ALL,IC9100_HF_ANTS}, {kHz(136),MHz(174),IC9100_MODES,-1,-1,IC9100_VFO_ALL,RIG_ANT_3}, {MHz(420),MHz(480),IC9100_MODES,-1,-1,IC9100_VFO_ALL,RIG_ANT_4}, {MHz(1240),MHz(1320),IC9100_MODES,-1,-1,IC9100_VFO_ALL,RIG_ANT_5}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC9100_OTHER_TX_MODES, W(2),W(100),IC9100_VFO_ALL,IC9100_HF_ANTS), FRQ_RNG_HF(1,RIG_MODE_AM, W(2),W(25),IC9100_VFO_ALL,IC9100_HF_ANTS), /* only HF */ FRQ_RNG_6m(1,IC9100_OTHER_TX_MODES, W(2),W(100),IC9100_VFO_ALL,IC9100_HF_ANTS), FRQ_RNG_2m(1,IC9100_OTHER_TX_MODES, W(2),W(100),IC9100_VFO_ALL,RIG_ANT_3), FRQ_RNG_70cm(1,IC9100_OTHER_TX_MODES, W(2),W(75),IC9100_VFO_ALL,RIG_ANT_4), /* option */ FRQ_RNG_23cm_REGION1(IC9100_OTHER_TX_MODES, W(1),W(10),IC9100_VFO_ALL,RIG_ANT_5), RIG_FRNG_END, }, .rx_range_list2 = { /* USA */ {kHz(30),MHz(60),IC9100_MODES,-1,-1,IC9100_VFO_ALL,IC9100_HF_ANTS}, {kHz(136),MHz(174),IC9100_MODES,-1,-1,IC9100_VFO_ALL,RIG_ANT_3}, {MHz(420),MHz(480),IC9100_MODES,-1,-1,IC9100_VFO_ALL,RIG_ANT_4}, {MHz(1240),MHz(1320),IC9100_MODES,-1,-1,IC9100_VFO_ALL,RIG_ANT_5}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC9100_OTHER_TX_MODES, W(2),W(100),IC9100_VFO_ALL,IC9100_HF_ANTS), FRQ_RNG_HF(2,RIG_MODE_AM, W(2),W(25),IC9100_VFO_ALL,IC9100_HF_ANTS), /* only HF */ /* USA only, TBC: end of range and modes */ {MHz(5.255),MHz(5.405),IC9100_OTHER_TX_MODES,W(2),W(100),IC9100_VFO_ALL,IC9100_HF_ANTS}, /* USA only */ {MHz(5.255),MHz(5.405),RIG_MODE_AM,W(2),W(100),IC9100_VFO_ALL,IC9100_HF_ANTS}, /* USA only */ FRQ_RNG_6m(2,IC9100_OTHER_TX_MODES, W(2),W(100),IC9100_VFO_ALL,IC9100_HF_ANTS), FRQ_RNG_2m(2,IC9100_OTHER_TX_MODES, W(2),W(100),IC9100_VFO_ALL,RIG_ANT_3), FRQ_RNG_70cm(2,IC9100_OTHER_TX_MODES, W(2),W(75),IC9100_VFO_ALL,RIG_ANT_4), /* option */ FRQ_RNG_23cm_REGION2(IC9100_OTHER_TX_MODES, W(1),W(10),IC9100_VFO_ALL,RIG_ANT_5), RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_SSB|RIG_MODE_CW,1}, {RIG_MODE_SSB|RIG_MODE_CW,10}, {RIG_MODE_SSB|RIG_MODE_CW,50}, {RIG_MODE_SSB|RIG_MODE_CW,100}, {RIG_MODE_FM,kHz(0.1)}, {RIG_MODE_FM,kHz(5)}, {RIG_MODE_FM,kHz(6.25)}, {RIG_MODE_FM,kHz(10)}, {RIG_MODE_FM,kHz(12.5)}, {RIG_MODE_FM,kHz(20)}, {RIG_MODE_FM,kHz(25)}, {RIG_MODE_FM,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_CW | RIG_MODE_SSB | RIG_MODE_RTTY, kHz(2.4)}, /* builtin */ {RIG_MODE_CW | RIG_MODE_RTTY, Hz(500)}, {RIG_MODE_FM, kHz(15)}, /* builtin */ {RIG_MODE_FM|RIG_MODE_AM, kHz(6)}, /* builtin */ RIG_FLT_END, }, .str_cal = IC9100_STR_CAL, .priv = (void*)&ic9100_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .get_freq = icom_get_freq, .set_freq = icom_set_freq, .get_mode = icom_get_mode, .set_mode = icom_set_mode, .get_vfo = NULL, .set_vfo = icom_set_vfo, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .get_ts = icom_get_ts, .set_ts = icom_set_ts, .get_func = icom_get_func, .set_func = icom_set_func, .get_level = icom_get_level, .set_level = icom_set_level, .set_ptt = icom_set_ptt, .get_ptt = icom_get_ptt, .set_rit = icom_set_rit, .set_rptr_shift = icom_set_rptr_shift, .get_rptr_shift = icom_get_rptr_shift, .set_rptr_offs = icom_set_rptr_offs, .get_rptr_offs = icom_get_rptr_offs, .set_ctcss_tone = icom_set_ctcss_tone, .get_ctcss_tone = icom_get_ctcss_tone, .set_ctcss_sql = icom_set_ctcss_sql, .get_ctcss_sql = icom_get_ctcss_sql, .set_dcs_sql = icom_set_dcs_code, .get_dcs_sql = icom_get_dcs_code, .set_parm = icom_set_parm, .get_parm = icom_get_parm, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .get_dcd = icom_get_dcd, .decode_event = icom_decode_event, .set_split_vfo = icom_set_split_vfo, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, }; /* end of file */ hamlib-1.2.15.3/icom/Makefile.in0000644000175000017500000006101012044564553013120 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = icom DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_icom_la_DEPENDENCIES = $(top_builddir)/lib/libmisc.la \ $(top_builddir)/src/libhamlib.la am__objects_1 = ic706.lo icr8500.lo ic735.lo ic775.lo ic756.lo \ ic275.lo ic475.lo ic1275.lo ic820h.lo ic821h.lo icr7000.lo \ ic910.lo ic9100.lo ic970.lo ic725.lo ic737.lo ic718.lo \ os535.lo os456.lo omni.lo delta2.lo ic92d.lo ic736.lo ic738.lo \ ic7410.lo ic746.lo ic703.lo ic726.lo ic271.lo ic765.lo \ ic781.lo ic471.lo id1.lo icr9000.lo icr9500.lo icr10.lo \ icr20.lo icr71.lo icr72.lo icr75.lo icrx7.lo ic707.lo ic728.lo \ ic751.lo ic761.lo ic78.lo ic7800.lo ic7000.lo ic7200.lo \ ic7600.lo ic7700.lo am_hamlib_icom_la_OBJECTS = $(am__objects_1) icom.lo frame.lo \ optoscan.lo hamlib_icom_la_OBJECTS = $(am_hamlib_icom_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_icom_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_icom_la_LDFLAGS) $(LDFLAGS) -o \ $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_icom_la_SOURCES) DIST_SOURCES = $(hamlib_icom_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ICOMSRCLIST = ic706.c icr8500.c ic735.c ic775.c ic756.c \ ic275.c ic475.c ic1275.c ic820h.c ic821h.c \ icr7000.c ic910.c ic9100.c ic970.c ic725.c ic737.c ic718.c \ os535.c os456.c omni.c delta2.c ic92d.c \ ic736.c ic738.c ic7410.c ic746.c ic703.c ic726.c ic271.c \ ic765.c ic781.c ic471.c id1.c icr9000.c icr9500.c \ icr10.c icr20.c icr71.c icr72.c icr75.c icrx7.c \ ic707.c ic728.c ic751.c ic761.c \ ic78.c ic7800.c ic7000.c ic7200.c ic7600.c ic7700.c pkglib_LTLIBRARIES = hamlib-icom.la hamlib_icom_la_SOURCES = $(ICOMSRCLIST) icom.c frame.c optoscan.c hamlib_icom_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_icom_la_LIBADD = $(top_builddir)/lib/libmisc.la \ $(top_builddir)/src/libhamlib.la EXTRA_DIST = README.icom TODO.icom noinst_HEADERS = frame.h icom.h icom_defs.h optoscan.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu icom/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu icom/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-icom.la: $(hamlib_icom_la_OBJECTS) $(hamlib_icom_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_icom_la_LINK) -rpath $(pkglibdir) $(hamlib_icom_la_OBJECTS) $(hamlib_icom_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/delta2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic1275.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic271.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic275.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic471.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic475.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic7000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic703.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic706.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic707.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic718.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic7200.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic725.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic726.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic728.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic735.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic736.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic737.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic738.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic7410.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic746.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic751.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic756.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic7600.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic761.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic765.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic7700.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic775.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic78.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic7800.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic781.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic820h.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic821h.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic910.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic9100.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic92d.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic970.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icom.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icr10.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icr20.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icr7000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icr71.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icr72.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icr75.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icr8500.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icr9000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icr9500.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icrx7.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/id1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/omni.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/optoscan.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os456.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os535.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/icom/frame.c0000644000175000017500000002757312044564477012336 00000000000000/* * Hamlib CI-V backend - low level communication routines * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "icom.h" #include "icom_defs.h" #include "frame.h" /* * Build a CI-V frame. * The whole frame is placed in frame[], * "re_id" is the transceiver's CI-V address, * "cmd" is the Command number, * "subcmd" is the Sub command number, set to -1 if not present in frame, * if the frame has no data, then the "data" pointer must be NULL, * and data_len==0. * "data_len" holds the Data area length pointed by the "data" pointer. * REM: if "data" is NULL, then "data_len" MUST be 0. * * NB: the frame array must be big enough to hold the frame. * The smallest frame is 6 bytes, the biggest is at least 13 bytes. */ int make_cmd_frame(char frame[], char re_id, char ctrl_id, char cmd, int subcmd, const unsigned char *data, int data_len) { int i = 0; #if 0 frame[i++] = PAD; /* give old rigs a chance to flush their rx buffers */ #endif frame[i++] = PR; /* Preamble code */ frame[i++] = PR; frame[i++] = re_id; frame[i++] = ctrl_id; frame[i++] = cmd; if (subcmd != -1) { #ifdef MULTIB_SUBCMD register int j; if ((j = subcmd & 0xff0000)) { /* allows multi-byte subcmd for dsp rigs */ frame[i++] = j >> 16; frame[i++] = (subcmd & 0xff00) >> 8; } else if ((j = subcmd & 0xff00)) frame[i++] = j >> 8; #endif frame[i++] = subcmd & 0xff; } if (data_len != 0) { memcpy(frame+i, data, data_len); i += data_len; } frame[i++] = FI; /* EOM code */ return i; } /* * icom_one_transaction * * We assume that rig!=NULL, rig->state!= NULL, payload!=NULL, data!=NULL, data_len!=NULL * Otherwise, you'll get a nice seg fault. You've been warned! * payload can be NULL if payload_len == 0 * subcmd can be equal to -1 (no subcmd wanted) * if no answer is to be expected, data_len must be set to NULL to tell so * * return RIG_OK if transaction completed, * or a negative value otherwise indicating the error. */ int icom_one_transaction (RIG *rig, int cmd, int subcmd, const unsigned char *payload, int payload_len, unsigned char *data, int *data_len) { struct icom_priv_data *priv; const struct icom_priv_caps *priv_caps; struct rig_state *rs; unsigned char buf[MAXFRAMELEN]; unsigned char sendbuf[MAXFRAMELEN]; int frm_len, retval; int ctrl_id; rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; priv_caps = (struct icom_priv_caps*)rig->caps->priv; ctrl_id = priv_caps->serial_full_duplex == 0 ? CTRLID : 0x80; frm_len = make_cmd_frame((char *) sendbuf, priv->re_civ_addr, ctrl_id, cmd, subcmd, payload, payload_len); /* * should check return code and that write wrote cmd_len chars! */ Hold_Decode(rig); serial_flush(&rs->rigport); retval = write_block(&rs->rigport, (char *) sendbuf, frm_len); if (retval != RIG_OK) { Unhold_Decode(rig); return retval; } if (priv_caps->serial_full_duplex == 0) { /* * read what we just sent, because TX and RX are looped, * and discard it... * - if what we read is not what we sent, then it means * a collision on the CI-V bus occured! * - if we get a timeout, then retry to send the frame, * up to rs->retry times. */ retval = read_icom_frame(&rs->rigport, buf); if (retval == -RIG_ETIMEOUT || retval == 0) { /* Nothing recieved, CI-V interface is not echoing */ Unhold_Decode(rig); return -RIG_BUSERROR; } if (retval < 0) { /* Other error, return it */ Unhold_Decode(rig); return retval; } switch (buf[retval-1]) { case COL: /* Collision */ Unhold_Decode(rig); return -RIG_BUSBUSY; case FI: /* Ok, normal frame */ break; default: /* Timeout after reading at least one character */ /* Problem on ci-v bus? */ Unhold_Decode(rig); return -RIG_BUSERROR; } if (retval != frm_len) { /* Not the same length??? */ /* Problem on ci-v bus? */ /* Someone else got a packet in? */ Unhold_Decode(rig); return -RIG_EPROTO; } if (memcmp(buf,sendbuf,frm_len)) { /* Frames are different? */ /* Problem on ci-v bus? */ /* Someone else got a packet in? */ Unhold_Decode(rig); return -RIG_EPROTO; } } /* * expect an answer? */ if (data_len == NULL) { Unhold_Decode(rig); return RIG_OK; } /* * wait for ACK ... * FIXME: handle pading/collisions * ACKFRMLEN is the smallest frame we can expect from the rig */ frm_len = read_icom_frame(&rs->rigport, buf); Unhold_Decode(rig); if (frm_len < 0) { /* RIG_TIMEOUT: timeout getting response, return timeout */ /* other error: return it */ return frm_len; } switch (buf[frm_len-1]) { case COL: /* Collision */ return -RIG_BUSBUSY; case FI: /* Ok, normal frame */ break; default: /* Timeout after reading at least one character */ /* Problem on ci-v bus? */ return -RIG_EPROTO; } if (frm_len < ACKFRMLEN) { return -RIG_EPROTO; } *data_len = frm_len-(ACKFRMLEN-1); memcpy(data, buf+4, *data_len); /* * TODO: check addresses in reply frame */ return RIG_OK; } /* * icom_transaction * * This function honors rigport.retry count. * * We assume that rig!=NULL, rig->state!= NULL, payload!=NULL, data!=NULL, data_len!=NULL * Otherwise, you'll get a nice seg fault. You've been warned! * payload can be NULL if payload_len == 0 * subcmd can be equal to -1 (no subcmd wanted) * * return RIG_OK if transaction completed, * or a negative value otherwise indicating the error. */ int icom_transaction (RIG *rig, int cmd, int subcmd, const unsigned char *payload, int payload_len, unsigned char *data, int *data_len) { int retval, retry; retry = rig->state.rigport.retry; do { retval = icom_one_transaction (rig, cmd, subcmd, payload, payload_len, data, data_len); if (retval == RIG_OK) break; } while (retry-- > 0); return retval; } /* used in read_icom_frame as end of block */ static const char icom_block_end[2] = {FI, COL}; #define icom_block_end_length 2 /* * read_icom_frame * read a whole CI-V frame (until 0xfd is encountered) * TODO: strips padding/collisions * FIXME: check return codes/bytes read */ int read_icom_frame(hamlib_port_t *p, unsigned char rxbuffer[]) { int read = 0; int retries = 10; char *rx_ptr = (char *)rxbuffer; /* * OK, now sometimes we may time out, e.g. the IC7000 can time out * during a PTT operation. So, we will insure that the last thing we * read was a proper end marker - if not, we will try again. */ do { int i = read_string(p, rx_ptr, MAXFRAMELEN-read, icom_block_end, icom_block_end_length); if (i < 0) /* die on errors */ return i; if (i == 0) /* nothing read?*/ { if (--retries <= 0) /* Tried enough times? */ return read; } /* OK, we got something. add it in and continue */ read += i; rx_ptr += i; } while ((rxbuffer[read-1] != FI) && (rxbuffer[read-1] != COL)); return read; } /* * convert mode and width as expressed by Hamlib frontend * to mode and passband data understandable by a CI-V rig * * if pd == -1, no passband data is to be sent * * return RIG_OK if everything's fine, negative value otherwise * * TODO: be more exhaustive * assumes rig!=NULL */ int rig2icom_mode(RIG *rig, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd) { unsigned char icmode; signed char icmode_ext; pbwidth_t medium_width; icmode_ext = -1; switch (mode) { case RIG_MODE_AM: icmode = S_AM; break; case RIG_MODE_AMS: icmode = S_AMS; break; case RIG_MODE_CW: icmode = S_CW; break; case RIG_MODE_CWR: icmode = S_CWR; break; case RIG_MODE_USB: icmode = S_USB; break; case RIG_MODE_LSB: icmode = S_LSB; break; case RIG_MODE_RTTY: icmode = S_RTTY; break; case RIG_MODE_RTTYR: icmode = S_RTTYR; break; case RIG_MODE_FM: icmode = S_FM; break; case RIG_MODE_WFM: icmode = S_WFM; break; default: rig_debug(RIG_DEBUG_ERR,"icom: Unsupported Hamlib mode %d\n",mode); return -RIG_EINVAL; } medium_width = rig_passband_normal(rig, mode); if (width == medium_width || width == RIG_PASSBAND_NORMAL) icmode_ext = -1; /* medium, no passband data-> rig default. Is medium always the default? */ else if (width < medium_width) icmode_ext = PD_NARROW_3; else icmode_ext = PD_WIDE_3; if (rig->caps->rig_model == RIG_MODEL_ICR7000) { if (mode == RIG_MODE_USB || mode == RIG_MODE_LSB) { icmode = S_R7000_SSB; icmode_ext = 0x00; } else if (mode == RIG_MODE_AM && icmode_ext == -1) { icmode_ext = PD_WIDE_3; /* default to Wide */ } } *md = icmode; *pd = icmode_ext; return RIG_OK; } /* * assumes rig!=NULL, mode!=NULL, width!=NULL */ void icom2rig_mode(RIG *rig, unsigned char md, int pd, rmode_t *mode, pbwidth_t *width) { *width = RIG_PASSBAND_NORMAL; switch (md) { case S_AM: *mode = RIG_MODE_AM; break; case S_AMS: *mode = RIG_MODE_AMS; break; case S_CW: *mode = RIG_MODE_CW; break; case S_CWR: *mode = RIG_MODE_CWR; break; case S_FM: if (rig->caps->rig_model == RIG_MODEL_ICR7000 && pd == 0x00) { *mode = RIG_MODE_USB; *width = rig_passband_normal(rig, RIG_MODE_USB); return; } else *mode = RIG_MODE_FM; break; case S_WFM: *mode = RIG_MODE_WFM; break; case S_USB: *mode = RIG_MODE_USB; break; case S_LSB: *mode = RIG_MODE_LSB; break; case S_RTTY: *mode = RIG_MODE_RTTY; break; case S_RTTYR: *mode = RIG_MODE_RTTYR; break; case S_PSK: *mode = RIG_MODE_PKTUSB; break; /* IC-7800 */ case S_PSKR: *mode = RIG_MODE_PKTLSB; break; case 0xff: *mode = RIG_MODE_NONE; break; /* blank mem channel */ default: rig_debug(RIG_DEBUG_ERR,"icom: Unsupported Icom mode %#.2x\n", md); *mode = RIG_MODE_NONE; } /* Most rigs return 1-wide, 2-narrow; or if it has 3 filters: 1-wide, 2-middle, 3-narrow. (Except for the 706 mkIIg 0-wide, 1-middle, 2-narrow.) For DSP rigs these are presets, which can be programmed for 30 - 41 bandwidths, depending on mode */ if (rig->caps->rig_model == RIG_MODEL_IC706MKIIG || rig->caps->rig_model == RIG_MODEL_IC706 || rig->caps->rig_model == RIG_MODEL_IC706MKII) pd++; switch (pd) { case 0x01: /* if no wide filter defined it's the default */ if (!(*width = rig_passband_wide(rig, *mode))) *width = rig_passband_normal(rig, *mode); break; case 0x02: if ((*width = rig_passband_wide(rig, *mode))) *width = rig_passband_normal(rig, *mode); else /* This really just depends on how you program the table. */ *width = rig_passband_narrow(rig, *mode); break; case 0x03: *width = rig_passband_narrow(rig, *mode); break; case -1: break; /* no passband data */ default: rig_debug(RIG_DEBUG_ERR,"icom: Unsupported Icom mode width %#.2x\n", pd); } return ; } hamlib-1.2.15.3/icom/ic735.c0000644000175000017500000001216512044564477012065 00000000000000/* * Hamlib CI-V backend - description of IC-735 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "icom.h" #include "bandplan.h" #define IC735_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) /* * 100W in all modes but AM (40W) */ #define IC735_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define IC735_AM_TX_MODES (RIG_MODE_AM) #define IC735_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC735_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO) #define IC735_ANTS RIG_ANT_1 /* */ static const struct icom_priv_caps ic735_priv_caps = { 0x04, /* default address */ 1, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic735_caps = { .rig_model = RIG_MODEL_IC735, .model_name = "IC-735", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .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 = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC735_VFO_OPS, .scan_ops = RIG_SCAN_NONE, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 10, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, { 11, 12, RIG_MTYPE_EDGE, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(30),IC735_ALL_RX_MODES,-1,-1,IC735_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC735_OTHER_TX_MODES, W(10),W(100),IC735_VFO_ALL,IC735_ANTS), FRQ_RNG_HF(1,IC735_AM_TX_MODES, W(10),W(40),IC735_VFO_ALL,IC735_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(30),IC735_ALL_RX_MODES,-1,-1,IC735_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { {kHz(1800),MHz(2)-1,IC735_OTHER_TX_MODES,5000,100000,IC735_VFO_ALL}, /* 100W class */ {kHz(1800),MHz(2)-1,IC735_AM_TX_MODES,2000,40000,IC735_VFO_ALL}, /* 40W class */ {kHz(3500),MHz(4)-1,IC735_OTHER_TX_MODES,5000,100000,IC735_VFO_ALL}, {kHz(3500),MHz(4)-1,IC735_AM_TX_MODES,2000,40000,IC735_VFO_ALL}, {MHz(7),kHz(7300),IC735_OTHER_TX_MODES,5000,100000,IC735_VFO_ALL}, {MHz(7),kHz(7300),IC735_AM_TX_MODES,2000,40000,IC735_VFO_ALL}, {kHz(10100),kHz(10150),IC735_OTHER_TX_MODES,5000,100000,IC735_VFO_ALL}, {kHz(10100),kHz(10150),IC735_AM_TX_MODES,2000,40000,IC735_VFO_ALL}, {MHz(14),kHz(14350),IC735_OTHER_TX_MODES,5000,100000,IC735_VFO_ALL}, {MHz(14),kHz(14350),IC735_AM_TX_MODES,2000,40000,IC735_VFO_ALL}, {kHz(18068),kHz(18168),IC735_OTHER_TX_MODES,5000,100000,IC735_VFO_ALL}, {kHz(18068),kHz(18168),IC735_AM_TX_MODES,2000,40000,IC735_VFO_ALL}, {MHz(21),kHz(21450),IC735_OTHER_TX_MODES,5000,100000,IC735_VFO_ALL}, {MHz(21),kHz(21450),IC735_AM_TX_MODES,2000,40000,IC735_VFO_ALL}, {kHz(24890),kHz(24990),IC735_OTHER_TX_MODES,5000,100000,IC735_VFO_ALL}, {kHz(24890),kHz(24990),IC735_AM_TX_MODES,2000,40000,IC735_VFO_ALL}, {MHz(28),kHz(29700),IC735_OTHER_TX_MODES,5000,100000,IC735_VFO_ALL}, {MHz(28),kHz(29700),IC735_AM_TX_MODES,2000,40000,IC735_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {IC735_ALL_RX_MODES,1}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.4)}, {RIG_MODE_AM, kHz(8)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic735_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/icr20.c0000644000175000017500000001032512044564477012146 00000000000000/* * Hamlib CI-V backend - description of IC-R20 * Copyright (c) 2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "icom.h" #include "idx_builtin.h" #define ICR20_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_WFM) #define ICR20_FUNC_ALL (RIG_FUNC_NONE) #define ICR20_LEVEL_ALL (RIG_LEVEL_RAWSTR) #define ICR20_VFO_ALL (RIG_VFO_A) #define ICR20_VFO_OPS (RIG_OP_NONE) #define ICR20_SCAN_OPS (RIG_SCAN_NONE) /* * FIXME: S-meter measurement! */ #define ICR20_STR_CAL { 2, \ { \ { 0, -60 }, /* S0 */ \ { 255, 60 } /* +60 */ \ } } static const struct icom_priv_caps icr20_priv_caps = { 0x6c, /* default address */ 0, /* 731 mode */ r8500_ts_sc_list /* wrong, but don't have set_ts anyway */ }; const struct rig_caps icr20_caps = { .rig_model = RIG_MODEL_ICR20, .model_name = "IC-R20", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER|RIG_FLAG_HANDHELD, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = ICR20_FUNC_ALL, .has_set_func = ICR20_FUNC_ALL, .has_get_level = ICR20_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(ICR20_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .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, .vfo_ops = ICR20_VFO_OPS, .scan_ops = ICR20_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, /* Only through cloning mode OPC-1382 */ .chan_list = { { 1, 999, RIG_MTYPE_MEM }, /* TBC */ { 1000, 1199, RIG_MTYPE_MEM }, /* auto-write */ { 1200, 1249, RIG_MTYPE_EDGE }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { /* Other countries but France */ {kHz(150),GHz(3.304999),ICR20_MODES,-1,-1,ICR20_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { /* USA */ {kHz(150),MHz(821.999),ICR20_MODES,-1,-1,ICR20_VFO_ALL}, {MHz(851),MHz(866.999),ICR20_MODES,-1,-1,ICR20_VFO_ALL}, {MHz(896),GHz(1.304999),ICR20_MODES,-1,-1,ICR20_VFO_ALL}, {GHz(1.305),GHz(3.304999),ICR20_MODES,-1,-1,ICR20_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {ICR20_MODES,Hz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(1.8)}, {RIG_MODE_AM|RIG_MODE_FM, kHz(12)}, {RIG_MODE_WFM, kHz(150)}, RIG_FLT_END, }, .str_cal = ICR20_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&icr20_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, /* TODO: do not pass bandwidth data */ .get_mode = icom_get_mode, /* .set_vfo = icom_set_vfo, */ .decode_event = icom_decode_event, .get_level = icom_get_level, .get_dcd = icom_get_dcd, }; hamlib-1.2.15.3/icom/omni.c0000644000175000017500000001755412044564477012204 00000000000000/* * Hamlib CI-V backend - description of the TenTenc OMNI VI * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* Improvements by Martin Ewing, AA6E, 3/2008 * This backend should support either the Ten-Tec Omni VI Plus (564) or the * Omni VI (563). Tested on an Omni VI. */ /* Known problems: * * To Do: * Implement vfo split, FSK mode */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "icom.h" #include "icom_defs.h" #include "frame.h" #include #define OMNIVIP_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define OMNIVIP_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define OMNIVIP_ALL_RX_MODES (OMNIVIP_OTHER_TX_MODES) #define OMNIVIP_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO) #define OMNIVIP_STR_CAL { 0, { } } static int omni6_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); static int omni6_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); static int omni6_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit); static const struct icom_priv_caps omnivip_priv_caps = { 0x04, /* default address */ 0, /* 731 mode */ NULL /* TODO */ }; const struct rig_caps omnivip_caps = { .rig_model = RIG_MODEL_OMNIVIP, .model_name = "Omni VI Plus", .mfg_name = "Ten-Tec", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, // Allow program controlled PTT .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 19200, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .parm_gran = {}, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9980), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = OMNIVIP_VFO_OPS, .scan_ops = RIG_SCAN_NONE, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 99, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, /* These limits measured on Omni VI SN 1A10473 */ .rx_range_list2 = { {kHz(1770),kHz(2330),OMNIVIP_ALL_RX_MODES,-1,-1,OMNIVIP_VFO_ALL}, {kHz(3471),kHz(4030),OMNIVIP_ALL_RX_MODES,-1,-1,OMNIVIP_VFO_ALL}, {kHz(6821),kHz(7338),OMNIVIP_ALL_RX_MODES,-1,-1,OMNIVIP_VFO_ALL}, {kHz(9971),kHz(10530),OMNIVIP_ALL_RX_MODES,-1,-1,OMNIVIP_VFO_ALL}, {kHz(13971),kHz(14530),OMNIVIP_ALL_RX_MODES,-1,-1,OMNIVIP_VFO_ALL}, {kHz(17971),kHz(18530),OMNIVIP_ALL_RX_MODES,-1,-1,OMNIVIP_VFO_ALL}, {kHz(20971),kHz(21530),OMNIVIP_ALL_RX_MODES,-1,-1,OMNIVIP_VFO_ALL}, {kHz(24471),kHz(25030),OMNIVIP_ALL_RX_MODES,-1,-1,OMNIVIP_VFO_ALL}, {kHz(27971),kHz(30030),OMNIVIP_ALL_RX_MODES,-1,-1,OMNIVIP_VFO_ALL}, RIG_FRNG_END, }, /* Note: There is no AM mode. */ .tx_range_list2 = { {kHz(1800),MHz(2)-1,OMNIVIP_OTHER_TX_MODES,5000,100000,OMNIVIP_VFO_ALL}, {kHz(3500),MHz(4)-1,OMNIVIP_OTHER_TX_MODES,5000,100000,OMNIVIP_VFO_ALL}, {MHz(7),kHz(7300),OMNIVIP_OTHER_TX_MODES,5000,100000,OMNIVIP_VFO_ALL}, {kHz(10100),kHz(10150),OMNIVIP_OTHER_TX_MODES,5000,100000,OMNIVIP_VFO_ALL}, {MHz(14),kHz(14350),OMNIVIP_OTHER_TX_MODES,5000,100000,OMNIVIP_VFO_ALL}, {kHz(18068),kHz(18168),OMNIVIP_OTHER_TX_MODES,5000,100000,OMNIVIP_VFO_ALL}, {MHz(21),kHz(21450),OMNIVIP_OTHER_TX_MODES,5000,100000,OMNIVIP_VFO_ALL}, {kHz(24890),kHz(24990),OMNIVIP_OTHER_TX_MODES,5000,100000,OMNIVIP_VFO_ALL}, {MHz(28),kHz(29700),OMNIVIP_OTHER_TX_MODES,5000,100000,OMNIVIP_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {OMNIVIP_ALL_RX_MODES, Hz(10)}, // This radio has 10 Hz steps. RIG_TS_END, }, /* mode/filter list, remember: order matters! * Possible XTAL filters: 2.4, 1.8, 0.5, 0.25 kHz - may not all be * present. FM filter is 15 kHz. * We are not supporting the 'FSK' (RTTY) mode at this time. */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.4)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&omnivip_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, // icom.c has no get_vfo .set_rit = omni6_set_rit, .get_rit = omni6_get_rit, // icom.c has no get_rit .set_xit = omni6_set_rit, // xit=rit for this rig .get_xit = omni6_get_rit, // (front panel controlled) .set_ptt = omni6_set_ptt, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; /* * omni6_set_ptt based on icom_set_ptt * Assumes rig!=NULL, rig->state.priv!=NULL */ int omni6_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { int retval, sc; sc = ptt == RIG_PTT_ON ? 0x1 : 0x2; /* * Ignore ACK/NAK on this command, because in CW mode, the Omni VI * does not send an ACK. */ retval = icom_transaction (rig, C_OMNI6_XMT, sc, NULL, 0, NULL, NULL); if (retval != RIG_OK) return retval; return RIG_OK; } /* * These 'rit' commands actually deal with an offset frequency. The operator * must select rit on/off or xit on/off manually to apply this offset. * Omni VI's rit uses 9's complement for negative freq, and freqs are in units * of 10 Hz. on the Omni. * Note that Omni VI rejects rit > 9980, but takes rit >= -9990. So the * rit limit should be +/- 9.98 kHz. */ int omni6_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { unsigned char freqbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int freq_len, ack_len=sizeof(ackbuf), retval; shortfreq_t rit10; rit10 = rit / 10; // 10 Hz resolution for Omni if (rit10 < 0) rit10 += 10000L; // 9's compl. freq_len = 2; to_bcd(freqbuf, rit10, 2*freq_len); retval = icom_transaction (rig, C_SET_OFFS, -1, freqbuf, freq_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"omni6_set_rit: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * Note: icom.c does not provide a get_rit method. It would have been * wrong for the Omni VI, anyway, so we implement it here. */ int omni6_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { unsigned char buffer[MAXFRAMELEN]; int buffer_len, retval; shortfreq_t my_rit; retval = icom_transaction (rig, C_RD_OFFS, -1, NULL, 0, buffer, & buffer_len); if (retval != RIG_OK) return retval; if (buffer_len != 3) { rig_debug(RIG_DEBUG_ERR,"omni6_get_rit: wrong length response (%d)\n", buffer_len); return -RIG_ERJCTED; } my_rit = 10*from_bcd(buffer, 2*buffer_len); if (my_rit > 10000L) my_rit -= 100000L; // 9's compl for negatives *rit = my_rit; return RIG_OK; } hamlib-1.2.15.3/icom/icom.c0000644000175000017500000022307012044564477012161 00000000000000/* * Hamlib CI-V backend - main file * Copyright (c) 2000-2012 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include #include #include #include #include #include "icom.h" #include "icom_defs.h" #include "frame.h" const struct ts_sc_list r8500_ts_sc_list[] = { { 10, 0x00 }, { 50, 0x01 }, { 100, 0x02 }, { kHz(1), 0x03 }, { 12500, 0x04 }, { kHz(5), 0x05 }, { kHz(9), 0x06 }, { kHz(10), 0x07 }, { 12500, 0x08 }, { kHz(20), 0x09 }, { kHz(25), 0x10 }, { kHz(100), 0x11 }, { MHz(1), 0x12 }, { 0, 0x13 }, /* programmable tuning step not supported */ { 0, 0 }, }; const struct ts_sc_list ic737_ts_sc_list[] = { { 10, 0x00 }, { kHz(1), 0x01 }, { kHz(2), 0x02 }, { kHz(3), 0x03 }, { kHz(4), 0x04 }, { kHz(5), 0x05 }, { kHz(6), 0x06 }, { kHz(7), 0x07 }, { kHz(8), 0x08 }, { kHz(9), 0x09 }, { kHz(10), 0x10 }, { 0, 0 }, }; const struct ts_sc_list r75_ts_sc_list[] = { { 10, 0x00 }, { 100, 0x01 }, { kHz(1), 0x02 }, { kHz(5), 0x03 }, { 6250, 0x04 }, { kHz(9), 0x05 }, { kHz(10), 0x06 }, { 12500, 0x07 }, { kHz(20), 0x08 }, { kHz(25), 0x09 }, { kHz(100), 0x10 }, { MHz(1), 0x11 }, { 0, 0 }, }; const struct ts_sc_list r7100_ts_sc_list[] = { { 100, 0x00 }, { kHz(1), 0x01 }, { kHz(5), 0x02 }, { kHz(10), 0x03 }, { 12500, 0x04 }, { kHz(20), 0x05 }, { kHz(25), 0x06 }, { kHz(100), 0x07 }, { 0, 0 }, }; const struct ts_sc_list r9000_ts_sc_list[] = { { 10, 0x00 }, { 100, 0x01 }, { kHz(1), 0x02 }, { kHz(5), 0x03 }, { kHz(9), 0x04 }, { kHz(10), 0x05 }, { 12500, 0x06 }, { kHz(20), 0x07 }, { kHz(25), 0x08 }, { kHz(100), 0x09 }, { 0, 0 }, }; const struct ts_sc_list r9500_ts_sc_list[] = { { 1, 0x00 }, { 10, 0x01 }, { 100, 0x02 }, { kHz(1), 0x03 }, { kHz(2.5), 0x04 }, { kHz(5), 0x05 }, { 6250, 0x06 }, { kHz(9), 0x07 }, { kHz(10), 0x08 }, { 12500, 0x09 }, { kHz(20), 0x10 }, { kHz(25), 0x11 }, { kHz(100), 0x12 }, { MHz(1), 0x13 }, { 0, 0 }, }; const struct ts_sc_list ic718_ts_sc_list[] = { { 10, 0x00 }, { kHz(1), 0x01 }, { kHz(5), 0x01 }, { kHz(9), 0x01 }, { kHz(10), 0x04 }, { kHz(100), 0x05 }, { 0, 0 }, }; const struct ts_sc_list ic756_ts_sc_list[] = { { 10, 0x00 }, { kHz(1), 0x01 }, { kHz(5), 0x02 }, { kHz(9), 0x03 }, { kHz(10), 0x04 }, { 0, 0 }, }; const struct ts_sc_list ic756pro_ts_sc_list[] = { { 10, 0x00 }, /* 1 if step turned off */ { 100, 0x01 }, { kHz(1), 0x02 }, { kHz(5), 0x03 }, { kHz(9), 0x04 }, { kHz(10), 0x05 }, { kHz(12.5), 0x06 }, { kHz(20), 0x07 }, { kHz(25), 0x08 }, { 0, 0 }, }; const struct ts_sc_list ic706_ts_sc_list[] = { { 10, 0x00 }, { 100, 0x01 }, { kHz(1), 0x02 }, { kHz(5), 0x03 }, { kHz(9), 0x04 }, { kHz(10), 0x05 }, { 12500, 0x06 }, { kHz(20), 0x07 }, { kHz(25), 0x08 }, { kHz(100), 0x09 }, { 0, 0 }, }; const struct ts_sc_list ic7000_ts_sc_list[] = { { 10, 0x00 }, { 100, 0x01 }, { kHz(1), 0x02 }, { kHz(5), 0x03 }, { kHz(9), 0x04 }, { kHz(10), 0x05 }, { 12500, 0x06 }, { kHz(20), 0x07 }, { kHz(25), 0x08 }, { kHz(100), 0x09 }, { MHz (1), 0x10 }, { 0, 0 }, }; const struct ts_sc_list ic7200_ts_sc_list[] = { { 10, 0x00 }, { 100, 0x01 }, { kHz(1), 0x02 }, { kHz(5), 0x03 }, { kHz(9), 0x04 }, { kHz(10), 0x05 }, { 0, 0 }, }; const struct ts_sc_list ic910_ts_sc_list[] = { { Hz(1), 0x00 }, { Hz(10), 0x01 }, { Hz(50), 0x02 }, { Hz(100), 0x03 }, { kHz(1), 0x04 }, { kHz(5), 0x05 }, { kHz(6.25), 0x06 }, { kHz(10), 0x07 }, { kHz(12.5), 0x08 }, { kHz(20), 0x09 }, { kHz(25), 0x10 }, { kHz(100), 0x11 }, { 0, 0 }, }; /* rtty filter list for some DSP rigs ie PRO */ #define RTTY_FIL_NB 5 const pbwidth_t rtty_fil[] = { Hz(250), Hz(300), Hz(350), Hz(500), kHz(1), 0, }; struct icom_addr { rig_model_t model; unsigned char re_civ_addr; }; #define TOK_CIVADDR TOKEN_BACKEND(1) #define TOK_MODE731 TOKEN_BACKEND(2) const struct confparams icom_cfg_params[] = { { TOK_CIVADDR, "civaddr", "CI-V address", "Transceiver's CI-V address", "0", RIG_CONF_NUMERIC, { .n = { 0, 0xff, 1 } } }, { TOK_MODE731, "mode731", "CI-V 731 mode", "CI-V operating frequency " "data length, needed for IC731 and IC735", "0", RIG_CONF_CHECKBUTTON }, { RIG_CONF_END, NULL, } }; /* * Please, if the default CI-V address of your rig is listed as UNKNOWN_ADDR, * send the value to for inclusion. Thanks --SF */ static const struct icom_addr icom_addr_list[] = { { RIG_MODEL_IC703, 0x68 }, { RIG_MODEL_IC706, 0x48 }, { RIG_MODEL_IC706MKII, 0x4e }, { RIG_MODEL_IC706MKIIG, 0x58 }, { RIG_MODEL_IC271, 0x20 }, { RIG_MODEL_IC275, 0x10 }, { RIG_MODEL_IC375, 0x12 }, { RIG_MODEL_IC471, 0x22 }, { RIG_MODEL_IC475, 0x14 }, { RIG_MODEL_IC575, 0x16 }, { RIG_MODEL_IC707, 0x3e }, { RIG_MODEL_IC725, 0x28 }, { RIG_MODEL_IC726, 0x30 }, { RIG_MODEL_IC728, 0x38 }, { RIG_MODEL_IC729, 0x3a }, { RIG_MODEL_IC731, 0x02 }, /* need confirmation */ { RIG_MODEL_IC735, 0x04 }, { RIG_MODEL_IC736, 0x40 }, { RIG_MODEL_IC7410, 0x80 }, { RIG_MODEL_IC746, 0x56 }, { RIG_MODEL_IC746PRO, 0x66 }, { RIG_MODEL_IC737, 0x3c }, { RIG_MODEL_IC738, 0x44 }, { RIG_MODEL_IC751, 0x1c }, { RIG_MODEL_IC751A, 0x1c }, { RIG_MODEL_IC756, 0x50 }, { RIG_MODEL_IC756PRO, 0x5c }, { RIG_MODEL_IC756PROII, 0x64 }, { RIG_MODEL_IC756PROIII, 0x6e }, { RIG_MODEL_IC7600, 0x7a }, { RIG_MODEL_IC761, 0x1e }, { RIG_MODEL_IC765, 0x2c }, { RIG_MODEL_IC775, 0x46 }, { RIG_MODEL_IC7800, 0x6a }, { RIG_MODEL_IC781, 0x26 }, { RIG_MODEL_IC820, 0x42 }, { RIG_MODEL_IC821, 0x4c }, { RIG_MODEL_IC821H, 0x4c }, { RIG_MODEL_IC910, 0x60 }, { RIG_MODEL_IC9100, 0x7c }, { RIG_MODEL_IC970, 0x2e }, { RIG_MODEL_IC1271, 0x24 }, { RIG_MODEL_IC1275, 0x18 }, { RIG_MODEL_ICR10, 0x52 }, { RIG_MODEL_ICR20, 0x6c }, { RIG_MODEL_ICR71, 0x1a }, { RIG_MODEL_ICR72, 0x32 }, { RIG_MODEL_ICR75, 0x5a }, { RIG_MODEL_ICRX7, 0x78 }, { RIG_MODEL_IC78, 0x62 }, { RIG_MODEL_ICR7000, 0x08 }, { RIG_MODEL_ICR7100, 0x34 }, { RIG_MODEL_ICR8500, 0x4a }, { RIG_MODEL_ICR9000, 0x2a }, { RIG_MODEL_ICR9500, 0x72 }, { RIG_MODEL_MINISCOUT, 0x94 }, { RIG_MODEL_IC718, 0x5e }, { RIG_MODEL_OS535, 0x80 }, /* same address as IC-7410 */ { RIG_MODEL_ICID1, 0x01 }, { RIG_MODEL_IC7000, 0x70 }, { RIG_MODEL_IC7200, 0x76 }, { RIG_MODEL_IC7700, 0x74 }, { RIG_MODEL_NONE, 0 }, }; /* * This is a generic icom_init function. * You might want to define yours, so you can customize it for your rig * * Basically, it sets up *priv * REM: serial port is already open (rig->state.rigport.fd) */ int icom_init(RIG *rig) { struct icom_priv_data *priv; const struct icom_priv_caps *priv_caps; const struct rig_caps *caps; if (!rig || !rig->caps) return -RIG_EINVAL; caps = rig->caps; if (!caps->priv) return -RIG_ECONF; priv_caps = (const struct icom_priv_caps *) caps->priv; priv = (struct icom_priv_data*)malloc(sizeof(struct icom_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } rig->state.priv = (void*)priv; /* TODO: CI-V address should be customizable */ /* * init the priv_data from static struct * + override with preferences */ priv->re_civ_addr = priv_caps->re_civ_addr; priv->civ_731_mode = priv_caps->civ_731_mode; return RIG_OK; } /* * ICOM Generic icom_cleanup routine * the serial port is closed by the frontend */ int icom_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * icom_set_freq * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct icom_priv_data *priv; struct rig_state *rs; unsigned char freqbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int freq_len, ack_len=sizeof(ackbuf), retval; rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; freq_len = priv->civ_731_mode ? 4:5; /* * to_bcd requires nibble len */ to_bcd(freqbuf, freq, freq_len*2); retval = icom_transaction (rig, C_SET_FREQ, -1, freqbuf, freq_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_freq: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_get_freq * Assumes rig!=NULL, rig->state.priv!=NULL, freq!=NULL * Note: old rig may return less than 4/5 bytes for get_freq */ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct icom_priv_data *priv; struct rig_state *rs; unsigned char freqbuf[MAXFRAMELEN]; int freq_len, retval; rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; retval = icom_transaction (rig, C_RD_FREQ, -1, NULL, 0, freqbuf, &freq_len); if (retval != RIG_OK) return retval; /* * freqbuf should contain Cn,Data area */ freq_len--; /* * is it a blank mem channel ? */ if (freq_len == 1 && freqbuf[1] == 0xff) { *freq = RIG_FREQ_NONE; return RIG_OK; } if (freq_len != 4 && freq_len != 5) { rig_debug(RIG_DEBUG_ERR,"icom_get_freq: wrong frame len=%d\n", freq_len); return -RIG_ERJCTED; } if (freq_len != (priv->civ_731_mode ? 4:5)) { rig_debug(RIG_DEBUG_WARN,"icom_get_freq: " "freq len (%d) differs from " "expected\n", freq_len); } /* * from_bcd requires nibble len */ *freq = from_bcd(freqbuf+1, freq_len*2); return RIG_OK; } int icom_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { unsigned char freqbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int freq_len, ack_len=sizeof(ackbuf), retval; freq_len = 2; /* * to_bcd requires nibble len */ to_bcd(freqbuf, rit, freq_len*2); retval = icom_transaction (rig, C_SET_OFFS, -1, freqbuf, freq_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_rit: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* icom_get_dsp_flt returns the dsp filter width in hz or 0 if the command is not implemented or error. This allows the default parameters to be assigned from the get_mode routine if the command is not implemented. Assumes rig != null and the current mode is in mode. Has been tested for IC-746pro, Should work on the all dsp rigs ie pro models. The 746 documentation says it has the get_if_filter, but doesn't give any decoding information ? Please test. */ pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode) { int retval, res_len, rfstatus; unsigned char resbuf[MAXFRAMELEN]; value_t rfwidth; if (rig_has_get_func(rig, RIG_FUNC_RF) && (mode & (RIG_MODE_RTTY | RIG_MODE_RTTYR))) { if(!rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_RF, &rfstatus) && (rfstatus)) { retval = rig_get_ext_parm (rig, TOK_RTTY_FLTR, &rfwidth); if (retval != RIG_OK || rfwidth.i >= RTTY_FIL_NB) return 0; /* use default */ else return rtty_fil[rfwidth.i]; } } retval = icom_transaction (rig, C_CTL_MEM, S_MEM_FILT_WDTH, 0, 0, resbuf, &res_len); if (retval != RIG_OK) { rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), " "len=%d\n", __FUNCTION__,resbuf[0],res_len); return 0; /* use default */ } if (res_len == 3 && resbuf[0] == C_CTL_MEM) { int i; i = (int) from_bcd(resbuf + 2, 2); if (mode & RIG_MODE_AM) return (i + 1)* 200; /* Ic_7800 */ else if (mode & (RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_RTTY | RIG_MODE_RTTYR)) return i < 10 ? (i+1) * 50 : (i -4) * 100; } return 0; } int icom_set_dsp_flt(RIG *rig, rmode_t mode, pbwidth_t width) { int retval, rfstatus, i; unsigned char ackbuf[MAXFRAMELEN]; unsigned char flt_ext; value_t rfwidth; int ack_len=sizeof(ackbuf), flt_idx; if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); if (rig_has_get_func(rig, RIG_FUNC_RF) && (mode & (RIG_MODE_RTTY | RIG_MODE_RTTYR))) { if(!rig_get_func(rig, RIG_VFO_CURR, RIG_FUNC_RF, &rfstatus) && (rfstatus)) { for (i=0; istate.priv!=NULL */ int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct icom_priv_data *priv; const struct icom_priv_caps *priv_caps; struct rig_state *rs; unsigned char ackbuf[MAXFRAMELEN]; unsigned char icmode; signed char icmode_ext; int ack_len=sizeof(ackbuf), retval, err; rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; priv_caps = (const struct icom_priv_caps *) rig->caps->priv; if (priv_caps->r2i_mode != NULL) { /* call priv code if defined */ err = priv_caps->r2i_mode(rig, mode, width, &icmode, &icmode_ext); } else { /* else call default */ err = rig2icom_mode(rig, mode, width, &icmode, &icmode_ext); } if (err < 0) return err; /* IC-731 and IC-735 don't support passband data */ if (priv->civ_731_mode || rig->caps->rig_model == RIG_MODEL_OS456) icmode_ext = -1; retval = icom_transaction (rig, C_SET_MODE, icmode, (unsigned char *) &icmode_ext, (icmode_ext == -1 ? 0 : 1), ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_mode: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } #if 0 /* Tentative DSP filter setting ($1A$03), but not supported by every rig, * and some models like IC910/Omni VI Plus have a different meaning for * this subcommand */ if ( (rig->caps->rig_model != RIG_MODEL_IC910) && (rig->caps->rig_model != RIG_MODEL_OMNIVIP) ) icom_set_dsp_flt(rig, mode, width); #endif return RIG_OK; } /* * icom_get_mode * Assumes rig!=NULL, rig->state.priv!=NULL, mode!=NULL, width!=NULL * * TODO: some IC781's, when sending mode info, in wide filter mode, no * width data is send along, making the frame 1 byte short. * (Thank to Mel, VE2DC for this info) */ int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { unsigned char modebuf[MAXFRAMELEN]; int mode_len, retval; retval = icom_transaction (rig, C_RD_MODE, -1, NULL, 0, modebuf, &mode_len); if (retval != RIG_OK) return retval; /* * modebuf should contain Cn,Data area */ mode_len--; if (mode_len != 2 && mode_len != 1) { rig_debug(RIG_DEBUG_ERR,"icom_get_mode: wrong frame len=%d\n", mode_len); return -RIG_ERJCTED; } icom2rig_mode(rig, modebuf[1], mode_len==2 ? modebuf[2] : -1, mode, width); /* IC910H has different meaning of command 1A, subcommand 03. So do * not ask for DSP filter settings */ /* Likewise, don't ask if we happen to be an Omni VI Plus */ if ( (rig->caps->rig_model == RIG_MODEL_IC910) || (rig->caps->rig_model == RIG_MODEL_OMNIVIP) ) return RIG_OK; /* Most rigs return 1-wide, 2-normal,3-narrow * For DSP rigs these are presets, can be programmed for 30 - 41 bandwidths, depending on mode. * Lets check for dsp filters */ if ((retval = icom_get_dsp_flt(rig, *mode)) !=0) *width = retval; return RIG_OK; } /* * icom_set_vfo * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_set_vfo(RIG *rig, vfo_t vfo) { unsigned char ackbuf[MAXFRAMELEN]; int ack_len=sizeof(ackbuf), icvfo, retval; if (vfo == RIG_VFO_CURR) return RIG_OK; switch(vfo) { case RIG_VFO_A: icvfo = S_VFOA; break; case RIG_VFO_B: icvfo = S_VFOB; break; case RIG_VFO_MAIN: icvfo = S_MAIN; break; case RIG_VFO_SUB: icvfo = S_SUB; break; case RIG_VFO_VFO: retval = icom_transaction (rig, C_SET_VFO, -1, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_vfo: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } return RIG_OK; case RIG_VFO_MEM: retval = icom_transaction (rig, C_SET_MEM, -1, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_vfo: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } return RIG_OK; default: rig_debug(RIG_DEBUG_ERR,"icom: Unsupported VFO %d\n", vfo); return -RIG_EINVAL; } retval = icom_transaction (rig, C_SET_VFO, icvfo, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_vfo: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_set_level * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct rig_state *rs; unsigned char lvlbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int ack_len=sizeof(ackbuf), lvl_len; int lvl_cn, lvl_sc; /* Command Number, Subcommand */ int icom_val; int i, retval; rs = &rig->state; /* * So far, levels of float type are in [0.0..1.0] range */ if (RIG_LEVEL_IS_FLOAT(level)) icom_val = val.f * 255; else icom_val = val.i; /* convert values to 0 .. 255 range */ if (rig->caps->rig_model == RIG_MODEL_ICR75) { switch (level) { case RIG_LEVEL_NR: icom_val = val.f * 240; break; case RIG_LEVEL_PBT_IN: case RIG_LEVEL_PBT_OUT: icom_val = (val.f / 10.0) + 128; if (icom_val > 255) icom_val = 255; break; default: break; } } /* * Most of the time, the data field is a 3 digit BCD, * but in *big endian* order: 0000..0255 * (from_bcd is little endian) */ lvl_len = 2; to_bcd_be(lvlbuf, (long long)icom_val, lvl_len*2); switch (level) { case RIG_LEVEL_PREAMP: lvl_cn = C_CTL_FUNC; lvl_sc = S_FUNC_PAMP; lvl_len = 1; if (val.i == 0) { lvlbuf[0] = 0; /* 0=OFF */ break; } for (i=0; ipreamp[i] == val.i) break; } if (i==MAXDBLSTSIZ || rs->preamp[i] == 0) { rig_debug(RIG_DEBUG_ERR,"Unsupported preamp set_level %ddB", val.i); return -RIG_EINVAL; } lvlbuf[0] = i+1; /* 1=P.AMP1, 2=P.AMP2 */ break; case RIG_LEVEL_ATT: lvl_cn = C_CTL_ATT; /* attenuator level is dB, in BCD mode */ lvl_sc = (val.i/10)<<4 | (val.i%10); lvl_len = 0; break; case RIG_LEVEL_AF: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_AF; break; case RIG_LEVEL_RF: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_RF; break; case RIG_LEVEL_SQL: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_SQL; break; case RIG_LEVEL_IF: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_IF; break; case RIG_LEVEL_APF: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_APF; break; case RIG_LEVEL_NR: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_NR; break; case RIG_LEVEL_PBT_IN: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_PBTIN; break; case RIG_LEVEL_PBT_OUT: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_PBTOUT; break; case RIG_LEVEL_CWPITCH: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_CWPITCH; /* use 'set mode' call for CWPITCH on IC-R75*/ if (rig->caps->rig_model == RIG_MODEL_ICR75) { lvl_cn = C_CTL_MEM; lvl_sc = S_MEM_MODE_SLCT; lvl_len = 3; lvlbuf[0] = S_PRM_CWPITCH; to_bcd_be(lvlbuf+1, (long long)icom_val, 4); } break; case RIG_LEVEL_RFPOWER: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_RFPOWER; break; case RIG_LEVEL_MICGAIN: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_MICGAIN; break; case RIG_LEVEL_KEYSPD: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_KEYSPD; break; case RIG_LEVEL_NOTCHF: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_NOTCHF; break; case RIG_LEVEL_COMP: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_COMP; break; case RIG_LEVEL_AGC: lvl_cn = C_CTL_FUNC; lvl_sc = S_FUNC_AGC; lvl_len = 1; switch (val.i) { case RIG_AGC_SLOW: lvlbuf[0] = D_AGC_SLOW; break; case RIG_AGC_MEDIUM: lvlbuf[0] = D_AGC_MID; break; case RIG_AGC_FAST: lvlbuf[0] = D_AGC_FAST; break; case RIG_AGC_SUPERFAST: lvlbuf[0] = D_AGC_SUPERFAST; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported LEVEL_AGC %d", val.i); return -RIG_EINVAL; } break; case RIG_LEVEL_BKINDL: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_BKINDL; break; case RIG_LEVEL_BALANCE: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_BALANCE; break; case RIG_LEVEL_VOXGAIN: if (rig->caps->rig_model == RIG_MODEL_IC910) { /* IC-910H */ lvl_cn = C_CTL_MEM; lvl_sc = S_MEM_VOXGAIN; } else { lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_VOXGAIN; } break; case RIG_LEVEL_VOXDELAY: /* IC-910H */ lvl_cn = C_CTL_MEM; lvl_sc = S_MEM_VOXDELAY; break; case RIG_LEVEL_ANTIVOX: if (rig->caps->rig_model == RIG_MODEL_IC910) { /* IC-910H */ lvl_cn = C_CTL_MEM; lvl_sc = S_MEM_ANTIVOX; } else { lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_ANTIVOX; } break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_level %d", level); return -RIG_EINVAL; } retval = icom_transaction (rig, lvl_cn, lvl_sc, lvlbuf, lvl_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_level: ack NG (%#.2x), " "len=%d\n", ackbuf[0], ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_get_level * Assumes rig!=NULL, rig->state.priv!=NULL, val!=NULL * * TODO (missing RIG_LEVEL): * - S_RFML: Read real RFpower-meter level * - S_CMP: Read COMP-meter level * - S_VD : Read Vd-meter level * - S_ID : Read Id-meter level */ int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct rig_state *rs; unsigned char lvlbuf[MAXFRAMELEN], lvl2buf[MAXFRAMELEN]; int lvl_len, lvl2_len; int lvl_cn, lvl_sc; /* Command Number, Subcommand */ int icom_val; int cmdhead; int retval; rs = &rig->state; lvl2_len = 0; switch (level) { case RIG_LEVEL_STRENGTH: case RIG_LEVEL_RAWSTR: lvl_cn = C_RD_SQSM; lvl_sc = S_SML; break; case RIG_LEVEL_ALC: lvl_cn = C_RD_SQSM; lvl_sc = S_ALC; break; case RIG_LEVEL_SWR: lvl_cn = C_RD_SQSM; lvl_sc = S_SWR; break; case RIG_LEVEL_PREAMP: lvl_cn = C_CTL_FUNC; lvl_sc = S_FUNC_PAMP; break; case RIG_LEVEL_ATT: lvl_cn = C_CTL_ATT; lvl_sc = -1; break; case RIG_LEVEL_AF: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_AF; break; case RIG_LEVEL_RF: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_RF; break; case RIG_LEVEL_SQL: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_SQL; break; case RIG_LEVEL_IF: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_IF; break; case RIG_LEVEL_APF: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_APF; break; case RIG_LEVEL_NR: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_NR; break; case RIG_LEVEL_PBT_IN: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_PBTIN; break; case RIG_LEVEL_PBT_OUT: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_PBTOUT; break; case RIG_LEVEL_CWPITCH: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_CWPITCH; /* use 'set mode' call for CWPITCH on IC-R75*/ if (rig->caps->rig_model == RIG_MODEL_ICR75) { lvl_cn = C_CTL_MEM; lvl_sc = S_MEM_MODE_SLCT; lvl2_len = 1; lvl2buf[0] = S_PRM_CWPITCH; } break; case RIG_LEVEL_RFPOWER: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_RFPOWER; break; case RIG_LEVEL_MICGAIN: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_MICGAIN; break; case RIG_LEVEL_KEYSPD: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_KEYSPD; break; case RIG_LEVEL_NOTCHF: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_NOTCHF; break; case RIG_LEVEL_COMP: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_COMP; break; case RIG_LEVEL_AGC: lvl_cn = C_CTL_FUNC; lvl_sc = S_FUNC_AGC; break; case RIG_LEVEL_BKINDL: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_BKINDL; break; case RIG_LEVEL_BALANCE: lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_BALANCE; break; case RIG_LEVEL_VOXGAIN: /* IC-910H */ if (rig->caps->rig_model == RIG_MODEL_IC910) { /* IC-910H */ lvl_cn = C_CTL_MEM; lvl_sc = S_MEM_VOXGAIN; } else { lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_VOXGAIN; } break; case RIG_LEVEL_VOXDELAY: /* IC-910H */ lvl_cn = C_CTL_MEM; lvl_sc = S_MEM_VOXDELAY; break; case RIG_LEVEL_ANTIVOX: if (rig->caps->rig_model == RIG_MODEL_IC910) { /* IC-910H */ lvl_cn = C_CTL_MEM; lvl_sc = S_MEM_ANTIVOX; } else { lvl_cn = C_CTL_LVL; lvl_sc = S_LVL_ANTIVOX; } break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_level %d", level); return -RIG_EINVAL; } /* use lvl2buf and lvl2_len for 'set mode' subcommand */ retval = icom_transaction (rig, lvl_cn, lvl_sc, lvl2buf, lvl2_len, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; /* * strbuf should contain Cn,Sc,Data area */ cmdhead = (lvl_sc == -1) ? 1:2; lvl_len -= cmdhead; /* back off one char since first char in buffer is now 'set mode' subcommand */ if ((rig->caps->rig_model == RIG_MODEL_ICR75)&&(level==RIG_LEVEL_CWPITCH)){ cmdhead = 3; lvl_len--; } if (lvlbuf[0] != ACK && lvlbuf[0] != lvl_cn) { rig_debug(RIG_DEBUG_ERR,"icom_get_level: ack NG (%#.2x), " "len=%d\n", lvlbuf[0],lvl_len); return -RIG_ERJCTED; } /* * The result is a 3 digit BCD, but in *big endian* order: 0000..0255 * (from_bcd is little endian) */ icom_val = from_bcd_be(lvlbuf+cmdhead, lvl_len*2); switch (level) { case RIG_LEVEL_RAWSTR: /* raw value */ val->i = icom_val; break; case RIG_LEVEL_AGC: switch (icom_val) { case D_AGC_SLOW: val->i = RIG_AGC_SLOW; break; case D_AGC_MID: val->i = RIG_AGC_MEDIUM; break; case D_AGC_FAST: val->i = RIG_AGC_FAST; break; case D_AGC_SUPERFAST: val->i = RIG_AGC_SUPERFAST; break; default: rig_debug(RIG_DEBUG_ERR,"Unexpected AGC 0x%02x", icom_val); return -RIG_EPROTO; } break; case RIG_LEVEL_ALC: /* 120 max on IC-7600 */ val->f = (float)icom_val/120; break; case RIG_LEVEL_SWR: /* {0->1, 48->1.5, 80->2} on IC-7600 */ val->f = 1. + (float)icom_val/80; break; case RIG_LEVEL_PREAMP: if (icom_val == 0) { val->i = 0; break; } if (icom_val > MAXDBLSTSIZ || rs->preamp[icom_val-1]==0) { rig_debug(RIG_DEBUG_ERR,"Unsupported preamp get_level %ddB", icom_val); return -RIG_EPROTO; } val->i = rs->preamp[icom_val-1]; break; /* RIG_LEVEL_ATT: returned value is already an integer in dB (coded in BCD) */ default: if (RIG_LEVEL_IS_FLOAT(level)) val->f = (float)icom_val/255; else val->i = icom_val; } /* convert values from 0 .. 255 range */ if (rig->caps->rig_model == RIG_MODEL_ICR75) { switch (level) { case RIG_LEVEL_NR: val->f = (float)icom_val / 240; break; case RIG_LEVEL_PBT_IN: case RIG_LEVEL_PBT_OUT: if (icom_val == 255) val->f = 1280.0; else val->f = (float)(icom_val - 128) * 10.0; break; default: break; } } rig_debug(RIG_DEBUG_TRACE,"icom_get_level: %d %d %d %f\n", lvl_len, icom_val, val->i, val->f); return RIG_OK; } /* * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_set_conf(RIG *rig, token_t token, const char *val) { struct icom_priv_data *priv; struct rig_state *rs; rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; switch(token) { case TOK_CIVADDR: if (val[0] == '0' && val[1] == 'x') priv->re_civ_addr = strtol(val, (char **)NULL, 16); else priv->re_civ_addr = atoi(val); break; case TOK_MODE731: priv->civ_731_mode = atoi(val) ? 1:0; break; default: return -RIG_EINVAL; } return RIG_OK; } /* * assumes rig!=NULL, * Assumes rig!=NULL, rig->state.priv!=NULL * and val points to a buffer big enough to hold the conf value. */ int icom_get_conf(RIG *rig, token_t token, char *val) { struct icom_priv_data *priv; struct rig_state *rs; rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; switch(token) { case TOK_CIVADDR: sprintf(val, "%d", priv->re_civ_addr); break; case TOK_MODE731: sprintf(val, "%d", priv->civ_731_mode); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * icom_set_ptt * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { unsigned char ackbuf[MAXFRAMELEN], pttbuf[1]; int ack_len=sizeof(ackbuf), retval; pttbuf[0] = ptt == RIG_PTT_ON ? 1 : 0; retval = icom_transaction (rig, C_CTL_PTT, S_PTT, pttbuf, 1, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_ptt: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_get_ptt * Assumes rig!=NULL, rig->state.priv!=NULL, ptt!=NULL */ int icom_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { unsigned char pttbuf[MAXFRAMELEN]; int ptt_len, retval; retval = icom_transaction (rig, C_CTL_PTT, S_PTT, NULL, 0, pttbuf, &ptt_len); if (retval != RIG_OK) return retval; /* * pttbuf should contain Cn,Sc,Data area */ ptt_len -= 2; if (ptt_len != 1) { rig_debug(RIG_DEBUG_ERR,"icom_get_ptt: wrong frame len=%d\n", ptt_len); return -RIG_ERJCTED; } *ptt = pttbuf[2] == 1 ? RIG_PTT_ON : RIG_PTT_OFF; return RIG_OK; } /* * icom_get_dcd * Assumes rig!=NULL, rig->state.priv!=NULL, ptt!=NULL */ int icom_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { unsigned char dcdbuf[MAXFRAMELEN]; int dcd_len, retval; retval = icom_transaction (rig, C_RD_SQSM, S_SQL, NULL, 0, dcdbuf, &dcd_len); if (retval != RIG_OK) return retval; /* * dcdbuf should contain Cn,Data area */ dcd_len -= 2; if (dcd_len != 1) { rig_debug(RIG_DEBUG_ERR,"icom_get_dcd: wrong frame len=%d\n", dcd_len); return -RIG_ERJCTED; } /* * 0x00=sql closed, 0x01=sql open */ *dcd = dcdbuf[2] == 1 ? RIG_DCD_ON : RIG_DCD_OFF; return RIG_OK; } /* * icom_set_rptr_shift * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift) { unsigned char ackbuf[MAXFRAMELEN]; int ack_len=sizeof(ackbuf), retval; int rptr_sc; switch (rptr_shift) { case RIG_RPT_SHIFT_NONE: rptr_sc = S_DUP_OFF; /* Simplex mode */ break; case RIG_RPT_SHIFT_MINUS: rptr_sc = S_DUP_M; /* Duplex - mode */ break; case RIG_RPT_SHIFT_PLUS: rptr_sc = S_DUP_P; /* Duplex + mode */ break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported shift %d", rptr_shift); return -RIG_EINVAL; } retval = icom_transaction (rig, C_CTL_SPLT, rptr_sc, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_rptr_shift: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_get_rptr_shift * Assumes rig!=NULL, rig->state.priv!=NULL, rptr_shift!=NULL * will not work for IC-746 Pro * NOTE: seems not to work (tested on IC-706MkIIG), please report --SF */ int icom_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift) { unsigned char rptrbuf[MAXFRAMELEN]; int rptr_len, retval; retval = icom_transaction (rig, C_CTL_SPLT, -1, NULL, 0, rptrbuf, &rptr_len); if (retval != RIG_OK) return retval; /* * rptrbuf should contain Cn,Sc */ rptr_len--; if (rptr_len != 1) { rig_debug(RIG_DEBUG_ERR,"icom_get_rptr_shift: wrong frame len=%d\n", rptr_len); return -RIG_ERJCTED; } switch (rptrbuf[1]) { case S_DUP_OFF: *rptr_shift = RIG_RPT_SHIFT_NONE; /* Simplex mode */ break; case S_DUP_M: *rptr_shift = RIG_RPT_SHIFT_MINUS; /* Duples - mode */ break; case S_DUP_P: *rptr_shift = RIG_RPT_SHIFT_PLUS; /* Duplex + mode */ break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported shift %d", rptrbuf[1]); return -RIG_EPROTO; } return RIG_OK; } /* * icom_set_rptr_offs * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs) { unsigned char offsbuf[MAXFRAMELEN],ackbuf[MAXFRAMELEN]; int ack_len=sizeof(ackbuf), retval; /* * Icoms are using a 100Hz unit (at least on 706MKIIg) -- SF */ to_bcd(offsbuf, rptr_offs/100, OFFS_LEN*2); retval = icom_transaction (rig, C_SET_OFFS, -1, offsbuf, OFFS_LEN, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_rptr_offs: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_get_rptr_offs * Assumes rig!=NULL, rig->state.priv!=NULL, rptr_offs!=NULL */ int icom_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs) { unsigned char offsbuf[MAXFRAMELEN]; int offs_len, retval; retval = icom_transaction (rig, C_RD_OFFS, -1, NULL, 0, offsbuf, &offs_len); if (retval != RIG_OK) return retval; /* * offsbuf should contain Cn */ offs_len--; if (offs_len != OFFS_LEN) { rig_debug(RIG_DEBUG_ERR,"icom_get_rptr_offs: " "wrong frame len=%d\n", offs_len); return -RIG_ERJCTED; } /* * Icoms are using a 100Hz unit (at least on 706MKIIg) -- SF */ *rptr_offs = from_bcd(offsbuf+1, offs_len*2)*100; return RIG_OK; } /* * Helper function to go back and forth split VFO */ static int get_split_vfos(const RIG *rig, vfo_t *rx_vfo, vfo_t *tx_vfo) { if ((rig->state.vfo_list & (RIG_VFO_A|RIG_VFO_B)) == (RIG_VFO_A|RIG_VFO_B)) { *rx_vfo = RIG_VFO_A; *tx_vfo = RIG_VFO_B; } else if ((rig->state.vfo_list & (RIG_VFO_MAIN|RIG_VFO_SUB)) == (RIG_VFO_MAIN|RIG_VFO_SUB)) { *rx_vfo = RIG_VFO_MAIN; *tx_vfo = RIG_VFO_SUB; } else { return -RIG_ENAVAIL; } return RIG_OK; } /* * icom_set_split_freq * Assumes rig!=NULL, rig->state.priv!=NULL, * icom_set_vfo,icom_set_freq works for this rig * FIXME: status * * Assumes also that the current VFO is the rx VFO. */ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) { int status; vfo_t rx_vfo, tx_vfo; /* This method works also in memory mode(RIG_VFO_MEM) */ if (rig_has_vfo_op(rig, RIG_OP_XCHG)) { status = icom_vfo_op(rig, vfo, RIG_OP_XCHG); if (status != RIG_OK) return status; status = icom_set_freq(rig, RIG_VFO_CURR, tx_freq); if (status != RIG_OK) return status; status = icom_vfo_op(rig, vfo, RIG_OP_XCHG); if (status != RIG_OK) return status; return 0; } status = get_split_vfos(rig, &rx_vfo, &tx_vfo); if (status != RIG_OK) return status; status = icom_set_vfo(rig, tx_vfo); if (status != RIG_OK) return status; status = icom_set_freq(rig, RIG_VFO_CURR, tx_freq); if (status != RIG_OK) return status; status = icom_set_vfo(rig, rx_vfo); if (status != RIG_OK) return status; return status; } /* * icom_get_split_freq * Assumes rig!=NULL, rig->state.priv!=NULL, rx_freq!=NULL, tx_freq!=NULL * icom_set_vfo,icom_get_freq works for this rig * FIXME: status */ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) { int status; vfo_t rx_vfo, tx_vfo; /* This method works also in memory mode(RIG_VFO_MEM) */ if (rig_has_vfo_op(rig, RIG_OP_XCHG)) { status = icom_vfo_op(rig, vfo, RIG_OP_XCHG); if (status != RIG_OK) return status; status = icom_get_freq(rig, RIG_VFO_CURR, tx_freq); if (status != RIG_OK) return status; status = icom_vfo_op(rig, vfo, RIG_OP_XCHG); if (status != RIG_OK) return status; return 0; } status = get_split_vfos(rig, &rx_vfo, &tx_vfo); if (status != RIG_OK) return status; status = icom_set_vfo(rig, tx_vfo); if (status != RIG_OK) return status; status = icom_get_freq(rig, RIG_VFO_CURR, tx_freq); if (status != RIG_OK) return status; status = icom_set_vfo(rig, rx_vfo); if (status != RIG_OK) return status; return status; } /* * icom_set_split_mode * Assumes rig!=NULL, rig->state.priv!=NULL, * icom_set_vfo,icom_set_mode works for this rig * FIXME: status */ int icom_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width) { int status; vfo_t rx_vfo, tx_vfo; /* This method works also in memory mode(RIG_VFO_MEM) */ if (rig_has_vfo_op(rig, RIG_OP_XCHG)) { status = icom_vfo_op(rig, vfo, RIG_OP_XCHG); if (status != RIG_OK) return status; status = icom_set_mode(rig, RIG_VFO_CURR, tx_mode, tx_width); if (status != RIG_OK) return status; status = icom_vfo_op(rig, vfo, RIG_OP_XCHG); if (status != RIG_OK) return status; return 0; } status = get_split_vfos(rig, &rx_vfo, &tx_vfo); if (status != RIG_OK) return status; status = icom_set_vfo(rig, tx_vfo); if (status != RIG_OK) return status; status = icom_set_mode(rig, RIG_VFO_CURR, tx_mode, tx_width); if (status != RIG_OK) return status; status = icom_set_vfo(rig, rx_vfo); if (status != RIG_OK) return status; return status; } /* * icom_get_split_mode * Assumes rig!=NULL, rig->state.priv!=NULL, * rx_mode!=NULL, rx_width!=NULL, tx_mode!=NULL, tx_width!=NULL * icom_set_vfo,icom_get_mode works for this rig * FIXME: status */ int icom_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width) { int status; vfo_t rx_vfo, tx_vfo; /* This method works also in memory mode(RIG_VFO_MEM) */ if (rig_has_vfo_op(rig, RIG_OP_XCHG)) { status = icom_vfo_op(rig, vfo, RIG_OP_XCHG); if (status != RIG_OK) return status; status = icom_get_mode(rig, RIG_VFO_CURR, tx_mode, tx_width); if (status != RIG_OK) return status; status = icom_vfo_op(rig, vfo, RIG_OP_XCHG); if (status != RIG_OK) return status; return 0; } status = get_split_vfos(rig, &rx_vfo, &tx_vfo); if (status != RIG_OK) return status; status = icom_set_vfo(rig, tx_vfo); if (status != RIG_OK) return status; status = icom_get_mode(rig, RIG_VFO_CURR, tx_mode, tx_width); if (status != RIG_OK) return status; status = icom_set_vfo(rig, rx_vfo); if (status != RIG_OK) return status; return status; } /* * icom_set_split * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { unsigned char ackbuf[MAXFRAMELEN]; int ack_len=sizeof(ackbuf), retval; int split_sc; switch (split) { case RIG_SPLIT_OFF: split_sc = S_SPLT_OFF; break; case RIG_SPLIT_ON: split_sc = S_SPLT_ON; break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported split %d", __FUNCTION__, split); return -RIG_EINVAL; } retval = icom_transaction (rig, C_CTL_SPLT, split_sc, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_split: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_get_split_vfo * Assumes rig!=NULL, rig->state.priv!=NULL, split!=NULL * * Does not appear to be supported by any mode? * \sa icom_mem_get_split_vfo() */ int icom_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { unsigned char splitbuf[MAXFRAMELEN]; int split_len, retval; retval = icom_transaction (rig, C_CTL_SPLT, -1, NULL, 0, splitbuf, &split_len); if (retval != RIG_OK) return retval; /* * splitbuf should contain Cn,Sc */ split_len--; if (split_len != 1) { rig_debug(RIG_DEBUG_ERR,"%s: wrong frame len=%d\n", __FUNCTION__, split_len); return -RIG_ERJCTED; } switch (splitbuf[1]) { case S_SPLT_OFF: *split = RIG_SPLIT_OFF; break; case S_SPLT_ON: *split = RIG_SPLIT_ON; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported split %d", splitbuf[1]); return -RIG_EPROTO; } return RIG_OK; } /* * icom_mem_get_split_vfo * Assumes rig!=NULL, rig->state.priv!=NULL, split!=NULL */ int icom_mem_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { int retval; /* this hacks works only when in memory mode * I have no clue how to detect split in regular VFO mode */ if (rig->state.current_vfo != RIG_VFO_MEM || !rig_has_vfo_op(rig, RIG_OP_XCHG)) return -RIG_ENAVAIL; retval = icom_vfo_op(rig, vfo, RIG_OP_XCHG); if (retval == RIG_OK) { *split = RIG_SPLIT_ON; /* get it back to normal */ retval = icom_vfo_op(rig, vfo, RIG_OP_XCHG); } else if (retval == -RIG_ERJCTED) { *split = RIG_SPLIT_OFF; } else { /* this is really an error! */ return retval; } return RIG_OK; } /* * icom_set_ts * Assumes rig!=NULL, rig->caps->priv!=NULL */ int icom_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) { const struct icom_priv_caps *priv_caps; unsigned char ackbuf[MAXFRAMELEN]; int i, ack_len=sizeof(ackbuf), retval; int ts_sc = 0; priv_caps = (const struct icom_priv_caps*)rig->caps->priv; for (i=0; its_sc_list[i].ts == ts) { ts_sc = priv_caps->ts_sc_list[i].sc; break; } } if (i >= TSLSTSIZ) return -RIG_EINVAL; /* not found, unsupported */ retval = icom_transaction (rig, C_SET_TS, ts_sc, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_ts: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_get_ts * Assumes rig!=NULL, rig->caps->priv!=NULL, ts!=NULL * NOTE: seems not to work (tested on IC-706MkIIG), please report --SF Not available on 746pro */ int icom_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) { const struct icom_priv_caps *priv_caps; unsigned char tsbuf[MAXFRAMELEN]; int ts_len, i, retval; priv_caps = (const struct icom_priv_caps*)rig->caps->priv; retval = icom_transaction (rig, C_SET_TS, -1, NULL, 0, tsbuf, &ts_len); if (retval != RIG_OK) return retval; /* * tsbuf should contain Cn,Sc */ ts_len--; if (ts_len != 1) { rig_debug(RIG_DEBUG_ERR,"icom_get_ts: wrong frame len=%d\n", ts_len); return -RIG_ERJCTED; } for (i=0; its_sc_list[i].sc == tsbuf[1]) { *ts = priv_caps->ts_sc_list[i].ts; break; } } if (i >= TSLSTSIZ) return -RIG_EPROTO; /* not found, unsupported */ return RIG_OK; } /* * icom_set_func * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { unsigned char fctbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int fct_len, acklen, retval; int fct_cn, fct_sc; /* Command Number, Subcommand */ /* * except for IC-R8500 */ fctbuf[0] = status? 0x01:0x00; fct_len = rig->caps->rig_model == RIG_MODEL_ICR8500 ? 0 : 1; switch (func) { case RIG_FUNC_FAGC: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_AGC; /* note: should it be a LEVEL only, and no func? --SF */ if (status != 0) fctbuf[0] = 0x03; /* default to 0x03 in IC746 pro super-fast */ else fctbuf[0] = 0x02; break; case RIG_FUNC_NB: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_NB; break; case RIG_FUNC_COMP: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_COMP; break; case RIG_FUNC_VOX: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_VOX; break; case RIG_FUNC_TONE: /* repeater tone */ fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_TONE; break; case RIG_FUNC_TSQL: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_TSQL; break; case RIG_FUNC_SBKIN: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_BKIN; if (status != 0) fctbuf[0] = 0x01; else fctbuf[0] = 0x00; break; case RIG_FUNC_FBKIN: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_BKIN; if (status != 0) fctbuf[0] = 0x02; else fctbuf[0] = 0x00; break; case RIG_FUNC_ANF: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_ANF; break; case RIG_FUNC_NR: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_NR; break; case RIG_FUNC_APF: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_APF; break; case RIG_FUNC_MON: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_MON; break; case RIG_FUNC_MN: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_MN; break; case RIG_FUNC_RF: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_RF; break; case RIG_FUNC_VSC: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_VSC; break; case RIG_FUNC_LOCK: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_DIAL_LK; break; case RIG_FUNC_AFC: /* IC-910H */ fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_AFC; break; case RIG_FUNC_SATMODE: /* IC-910H */ fct_cn = C_CTL_MEM; fct_sc = S_MEM_SATMODE; break; case RIG_FUNC_SCOPE: /* IC-910H */ fct_cn = C_CTL_MEM; fct_sc = S_MEM_BANDSCOPE; break; case RIG_FUNC_RESUME: /* IC-910H & IC-746-Pro*/ fct_cn = C_CTL_SCAN; fct_sc = status ? S_SCAN_RSMON : S_SCAN_RSMOFF; fct_len = 0; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_func %d", func); return -RIG_EINVAL; } retval = icom_transaction(rig, fct_cn, fct_sc, fctbuf, fct_len, ackbuf, &acklen); if (retval != RIG_OK) return retval; if (acklen != 1) { rig_debug(RIG_DEBUG_ERR,"icom_set_func: wrong frame len=%d\n", acklen); return -RIG_EPROTO; } return RIG_OK; } /* * icom_get_func * Assumes rig!=NULL, rig->state.priv!=NULL * FIXME: IC8500 and no-sc, any support? */ int icom_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { unsigned char ackbuf[MAXFRAMELEN]; int ack_len=sizeof(ackbuf), retval; int fct_cn, fct_sc; /* Command Number, Subcommand */ switch (func) { case RIG_FUNC_FAGC: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_AGC; /* default to 0x01=slow 0x03=super-fast */ break; case RIG_FUNC_NB: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_NB; break; case RIG_FUNC_COMP: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_COMP; break; case RIG_FUNC_VOX: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_VOX; break; case RIG_FUNC_TONE: /* repeater tone */ fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_TONE; break; case RIG_FUNC_TSQL: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_TSQL; break; case RIG_FUNC_SBKIN: /* returns 1 for semi and 2 for full adjusted below */ case RIG_FUNC_FBKIN: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_BKIN; break; case RIG_FUNC_ANF: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_ANF; break; case RIG_FUNC_NR: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_NR; break; case RIG_FUNC_APF: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_APF; break; case RIG_FUNC_MON: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_MON; break; case RIG_FUNC_MN: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_MN; break; case RIG_FUNC_RF: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_RF; break; case RIG_FUNC_VSC: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_VSC; break; case RIG_FUNC_LOCK: fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_DIAL_LK; break; case RIG_FUNC_AFC: /* IC-910H */ fct_cn = C_CTL_FUNC; fct_sc = S_FUNC_AFC; break; case RIG_FUNC_SATMODE: /* IC-910H */ fct_cn = C_CTL_MEM; fct_sc = S_MEM_SATMODE; break; case RIG_FUNC_SCOPE: /* IC-910H */ fct_cn = C_CTL_MEM; fct_sc = S_MEM_BANDSCOPE; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_func %d", func); return -RIG_EINVAL; } retval = icom_transaction (rig, fct_cn, fct_sc, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 3) { rig_debug(RIG_DEBUG_ERR,"icom_get_func: wrong frame len=%d\n", ack_len); return -RIG_EPROTO; } if (func != RIG_FUNC_FBKIN) *status = ackbuf[2]; else *status = ackbuf[2] == 2 ? 1 : 0; return RIG_OK; } /* * icom_set_parm * Assumes rig!=NULL These are very much rig specific and should probably be in rig files. These are for ICR75C only. */ int icom_set_parm(RIG *rig, setting_t parm, value_t val) { unsigned char prmbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int ack_len=sizeof(ackbuf), prm_len; int prm_cn, prm_sc; int icom_val; int retval; int min,hr,sec; switch (parm) { case RIG_PARM_ANN: if ((val.i == RIG_ANN_FREQ) || (val.i == RIG_ANN_RXMODE)) { prm_cn = C_CTL_ANN; prm_sc = val.i; prm_len = 0; } else { if ((val.i == RIG_ANN_ENG)||(val.i == RIG_ANN_JAP)) { prm_cn = C_CTL_MEM; prm_sc = S_MEM_MODE_SLCT; prm_len = 2; prmbuf[0] = S_PRM_LANG; prmbuf[1] = (val.i == RIG_ANN_ENG ? 0 : 1); } else { rig_debug(RIG_DEBUG_ERR,"Unsupported set_parm_ann %d\n", val.i); return -RIG_EINVAL; } } break; case RIG_PARM_APO: prm_cn = C_CTL_MEM; prm_sc = S_MEM_MODE_SLCT; hr = (float)val.i/60.0; min = val.i - (hr*60); prm_len = 3; prmbuf[0] = S_PRM_SLPTM; to_bcd_be(prmbuf+1, (long long)hr, 2); to_bcd_be(prmbuf+2, (long long)min, 2); break; case RIG_PARM_BACKLIGHT: prm_cn = C_CTL_MEM; prm_sc = S_MEM_MODE_SLCT; icom_val = val.f * 255; prm_len = 3; prmbuf[0] = S_PRM_BACKLT; to_bcd_be(prmbuf+1, (long long)icom_val, (prm_len-1)*2); break; case RIG_PARM_BEEP: prm_cn = C_CTL_MEM; prm_sc = S_MEM_MODE_SLCT; prm_len = 2; prmbuf[0] = S_PRM_BEEP; prmbuf[1] = val.i; break; case RIG_PARM_TIME: prm_cn = C_CTL_MEM; prm_sc = S_MEM_MODE_SLCT; hr = (float)val.i/3600.0; min = (float)(val.i - (hr*3600))/60.0; sec = (val.i - (hr*3600) - (min*60)); prm_len = 4; prmbuf[0] = S_PRM_TIME; to_bcd_be(prmbuf+1, (long long)hr, 2); to_bcd_be(prmbuf+2, (long long)min, 2); to_bcd_be(prmbuf+3, (long long)sec, 2); break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_parm %d\n", parm); return -RIG_EINVAL; } retval = icom_transaction(rig, prm_cn, prm_sc, prmbuf, prm_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1) { rig_debug(RIG_DEBUG_ERR,"icom_set_parm: wrong frame len=%d\n", ack_len); return -RIG_EPROTO; } return RIG_OK; } /* * icom_get_parm * Assumes rig!=NULL */ int icom_get_parm(RIG *rig, setting_t parm, value_t *val) { unsigned char prmbuf[MAXFRAMELEN], resbuf[MAXFRAMELEN]; int prm_len, res_len; int prm_cn, prm_sc; int icom_val; int cmdhead; int retval; int min,hr,sec; switch (parm) { case RIG_PARM_APO: prm_cn = C_CTL_MEM; prm_sc = S_MEM_MODE_SLCT; prm_len = 1; prmbuf[0] = S_PRM_SLPTM; break; case RIG_PARM_BACKLIGHT: prm_cn = C_CTL_MEM; prm_sc = S_MEM_MODE_SLCT; prm_len = 1; prmbuf[0] = S_PRM_BACKLT; break; case RIG_PARM_BEEP: prm_cn = C_CTL_MEM; prm_sc = S_MEM_MODE_SLCT; prm_len = 1; prmbuf[0] = S_PRM_BEEP; break; case RIG_PARM_TIME: prm_cn = C_CTL_MEM; prm_sc = S_MEM_MODE_SLCT; prm_len = 1; prmbuf[0] = S_PRM_TIME; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_parm %d", parm); return -RIG_EINVAL; } retval = icom_transaction (rig, prm_cn, prm_sc, prmbuf, prm_len, resbuf, &res_len); if (retval != RIG_OK) return retval; /* * strbuf should contain Cn,Sc,[pn],Data area */ cmdhead = (prm_sc == -1) ? 1:3; res_len -= cmdhead; if (resbuf[0] != ACK && resbuf[0] != prm_cn) { rig_debug(RIG_DEBUG_ERR,"%s: ack NG (%#.2x), " "len=%d\n", __FUNCTION__,resbuf[0],res_len); return -RIG_ERJCTED; } switch (parm) { case RIG_PARM_APO: hr = from_bcd_be(resbuf+cmdhead, 2); min = from_bcd_be(resbuf+cmdhead+1, 2); icom_val = (hr*60)+min; val->i = icom_val; break; case RIG_PARM_TIME: hr = from_bcd_be(resbuf+cmdhead, 2); min = from_bcd_be(resbuf+cmdhead+1, 2); sec = from_bcd_be(resbuf+cmdhead+2, 2); icom_val = (hr*3600)+(min*60)+sec; val->i = icom_val; break; default: icom_val = from_bcd_be(resbuf+cmdhead, res_len*2); if (RIG_PARM_IS_FLOAT(parm)) val->f = (float)icom_val/255; else val->i = icom_val; } rig_debug(RIG_DEBUG_TRACE,"%s: %d %d %d %f\n", __FUNCTION__, res_len, icom_val, val->i, val->f); return RIG_OK; } /* * icom_set_ctcss_tone * Assumes rig!=NULL, rig->state.priv!=NULL * * Works for 746 pro and should work for 756 xx and 7800 */ int icom_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone) { const struct rig_caps *caps; unsigned char tonebuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int tone_len, ack_len=sizeof(ackbuf), retval; int i; caps = rig->caps; for (i = 0; caps->ctcss_list[i] != 0 && i<52; i++) { if (caps->ctcss_list[i] == tone) break; } if (caps->ctcss_list[i] != tone) return -RIG_EINVAL; /* Sent as frequency in tenth of Hz */ tone_len = 3; to_bcd_be(tonebuf, tone, tone_len*2); retval = icom_transaction(rig, C_SET_TONE, S_TONE_RPTR, tonebuf, tone_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_ctcss_tone: ack NG (%#.2x), " "len=%d\n", ackbuf[0], ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_get_ctcss_tone * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone) { const struct rig_caps *caps; unsigned char tonebuf[MAXFRAMELEN]; int tone_len, retval; int i; caps = rig->caps; retval = icom_transaction(rig, C_SET_TONE, S_TONE_RPTR, NULL, 0, tonebuf, &tone_len); if (retval != RIG_OK) return retval; /* cn,sc,data*3 */ if (tone_len != 5) { rig_debug(RIG_DEBUG_ERR,"icom_get_ctcss_tone: ack NG (%#.2x), " "len=%d\n", tonebuf[0], tone_len); return -RIG_ERJCTED; } tone_len -= 2; *tone = from_bcd_be(tonebuf+2, tone_len*2); /* check this tone exists. That's better than nothing. */ for (i = 0; caps->ctcss_list[i] != 0 && i<52; i++) { if (caps->ctcss_list[i] == *tone) return RIG_OK; } rig_debug(RIG_DEBUG_ERR,"icom_get_ctcss_tone: CTCSS NG " "(%#.2x)\n", tonebuf[2]); return -RIG_EPROTO; } /* * icom_set_ctcss_sql * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone) { const struct rig_caps *caps; unsigned char tonebuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int tone_len, ack_len=sizeof(ackbuf), retval; int i; caps = rig->caps; for (i = 0; caps->ctcss_list[i] != 0 && i<52; i++) { if (caps->ctcss_list[i] == tone) break; } if (caps->ctcss_list[i] != tone) return -RIG_EINVAL; /* Sent as frequency in tenth of Hz */ tone_len = 3; to_bcd_be(tonebuf, tone, tone_len*2); retval = icom_transaction(rig, C_SET_TONE, S_TONE_SQL, tonebuf, tone_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_ctcss_sql: ack NG (%#.2x), " "len=%d\n", ackbuf[0], ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_get_ctcss_sql * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone) { const struct rig_caps *caps; unsigned char tonebuf[MAXFRAMELEN]; int tone_len, retval; int i; caps = rig->caps; retval = icom_transaction(rig, C_SET_TONE, S_TONE_SQL, NULL, 0, tonebuf, &tone_len); if (retval != RIG_OK) return retval; if (tone_len != 5) { rig_debug(RIG_DEBUG_ERR,"icom_get_ctcss_sql: ack NG (%#.2x), " "len=%d\n", tonebuf[0], tone_len); return -RIG_ERJCTED; } tone_len -= 2; *tone = from_bcd_be(tonebuf+2, tone_len*2); /* check this tone exists. That's better than nothing. */ for (i = 0; caps->ctcss_list[i] != 0 && i<52; i++) { if (caps->ctcss_list[i] == *tone) return RIG_OK; } rig_debug(RIG_DEBUG_ERR,"icom_get_ctcss_sql: CTCSS NG " "(%#.2x)\n", tonebuf[2]); return -RIG_EPROTO; } /* * icom_set_dcs_code * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code) { const struct rig_caps *caps; unsigned char codebuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int code_len, ack_len=sizeof(ackbuf), retval; int i; caps = rig->caps; for (i = 0; caps->dcs_list[i] != 0 && i<104; i++) { if (caps->dcs_list[i] == code) break; } if (caps->dcs_list[i] != code) return -RIG_EINVAL; code_len = 3; to_bcd_be(codebuf, code, code_len*2); retval = icom_transaction(rig, C_SET_TONE, S_TONE_DTCS, codebuf, code_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_dcs_code: ack NG (%#.2x), " "len=%d\n", ackbuf[0], ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_get_dcs_code * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code) { const struct rig_caps *caps; unsigned char codebuf[MAXFRAMELEN]; int code_len, retval; int i; caps = rig->caps; retval = icom_transaction(rig, C_SET_TONE, S_TONE_DTCS, NULL, 0, codebuf, &code_len); if (retval != RIG_OK) return retval; /* cn,sc,data*3 */ if (code_len != 5) { rig_debug(RIG_DEBUG_ERR,"icom_get_dcs_code: ack NG (%#.2x), " "len=%d\n", codebuf[0], code_len); return -RIG_ERJCTED; } code_len -= 2; *code = from_bcd_be(codebuf+2, code_len*2); /* check this code exists. That's better than nothing. */ for (i = 0; caps->dcs_list[i] != 0 && i<104; i++) { if (caps->dcs_list[i] == *code) return RIG_OK; } rig_debug(RIG_DEBUG_ERR,"icom_get_dcs_code: DTCS NG " "(%#.2x)\n", codebuf[2]); return -RIG_EPROTO; } /* * icom_set_powerstat * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_set_powerstat(RIG *rig, powerstat_t status) { unsigned char ackbuf[MAXFRAMELEN]; int ack_len=sizeof(ackbuf), retval; int pwr_sc; pwr_sc = status==RIG_POWER_ON ? S_PWR_ON:S_PWR_OFF; retval = icom_transaction(rig, C_SET_PWR, pwr_sc, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_powerstat: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_get_powerstat * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_get_powerstat(RIG *rig, powerstat_t *status) { unsigned char cmdbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int cmd_len, ack_len=sizeof(ackbuf), retval; /* r75 has no way to get power status, so fake it */ if (rig->caps->rig_model == RIG_MODEL_ICR75) { /* getting the mode doesn't work if a memory is blank */ /* so use one of the more innculous 'set mode' commands instead */ cmd_len = 1; cmdbuf[0] = S_PRM_TIME; retval = icom_transaction(rig, C_CTL_MEM, S_MEM_MODE_SLCT, cmdbuf, cmd_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; *status = ((ack_len == 6)&&(ackbuf[0] == C_CTL_MEM)) ? RIG_POWER_ON : RIG_POWER_OFF; } else { retval = icom_transaction(rig, C_SET_PWR, -1, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_get_powerstat: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } *status = ackbuf[1] == S_PWR_ON ? RIG_POWER_ON : RIG_POWER_OFF; } return RIG_OK; } /* * icom_set_mem * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_set_mem(RIG *rig, vfo_t vfo, int ch) { unsigned char membuf[2]; unsigned char ackbuf[MAXFRAMELEN]; int ack_len=sizeof(ackbuf), retval; int chan_len; chan_len = ch < 100 ? 1 : 2; to_bcd_be(membuf, ch, chan_len*2); retval = icom_transaction (rig, C_SET_MEM, -1, membuf, chan_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_mem: ack NG (%#.2x), " "len=%d\n", ackbuf[0], ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_set_bank * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_set_bank(RIG *rig, vfo_t vfo, int bank) { unsigned char bankbuf[2]; unsigned char ackbuf[MAXFRAMELEN]; int ack_len=sizeof(ackbuf), retval; to_bcd_be(bankbuf, bank, BANK_NB_LEN*2); retval = icom_transaction (rig, C_SET_MEM, S_BANK, bankbuf, CHAN_NB_LEN, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_bank: ack NG (%#.2x), " "len=%d\n", ackbuf[0], ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_set_ant * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_set_ant(RIG * rig, vfo_t vfo, ant_t ant) { unsigned char antarg; unsigned char ackbuf[MAXFRAMELEN]; int ack_len=sizeof(ackbuf), retval, i_ant=0; int ant_len; /* * TODO: IC-756* and [RX ANT] */ switch (ant) { case RIG_ANT_1: i_ant = 0; break; case RIG_ANT_2: i_ant = 1; break; case RIG_ANT_3: i_ant = 2; break; case RIG_ANT_4: i_ant = 3; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported ant %#x", ant); return -RIG_EINVAL; } antarg = 0; ant_len = (rig->caps->rig_model == RIG_MODEL_ICR75) ? 0 : 1; retval = icom_transaction (rig, C_CTL_ANT, i_ant, &antarg, ant_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_set_ant: ack NG (%#.2x), " "len=%d\n", ackbuf[0], ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_get_ant * Assumes rig!=NULL, rig->state.priv!=NULL * only meaningfull for HF */ int icom_get_ant(RIG *rig, vfo_t vfo, ant_t *ant) { unsigned char ackbuf[MAXFRAMELEN]; int ack_len=sizeof(ackbuf), retval; retval = icom_transaction(rig, C_CTL_ANT, -1, NULL, 0, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if ((ack_len != 2 && ack_len != 3) || ackbuf[0] != C_CTL_ANT || ackbuf[1] > 3) { rig_debug(RIG_DEBUG_ERR,"icom_get_ant: ack NG (%#.2x), " "len=%d\n", ackbuf[0],ack_len); return -RIG_ERJCTED; } /* Note: with IC756/IC-756Pro/IC-7800, ackbuf[2] deals with [RX ANT] */ *ant = RIG_ANT_N(ackbuf[1]); return RIG_OK; } /* * icom_vfo_op, Mem/VFO operation * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { unsigned char mvbuf[MAXFRAMELEN]; unsigned char ackbuf[MAXFRAMELEN]; int mv_len, ack_len=sizeof(ackbuf), retval; int mv_cn, mv_sc; int vfo_list; mv_len = 0; switch(op) { case RIG_OP_CPY: mv_cn = C_SET_VFO; vfo_list = rig->state.vfo_list; if ((vfo_list & (RIG_VFO_A|RIG_VFO_B)) == (RIG_VFO_A|RIG_VFO_B)) mv_sc = S_BTOA; else if ((vfo_list & (RIG_VFO_MAIN|RIG_VFO_SUB)) == (RIG_VFO_MAIN|RIG_VFO_SUB)) mv_sc = S_SUBTOMAIN; else return -RIG_ENAVAIL; break; case RIG_OP_XCHG: mv_cn = C_SET_VFO; mv_sc = S_XCHNG; break; #if 0 case RIG_OP_DUAL_OFF: mv_cn = C_SET_VFO; mv_sc = S_DUAL_OFF; break; case RIG_OP_DUAL_ON: mv_cn = C_SET_VFO; mv_sc = S_DUAL_ON; break; #endif case RIG_OP_FROM_VFO: mv_cn = C_WR_MEM; mv_sc = -1; break; case RIG_OP_TO_VFO: mv_cn = C_MEM2VFO; mv_sc = -1; break; case RIG_OP_MCL: mv_cn = C_CLR_MEM; mv_sc = -1; break; case RIG_OP_TUNE: mv_cn = C_CTL_PTT; mv_sc = S_ANT_TUN; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported mem/vfo op %#x", op); return -RIG_EINVAL; } retval = icom_transaction (rig, mv_cn, mv_sc, mvbuf, mv_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { if (op != RIG_OP_XCHG) rig_debug(RIG_DEBUG_ERR,"icom_vfo_op: ack NG (%#.2x), " "len=%d\n", ackbuf[0], ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_scan, scan operation * Assumes rig!=NULL, rig->state.priv!=NULL */ int icom_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) { unsigned char scanbuf[MAXFRAMELEN]; unsigned char ackbuf[MAXFRAMELEN]; int scan_len, ack_len=sizeof(ackbuf), retval; int scan_cn, scan_sc; scan_len = 0; scan_cn = C_CTL_SCAN; switch(scan) { case RIG_SCAN_STOP: scan_sc = S_SCAN_STOP; break; case RIG_SCAN_MEM: retval = icom_set_vfo(rig, RIG_VFO_MEM); if (retval != RIG_OK) return retval; /* Looks like all the IC-R* have this command, * but some old models don't have it. * Should be put in icom_priv_caps ? */ if (rig->caps->rig_type == RIG_TYPE_RECEIVER) scan_sc = S_SCAN_MEM2; else scan_sc = S_SCAN_START; break; case RIG_SCAN_SLCT: retval = icom_set_vfo(rig, RIG_VFO_MEM); if (retval != RIG_OK) return retval; scan_sc = S_SCAN_START; break; case RIG_SCAN_PRIO: case RIG_SCAN_PROG: /* TODO: for SCAN_PROG, check this is an edge chan */ /* BTW, I'm wondering if this is possible with CI-V */ retval = icom_set_mem(rig, RIG_VFO_CURR, ch); if (retval != RIG_OK) return retval; retval = icom_set_vfo(rig, RIG_VFO_VFO); if (retval != RIG_OK) return retval; scan_sc = S_SCAN_START; break; case RIG_SCAN_DELTA: scan_sc = S_SCAN_DELTA; /* TODO: delta-f support */ break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported scan %#x", scan); return -RIG_EINVAL; } retval = icom_transaction (rig, scan_cn, scan_sc, scanbuf, scan_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR,"icom_scan: ack NG (%#.2x), " "len=%d\n", ackbuf[0], ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * icom_decode is called by sa_sigio, when some asynchronous * data has been received from the rig */ int icom_decode_event(RIG *rig) { struct icom_priv_data *priv; struct rig_state *rs; unsigned char buf[MAXFRAMELEN]; int frm_len; freq_t freq; rmode_t mode; pbwidth_t width; rig_debug(RIG_DEBUG_VERBOSE, "icom: icom_decode called\n"); rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; frm_len = read_icom_frame(&rs->rigport, buf); if (frm_len == -RIG_ETIMEOUT) rig_debug(RIG_DEBUG_VERBOSE, "icom: icom_decode got a timeout before the first character\n"); if (frm_len < 0) return frm_len; switch (buf[frm_len-1]) { case COL: rig_debug(RIG_DEBUG_VERBOSE, "icom: icom_decode saw a collision\n"); /* Collision */ return -RIG_BUSBUSY; case FI: /* Ok, normal frame */ break; default: /* Timeout after reading at least one character */ /* Problem on ci-v bus? */ return -RIG_EPROTO; } if (buf[3] != BCASTID && buf[3] != priv->re_civ_addr) { rig_debug(RIG_DEBUG_WARN, "icom_decode: CI-V %#x called for %#x!\n", priv->re_civ_addr, buf[3]); } /* * the first 2 bytes must be 0xfe * the 3rd one the emitter * the 4rd one 0x00 since this is transceive mode * then the command number * the rest is data * and don't forget one byte at the end for the EOM */ switch (buf[4]) { case C_SND_FREQ: /* * TODO: the freq length might be less than 4 or 5 bytes * on older rigs! */ if (rig->callbacks.freq_event) { freq = from_bcd(buf+5, (priv->civ_731_mode ? 4:5)*2); return rig->callbacks.freq_event(rig, RIG_VFO_CURR, freq, rig->callbacks.freq_arg); } else return -RIG_ENAVAIL; break; case C_SND_MODE: if (rig->callbacks.mode_event) { icom2rig_mode(rig, buf[5], buf[6], &mode, &width); return rig->callbacks.mode_event(rig, RIG_VFO_CURR, mode, width, rig->callbacks.mode_arg); } else return -RIG_ENAVAIL; break; default: rig_debug(RIG_DEBUG_VERBOSE,"icom_decode: tranceive cmd " "unsupported %#2.2x\n",buf[4]); return -RIG_ENIMPL; } return RIG_OK; } /* * init_icom is called by rig_probe_all (register.c) * * probe_icom reports all the devices on the CI-V bus. * * rig_model_t probeallrigs_icom(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data) */ DECLARE_PROBERIG_BACKEND(icom) { unsigned char buf[MAXFRAMELEN], civ_addr, civ_id; int frm_len, i; int retval; rig_model_t model = RIG_MODEL_NONE; int rates[] = { 19200, 9600, 300, 0 }; int rates_idx; if (!port) return RIG_MODEL_NONE; if (port->type.rig != RIG_PORT_SERIAL) return RIG_MODEL_NONE; port->write_delay = port->post_write_delay = 0; port->retry = 1; /* * try for all different baud rates */ for (rates_idx = 0; rates[rates_idx]; rates_idx++) { port->parm.serial.rate = rates[rates_idx]; port->timeout = 2*1000/rates[rates_idx] + 40; retval = serial_open(port); if (retval != RIG_OK) return RIG_MODEL_NONE; /* * try all possible addresses on the CI-V bus * FIXME: actualy, old rigs do not support C_RD_TRXID cmd! * Try to be smart, and deduce model depending * on freq range, return address, and * available commands. */ for (civ_addr=0x01; civ_addr<=0x7f; civ_addr++) { frm_len = make_cmd_frame((char *) buf, civ_addr, CTRLID, C_RD_TRXID, S_RD_TRXID, NULL, 0); serial_flush(port); write_block(port, (char *) buf, frm_len); /* read out the bytes we just sent * TODO: check this is what we expect */ frm_len = read_icom_frame(port, buf); /* this is the reply */ frm_len = read_icom_frame(port, buf); /* timeout.. nobody's there */ if (frm_len <= 0) continue; if (buf[7] != FI && buf[5] != FI) { /* protocol error, unexpected reply. * is this a CI-V device? */ close(port->fd); return RIG_MODEL_NONE; } else if (buf[4] == NAK) { /* * this is an Icom, but it does not support transceiver ID * try to guess from the return address */ civ_id = buf[3]; } else { civ_id = buf[6]; } for (i=0; icom_addr_list[i].model != RIG_MODEL_NONE; i++) { if (icom_addr_list[i].re_civ_addr == civ_id) { rig_debug(RIG_DEBUG_VERBOSE,"probe_icom: found %#x" " at %#x\n", civ_id, buf[3]); model = icom_addr_list[i].model; if (cfunc) (*cfunc)(port, model, data); break; } } /* * not found in known table.... * update icom_addr_list[]! */ if (icom_addr_list[i].model == RIG_MODEL_NONE) rig_debug(RIG_DEBUG_WARN,"probe_icom: found unknown device " "with CI-V ID %#x, please report to Hamlib " "developers.\n", civ_id); } /* * Try to identify OptoScan */ for (civ_addr=0x80; civ_addr<=0x8f; civ_addr++) { frm_len = make_cmd_frame((char *) buf, civ_addr, CTRLID, C_CTL_MISC, S_OPTO_RDID, NULL, 0); serial_flush(port); write_block(port, (char *) buf, frm_len); /* read out the bytes we just sent * TODO: check this is what we expect */ frm_len = read_icom_frame(port, buf); /* this is the reply */ frm_len = read_icom_frame(port, buf); /* timeout.. nobody's there */ if (frm_len <= 0) continue; /* wrong protocol? */ if (frm_len != 7 || buf[4] != C_CTL_MISC || buf[5] != S_OPTO_RDID) continue; rig_debug(RIG_DEBUG_VERBOSE, "%s, found OptoScan%c%c%c, software version %d.%d, " "interface version %d.%d, at %#x\n", __FUNCTION__, buf[2], buf[3], buf[4], buf[5] >> 4, buf[5] & 0xf, buf[6] >> 4, buf[6] & 0xf, civ_addr); if (buf[6] == '5' && buf[7] == '3' && buf[8] == '5') model = RIG_MODEL_OS535; else if (buf[6] == '4' && buf[7] == '5' && buf[8] == '6') model = RIG_MODEL_OS456; else continue; if (cfunc) (*cfunc)(port, model, data); break; } close(port->fd); /* * Assumes all the rigs on the bus are running at same speed. * So if one at least has been found, none will be at lower speed. */ if (model != RIG_MODEL_NONE) return model; } return model; } /* * initrigs_icom is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(icom) { rig_debug(RIG_DEBUG_VERBOSE, "icom: _init called\n"); rig_register(&ic703_caps); rig_register(&ic706_caps); rig_register(&ic706mkii_caps); rig_register(&ic706mkiig_caps); rig_register(&ic718_caps); rig_register(&ic725_caps); rig_register(&ic726_caps); rig_register(&ic735_caps); rig_register(&ic736_caps); rig_register(&ic737_caps); rig_register(&ic738_caps); rig_register(&ic7410_caps); rig_register(&ic746_caps); rig_register(&ic746pro_caps); rig_register(&ic751_caps); rig_register(&ic761_caps); rig_register(&ic775_caps); rig_register(&ic756_caps); rig_register(&ic756pro_caps); rig_register(&ic756pro2_caps); rig_register(&ic756pro3_caps); rig_register(&ic7600_caps); rig_register(&ic765_caps); rig_register(&ic7700_caps); rig_register(&ic78_caps); rig_register(&ic7800_caps); rig_register(&ic7000_caps); rig_register(&ic7200_caps); rig_register(&ic781_caps); rig_register(&ic707_caps); rig_register(&ic728_caps); rig_register(&ic820h_caps); rig_register(&ic821h_caps); rig_register(&ic910_caps); rig_register(&ic9100_caps); rig_register(&ic970_caps); rig_register(&icrx7_caps); rig_register(&icr10_caps); rig_register(&icr20_caps); rig_register(&icr71_caps); rig_register(&icr72_caps); rig_register(&icr75_caps); rig_register(&icr7000_caps); rig_register(&icr7100_caps); rig_register(&icr8500_caps); rig_register(&icr9000_caps); rig_register(&icr9500_caps); rig_register(&ic271_caps); rig_register(&ic275_caps); rig_register(&ic471_caps); rig_register(&ic475_caps); rig_register(&ic1275_caps); rig_register(&os535_caps); rig_register(&os456_caps); rig_register(&omnivip_caps); rig_register(&delta2_caps); rig_register(&ic92d_caps); rig_register(&id1_caps); return RIG_OK; } hamlib-1.2.15.3/icom/icr9500.c0000644000175000017500000001413612044564477012326 00000000000000/* * Hamlib CI-V backend - IC-R9500 descriptions * Copyright (c) 2000-2011 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "serial.h" #include "misc.h" #include "idx_builtin.h" #include "icom.h" #include "icom_defs.h" #include "frame.h" #define ICR9500_MODES (RIG_MODE_AM|RIG_MODE_AMS|\ RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_RTTYR|\ RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_WFM) #define ICR9500_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL) #define ICR9500_FUNCS (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_TSQL|RIG_FUNC_NR|RIG_FUNC_MN|RIG_FUNC_ANF|RIG_FUNC_VSC|RIG_FUNC_LOCK) #define ICR9500_LEVELS (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_APF) #define ICR9500_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT) #define ICR9500_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO|RIG_SCAN_SLCT|RIG_SCAN_PRIO) /* TBC */ #define ICR9500_HF_ANTS (RIG_ANT_1|RIG_ANT_2|RIG_ANT_3) #define ICR9500_VFOS (RIG_VFO_A|RIG_VFO_MEM) #define ICR9500_MEM_CAP { /* FIXME */ \ .freq = 1, \ .mode = 1, \ .width = 1, \ .levels = RIG_LEVEL_ATT, \ } /* TODO: S-Meter measurements */ #define ICR9500_STR_CAL UNKNOWN_IC_STR_CAL static const struct icom_priv_caps icr9500_priv_caps = { 0x72, /* default address */ 0, /* 731 mode */ r9500_ts_sc_list }; /* * ICR9500A rig capabilities. */ const struct rig_caps icr9500_caps = { .rig_model = RIG_MODEL_ICR9500, .model_name = "IC-R9500", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .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 = 1000, .retry = 3, .has_get_func = ICR9500_FUNCS, .has_set_func = ICR9500_FUNCS, .has_get_level = ICR9500_LEVELS, .has_set_level = RIG_LEVEL_SET(ICR9500_LEVELS), .has_get_parm = ICR9500_PARMS, .has_set_parm = RIG_PARM_SET(ICR9500_PARMS), .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = common_dcs_list, .preamp = { 10, 20, RIG_DBLST_END }, /* FIXME: TBC */ .attenuator = { 6, 10, 12, 18, 20, 24, 30, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = ICR9500_OPS, .scan_ops = ICR9500_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 12, .chan_desc_sz = 0, /* FIXME */ .chan_list = { { 0, 999, RIG_MTYPE_MEM, ICR9500_MEM_CAP }, /* TBC */ { 1000, 1099, RIG_MTYPE_EDGE, IC_MIN_MEM_CAP }, /* Bank-A (Auto) */ { 1100, 1199, RIG_MTYPE_EDGE, IC_MIN_MEM_CAP }, /* Bank-S (skip) */ { 1200, 1219, RIG_MTYPE_EDGE, IC_MIN_MEM_CAP }, /* Bank-P (Scan edge), 2 by 2 */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(5),MHz(30)-1,ICR9500_MODES,-1,-1, ICR9500_VFOS, ICR9500_HF_ANTS}, {MHz(30),MHz(3335),ICR9500_MODES,-1,-1, ICR9500_VFOS, RIG_ANT_4}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(5),MHz(30)-1,ICR9500_MODES,-1,-1, ICR9500_VFOS, ICR9500_HF_ANTS}, {MHz(30),MHz(3335),ICR9500_MODES,-1,-1, ICR9500_VFOS, RIG_ANT_4}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, /* no TX ranges, this is a receiver */ .tuning_steps = { {ICR9500_MODES,1}, /* resolution */ {ICR9500_MODES,10}, {ICR9500_MODES,100}, {ICR9500_MODES,kHz(1)}, {ICR9500_MODES,kHz(2.5)}, {ICR9500_MODES,kHz(5)}, {ICR9500_MODES,kHz(6.25)}, {ICR9500_MODES,kHz(9)}, {ICR9500_MODES,kHz(10)}, {ICR9500_MODES,12500}, {ICR9500_MODES,kHz(20)}, {ICR9500_MODES,kHz(25)}, {ICR9500_MODES,kHz(100)}, {ICR9500_MODES,MHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.4)}, {RIG_MODE_CW, Hz(500)}, {RIG_MODE_AM|RIG_MODE_AMS, kHz(6)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_WFM, kHz(350)}, RIG_FLT_END, }, .str_cal = ICR9500_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&icr9500_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .set_rptr_shift = icom_set_rptr_shift, .get_rptr_shift = icom_get_rptr_shift, .set_rptr_offs = icom_set_rptr_offs, .get_rptr_offs = icom_get_rptr_offs, .set_ctcss_sql = icom_set_ctcss_sql, .get_ctcss_sql = icom_get_ctcss_sql, .set_dcs_sql = icom_set_dcs_code, .get_dcs_sql = icom_get_dcs_code, .set_ts = icom_set_ts, .get_ts = icom_get_ts, .set_func = icom_set_func, .get_func = icom_get_func, .set_level = icom_set_level, .get_level = icom_get_level, .set_parm = icom_set_parm, .get_parm = icom_get_parm, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .set_bank = icom_set_bank, .vfo_op = icom_vfo_op, .scan = icom_scan, .get_dcd = icom_get_dcd, }; /* * Function definitions below */ hamlib-1.2.15.3/icom/os535.c0000644000175000017500000001127412044564477012111 00000000000000/* * Hamlib CI-V backend - description of the OptoScan535 * Copyright (c) 2000-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * This backend is currently being maintained by Michael Smith, KE4RJQ. * Email: james (dot) m (dot) smith (at) earthlink (dot) net */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "idx_builtin.h" #include "icom.h" #include "tones.h" #include "optoscan.h" extern struct confparams opto_ext_parms[]; #define OS535_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define OS535_VFO_ALL (RIG_VFO_A) #define OS535_LEVELS (RIG_LEVEL_RAWSTR|RIG_LEVEL_AF) #define OS535_SCAN_OPS (RIG_SCAN_PLT) #define OS535_STR_CAL { 2, { \ { 20, 60 }, \ { 137, -60 }, \ } } /* TBC */ /* * The OptoScan is not actually a rig. This is an add-in circuit board * for the Realistic PRO-2035 and PRO-2045 Scanning VHF-UHF Receivers. * http://www.optoelectronics.com/tech/pdf/os535/os535_ci5_spec_v10.pdf * * TODO: srch_dcs, srch_ctcss, rcv_dtmf, and make icom_probe opto aware */ static const struct icom_priv_caps os535_priv_caps = { 0x80, /* default address */ 0, /* 731 mode */ NULL, .settle_time = 12, }; const struct rig_caps os535_caps = { .rig_model = RIG_MODEL_OS535, .model_name = "OptoScan535", .mfg_name = "Optoelectronics", .version = "0.3", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_SCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_SERIAL_CAR, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 38400, .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 = OS535_LEVELS, .has_set_level = RIG_LEVEL_AF, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = full_ctcss_list, .dcs_list = full_dcs_list, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = RIG_OP_NONE, .scan_ops = OS535_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, .rx_range_list1 = { { MHz(25),MHz(520),OS535_MODES,-1,-1,OS535_VFO_ALL}, { MHz(760),MHz(1300),OS535_MODES,-1,-1,OS535_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, /* this is a scanner */ .rx_range_list2 = { { MHz(25),MHz(520),OS535_MODES,-1,-1,OS535_VFO_ALL}, { MHz(760),MHz(823.995),OS535_MODES,-1,-1,OS535_VFO_ALL}, { MHz(849),MHz(868.995),OS535_MODES,-1,-1,OS535_VFO_ALL}, { MHz(894),MHz(1300),OS535_MODES,-1,-1,OS535_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, /* this is a scanner */ .tuning_steps = { {OS535_MODES,kHz(5)}, {OS535_MODES,kHz(12.5)}, {OS535_MODES,kHz(50)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM, kHz(15)}, /* TBC */ RIG_FLT_END, }, .str_cal = OS535_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&os535_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = optoscan_open, .rig_close = optoscan_close, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .get_dcd = icom_get_dcd, .decode_event = icom_decode_event, .get_info = optoscan_get_info, .get_ctcss_tone = optoscan_get_ctcss_tone, .get_dcs_code = optoscan_get_dcs_code, .recv_dtmf = optoscan_recv_dtmf, .extparms = opto_ext_parms, .set_ext_parm = optoscan_set_ext_parm, .get_ext_parm = optoscan_get_ext_parm, .set_level = optoscan_set_level, .get_level = optoscan_get_level, .scan = optoscan_scan, }; hamlib-1.2.15.3/icom/frame.h0000644000175000017500000000274312044564477012333 00000000000000/* * Hamlib CI-V backend - low level communication header * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FRAME_H #define _FRAME_H 1 #define MAXFRAMELEN 56 /* * helper functions */ int make_cmd_frame(char frame[], char re_id, char ctrl_id, char cmd, int subcmd, const unsigned char *data, int data_len); int icom_transaction (RIG *rig, int cmd, int subcmd, const unsigned char *payload, int payload_len, unsigned char *data, int *data_len); int read_icom_frame(hamlib_port_t *p, unsigned char rxbuffer[]); int rig2icom_mode(RIG *rig, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd); void icom2rig_mode(RIG *rig, unsigned char md, int pd, rmode_t *mode, pbwidth_t *width); #endif /* _FRAME_H */ hamlib-1.2.15.3/icom/icrx7.c0000644000175000017500000000740712044564477012272 00000000000000/* * Hamlib CI-V backend - description of IC-RX7 * Copyright (c) 2011 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "icom.h" #include "idx_builtin.h" #define ICRX7_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define ICRX7_FUNC_ALL (RIG_FUNC_NONE) #define ICRX7_LEVEL_ALL (RIG_LEVEL_RAWSTR) #define ICRX7_VFO_ALL (RIG_VFO_A) #define ICRX7_VFO_OPS (RIG_OP_NONE) #define ICRX7_SCAN_OPS (RIG_SCAN_NONE) /* * FIXME: S-meter measurement */ #define ICRX7_STR_CAL UNKNOWN_IC_STR_CAL static const struct icom_priv_caps icrx7_priv_caps = { 0x78, /* default address */ 0, /* 731 mode */ r8500_ts_sc_list /* wrong, but don't have set_ts anyway */ }; const struct rig_caps icrx7_caps = { .rig_model = RIG_MODEL_ICRX7, .model_name = "IC-RX7", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER|RIG_FLAG_HANDHELD, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = ICRX7_FUNC_ALL, .has_set_func = ICRX7_FUNC_ALL, .has_get_level = ICRX7_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(ICRX7_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .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, .vfo_ops = ICRX7_VFO_OPS, .scan_ops = ICRX7_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { /* Unfortunately, not accessible through CI-V */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(150),GHz(1.3),ICRX7_MODES,-1,-1,ICRX7_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(150),MHz(821.995),ICRX7_MODES,-1,-1,ICRX7_VFO_ALL}, {MHz(851),MHz(866.995),ICRX7_MODES,-1,-1,ICRX7_VFO_ALL}, {MHz(896),GHz(1.3),ICRX7_MODES,-1,-1,ICRX7_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {ICRX7_MODES,Hz(100)}, RIG_TS_END, }, .filters = { {RIG_MODE_AM|RIG_MODE_FM, kHz(15)}, {RIG_MODE_WFM, kHz(150)}, RIG_FLT_END, }, .str_cal = ICRX7_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&icrx7_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, /* TODO: do not pass bandwidth data */ .get_mode = icom_get_mode, .decode_event = icom_decode_event, .get_level = icom_get_level, .get_dcd = icom_get_dcd, }; hamlib-1.2.15.3/icom/ic7700.c0000644000175000017500000001736412044564477012152 00000000000000/* * Hamlib CI-V backend - description of IC-7700 and variations * Copyright (c) 2009-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include #include "token.h" #include "idx_builtin.h" #include "icom.h" #include "icom_defs.h" #include "frame.h" #include "misc.h" #include "bandplan.h" /* * TODO: PSK and PSKR */ #define IC7700_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC7700_1HZ_TS_MODES IC7700_ALL_RX_MODES #define IC7700_OTHER_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC7700_AM_TX_MODES (RIG_MODE_AM) #define IC7700_FUNCS (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_NR|RIG_FUNC_MON|RIG_FUNC_MN|RIG_FUNC_ANF|RIG_FUNC_VSC|RIG_FUNC_LOCK) #define IC7700_LEVELS (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_COMP|RIG_LEVEL_BKINDL|RIG_LEVEL_BALANCE|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_APF|RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY|RIG_LEVEL_SWR|RIG_LEVEL_ALC) #define IC7700_VFOS (RIG_VFO_MAIN|RIG_VFO_SUB|RIG_VFO_MEM) #define IC7700_PARMS (RIG_PARM_ANN|RIG_PARM_BACKLIGHT) #define IC7700_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL|RIG_OP_TUNE) #define IC7700_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO|RIG_SCAN_PROG|RIG_SCAN_DELTA|RIG_SCAN_PRIO) #define IC7700_ANTS (RIG_ANT_1|RIG_ANT_2|RIG_ANT_3|RIG_ANT_4) /* * FIXME: real measures! */ #define IC7700_STR_CAL { 3, \ { \ { 0,-54 }, \ { 120, 0 }, \ { 241, 60 } \ } } /* * IC-7700 rig capabilities. * * TODO: complete command set (esp. the $1A bunch!) and testing.. */ static const struct icom_priv_caps ic7700_priv_caps = { 0x74, /* default address */ 0, /* 731 mode */ ic756pro_ts_sc_list }; const struct rig_caps ic7700_caps = { .rig_model = RIG_MODEL_IC7700, .model_name = "IC-7700", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC7700_FUNCS, .has_set_func = IC7700_FUNCS, .has_get_level = IC7700_LEVELS, .has_set_level = RIG_LEVEL_SET(IC7700_LEVELS), .has_get_parm = IC7700_PARMS, .has_set_parm = RIG_PARM_SET(IC7700_PARMS), /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, 20, RIG_DBLST_END, }, /* FIXME: TBC */ .attenuator = { 6, 12, 18, RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC7700_VFO_OPS, .scan_ops = IC7700_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM }, { 100, 101, RIG_MTYPE_EDGE }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(60),IC7700_ALL_RX_MODES,-1,-1,IC7700_VFOS,IC7700_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC7700_OTHER_TX_MODES, W(5),W(200),IC7700_VFOS,IC7700_ANTS), FRQ_RNG_6m(1,IC7700_OTHER_TX_MODES, W(5),W(200),IC7700_VFOS,IC7700_ANTS), FRQ_RNG_HF(1,IC7700_AM_TX_MODES, W(5),W(50),IC7700_VFOS,IC7700_ANTS), /* AM class */ FRQ_RNG_6m(1,IC7700_AM_TX_MODES, W(5),W(50),IC7700_VFOS,IC7700_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(60),IC7700_ALL_RX_MODES,-1,-1,IC7700_VFOS,IC7700_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC7700_OTHER_TX_MODES, W(5),W(200),IC7700_VFOS,IC7700_ANTS), FRQ_RNG_6m(2,IC7700_OTHER_TX_MODES, W(5),W(200),IC7700_VFOS,IC7700_ANTS), FRQ_RNG_HF(2,IC7700_AM_TX_MODES, W(5),W(50),IC7700_VFOS,IC7700_ANTS), /* AM class */ FRQ_RNG_6m(2,IC7700_AM_TX_MODES, W(5),W(50),IC7700_VFOS,IC7700_ANTS), /* AM class */ /* USA only, TBC: end of range and modes */ {MHz(5.33050),MHz(5.33350),IC7700_OTHER_TX_MODES,W(5),W(200),IC7700_VFOS,IC7700_ANTS}, /* USA only */ {MHz(5.34650),MHz(5.34950),IC7700_OTHER_TX_MODES,W(5),W(200),IC7700_VFOS,IC7700_ANTS}, /* USA only */ {MHz(5.36650),MHz(5.36950),IC7700_OTHER_TX_MODES,W(5),W(200),IC7700_VFOS,IC7700_ANTS}, /* USA only */ {MHz(5.37150),MHz(5.37450),IC7700_OTHER_TX_MODES,W(5),W(200),IC7700_VFOS,IC7700_ANTS}, /* USA only */ {MHz(5.40350),MHz(5.40650),IC7700_OTHER_TX_MODES,W(5),W(200),IC7700_VFOS,IC7700_ANTS}, /* USA only */ RIG_FRNG_END, }, .tuning_steps = { {IC7700_1HZ_TS_MODES,1}, {IC7700_ALL_RX_MODES,Hz(100)}, {IC7700_ALL_RX_MODES,kHz(1)}, {IC7700_ALL_RX_MODES,kHz(5)}, {IC7700_ALL_RX_MODES,kHz(9)}, {IC7700_ALL_RX_MODES,kHz(10)}, {IC7700_ALL_RX_MODES,kHz(12.5)}, {IC7700_ALL_RX_MODES,kHz(20)}, {IC7700_ALL_RX_MODES,kHz(25)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(2.4)}, {RIG_MODE_CW|RIG_MODE_CWR, Hz(400)}, {RIG_MODE_CW|RIG_MODE_CWR, Hz(1000)}, {RIG_MODE_CW|RIG_MODE_CWR, Hz(50)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_FM, kHz(12)}, {RIG_MODE_FM, kHz(8)}, /* TBC */ RIG_FLT_END, }, .str_cal = IC7700_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic7700_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .set_rit = icom_set_rit, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_parm = icom_set_parm, .get_parm = icom_get_parm, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ptt = icom_set_ptt, .get_ptt = icom_get_ptt, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .get_ts = icom_get_ts, .set_rptr_shift = icom_set_rptr_shift, .get_rptr_shift = icom_get_rptr_shift, .set_rptr_offs = icom_set_rptr_offs, .get_rptr_offs = icom_get_rptr_offs, .set_ctcss_tone = icom_set_ctcss_tone, .get_ctcss_tone = icom_get_ctcss_tone, .set_ctcss_sql = icom_set_ctcss_sql, .get_ctcss_sql = icom_get_ctcss_sql, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, .get_split_vfo = icom_mem_get_split_vfo, }; hamlib-1.2.15.3/icom/icr71.c0000644000175000017500000000714512044564477012162 00000000000000/* * Hamlib CI-V backend - description of IC-R71 * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "icom.h" /* FM optional */ #define ICR71_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define ICR71_FUNC_ALL (RIG_FUNC_NONE) #define ICR71_LEVEL_ALL (RIG_LEVEL_NONE) #define ICR71_VFO_ALL (RIG_VFO_A|RIG_VFO_MEM) #define ICR71_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO) #define ICR71_SCAN_OPS (RIG_SCAN_NONE) static const struct icom_priv_caps icr71_priv_caps = { 0x1a, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list /* none actually */ }; const struct rig_caps icr71_caps = { .rig_model = RIG_MODEL_ICR71, .model_name = "IC-R71", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .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 = ICR71_FUNC_ALL, .has_set_func = ICR71_FUNC_ALL, .has_get_level = ICR71_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(ICR71_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = ICR71_VFO_OPS, .scan_ops = ICR71_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100),MHz(30),ICR71_MODES,-1,-1,ICR71_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(30),ICR71_MODES,-1,-1,ICR71_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {ICR71_MODES,Hz(10)}, /* resolution */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.3)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, /* optional w/ IC-EX257 unit */ RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&icr71_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/ic728.c0000644000175000017500000001043112044564477012061 00000000000000/* * Hamlib CI-V backend - description of IC-728 * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "bandplan.h" #include "icom.h" #define IC728_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) /* * IC-728 * specs: http://www.qsl.net/sm7vhs/radio/icom/ic728/specs.htm * */ #define IC728_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define IC728_AM_TX_MODES (RIG_MODE_AM) #define IC728_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC728_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_CPY|RIG_OP_MCL) #define IC728_SCAN_OPS (RIG_SCAN_VFO|RIG_SCAN_MEM) /* TBC */ #define IC728_ANTS RIG_ANT_1 /* */ static const struct icom_priv_caps ic728_priv_caps = { 0x38, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic728_caps = { .rig_model = RIG_MODEL_IC728, .model_name = "IC-728", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 9600, .serial_data_bits = 8, .serial_stop_bits = 2, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC728_VFO_OPS, .scan_ops = IC728_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 26, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(500),MHz(30),IC728_ALL_RX_MODES,-1,-1,IC728_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC728_OTHER_TX_MODES, W(10),W(100),IC728_VFO_ALL,IC728_ANTS), FRQ_RNG_HF(1,IC728_AM_TX_MODES, W(10),W(40),IC728_VFO_ALL,IC728_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30),IC728_ALL_RX_MODES,-1,-1,IC728_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC728_OTHER_TX_MODES, W(10),W(100),IC728_VFO_ALL,IC728_ANTS), FRQ_RNG_HF(2,IC728_AM_TX_MODES, W(10),W(40),IC728_VFO_ALL,IC728_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {IC728_ALL_RX_MODES,10}, /* basic resolution, there's no set_ts */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.1)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic728_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_split_vfo = icom_set_split_vfo, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .scan = icom_scan, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/Makefile.am0000644000175000017500000000146412044564477013123 00000000000000ICOMSRCLIST = ic706.c icr8500.c ic735.c ic775.c ic756.c \ ic275.c ic475.c ic1275.c ic820h.c ic821h.c \ icr7000.c ic910.c ic9100.c ic970.c ic725.c ic737.c ic718.c \ os535.c os456.c omni.c delta2.c ic92d.c \ ic736.c ic738.c ic7410.c ic746.c ic703.c ic726.c ic271.c \ ic765.c ic781.c ic471.c id1.c icr9000.c icr9500.c \ icr10.c icr20.c icr71.c icr72.c icr75.c icrx7.c \ ic707.c ic728.c ic751.c ic761.c \ ic78.c ic7800.c ic7000.c ic7200.c ic7600.c ic7700.c pkglib_LTLIBRARIES = hamlib-icom.la hamlib_icom_la_SOURCES = $(ICOMSRCLIST) icom.c frame.c optoscan.c hamlib_icom_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_icom_la_LIBADD = $(top_builddir)/lib/libmisc.la \ $(top_builddir)/src/libhamlib.la EXTRA_DIST = README.icom TODO.icom noinst_HEADERS = frame.h icom.h icom_defs.h optoscan.h hamlib-1.2.15.3/icom/ic736.c0000644000175000017500000001235312044564477012065 00000000000000/* * Hamlib CI-V backend - description of IC-736 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "icom.h" /* * IC-736 */ #define IC736_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) /* * 100W in all modes but AM (40W) */ #define IC736_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define IC736_AM_TX_MODES (RIG_MODE_AM) #define IC736_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC736_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_CPY) #define IC736_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_PROG|RIG_SCAN_VFO) #define IC736_ANTS 0 /* FIXME: declare both antenna connectors */ #define IC736_STR_CAL { 0, { } } /* */ static const struct icom_priv_caps ic736_priv_caps = { 0x40, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic736_caps = { .rig_model = RIG_MODEL_IC736, .model_name = "IC-736", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 19200, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC736_VFO_OPS, .scan_ops = IC736_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 89, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, { 90, 99, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, /* FIXME: split */ { 100, 101, RIG_MTYPE_EDGE, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(500),MHz(30),IC736_ALL_RX_MODES,-1,-1,IC736_VFO_ALL,IC736_ANTS}, {MHz(50),MHz(54),IC736_ALL_RX_MODES,-1,-1,IC736_VFO_ALL,IC736_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC736_OTHER_TX_MODES, W(5),W(100),IC736_VFO_ALL,IC736_ANTS), FRQ_RNG_6m(1,IC736_OTHER_TX_MODES, W(5),W(100),IC736_VFO_ALL,IC736_ANTS), FRQ_RNG_HF(1,IC736_AM_TX_MODES, W(4),W(40),IC736_VFO_ALL,IC736_ANTS), /* AM class */ FRQ_RNG_6m(1,IC736_AM_TX_MODES, W(4),W(40),IC736_VFO_ALL,IC736_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30),IC736_ALL_RX_MODES,-1,-1,IC736_VFO_ALL,IC736_ANTS}, {MHz(50),MHz(54),IC736_ALL_RX_MODES,-1,-1,IC736_VFO_ALL,IC736_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC736_OTHER_TX_MODES, W(5),W(100),IC736_VFO_ALL,IC736_ANTS), FRQ_RNG_6m(2,IC736_OTHER_TX_MODES, W(5),W(100),IC736_VFO_ALL,IC736_ANTS), FRQ_RNG_HF(2,IC736_AM_TX_MODES, W(4),W(40),IC736_VFO_ALL,IC736_ANTS), /* AM class */ FRQ_RNG_6m(2,IC736_AM_TX_MODES, W(4),W(40),IC736_VFO_ALL,IC736_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { /* TBC */ {IC736_ALL_RX_MODES,10}, {IC736_ALL_RX_MODES,kHz(1)}, {IC736_ALL_RX_MODES,kHz(2)}, {IC736_ALL_RX_MODES,kHz(3)}, {IC736_ALL_RX_MODES,kHz(4)}, {IC736_ALL_RX_MODES,kHz(5)}, {IC736_ALL_RX_MODES,kHz(6)}, {IC736_ALL_RX_MODES,kHz(7)}, {IC736_ALL_RX_MODES,kHz(8)}, {IC736_ALL_RX_MODES,kHz(9)}, {IC736_ALL_RX_MODES,kHz(10)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.1)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic736_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ts = icom_set_ts, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, }; hamlib-1.2.15.3/icom/delta2.c0000644000175000017500000001126612044564477012407 00000000000000/* * Hamlib CI-V backend - description of the TenTenc DeltaII * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* * Delta II (aka TT 536) cloned after Omni VI. * Needs RS-232 Serial Level Converter Model 305 or equivalent. * * For changing CI-V address of the rig, see: * http://www.tentecwiki.org/doku.php?id=536addr */ /* Known problems: * * To Do: get the datasheet, and testing on real hardware!! */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "icom.h" #include "icom_defs.h" #include "frame.h" #include "misc.h" #define DELTAII_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define DELTAII_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define DELTAII_ALL_RX_MODES (DELTAII_OTHER_TX_MODES|RIG_MODE_AM) #define DELTAII_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO) #define DELTAII_STR_CAL { 0, { } } static const struct icom_priv_caps delta2_priv_caps = { 0x01, /* default address */ 1, /* 731 mode */ ic737_ts_sc_list /* TODO: ts_sc_list */ }; const struct rig_caps delta2_caps = { .rig_model = RIG_MODEL_DELTAII, .model_name = "Delta II", .mfg_name = "Ten-Tec", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .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 = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .parm_gran = {}, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = DELTAII_VFO_OPS, .scan_ops = RIG_SCAN_NONE, .str_cal = DELTAII_STR_CAL, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { /* TODO: 32 simplex, 16 duplex */ { 0, 47, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, /* These limits measured on Omni VI SN 1A10473 */ .rx_range_list2 = { {kHz(100),kHz(29999),DELTAII_ALL_RX_MODES,-1,-1,DELTAII_VFO_ALL}, RIG_FRNG_END, }, /* Note: There is no AM mode. */ .tx_range_list2 = { {kHz(1800),MHz(2)-1,DELTAII_OTHER_TX_MODES,5000,100000,DELTAII_VFO_ALL}, {kHz(3500),MHz(4)-1,DELTAII_OTHER_TX_MODES,5000,100000,DELTAII_VFO_ALL}, {MHz(7),kHz(7300),DELTAII_OTHER_TX_MODES,5000,100000,DELTAII_VFO_ALL}, {kHz(10100),kHz(10150),DELTAII_OTHER_TX_MODES,5000,100000,DELTAII_VFO_ALL}, {MHz(14),kHz(14350),DELTAII_OTHER_TX_MODES,5000,100000,DELTAII_VFO_ALL}, {kHz(18068),kHz(18168),DELTAII_OTHER_TX_MODES,5000,100000,DELTAII_VFO_ALL}, {MHz(21),kHz(21450),DELTAII_OTHER_TX_MODES,5000,100000,DELTAII_VFO_ALL}, {kHz(24890),kHz(24990),DELTAII_OTHER_TX_MODES,5000,100000,DELTAII_VFO_ALL}, {MHz(28),kHz(29700),DELTAII_OTHER_TX_MODES,5000,100000,DELTAII_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {DELTAII_ALL_RX_MODES, Hz(10)}, // This radio has 10 Hz steps. RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.4)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&delta2_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, // icom.c has no get_vfo .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/README.icom0000644000175000017500000000143112044564477012667 00000000000000hamlib - Copyright (C) 2008 The Hamlib Group File: README.icom Notes on Icom backends 2008-03, AA6E: Tested and extended omni.c for Ten-Tec Omni VI and Omni VI Plus It is now at least "beta" level. 2008-07, AA6E: Tests with IC-756PROIII at ARRL. Added AF, RF, SQL levels, COMP, BALANCE. Note: communications do not seem completely reliable for baud rates > 9600. VOX-related commands are implemented for the '910H but are wrong for the '756 and other models. They should be reimplemented in a more general way. 2008-10, DL1JBE: Tested IC-275H and IC-475H at local clubstation. Offered functions do work as expected in most cases. Only problem: Bandwidth in Get_Mode is reported always as 0. Besides this backend seems to be stable -> Changing State to RIG_STATUS_BETA. hamlib-1.2.15.3/icom/icom_defs.h0000644000175000017500000003400612044564477013166 00000000000000/* * Hamlib CI-V backend - defines for the ICOM "CI-V" interface. * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ICOM_DEFS_H #define _ICOM_DEFS_H 1 /* * CI-V frame codes */ #define PR 0xfe /* Preamble code */ #define CTRLID 0xe0 /* Controllers's default address */ #define BCASTID 0x00 /* Broadcast address */ #define FI 0xfd /* End of message code */ #define ACK 0xfb /* OK code */ #define NAK 0xfa /* NG code */ #define COL 0xfc /* CI-V bus collision detected */ #define PAD 0xff /* Transmit padding */ #define ACKFRMLEN 6 /* reply frame length */ #define S_NONE -1 /* * Arguments length in bytes */ #define CHAN_NB_LEN 2 #define BANK_NB_LEN 2 #define OFFS_LEN 3 /* * Cn controller commands * Most radios have 2 or 3 recieve passbands available. Where only 2 are available they are selected by 01 for wide and 02 for narrow Actual bandwidth is determined by the filters installed. With the newer DSP rigs there are 3 presets 01 = wide 02 = middle and 03 = narrow. Acutally you can set change any of these presets to any thing you want. * Notes: * The following only applies to IC-706. * 1. When wide or normal op available: add "00" for wide, "01" normal * Normal or narrow op: add "00" for normal, "01" for narrow * Wide, normal or narrow op: add "00" for wide, "01" normal, "02" narrow * 2. Memory channel number 1A=0100/1b=0101, 2A=0102/2b=0103, * 3A=0104/3b=0105, C1=0106, C2=0107 */ #define C_SND_FREQ 0x00 /* Send frequency data trancieve mode does not ack*/ #define C_SND_MODE 0x01 /* Send mode data, Sc for trancieve mode does not ack */ #define C_RD_BAND 0x02 /* Read band edge frequencies */ #define C_RD_FREQ 0x03 /* Read display frequency */ #define C_RD_MODE 0x04 /* Read display mode */ #define C_SET_FREQ 0x05 /* Set frequency data(1) */ #define C_SET_MODE 0x06 /* Set mode data, Sc */ #define C_SET_VFO 0x07 /* Set VFO */ #define C_SET_MEM 0x08 /* Set channel, Sc(2) */ #define C_WR_MEM 0x09 /* Write memory */ #define C_MEM2VFO 0x0a /* Memory to VFO */ #define C_CLR_MEM 0x0b /* Memory clear */ #define C_RD_OFFS 0x0c /* Read duplex offset frequency; default changes with HF/6M/2M */ #define C_SET_OFFS 0x0d /* Set duplex offset frequency */ #define C_CTL_SCAN 0x0e /* Control scan, Sc */ #define C_CTL_SPLT 0x0f /* Control split, and duplex mode Sc */ #define C_SET_TS 0x10 /* Set tuning step, Sc */ #define C_CTL_ATT 0x11 /* Set/get attenuator, Sc */ #define C_CTL_ANT 0x12 /* Set/get antenna, Sc */ #define C_CTL_ANN 0x13 /* Control announce (speech synth.), Sc */ #define C_CTL_LVL 0x14 /* Set AF/RF/squelch, Sc */ #define C_RD_SQSM 0x15 /* Read squelch condiction/S-meter level, Sc */ #define C_CTL_FUNC 0x16 /* Function settings (AGC,NB,etc.), Sc */ #define C_SND_CW 0x17 /* Send CW message */ #define C_SET_PWR 0x18 /* Set Power ON/OFF, Sc */ #define C_RD_TRXID 0x19 /* Read transceiver ID code */ #define C_CTL_MEM 0x1a /* Misc memory/bank/rig control functions, Sc */ #define C_SET_TONE 0x1b /* Set tone frequency */ #define C_CTL_PTT 0x1c /* Control Transmit On/Off, Sc */ #define C_CTL_MISC 0x7f /* Miscellaneous control, Sc */ /* * Sc controller sub commands */ /* * Set mode data (C_SET_MODE) sub commands */ #define S_LSB 0x00 /* Set to LSB */ #define S_USB 0x01 /* Set to USB */ #define S_AM 0x02 /* Set to AM */ #define S_CW 0x03 /* Set to CW */ #define S_RTTY 0x04 /* Set to RTTY */ #define S_FM 0x05 /* Set to FM */ #define S_WFM 0x06 /* Set to Wide FM */ #define S_CWR 0x07 /* Set to CW Reverse */ #define S_RTTYR 0x08 /* Set to RTTY Reverse */ #define S_AMS 0x11 /* Set to AMS */ #define S_PSK 0x12 /* 7800 PSK USB */ #define S_PSKR 0x13 /* 7800 PSK LSB */ #define S_R7000_SSB 0x05 /* Set to SSB on R-7000 */ /* filter width coding for older ICOM rigs with 2 filter width */ /* there is no special 'wide' for that rigs */ #define PD_MEDIUM_2 0x01 /* Medium */ #define PD_NARROW_2 0x02 /* Narrow */ /* filter width coding for newer ICOM rigs with 3 filter width */ #define PD_WIDE_3 0x01 /* Wide */ #define PD_MEDIUM_3 0x02 /* Medium */ #define PD_NARROW_3 0x03 /* Narrow */ /* * Set VFO (C_SET_VFO) sub commands */ #define S_VFOA 0x00 /* Set to VFO A */ #define S_VFOB 0x01 /* Set to VFO B */ #define S_BTOA 0xa0 /* VFO A=B */ #define S_XCHNG 0xb0 /* Switch VFO A and B */ #define S_SUBTOMAIN 0xb1 /* MAIN = SUB */ #define S_DUAL_OFF 0xc0 /* Dual watch off */ #define S_DUAL_ON 0xc1 /* Dual watch on */ #define S_MAIN 0xd0 /* Select MAIN band */ #define S_SUB 0xd1 /* Select SUB band */ #define S_FRONTWIN 0xe0 /* Select front window */ /* * Set MEM (C_SET_MEM) sub commands */ #define S_BANK 0xa0 /* Select memory bank */ /* * Scan control (C_CTL_SCAN) subcommands */ #define S_SCAN_STOP 0x00 /* Stop scan/window scan */ #define S_SCAN_START 0x01 /* Programmed/Memory scan */ #define S_SCAN_PROG 0x02 /* Programmed scan */ #define S_SCAN_DELTA 0x03 /* Delta-f scan */ #define S_SCAN_WRITE 0x04 /* auto memory-write scan */ #define S_SCAN_FPROG 0x12 /* Fine programmed scan */ #define S_SCAN_FDELTA 0x13 /* Fine delta-f scan */ #define S_SCAN_MEM2 0x22 /* Memory scan */ #define S_SCAN_SLCTN 0x23 /* Selected number memory scan */ #define S_SCAN_SLCTM 0x24 /* Selected mode memory scan */ #define S_SCAN_PRIO 0x42 /* Priority / window scan */ #define S_SCAN_NSLCT 0xB0 /* Set as non select channel */ #define S_SCAN_SLCT 0xB1 /* Set as select channel */ #define S_SCAN_SL_NUM 0xB2 /* select programed mem scan 7800 only */ #define S_SCAN_RSMOFF 0xD0 /* Set scan resume OFF */ #define S_SCAN_RSMON 0xD3 /* Set scan resume ON */ /* * Split control (S_CTL_SPLT) subcommands */ #define S_SPLT_OFF 0x00 /* Split OFF */ #define S_SPLT_ON 0x01 /* Split ON */ #define S_DUP_OFF 0x10 /* Simplex mode */ #define S_DUP_M 0x11 /* Duplex - mode */ #define S_DUP_P 0x12 /* Duplex + mode */ /* * Set Attenuator (C_CTL_ATT) subcommands */ #define S_ATT_RD -1 /* Without subcommand, reads out setting */ #define S_ATT_OFF 0x00 /* Off */ #define S_ATT_6dB 0x06 /* 6 dB, IC-756Pro */ #define S_ATT_10dB 0x10 /* 10 dB */ #define S_ATT_12dB 0x12 /* 12 dB, IC-756Pro */ #define S_ATT_18dB 0x18 /* 18 dB, IC-756Pro */ #define S_ATT_20dB 0x20 /* 20 dB */ #define S_ATT_30dB 0x30 /* 30 dB, or Att on for IC-R75 */ /* * Set Preamp (S_FUNC_PAMP) data */ #define D_PAMP_OFF 0x00 #define D_PAMP1 0x01 #define D_PAMP2 0x02 /* * Set AGC (S_FUNC_AGC) data */ #define D_AGC_FAST 0x00 #define D_AGC_MID 0x01 #define D_AGC_SLOW 0x02 #define D_AGC_SUPERFAST 0x03 /* IC746 pro */ /* * Set antenna (C_SET_ANT) subcommands */ #define S_ANT_RD -1 /* Without subcommand, reads out setting */ #define S_ANT1 0x00 /* Antenna 1 */ #define S_ANT2 0x01 /* Antenna 2 */ /* * Announce control (C_CTL_ANN) subcommands */ #define S_ANN_ALL 0x00 /* Announce all */ #define S_ANN_FREQ 0x01 /* Announce freq */ #define S_ANN_MODE 0x02 /* Announce operating mode */ /* * Function settings (C_CTL_LVL) subcommands */ #define S_LVL_AF 0x01 /* AF level setting */ #define S_LVL_RF 0x02 /* RF level setting */ #define S_LVL_SQL 0x03 /* SQL level setting */ #define S_LVL_IF 0x04 /* IF shift setting */ #define S_LVL_APF 0x05 /* APF level setting */ #define S_LVL_NR 0x06 /* NR level setting */ #define S_LVL_PBTIN 0x07 /* Twin PBT setting (inside) */ #define S_LVL_PBTOUT 0x08 /* Twin PBT setting (outside) */ #define S_LVL_CWPITCH 0x09 /* CW pitch setting */ #define S_LVL_RFPOWER 0x0a /* RF power setting */ #define S_LVL_MICGAIN 0x0b /* MIC gain setting */ #define S_LVL_KEYSPD 0x0c /* Key Speed setting */ #define S_LVL_NOTCHF 0x0d /* Notch freq. setting */ #define S_LVL_COMP 0x0e /* Compressor level setting */ #define S_LVL_BKINDL 0x0f /* BKin delay setting */ #define S_LVL_BALANCE 0x10 /* Balance setting (Dual watch) */ #define S_LVL_AGC 0x11 /* AGC (7800) */ #define S_LVL_NB 0x12 /* NB setting */ #define S_LVL_DIGI 0x13 /* DIGI-SEL (7800) */ #define S_LVL_DRIVE 0x14 /* DRIVE gain setting */ #define S_LVL_MON 0x15 /* Monitor gain setting */ #define S_LVL_VOXGAIN 0x16 /* VOX gain setting */ #define S_LVL_ANTIVOX 0x17 /* Anti VOX gain setting */ #define S_LVL_CONTRAST 0x18 /* CONTRAST level setting */ #define S_LVL_BRIGHT 0x19 /* BRIGHT level setting */ /* * Read squelch condition/S-meter level/other meter levels (C_RD_SQSM) subcommands */ #define S_SQL 0x01 /* Read squelch condition */ #define S_SML 0x02 /* Read S-meter level */ #define S_RFML 0x11 /* Read RF-meter level */ #define S_SWR 0x12 /* Read SWR-meter level */ #define S_ALC 0x13 /* Read ALC-meter level */ #define S_CMP 0x14 /* Read COMP-meter level */ #define S_VD 0x15 /* Read Vd-meter level */ #define S_ID 0x16 /* Read Id-meter level */ /* * Function settings (C_CTL_FUNC) subcommands Set and Read */ #define S_FUNC_PAMP 0x02 /* Preamp setting */ #define S_FUNC_AGCOFF 0x10 /* IC-R8500 only */ #define S_FUNC_AGCON 0x11 /* IC-R8500 only */ #define S_FUNC_AGC 0x12 /* AGC setting presets: the dsp models allow these to be modified */ #define S_FUNC_NBOFF 0x20 /* IC-R8500 only */ #define S_FUNC_NBON 0x21 /* IC-R8500 only */ #define S_FUNC_NB 0x22 /* NB setting */ #define S_FUNC_APFOFF 0x30 /* IC-R8500 only */ #define S_FUNC_APFON 0x31 /* IC-R8500 only */ #define S_FUNC_APF 0x32 /* APF setting */ #define S_FUNC_NR 0x40 /* NR setting */ #define S_FUNC_ANF 0x41 /* ANF setting */ #define S_FUNC_TONE 0x42 /* TONE setting */ #define S_FUNC_TSQL 0x43 /* TSQL setting */ #define S_FUNC_COMP 0x44 /* COMP setting */ #define S_FUNC_MON 0x45 /* Monitor setting */ #define S_FUNC_VOX 0x46 /* VOX setting */ #define S_FUNC_BKIN 0x47 /* BK-IN setting */ #define S_FUNC_MN 0x48 /* Manual notch setting */ #define S_FUNC_RF 0x49 /* RTTY Filter setting */ #define S_FUNC_AFC 0x4A /* Auto Frequency Control (AFC) setting */ #define S_FUNC_DTCS 0x4B /*DTCS tone code squelch setting*/ #define S_FUNC_VSC 0x4C /* voice squelch control useful for scanning*/ #define S_FUNC_MANAGC 0x4D /* manual AGC */ #define S_FUNC_DIGISEL 0x4E /* DIGI-SEL */ #define S_FUNC_TW_PK 0x4F /* RTTY Twin Peak filter 0= off 1 = on */ #define S_FUNC_DIAL_LK 0x50 /* Dial lock */ /* * Set Power On/Off (C_SET_PWR) subcommands */ #define S_PWR_OFF 0x00 #define S_PWR_ON 0x01 /* * Transmit control (C_CTL_PTT) subcommands */ #define S_PTT 0x00 #define S_ANT_TUN 0x01 /* Auto tuner 0=OFF, 1 = ON, 2=Start Tuning */ /* * Misc contents (C_CTL_MEM) subcommands applies to newer rigs. */ #define S_MEM_CNTNT 0x00 /* Memory content 2 bigendian */ #define S_MEM_BAND_REG 0x01 /* band stacking register */ #define S_MEM_FILT_WDTH 0x03 /* current passband filter width */ #define S_MEM_PARM 0x05 /* rig parameters; extended parm # + param value: should be coded */ /* in the rig files because they are different for each rig */ #define S_MEM_DATA_MODE 0x06 /* data mode */ #define S_MEM_TX_PB 0x07 /* SSB tx passband */ #define S_MEM_FLTR_SHAPE 0x08 /* DSP filter shape 0=sharp 1=soft */ /* Icr75c */ #define S_MEM_CNTNT_SLCT 0x01 #define S_MEM_FLT_SLCT 0x01 #define S_MEM_MODE_SLCT 0x02 /* For IC-910H rig. */ #define S_MEM_RDWR_MEM 0x00 /* Read/write memory channel */ #define S_MEM_SATMEM 0x01 /* Satellite memory */ #define S_MEM_VOXGAIN 0x02 /* VOX gain level (0=0%, 255=100%) */ #define S_MEM_VOXDELAY 0x03 /* VOX delay (0=0.0 sec, 20=2.0 sec) */ #define S_MEM_ANTIVOX 0x04 /* anti VOX setting */ #define S_MEM_ATTLEVEL 0x05 /* Attenuation level (0=0%, 255=100%) */ #define S_MEM_RIT 0x06 /* RIT (0=off, 1=on, 2=sub dial) */ #define S_MEM_SATMODE 0x07 /* Satellite mode (on/off) */ #define S_MEM_BANDSCOPE 0x08 /* Simple bandscope (on/off) */ /* * Tone control (C_SET_TONE) subcommands */ #define S_TONE_RPTR 0x00 /* Tone frequency setting for repeater receive */ #define S_TONE_SQL 0x01 /* Tone frequency setting for squelch */ #define S_TONE_DTCS 0x02 /* DTCS code and polarity for squelch */ /* * Transceiver ID (C_RD_TRXID) subcommands */ #define S_RD_TRXID 0x00 /* * C_CTL_MISC OptoScan extension */ #define S_OPTO_LOCAL 0x01 #define S_OPTO_REMOTE 0x02 #define S_OPTO_TAPE_ON 0x03 #define S_OPTO_TAPE_OFF 0x04 #define S_OPTO_RDSTAT 0x05 #define S_OPTO_RDCTCSS 0x06 #define S_OPTO_RDDCS 0x07 #define S_OPTO_RDDTMF 0x08 #define S_OPTO_RDID 0x09 #define S_OPTO_SPKRON 0x0a #define S_OPTO_SPKROFF 0x0b #define S_OPTO_5KSCON 0x0c #define S_OPTO_5KSCOFF 0x0d #define S_OPTO_NXT 0x0e #define S_OPTO_SCON 0x0f #define S_OPTO_SCOFF 0x10 /* * OmniVIPlus (Omni VI) extensions */ #define C_OMNI6_XMT 0x16 /* * S_MEM_MODE_SLCT Misc CI-V Mode settings */ #define S_PRM_BEEP 0x02 #define S_PRM_CWPITCH 0x10 #define S_PRM_LANG 0x15 #define S_PRM_BACKLT 0x21 #define S_PRM_SLEEP 0x32 #define S_PRM_SLPTM 0x33 #define S_PRM_TIME 0x27 /* * Tokens for Extra Level and Parameters common to multiple rigs. Use token # > 99. Defined here so they * will be available in ICOM name space. They have different internal commands primarily in dsp rigs. These * tokens are used ext_lvl and ext_parm funtions in the individual rig files. * Extra parameters which are rig specific should be coded in the individual rig files and token #s < 100. */ #define TOKEN_BACKEND(t) (t) #define TOK_RTTY_FLTR TOKEN_BACKEND(100) #define TOK_SSBBASS TOKEN_BACKEND(101) #define TOK_SQLCTRL TOKEN_BACKEND(102) #endif /* _ICOM_DEFS_H */ hamlib-1.2.15.3/icom/ic746.c0000644000175000017500000006741712044564477012101 00000000000000/* * Hamlib CI-V backend - description of IC-746 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include #include "token.h" #include "idx_builtin.h" #include "icom.h" #include "icom_defs.h" #include "frame.h" #include "bandplan.h" #include "misc.h" /* * IC-746 and IC-746pro * * TODO: * - advanced scanning functions * - set_channel * - set_ctcss_tone/ctcss_sql * - set keyer? * - test all that stuff.. */ #define IC746_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) #define IC746_1HZ_TS_MODES IC746_ALL_RX_MODES /* * 100W in all modes but AM (40W) * deleted rig_mode_tx_modes */ #define IC746_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FM) #define IC746_AM_TX_MODES (RIG_MODE_AM) #define IC746_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_NR|RIG_FUNC_MON|RIG_FUNC_MN|RIG_FUNC_RF|RIG_FUNC_ANF|RIG_FUNC_VSC|RIG_FUNC_RESUME|RIG_FUNC_ARO) #define IC746_LEVEL_ALL (RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_COMP|RIG_LEVEL_BKINDL|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR) #define IC746_GET_PARM (RIG_PARM_BACKLIGHT|RIG_PARM_BEEP) #define IC746_SET_PARM (RIG_PARM_BACKLIGHT|RIG_PARM_BEEP|RIG_PARM_ANN) #define IC746_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC746_ANTS (RIG_ANT_1|RIG_ANT_2) #define IC746_VFO_OPS (RIG_OP_CPY|RIG_OP_XCHG|RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_MCL|RIG_OP_TUNE) #define IC746_SCAN_OPS (RIG_SCAN_VFO|RIG_SCAN_MEM|RIG_SCAN_SLCT|RIG_SCAN_PROG|RIG_SCAN_DELTA) #define IC746_STR_CAL { 16, \ { \ { 0, -60 }, \ { 10, -55 }, \ { 27, -49 }, \ { 45, -42 }, \ { 60, -35 }, \ { 76, -28 }, \ { 89, -21 }, \ { 100, -14 }, \ { 110, -7 }, \ { 120, 0 }, \ { 125, 10 }, \ { 129, 20 }, \ { 133, 30 }, \ { 138, 40 }, \ { 142, 50 }, \ { 146, 60 } \ } } #define IC746PRO_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .tx_freq = 1, \ .tx_mode = 1, \ .tx_width = 1, \ .split = 1, \ .rptr_shift = 1,\ .ctcss_tone = 1,\ .ctcss_sql = 1, \ .dcs_code = 1, \ .flags = 1, \ .channel_desc = 1, \ } /* Memory channel buffer structure for IC-746 pro and ? Note requires an ack_buff of 64 bytes and data length is 46. */ typedef struct { unsigned char freq[5]; /* little endian frequency */ unsigned char mode; unsigned char pb; /* passband or filter selection*/ unsigned char data; /* data port 0=off 1=on */ unsigned char dup; /* duplex, tone, tonesql and DTCS Values in hex are "or"ed together 00 = Simplex 10 = -DUP 20 = +DUP 01 = ctcss tone on 02 = tone_sql on 03 = DTCS on */ unsigned char tone[3]; /* ctcss tone bigendian first byte fixed 00 */ unsigned char tone_sql[3]; /* tone squelch frequency as tone */ struct { unsigned char pol; /* DTCS polarity by nibbles Tx pol | Rx pol; 0 = normal; 1 = rev */ unsigned char code[2]; /* DTCS code bigendian */ } dcs; } channel_str_t; typedef struct { char chan_flag; /* split 0x10 = on; scan select 0x01 = on */ channel_str_t rx; channel_str_t tx; char name[9]; /*name 9 ascii no null terminator */ } mem_buf_t; #define MAX_MEM_BUF_LEN sizeof(mem_buf_t) /* IC-746 Pro has a 3 "band-stacking registers" defined for each hamband and general coverage. These are updated and rotated when band is changed from front panel. The most recent is rolled down and the oldest discarded. The structure of the register is roughly half a memory buffer. */ typedef channel_str_t band_stack_reg_t; static int ic746_set_parm(RIG *rig, setting_t parm, value_t val); static int ic746_get_parm(RIG *rig, setting_t parm, value_t *val); static int ic746pro_get_channel(RIG *rig, channel_t *chan); static int ic746pro_set_ext_parm(RIG *rig, token_t token, value_t val); static int ic746pro_get_ext_parm(RIG *rig, token_t token, value_t *val); /* * ic746 rig capabilities. */ static const struct icom_priv_caps ic746_priv_caps = { 0x56, /* default address */ 0, /* 731 mode */ ic756pro_ts_sc_list }; const struct rig_caps ic746_caps = { .rig_model = RIG_MODEL_IC746, .model_name = "IC-746", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC746_FUNC_ALL, .has_set_func = IC746_FUNC_ALL, .has_get_level = IC746_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(IC746_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_ANN, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, 20, RIG_DBLST_END, }, /* FIXME: TBC */ .attenuator = { 20, RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC746_VFO_OPS, .scan_ops = IC746_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM }, { 100, 101, RIG_MTYPE_EDGE }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(60),IC746_ALL_RX_MODES,-1,-1,IC746_VFO_ALL,IC746_ANTS}, {MHz(108),MHz(174),IC746_ALL_RX_MODES,-1,-1,IC746_VFO_ALL,IC746_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC746_OTHER_TX_MODES, W(5),W(100),IC746_VFO_ALL,IC746_ANTS), FRQ_RNG_6m(1,IC746_OTHER_TX_MODES, W(5),W(100),IC746_VFO_ALL,IC746_ANTS), FRQ_RNG_2m(1,IC746_OTHER_TX_MODES, W(5),W(100),IC746_VFO_ALL,IC746_ANTS), FRQ_RNG_HF(1,IC746_AM_TX_MODES, W(2),W(40),IC746_VFO_ALL,IC746_ANTS), /* AM class */ FRQ_RNG_6m(1,IC746_AM_TX_MODES, W(2),W(40),IC746_VFO_ALL,IC746_ANTS), /* AM class */ FRQ_RNG_2m(1,IC746_AM_TX_MODES, W(2),W(40),IC746_VFO_ALL,IC746_ANTS), /* AM class */ RIG_FRNG_END, }, /* most it2 rigs have 108-174 coverage*/ .rx_range_list2 = { {kHz(30),MHz(60),IC746_ALL_RX_MODES,-1,-1,IC746_VFO_ALL,IC746_ANTS}, {MHz(108),MHz(174),IC746_ALL_RX_MODES,-1,-1,IC746_VFO_ALL,IC746_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC746_OTHER_TX_MODES, W(5),W(100),IC746_VFO_ALL,IC746_ANTS), FRQ_RNG_6m(2,IC746_OTHER_TX_MODES, W(5),W(100),IC746_VFO_ALL,IC746_ANTS), FRQ_RNG_2m(2,IC746_OTHER_TX_MODES, W(5),W(100),IC746_VFO_ALL,IC746_ANTS), FRQ_RNG_HF(2,IC746_AM_TX_MODES, W(2),W(40),IC746_VFO_ALL,IC746_ANTS), /* AM class */ FRQ_RNG_6m(2,IC746_AM_TX_MODES, W(2),W(40),IC746_VFO_ALL,IC746_ANTS), /* AM class */ FRQ_RNG_2m(2,IC746_AM_TX_MODES, W(2),W(40),IC746_VFO_ALL,IC746_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {IC746_1HZ_TS_MODES,1}, {IC746_ALL_RX_MODES,100}, {IC746_ALL_RX_MODES,kHz(1)}, {IC746_ALL_RX_MODES,kHz(5)}, {IC746_ALL_RX_MODES,kHz(9)}, {IC746_ALL_RX_MODES,kHz(10)}, {IC746_ALL_RX_MODES,kHz(12.5)}, {IC746_ALL_RX_MODES,kHz(20)}, {IC746_ALL_RX_MODES,kHz(25)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_RTTYR|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_CW, kHz(2.1)}, {RIG_MODE_CW|RIG_MODE_CWR, Hz(500)}, {RIG_MODE_FM, kHz(12)}, {RIG_MODE_FM|RIG_MODE_AM, kHz(9)}, RIG_FLT_END, }, .str_cal = IC746_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic746_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_parm = ic746_set_parm, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .get_ts = icom_get_ts, .set_rptr_shift = icom_set_rptr_shift, .get_rptr_shift = icom_get_rptr_shift, .set_rptr_offs = icom_set_rptr_offs, .get_rptr_offs = icom_get_rptr_offs, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, .get_split_vfo = icom_mem_get_split_vfo, .set_ptt = icom_set_ptt, .get_ptt = icom_get_ptt, }; /* IC-746Pro Rig parameters Only available in this namespace. This is a partial list */ #define S_MEM_SC_LEN 2 /* 756PRO S_MEM subcmd length */ #define S_MEM_LCD_CONT 0x501 /* LCD Contrast 0-256/0-100% */ #define S_MEM_BKLIT 0x502 /* Backlight 0-256/0-100% */ #define S_MEM_BEEP 0x506 /* Button confirmation */ #define S_MEM_SQL_CTL 0x508 /* RF/SQL ctl set 0=auto; 1 = sql; 2 = RF+SQL */ #define S_MEM_QSPLT 0x511 /* enable quick split mode */ /* values -9.999 MHz to + 9.999 Mhz */ #define S_MEM_SPLT_OFST 0x512 /* default split offset 4 bytes little endian last byte sign*/ #define S_MEM_SPLT_LOCK 0x513 /* split lock set */ /* values 0.000 MHz to + 9.999 Mhz */ #define S_MEM_HF_DUP_OFST 0x514 /* default HF band duplex offset 3 byte little endian */ #define S_MEM_6M_DUP_OFST 0x515 /* default 50 mHz duplex offset 3 byte little endian */ #define S_MEM_2M_DUP_OFST 0x516 /* default 144 MHz duplex offset 3 byte little endian */ #define S_MEM_AUTO_RPTR 0x518 /* auto repeater set 0=OFF; 1=ON-1; 2=ON-2 */ #define S_MEM_LANG 0x523 /* 0=English 1=Japanese for voice announcer */ #define S_MEM_TRCV 0x536 /* CI-V trancieve mode */ #define S_MEM_CMP_LVL 0x538 /* speech compressor level 0-10 */ #define S_MEM_SBASS 0x539 /* SSB TX tone bass level */ #define S_MEM_RTTY_FL_PB 0x562 /* 0=250 Hz, 1=300' 2 = 350, 3 = 500, 4 = 1 KHz */ #define S_MEM_RTTY_TWNPK 0x563 /* rtty twin peak filter off/on */ #define S_MEM_SCN_SPD 0x570 /* 0 = low; 1 = high */ #define S_MEM_NB_LVL 0x572 /* NB level 0-255 */ #define S_MEM_VOX_GN_LVL 0x573 /* vox gain */ #define S_MEM_AVOX_GN_LVL 0x574 /* anti-vox gain */ #define S_MEM_VOX_DEL_LVL 0x575 /* vox delay 0=0 - 20=2.0 sec */ static const struct confparams ic746pro_ext_parms[] = { { TOK_SSBBASS, "ssbbass", "SSB Tx Tone (Bass)", "SSB Tx Tone (Bass)", NULL, RIG_CONF_NUMERIC, { .n = { 0, 10, 1 } } }, { TOK_SQLCTRL, "sqlctrl", "RF/Sql control", "set RF/Squelch control", NULL, RIG_CONF_COMBO, { .c = {{ "Auto", "Sql", "RF+Sql", NULL }} } }, { TOK_RTTY_FLTR, "rttyfltr", "RTTY Fltr Width preset", "Set/Read RTTY preset filter width", "350", RIG_CONF_COMBO, { .c = {{"250", "300", "350", "500", "1000", NULL }} } }, { RIG_CONF_END, NULL, } }; /* * NUMERIC: val.f * COMBO: val.i, starting from 0 Index to a string table. * STRING: val.cs for set, val.s for get * CHECKBUTTON: val.i 0/1 */ /* * ic746pro rig capabilities. */ static const struct icom_priv_caps ic746pro_priv_caps = { 0x66, /* default address */ 0, /* 731 mode */ ic756pro_ts_sc_list }; const struct rig_caps ic746pro_caps = { .rig_model = RIG_MODEL_IC746PRO, .model_name = "IC-746PRO", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 19200, .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 = IC746_FUNC_ALL, .has_set_func = IC746_FUNC_ALL, .has_get_level = IC746_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(IC746_LEVEL_ALL), .has_get_parm = IC746_GET_PARM, .has_set_parm = IC746_SET_PARM, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .extparms = ic746pro_ext_parms, .ctcss_list = common_ctcss_list, .dcs_list = full_dcs_list, .preamp = { 10, 20, RIG_DBLST_END, }, /* FIXME: TBC */ .attenuator = { 20, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .vfo_ops = IC746_VFO_OPS, .scan_ops = IC746_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 9, .chan_list = { { 1, 99, RIG_MTYPE_MEM, IC746PRO_MEM_CAP }, { 100, 101, RIG_MTYPE_EDGE, IC746PRO_MEM_CAP }, /* two by two */ { 102, 102, RIG_MTYPE_CALL, IC746PRO_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(60),IC746_ALL_RX_MODES,-1,-1,IC746_VFO_ALL,IC746_ANTS}, {MHz(144),MHz(146),IC746_ALL_RX_MODES,-1,-1,IC746_VFO_ALL,IC746_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,IC746_OTHER_TX_MODES, W(5),W(100),IC746_VFO_ALL,IC746_ANTS), FRQ_RNG_6m(1,IC746_OTHER_TX_MODES, W(5),W(100),IC746_VFO_ALL,IC746_ANTS), FRQ_RNG_2m(1,IC746_OTHER_TX_MODES, W(5),W(100),IC746_VFO_ALL,IC746_ANTS), FRQ_RNG_HF(1,IC746_AM_TX_MODES, W(2),W(40),IC746_VFO_ALL,IC746_ANTS), /* AM class */ FRQ_RNG_6m(1,IC746_AM_TX_MODES, W(2),W(40),IC746_VFO_ALL,IC746_ANTS), /* AM class */ FRQ_RNG_2m(1,IC746_AM_TX_MODES, W(2),W(40),IC746_VFO_ALL,IC746_ANTS), /* AM class */ RIG_FRNG_END, }, /* most it2 rigs have 108-174 coverage*/ .rx_range_list2 = { {kHz(30),MHz(60),IC746_ALL_RX_MODES,-1,-1,IC746_VFO_ALL,IC746_ANTS}, {MHz(108),MHz(174),IC746_ALL_RX_MODES,-1,-1,IC746_VFO_ALL,IC746_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,IC746_OTHER_TX_MODES, W(5),W(100),IC746_VFO_ALL,IC746_ANTS), FRQ_RNG_6m(2,IC746_OTHER_TX_MODES, W(5),W(100),IC746_VFO_ALL,IC746_ANTS), FRQ_RNG_2m(2,IC746_OTHER_TX_MODES, W(5),W(100),IC746_VFO_ALL,IC746_ANTS), FRQ_RNG_HF(2,IC746_AM_TX_MODES, W(2),W(40),IC746_VFO_ALL,IC746_ANTS), /* AM class */ FRQ_RNG_6m(2,IC746_AM_TX_MODES, W(2),W(40),IC746_VFO_ALL,IC746_ANTS), /* AM class */ FRQ_RNG_2m(2,IC746_AM_TX_MODES, W(2),W(40),IC746_VFO_ALL,IC746_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {IC746_1HZ_TS_MODES,1}, {IC746_ALL_RX_MODES,100}, {IC746_ALL_RX_MODES,kHz(1)}, {IC746_ALL_RX_MODES,kHz(5)}, {IC746_ALL_RX_MODES,kHz(9)}, {IC746_ALL_RX_MODES,kHz(10)}, {IC746_ALL_RX_MODES,kHz(12.5)}, {IC746_ALL_RX_MODES,kHz(20)}, {IC746_ALL_RX_MODES,kHz(25)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! But duplication may speed up search. Put the most commonly used modes first! It might be better to rewrite and just put all filter widths for 1 mode together in 1 record. Remember these are defaults, with dsp rigs you can change them to anything you want (except rtty filter modes). */ .filters = { {RIG_MODE_SSB, kHz(2.4)}, {RIG_MODE_SSB, kHz(1.8)}, {RIG_MODE_SSB, kHz(3)}, {RIG_MODE_FM, kHz(10)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_FM, kHz(7)}, /* There are 5 rtty filters when rtty filter mode is set (default condition) { 1k, 500, 350, 300, 250 }. These are fixed. If rtty filter mode is unset there are 3 general IF filters { 2.4k, 500, 250 are the defaults }. These can be changed. There is a "twin-peak" filter mode as well. It boosts the 2125 and 2295 recieve frequency reponse. The S_FUNC_RF (rtty filter) turns the rtty filter mode on and off. */ {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(500)}, /* RTTY & "normal" IF Filters */ {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(250)}, /* RTTY & "narrow" IF Filters */ {RIG_MODE_CW|RIG_MODE_CWR, kHz(2.4)}, /* "wide" IF filter */ {RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(1)}, /*RTTY mode Filter*/ {RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(350)}, /*"Default " rtty mode filter*/ {RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(300)}, /* RTTY mode Filter */ {RIG_MODE_AM, kHz(6)}, {RIG_MODE_AM, kHz(3)}, {RIG_MODE_AM, kHz(9)}, RIG_FLT_END, }, .str_cal = IC746_STR_CAL, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic746pro_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .set_ant = icom_set_ant, .get_ant = icom_get_ant, .decode_event = icom_decode_event, .set_level = icom_set_level, .get_level = icom_get_level, .set_func = icom_set_func, .get_func = icom_get_func, .set_parm = ic746_set_parm, .get_parm = ic746_get_parm, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, .scan = icom_scan, .set_ptt = icom_set_ptt, .get_ptt = icom_get_ptt, .get_dcd = icom_get_dcd, .set_ts = icom_set_ts, .get_ts = NULL, .set_rptr_shift = icom_set_rptr_shift, .get_rptr_shift = NULL, .set_rptr_offs = icom_set_rptr_offs, .get_rptr_offs = icom_get_rptr_offs, .set_ctcss_tone = icom_set_ctcss_tone, .get_ctcss_tone = icom_get_ctcss_tone, .set_ctcss_sql = icom_set_ctcss_sql, .get_ctcss_sql = icom_get_ctcss_sql, .set_split_freq = icom_set_split_freq, .get_split_freq = icom_get_split_freq, .set_split_mode = icom_set_split_mode, .get_split_mode = icom_get_split_mode, .set_split_vfo = icom_set_split_vfo, .get_split_vfo = NULL, .set_ext_parm = ic746pro_set_ext_parm, .get_ext_parm = ic746pro_get_ext_parm, .get_channel = ic746pro_get_channel, }; /* * Assumes rig!=NULL, rig->state.priv!=NULL */ static int ic746pro_set_ext_parm(RIG *rig, token_t token, value_t val) { unsigned char epbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int ack_len, ep_len, val_len; int ep_cmd = C_CTL_MEM; int ep_sc; /* Subcommand in $1A $05xx */ int icom_val = 0; int retval; ep_len = 0; /* 0 implies BCD data */ val_len = 1; switch(token) { case TOK_SSBBASS: ep_sc = S_MEM_SBASS ; icom_val = val.f; break; case TOK_SQLCTRL: ep_sc = S_MEM_SQL_CTL; /* TODO: check range this actually doesn't decode the input type 'string' */ icom_val = val.i; break; case TOK_RTTY_FLTR: /* RTTY filter mode 0 - 4 = 250, 300, 350, 500, 1000 */ if (val.i < 0 || val.i > 4) return -RIG_EINVAL; ep_sc = S_MEM_RTTY_FL_PB; icom_val = val.i; break; default: return -RIG_EINVAL; } if (ep_len == 0) { to_bcd_be(epbuf, (long long)icom_val, val_len*2); ep_len += val_len; } retval = icom_transaction (rig, ep_cmd, ep_sc, epbuf, ep_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1 || ackbuf[0] != ACK) { rig_debug(RIG_DEBUG_ERR, "%s: ack NG (%#.2x), " "len=%d\n", __FUNCTION__, ackbuf[0], ack_len); return -RIG_ERJCTED; } return RIG_OK; } /* * Assumes rig!=NULL, rig->state.priv!=NULL * and val points to a buffer big enough to hold the conf value. */ static int ic746pro_get_ext_parm(RIG *rig, token_t token, value_t *val) { const struct confparams *cfp; unsigned char resbuf[MAXFRAMELEN]; int res_len, icom_val=0; int cmdhead; int retval; int ep_cmd = C_CTL_MEM; int ep_sc; /* Subcommand in $1A $05xx */ switch(token) { case TOK_SSBBASS: ep_sc = S_MEM_SBASS ; break; case TOK_SQLCTRL: ep_sc = S_MEM_SQL_CTL; break; case TOK_RTTY_FLTR: /* RTTY filter mode 0 - 4 */ ep_sc = S_MEM_RTTY_FL_PB; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_ext_parm %d", token); return -RIG_EINVAL; } retval = icom_transaction (rig, ep_cmd, ep_sc, NULL, 0, resbuf, &res_len); if (retval != RIG_OK) return retval; /* * strbuf should contain Cn,Sc,Data area */ cmdhead = (ep_sc == -1) ? 1:S_MEM_SC_LEN + 1; res_len -= cmdhead; /* should echo cmd, subcmd and then data, if you get an ack something is wrong */ if (resbuf[0] != ep_cmd) { if (resbuf[0] == ACK) { rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), " "len=%d\n", __FUNCTION__,resbuf[0],res_len); return -RIG_EPROTO; } else { rig_debug(RIG_DEBUG_ERR,"%s: ack NG (%#.2x), " "len=%d\n", __FUNCTION__,resbuf[0],res_len); return -RIG_ERJCTED; } } cfp = rig_ext_lookup_tok(rig, token); switch(cfp->type) { case RIG_CONF_STRING: memcpy(val->s, resbuf, res_len); break; case RIG_CONF_CHECKBUTTON: case RIG_CONF_COMBO: val->i = from_bcd_be(resbuf+cmdhead, res_len*2); break; case RIG_CONF_NUMERIC: val->f = from_bcd_be(resbuf+cmdhead, res_len*2); break; default: rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), " "len=%d\n", __FUNCTION__,resbuf[0],res_len); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE,"%s: %d %d %d %f\n", __FUNCTION__, res_len, icom_val, val->i, val->f); return RIG_OK; } /* * icom_set_parm * Assumes rig!=NULL * These are very much rig specific and should probably be in rig files. These are for IC-746Pro. * The 746 has no parameters. */ int ic746_set_parm(RIG *rig, setting_t parm, value_t val) { unsigned char prmbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int ack_len, prm_len; int prm_cn, prm_sc; int retval, icom_val; prm_cn = C_CTL_MEM; /* Most parm are 0x05xx */ prm_sc = S_MEM_PARM; switch (parm) { case RIG_PARM_ANN: if ((val.i == RIG_ANN_FREQ) || (val.i == RIG_ANN_RXMODE)) { prm_cn = C_CTL_ANN; prm_sc = val.i; prm_len = 0; } else { if ((val.i == RIG_ANN_ENG)||(val.i == RIG_ANN_JAP)) { prm_cn = C_CTL_MEM; prm_sc = S_MEM_LANG; prm_len = 1; prmbuf[0] = (val.i == RIG_ANN_ENG ? 0 : 1); } else { rig_debug(RIG_DEBUG_ERR,"Unsupported set_parm_ann %d\n", val.i); return -RIG_EINVAL; } } break; case RIG_PARM_BACKLIGHT: prm_sc = S_MEM_BKLIT; prm_len = 2; icom_val = val.f * 255 ; to_bcd_be(prmbuf + 1, (long long)icom_val, 4); break; case RIG_PARM_BEEP: prm_sc = S_MEM_BEEP; prm_len = 1; prmbuf[1] = val.i; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_parm %d\n", parm); return -RIG_EINVAL; } retval = icom_transaction(rig, prm_cn, prm_sc, prmbuf, prm_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len != 1) { rig_debug(RIG_DEBUG_ERR,"icom_set_parm: wrong frame len=%d\n", ack_len); return -RIG_EPROTO; } return RIG_OK; } /* * icom_get_parm * Assumes rig!=NULL */ int ic746_get_parm(RIG *rig, setting_t parm, value_t *val) { unsigned char resbuf[MAXFRAMELEN]; int res_len, icom_val; int prm_cn, prm_sc; int cmdhead; int retval; prm_cn = C_CTL_MEM; switch (parm) { case RIG_PARM_BACKLIGHT: prm_sc = S_MEM_BKLIT; break; case RIG_PARM_BEEP: prm_sc = S_MEM_BEEP; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_parm %d", parm); return -RIG_EINVAL; } retval = icom_transaction (rig, prm_cn, prm_sc, NULL, 0, resbuf, &res_len); if (retval != RIG_OK) return retval; /* * strbuf should contain Cn,Sc,Data area */ cmdhead = (prm_sc == -1) ? 1:3; res_len -= cmdhead; /* should echo cmd, subcmd and then data, if you get an ack something is wrong */ if (resbuf[0] != prm_cn) { if (resbuf[0] == ACK) { rig_debug(RIG_DEBUG_ERR,"%s: protocol error (%#.2x), " "len=%d\n", __FUNCTION__,resbuf[0],res_len); return -RIG_EPROTO; } else { rig_debug(RIG_DEBUG_ERR,"%s: ack NG (%#.2x), " "len=%d\n", __FUNCTION__,resbuf[0],res_len); return -RIG_ERJCTED; } } icom_val = from_bcd_be(resbuf+cmdhead, res_len*2); if (RIG_PARM_IS_FLOAT(parm)) val->f = (float)icom_val/255; else val->i = icom_val; rig_debug(RIG_DEBUG_TRACE,"%s: %d %d %d %f\n", __FUNCTION__, res_len, icom_val, val->i, val->f); return RIG_OK; } /* * ic746pro_get_channel * Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL * * If memory is empty it will return RIG_OK,but every thing will be null. Where do we boundary check? */ int ic746pro_get_channel(RIG *rig, channel_t *chan) { struct icom_priv_data *priv; struct rig_state *rs; unsigned char chanbuf[46], databuf[32]; mem_buf_t *membuf; int chan_len, freq_len, retval, data_len, sc, band; rs = &rig->state; priv = (struct icom_priv_data*)rs->priv; to_bcd_be(chanbuf,chan->channel_num,4); chan_len = 2; freq_len = priv->civ_731_mode ? 4:5; retval = icom_transaction (rig, C_CTL_MEM, S_MEM_CNTNT, chanbuf, chan_len, chanbuf, &chan_len); if (retval != RIG_OK) return retval; chan->vfo = RIG_VFO_MEM; chan->ant = RIG_ANT_NONE; chan->freq = 0; chan->mode = RIG_MODE_NONE; chan->width = RIG_PASSBAND_NORMAL; chan->rptr_shift = RIG_RPT_SHIFT_NONE; chan->rptr_offs = 0; chan->tuning_step = 0; chan->tx_freq = 0; chan->tx_mode = RIG_MODE_NONE; chan->tx_width = RIG_PASSBAND_NORMAL; chan->tx_vfo = RIG_VFO_NONE; chan->rit = 0; chan->xit = 0; chan->funcs = 0; chan->levels[rig_setting2idx(RIG_LEVEL_PREAMP)].i = 0; chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i = 0; chan->levels[rig_setting2idx(RIG_LEVEL_AF)].f = 0; chan->levels[rig_setting2idx(RIG_LEVEL_RF)].f = 0; chan->levels[rig_setting2idx(RIG_LEVEL_SQL)].f = 0; chan->levels[rig_setting2idx(RIG_LEVEL_NR)].f = 0; chan->levels[rig_setting2idx(RIG_LEVEL_PBT_IN)].f = 0; chan->levels[rig_setting2idx(RIG_LEVEL_PBT_OUT)].f = 0; chan->levels[rig_setting2idx(RIG_LEVEL_CWPITCH)].i = 0; chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i = RIG_AGC_OFF; chan->ctcss_tone = 0; chan->ctcss_sql = 0; chan->dcs_code = 0; chan->dcs_sql = 0; chan->scan_group = 0; chan->flags = RIG_CHFLAG_SKIP; strcpy(chan->channel_desc, " "); /* * chanbuf should contain Cn,Sc, Chan #, Data area */ if ((chan_len != freq_len*2+40) && (chan_len != 1)) { rig_debug(RIG_DEBUG_ERR,"ic746pro_get_channel: wrong frame len=%d\n", chan_len); return -RIG_ERJCTED; } /* do this only if not a blank channel */ if (chan_len != 1) { membuf = (mem_buf_t *) (chanbuf+4); chan->flags = membuf->chan_flag && 0x01 ? RIG_CHFLAG_SKIP : RIG_CHFLAG_NONE; /* data mode on */ if (membuf->rx.data) chan->flags |= RIG_CHFLAG_DATA; /* * from_bcd requires nibble len */ chan->freq = from_bcd(membuf->rx.freq, freq_len*2); icom2rig_mode(rig, membuf->rx.mode, membuf->rx.pb, &chan->mode, &chan->width); chan->rptr_shift = (rptr_shift_t) (membuf->rx.dup >> 8); /* offset is default for the band & is not stored in channel memory. The following retrieves the system default for the band */ band = (int) chan->freq / 1000000; /* hf, 2m or 6 m */ if (band < 50 ) sc = S_MEM_HF_DUP_OFST; else if (band < 108) sc = S_MEM_6M_DUP_OFST; else sc = S_MEM_2M_DUP_OFST; retval = icom_transaction (rig, C_CTL_MEM, sc, NULL, 0 , databuf, &data_len); if (retval != RIG_OK) return retval; chan->rptr_offs = from_bcd(databuf + 3, 6) * 100; chan->ctcss_tone = from_bcd_be(membuf->rx.tone, 6); chan->ctcss_sql = from_bcd_be(membuf->rx.tone_sql, 6); chan->dcs_code = from_bcd_be(membuf->rx.dcs.code, 4); /* The dcs information include in the channel includes polarity information for both tx and receive. Both directions are enabled when in dcs mode */ chan->tx_freq = from_bcd(membuf->tx.freq, freq_len*2); icom2rig_mode(rig, membuf->tx.mode, membuf->tx.pb, &chan->tx_mode, &chan->tx_width); strncpy(chan->channel_desc, membuf->name, 9); chan->channel_desc[9] = '\0'; /* add null terminator */ } return RIG_OK; } hamlib-1.2.15.3/icom/ic475.c0000644000175000017500000000733712044564477012073 00000000000000/* * Hamlib CI-V backend - description of IC-475 and variations * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "icom.h" #define IC475_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define IC475_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define IC475_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO) /* * FIXME: this appears to be the IC-475A/E * what about the IC-475H ? please give it a fix. --SF */ static const struct icom_priv_caps ic475_priv_caps = { 0x14, /* default address */ 0, /* 731 mode */ ic737_ts_sc_list }; const struct rig_caps ic475_caps = { .rig_model = RIG_MODEL_IC475, .model_name = "IC-475", .mfg_name = "Icom", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .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 = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .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, .vfo_ops = IC475_VFO_OPS, .scan_ops = RIG_SCAN_NONE, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM, IC_MIN_MEM_CAP }, { 100, 101, RIG_MTYPE_EDGE, IC_MIN_MEM_CAP }, { 102, 102, RIG_MTYPE_CALL, IC_MIN_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {MHz(430),MHz(450),IC475_MODES,-1,-1,IC475_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { {MHz(430),MHz(440),IC475_MODES,W(2.5),W(25),IC475_VFO_ALL}, RIG_FRNG_END, }, .rx_range_list2 = { {MHz(430),MHz(450),IC475_MODES,-1,-1,IC475_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { {MHz(430),MHz(450),IC475_MODES,W(2.5),W(25),IC475_VFO_ALL}, RIG_FRNG_END, }, .tuning_steps = { {IC475_MODES,10}, /* TBC: does this rig supports settin tuning step? */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.3)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .cfgparams = icom_cfg_params, .set_conf = icom_set_conf, .get_conf = icom_get_conf, .priv = (void*)&ic475_priv_caps, .rig_init = icom_init, .rig_cleanup = icom_cleanup, .rig_open = NULL, .rig_close = NULL, .set_freq = icom_set_freq, .get_freq = icom_get_freq, .set_mode = icom_set_mode, .get_mode = icom_get_mode, .set_vfo = icom_set_vfo, .decode_event = icom_decode_event, .set_mem = icom_set_mem, .vfo_op = icom_vfo_op, }; hamlib-1.2.15.3/icom/icom.h0000644000175000017500000002246512044564477012173 00000000000000/* * Hamlib CI-V backend - main header * Copyright (c) 2000-2012 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ICOM_H #define _ICOM_H 1 #include "hamlib/rig.h" #include "cal.h" #include "tones.h" #ifdef HAVE_SYS_TIME_H #include #endif #define BACKEND_VER "0.7" /* * defines used by comp_cal_str in rig.c * STR_CAL_LENGTH is the length of the S Meter calibration table * STR_CAL_S0 is the value in dB of the lowest value (not even in table) * MULTIB_SUBCMD allows the dsp rigs ie pro models to use multibyte subcommands for all the extra * parameters and levels. */ #define STR_CAL_LENGTH 16 #define STR_CAL_S0 -54 #define MULTIB_SUBCMD /* * minimal channel caps. * If your rig has better/lesser, don't modify this define but clone it, * so you don't change other rigs. */ #define IC_MIN_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ } /* * common channel caps. * If your rig has better/lesser, don't modify this define but clone it, * so you don't change other rigs. */ #define IC_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .tx_freq = 1, \ .tx_mode = 1, \ .tx_width = 1, \ .rptr_offs = 1, \ } /* * S-Meter data for uncalibrated rigs */ #define UNKNOWN_IC_STR_CAL { 2, {{ 0, -60}, { 255, 60}} } struct ts_sc_list { shortfreq_t ts; /* tuning step */ unsigned char sc; /* sub command */ }; /** * \brief Pipelined tuning state data structure. */ typedef struct rig_pltstate { freq_t freq; freq_t next_freq; rmode_t mode; rmode_t next_mode; pbwidth_t width; pbwidth_t next_width; struct timeval timer_start; struct timeval timer_current; int usleep_time; /* dependent on radio module & serial data rate */ } pltstate_t; struct icom_priv_caps { unsigned char re_civ_addr; /* the remote dlft equipment's CI-V address*/ int civ_731_mode; /* Off: freqs on 10 digits, On: freqs on 8 digits */ const struct ts_sc_list *ts_sc_list; int settle_time; /*!< Receiver settle time, in ms */ int (*r2i_mode)(RIG *rig, rmode_t mode, pbwidth_t width, unsigned char *md, signed char *pd); /*< backend specific code to convert bandwidth and mode to cmd tokens */ void (*i2r_mode)(RIG *rig, unsigned char md, int pd, rmode_t *mode, pbwidth_t *width); /*< backend specific code to convert response tokens to bandwidth and mode */ int serial_full_duplex; /*!< Whether RXD&TXD are not tied together */ }; struct icom_priv_data { unsigned char re_civ_addr; /* the remote equipment's CI-V address*/ int civ_731_mode; /* Off: freqs on 10 digits, On: freqs on 8 digits */ pltstate_t *pltstate; /* only on optoscan */ }; extern const struct ts_sc_list r8500_ts_sc_list[]; extern const struct ts_sc_list ic737_ts_sc_list[]; extern const struct ts_sc_list r75_ts_sc_list[]; extern const struct ts_sc_list r7100_ts_sc_list[]; extern const struct ts_sc_list r9000_ts_sc_list[]; extern const struct ts_sc_list r9500_ts_sc_list[]; extern const struct ts_sc_list ic756_ts_sc_list[]; extern const struct ts_sc_list ic756pro_ts_sc_list[]; extern const struct ts_sc_list ic706_ts_sc_list[]; extern const struct ts_sc_list ic7000_ts_sc_list[]; extern const struct ts_sc_list ic7200_ts_sc_list[]; extern const struct ts_sc_list ic910_ts_sc_list[]; extern const struct ts_sc_list ic718_ts_sc_list[]; extern const pbwidth_t rtty_fil[]; /* rtty filter passband width; available on 746pro and 756pro rigs */ pbwidth_t icom_get_dsp_flt(RIG *rig, rmode_t mode); int icom_init(RIG *rig); int icom_cleanup(RIG *rig); int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int icom_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); int icom_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int icom_set_vfo(RIG *rig, vfo_t vfo); int icom_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift); int icom_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift); int icom_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs); int icom_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs); int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq); int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq); int icom_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width); int icom_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width); int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); int icom_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); int icom_mem_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); int icom_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts); int icom_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts); int icom_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); int icom_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); int icom_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); int icom_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone); int icom_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone); int icom_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone); int icom_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone); int icom_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code); int icom_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code); int icom_set_bank(RIG *rig, vfo_t vfo, int bank); int icom_set_mem(RIG *rig, vfo_t vfo, int ch); int icom_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); int icom_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch); int icom_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int icom_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int icom_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int icom_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); int icom_set_parm(RIG *rig, setting_t parm, value_t val); int icom_get_parm(RIG *rig, setting_t parm, value_t *val); int icom_set_conf(RIG *rig, token_t token, const char *val); int icom_get_conf(RIG *rig, token_t token, char *val); int icom_set_powerstat(RIG *rig, powerstat_t status); int icom_get_powerstat(RIG *rig, powerstat_t *status); int icom_set_ant(RIG * rig, vfo_t vfo, ant_t ant); int icom_get_ant(RIG * rig, vfo_t vfo, ant_t *ant); int icom_decode_event(RIG *rig); extern const struct confparams icom_cfg_params[]; extern const struct rig_caps ic703_caps; extern const struct rig_caps ic706_caps; extern const struct rig_caps ic706mkii_caps; extern const struct rig_caps ic706mkiig_caps; extern const struct rig_caps ic707_caps; extern const struct rig_caps ic718_caps; extern const struct rig_caps ic725_caps; extern const struct rig_caps ic726_caps; extern const struct rig_caps ic728_caps; extern const struct rig_caps ic735_caps; extern const struct rig_caps ic736_caps; extern const struct rig_caps ic737_caps; extern const struct rig_caps ic738_caps; extern const struct rig_caps ic746_caps; extern const struct rig_caps ic7410_caps; extern const struct rig_caps ic746pro_caps; extern const struct rig_caps ic756_caps; extern const struct rig_caps ic756pro_caps; extern const struct rig_caps ic756pro2_caps; extern const struct rig_caps ic756pro3_caps; extern const struct rig_caps ic751_caps; extern const struct rig_caps ic7600_caps; extern const struct rig_caps ic761_caps; extern const struct rig_caps ic765_caps; extern const struct rig_caps ic7700_caps; extern const struct rig_caps ic775_caps; extern const struct rig_caps ic78_caps; extern const struct rig_caps ic7800_caps; extern const struct rig_caps ic7000_caps; extern const struct rig_caps ic7200_caps; extern const struct rig_caps ic781_caps; extern const struct rig_caps ic820h_caps; extern const struct rig_caps ic821h_caps; extern const struct rig_caps ic910_caps; extern const struct rig_caps ic9100_caps; extern const struct rig_caps ic970_caps; extern const struct rig_caps icrx7_caps; extern const struct rig_caps icr10_caps; extern const struct rig_caps icr20_caps; extern const struct rig_caps icr71_caps; extern const struct rig_caps icr72_caps; extern const struct rig_caps icr75_caps; extern const struct rig_caps icr7000_caps; extern const struct rig_caps icr7100_caps; extern const struct rig_caps icr8500_caps; extern const struct rig_caps icr9000_caps; extern const struct rig_caps icr9500_caps; extern const struct rig_caps ic271_caps; extern const struct rig_caps ic275_caps; extern const struct rig_caps ic471_caps; extern const struct rig_caps ic475_caps; extern const struct rig_caps ic1275_caps; extern const struct rig_caps omnivip_caps; extern const struct rig_caps delta2_caps; extern const struct rig_caps os456_caps; extern const struct rig_caps os535_caps; extern const struct rig_caps ic92d_caps; extern const struct rig_caps id1_caps; #endif /* _ICOM_H */ hamlib-1.2.15.3/aclocal.m40000644000175000017500000015026412044564536011777 00000000000000# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file 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. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, [m4_warning([this file was generated for autoconf 2.67. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU 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 # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file 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. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file 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. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 # Free Software Foundation, Inc. # # This file 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. # serial 10 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file 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. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file 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. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file 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. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file 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. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file 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. # serial 5 # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless `enable' is passed literally. # For symmetry, `disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful (and sometimes confusing) to the casual installer], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file 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. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file 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. # serial 6 # AM_PROG_CC_C_O # -------------- # Like AC_PROG_CC_C_O, but changed for automake. AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi dnl Make sure AC_PROG_CC is never called again, or it will override our dnl setting of CC. m4_define([AC_PROG_CC], [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file 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. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file 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. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file 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. # serial 4 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 # Free Software Foundation, Inc. # # This file 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. # AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # --------------------------------------------------------------------------- # Adds support for distributing Python modules and packages. To # install modules, copy them to $(pythondir), using the python_PYTHON # automake variable. To install a package with the same name as the # automake package, install to $(pkgpythondir), or use the # pkgpython_PYTHON automake variable. # # The variables $(pyexecdir) and $(pkgpyexecdir) are provided as # locations to install python extension modules (shared libraries). # Another macro is required to find the appropriate flags to compile # extension modules. # # If your package is configured with a different prefix to python, # users will have to add the install directory to the PYTHONPATH # environment variable, or create a .pth file (see the python # documentation for details). # # If the MINIMUM-VERSION argument is passed, AM_PATH_PYTHON will # cause an error if the version of python installed on the system # doesn't meet the requirement. MINIMUM-VERSION should consist of # numbers and dots only. AC_DEFUN([AM_PATH_PYTHON], [ dnl Find a Python interpreter. Python versions prior to 2.0 are not dnl supported. (2.0 was released on October 16, 2000). m4_define_default([_AM_PYTHON_INTERPRETER_LIST], [python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 dnl python2.1 python2.0]) m4_if([$1],[],[ dnl No version check is needed. # Find any Python interpreter. if test -z "$PYTHON"; then AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) fi am_display_PYTHON=python ], [ dnl A version check is needed. if test -n "$PYTHON"; then # If the user set $PYTHON, use it and don't search something else. AC_MSG_CHECKING([whether $PYTHON version >= $1]) AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], [AC_MSG_RESULT(yes)], [AC_MSG_ERROR(too old)]) am_display_PYTHON=$PYTHON else # Otherwise, try each interpreter until we find one that satisfies # VERSION. AC_CACHE_CHECK([for a Python interpreter with version >= $1], [am_cv_pathless_PYTHON],[ for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST none; do test "$am_cv_pathless_PYTHON" = none && break AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) done]) # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. if test "$am_cv_pathless_PYTHON" = none; then PYTHON=: else AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) fi am_display_PYTHON=$am_cv_pathless_PYTHON fi ]) if test "$PYTHON" = :; then dnl Run any user-specified action, or abort. m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) else dnl Query Python for its version number. Getting [:3] seems to be dnl the best way to do this; it's what "site.py" does in the standard dnl library. AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`]) AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) dnl Use the values of $prefix and $exec_prefix for the corresponding dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made dnl distinct variables so they can be overridden if need be. However, dnl general consensus is that you shouldn't need this ability. AC_SUBST([PYTHON_PREFIX], ['${prefix}']) AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}']) dnl At times (like when building shared libraries) you may want dnl to know which OS platform Python thinks this is. AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`]) AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) dnl Set up 4 directories: dnl pythondir -- where to install python scripts. This is the dnl site-packages directory, not the python standard library dnl directory like in previous automake betas. This behavior dnl is more consistent with lispdir.m4 for example. dnl Query distutils for this directory. distutils does not exist in dnl Python 1.5, so we fall back to the hardcoded directory if it dnl doesn't work. AC_CACHE_CHECK([for $am_display_PYTHON script directory], [am_cv_python_pythondir], [if test "x$prefix" = xNONE then am_py_prefix=$ac_default_prefix else am_py_prefix=$prefix fi am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null || echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` case $am_cv_python_pythondir in $am_py_prefix*) am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` ;; *) case $am_py_prefix in /usr|/System*) ;; *) am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages ;; esac ;; esac ]) AC_SUBST([pythondir], [$am_cv_python_pythondir]) dnl pkgpythondir -- $PACKAGE directory under pythondir. Was dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is dnl more consistent with the rest of automake. AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) dnl pyexecdir -- directory for installing python extension modules dnl (shared libraries) dnl Query distutils for this directory. distutils does not exist in dnl Python 1.5, so we fall back to the hardcoded directory if it dnl doesn't work. AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], [am_cv_python_pyexecdir], [if test "x$exec_prefix" = xNONE then am_py_exec_prefix=$am_py_prefix else am_py_exec_prefix=$exec_prefix fi am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null || echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"` case $am_cv_python_pyexecdir in $am_py_exec_prefix*) am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` ;; *) case $am_py_exec_prefix in /usr|/System*) ;; *) am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages ;; esac ;; esac ]) AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) dnl Run any user-specified action. $2 fi ]) # AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) # --------------------------------------------------------------------------- # Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. # Run ACTION-IF-FALSE otherwise. # This test uses sys.hexversion instead of the string equivalent (first # word of sys.version), in order to cope with versions such as 2.2c1. # This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). AC_DEFUN([AM_PYTHON_CHECK_VERSION], [prog="import sys # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. # map returns an iterator in Python 3.0 and a list in 2.x minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] minverhex = 0 # xrange is not present in Python 3.0 and range returns an iterator for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] sys.exit(sys.hexversion < minverhex)" AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file 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. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2009 Free Software Foundation, Inc. # # This file 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. # serial 1 # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # (`yes' being less verbose, `no' or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [ --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0')]) case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file 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. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 Free Software Foundation, Inc. # # This file 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. # serial 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file 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. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([macros/ac_python_devel.m4]) m4_include([macros/aclocal-include.m4]) m4_include([macros/acx_pthread.m4]) m4_include([macros/gr_pwin32.m4]) m4_include([macros/gr_swig.m4]) m4_include([macros/hl_getaddrinfo.m4]) m4_include([macros/lf_warnings.m4]) m4_include([macros/libtool.m4]) m4_include([macros/ltoptions.m4]) m4_include([macros/ltsugar.m4]) m4_include([macros/ltversion.m4]) m4_include([macros/lt~obsolete.m4]) m4_include([macros/perl.m4]) m4_include([macros/tcl.m4]) hamlib-1.2.15.3/ChangeLog0000644000175000017500000000017712044564477011712 00000000000000For a complete log of changes to Hamlib, please visit: http://hamlib.git.sourceforge.net/git/gitweb.cgi?p=hamlib/hamlib;a=log hamlib-1.2.15.3/rft/0000755000175000017500000000000012044565031010771 500000000000000hamlib-1.2.15.3/rft/rft.c0000644000175000017500000000450712044564477011673 00000000000000/* * Hamlib RFT backend - main file * Copyright (c) 2003 by Thomas B. Ruecker * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "register.h" #include "rft.h" #define BUFSZ 64 #define CR "\x0d" #define EOM CR /* * rft_transaction * We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL */ int rft_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval; struct rig_state *rs; rs = &rig->state; serial_flush(&rs->rigport); 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; retval = read_string(&rs->rigport, data, BUFSZ, CR, 1); if (retval == -RIG_ETIMEOUT) retval = 0; if (retval < 0) return retval; *data_len = retval; return RIG_OK; } /* * rft_set_freq * Assumes rig!=NULL */ int rft_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char freqbuf[16], ackbuf[16]; int freq_len, ack_len, retval; /* */ freq_len = sprintf(freqbuf,"FRQ%f" EOM, (float)freq/1000); retval = rft_transaction(rig, freqbuf, freq_len, ackbuf, &ack_len); return retval; } /* * initrigs_rft is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(rft) { rig_debug(RIG_DEBUG_VERBOSE, "rft: _init called\n"); rig_register(&ekd500_caps); return RIG_OK; } hamlib-1.2.15.3/rft/Makefile.in0000644000175000017500000004747512044564555013011 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = rft DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_rft_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = ekd500.lo am_hamlib_rft_la_OBJECTS = $(am__objects_1) rft.lo hamlib_rft_la_OBJECTS = $(am_hamlib_rft_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_rft_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(hamlib_rft_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_rft_la_SOURCES) DIST_SOURCES = $(hamlib_rft_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ RFTSRC = ekd500.c pkglib_LTLIBRARIES = hamlib-rft.la hamlib_rft_la_SOURCES = $(RFTSRC) rft.c hamlib_rft_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_rft_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = rft.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu rft/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu rft/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-rft.la: $(hamlib_rft_la_OBJECTS) $(hamlib_rft_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_rft_la_LINK) -rpath $(pkglibdir) $(hamlib_rft_la_OBJECTS) $(hamlib_rft_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ekd500.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rft.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/rft/ekd500.c0000644000175000017500000000603712044564477012070 00000000000000/* * Hamlib RFT backend - EKD-500 description * Copyright (c) 2003-2009 by Thomas B. Ruecker * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "rft.h" #define EKD500_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_AM|RIG_MODE_FM) #define EKD500_FUNC (RIG_FUNC_NONE) #define EKD500_LEVEL_ALL (RIG_LEVEL_NONE) #define EKD500_PARM_ALL (RIG_PARM_NONE) #define EKD500_VFO (RIG_VFO_A) #define EKD500_VFO_OPS (RIG_OP_NONE) /* * EKD-500 rig capabilities. * * Documentation: * http://www.premium-rx.org/ekd500.htm */ const struct rig_caps ekd500_caps = { .rig_model = RIG_MODEL_EKD500, .model_name = "EKD-500", .mfg_name = "RFT", .version = "0.4", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 2400, .serial_data_bits = 7, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_EVEN, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 1, .timeout = 200, .retry = 3, .has_get_func = EKD500_FUNC, .has_set_func = EKD500_FUNC, .has_get_level = EKD500_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(EKD500_LEVEL_ALL), .has_get_parm = EKD500_PARM_ALL, .has_set_parm = RIG_PARM_SET(EKD500_PARM_ALL), .level_gran = {}, .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 = 7, .vfo_ops = EKD500_VFO_OPS, .chan_list = { RIG_CHAN_END, /* FIXME */ }, .rx_range_list1 = { {kHz(10),MHz(30),EKD500_MODES,-1,-1,EKD500_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(10),MHz(30),EKD500_MODES,-1,-1,EKD500_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {EKD500_MODES,10}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_AM, kHz(2.2)}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .priv = NULL, .set_freq = rft_set_freq, }; /* * Function definitions below */ hamlib-1.2.15.3/rft/rft.h0000644000175000017500000000201212044564477011665 00000000000000/* * Hamlib RFT backend - main header * Copyright (c) 2003 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _RFT_H #define _RFT_H 1 #include int rft_set_freq(RIG *rig, vfo_t vfo, freq_t freq); extern const struct rig_caps ekd500_caps; #endif /* _RFT_H */ hamlib-1.2.15.3/rft/Makefile.am0000644000175000017500000000035312044564477012763 00000000000000RFTSRC = ekd500.c pkglib_LTLIBRARIES = hamlib-rft.la hamlib_rft_la_SOURCES = $(RFTSRC) rft.c hamlib_rft_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_rft_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = rft.h hamlib-1.2.15.3/kenwood/0000755000175000017500000000000012044565013011644 500000000000000hamlib-1.2.15.3/kenwood/elecraft.c0000644000175000017500000001542312044564477013537 00000000000000/* * Hamlib Elecraft backend--support Elecraft extensions to Kenwood commands * Copyright (C) 2010,2011 by Nate Bargmann, n0nb@n0nb.us * Copyright (C) 2011 by Alexander Sack, Alexander Sack, pisymbol@gmail.com * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * See the file 'COPYING.LIB' in the main Hamlib distribution directory for * the complete text of the GNU Lesser Public License version 2.1. * */ #include #include #include "elecraft.h" #include "kenwood.h" static const struct elec_ext_id_str elec_ext_id_str_lst[] = { { K20, "K20" }, { K21, "K21" }, { K22, "K22" }, { K23, "K23" }, { K30, "K30" }, { K31, "K31" }, { EXT_LEVEL_NONE, NULL }, /* end marker */ }; /* Private Elecraft extra levels definitions * * Token definitions for .cfgparams in rig_caps * See enum rig_conf_e and struct confparams in rig.h */ const struct confparams elecraft_ext_levels[] = { { TOK_IF_FREQ, "ifctr", "IF center frequency", "IF center freq", NULL, RIG_CONF_NUMERIC, { .n = { 0, 9990, 10 } } }, { TOK_TX_STAT, "txst", "TX status", "TX status", NULL, RIG_CONF_CHECKBUTTON, { { } }, }, { TOK_RIT_CLR, "ritclr", "RIT clear", "RIT clear", NULL, RIG_CONF_BUTTON, { { } }, }, { RIG_CONF_END, NULL, } }; /* Private function declarations */ int verify_kenwood_id(RIG *rig, char *id); int elecraft_get_extension_level(RIG *rig, const char *cmd, int *ext_level); int elecraft_get_firmware_revision_level(RIG *rig, const char *cmd, char *fw_rev); /* Shared backend function definitions */ /* elecraft_open() * * First checks for ID of '017' then tests for an Elecraft radio/backend using * the K2; command. Here we also test for a K3 and if that fails, assume a K2. * Finally, save the value for later reading. * */ int elecraft_open(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; int err; char id[KENWOOD_MAX_BUF_LEN]; /* Actual read extension levels from radio. * * The value stored in the k?_ext_lvl variables map to * elec_ext_id_str_lst.level and is only written to by the * elecraft_get_extension_level() private function during elecraft_open() * and thereafter shall be treated as READ ONLY! */ struct kenwood_priv_data *priv = rig->state.priv; /* Use check for "ID017;" to verify rig is reachable */ err = verify_kenwood_id(rig, id); if (err != RIG_OK) return err; switch(rig->caps->rig_model) { case RIG_MODEL_K2: err = elecraft_get_extension_level(rig, "K2", &priv->k2_ext_lvl); if (err != RIG_OK) return err; rig_debug(RIG_DEBUG_VERBOSE, "%s: K2 level is %d, %s\n", __func__, priv->k2_ext_lvl, elec_ext_id_str_lst[priv->k2_ext_lvl].id); break; case RIG_MODEL_K3: err = elecraft_get_extension_level(rig, "K2", &priv->k2_ext_lvl); if (err != RIG_OK) return err; rig_debug(RIG_DEBUG_VERBOSE, "%s: K2 level is %d, %s\n", __func__, priv->k2_ext_lvl, elec_ext_id_str_lst[priv->k2_ext_lvl].id); err = elecraft_get_extension_level(rig, "K3", &priv->k3_ext_lvl); if (err != RIG_OK) return err; rig_debug(RIG_DEBUG_VERBOSE, "%s: K3 level is %d, %s\n", __func__, priv->k3_ext_lvl, elec_ext_id_str_lst[priv->k3_ext_lvl].id); err = elecraft_get_firmware_revision_level(rig, "RVM", priv->k3_fw_rev); if (err != RIG_OK) return err; break; default: rig_debug(RIG_DEBUG_WARN, "%s: unrecognized rig model %d\n", __func__, rig->caps->rig_model); return -RIG_EINVAL; } return RIG_OK; } /* Private helper functions */ /* Tests for Kenwood ID string of "017" */ int verify_kenwood_id(RIG *rig, char *id) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !id) return -RIG_EINVAL; int err; char *idptr; /* Check for an Elecraft K2|K3 which returns "017" */ err = kenwood_get_id(rig, id); if (err != RIG_OK) { rig_debug(RIG_DEBUG_VERBOSE, "%s: cannot get identification\n", __func__); return err; } /* ID is 'ID017;' */ if (strlen(id) < 5) { rig_debug(RIG_DEBUG_VERBOSE, "%s: unknown ID type (%s)\n", __func__, id); return -RIG_EPROTO; } /* check for any white space and skip it */ idptr = &id[2]; if (*idptr == ' ') idptr++; if (strcmp("017", idptr) != 0) { rig_debug(RIG_DEBUG_VERBOSE, "%s: Rig (%s) is not a K2 or K3\n", __func__, id); return -RIG_EPROTO; } else rig_debug(RIG_DEBUG_VERBOSE, "%s: Rig ID is %s\n", __func__, id); return RIG_OK; } /* Determines K2 and K3 extension level */ int elecraft_get_extension_level(RIG *rig, const char *cmd, int *ext_level) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !ext_level) return -RIG_EINVAL; int err, i; char buf[KENWOOD_MAX_BUF_LEN]; char *bufptr; err = kenwood_safe_transaction(rig, cmd, buf, KENWOOD_MAX_BUF_LEN, 4); if (err != RIG_OK) { rig_debug(RIG_DEBUG_VERBOSE, "%s: Cannot get K2|K3 ID\n", __func__); return err; } /* Get extension level string */ bufptr = &buf[0]; for (i = 0; elec_ext_id_str_lst[i].level != EXT_LEVEL_NONE; i++) { if (strcmp(elec_ext_id_str_lst[i].id, bufptr) != 0) continue; if (strcmp(elec_ext_id_str_lst[i].id, bufptr) == 0) { *ext_level = elec_ext_id_str_lst[i].level; rig_debug(RIG_DEBUG_VERBOSE, "%s: %s extension level is %d, %s\n", __func__, cmd, *ext_level, elec_ext_id_str_lst[i].id); } } return RIG_OK; } /* Determine firmware revision level */ int elecraft_get_firmware_revision_level(RIG *rig, const char *cmd, char *fw_rev) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !fw_rev) return -RIG_EINVAL; int err; char *bufptr; char buf[KENWOOD_MAX_BUF_LEN]; size_t size = KENWOOD_MAX_BUF_LEN; err = kenwood_transaction(rig, cmd, sizeof(cmd), buf, &size); if (err != RIG_OK) { rig_debug(RIG_DEBUG_VERBOSE, "%s: Cannot get firmeware revision level\n", __func__); return err; } /* Get the actual firmware revision number. */ bufptr = &buf[0]; /* Skip the command string */ bufptr += sizeof(cmd); /* Ignore leading zero's */ while (bufptr && *bufptr == '0') { bufptr++; } /* Copy out */ strncpy(fw_rev, bufptr, sizeof(bufptr)); rig_debug(RIG_DEBUG_VERBOSE, "%s: Elecraft firmware revision is %s\n", __func__, fw_rev); return RIG_OK; } hamlib-1.2.15.3/kenwood/k2.c0000644000175000017500000004100212044564477012256 00000000000000/* * Hamlib Kenwood backend - Elecraft K2 description * Copyright (c) 2002-2009 by Stephane Fillod * Copyright (c) 2010 by Nate Bargmann, n0nb@arrl.net * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * See the file 'COPYING.LIB' in the main Hamlib distribution directory for * the complete text of the GNU Lesser Public License version 2.1. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "kenwood.h" #include "elecraft.h" #define K2_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define K2_FUNC_ALL (RIG_FUNC_NB|RIG_FUNC_LOCK) #define K2_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_PREAMP|RIG_LEVEL_AGC|RIG_LEVEL_SQL|\ RIG_LEVEL_STRENGTH|RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD) #define K2_VFO (RIG_VFO_A|RIG_VFO_B) #define K2_VFO_OP (RIG_OP_UP|RIG_OP_DOWN) #define K2_ANTS (RIG_ANT_1|RIG_ANT_2) /* kenwood_transaction() will add this to command strings * sent to the rig and remove it from strings returned from * the rig, so no need to append ';' manually to command strings. */ static struct kenwood_priv_caps k2_priv_caps = { .cmdtrm = EOM_KEN, }; /* K2 Filter list, four per mode */ struct k2_filt_s { shortfreq_t width; /* Filter width in Hz */ char fslot; /* Crystal filter slot number--1-4 */ char afslot; /* AF filter slot number--0-2 */ }; /* Number of filter slot arrays to allocate (TNX Diane, VA3DB) */ #define K2_FILT_NUM 4 /* K2 Filter List * * This struct will be populated as modes are queried or in response * to a request to set a given mode. This way a cache can be maintained * of the installed filters and an appropriate filter can be selected * for a requested bandwidth. Each mode has up to four filter slots available. */ struct k2_filt_lst_s { struct k2_filt_s filt_list[K2_FILT_NUM]; }; struct k2_filt_lst_s k2_fwmd_ssb; struct k2_filt_lst_s k2_fwmd_cw; struct k2_filt_lst_s k2_fwmd_rtty; /* K2 specific rig_caps API function declarations */ int k2_open(RIG *rig); int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int k2_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int k2_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val); /* Private function declarations */ int k2_probe_mdfw(RIG *rig, struct kenwood_priv_data *priv); int k2_mdfw_rest(RIG *rig, const char *mode, const char *fw); int k2_pop_fw_lst(RIG *rig, const char *cmd); /* * KIO2 rig capabilities. * This kit can recognize a large subset of TS-570 commands. * * Part of info comes from http://www.elecraft.com/K2_Manual_Download_Page.htm#K2 * look for KIO2 Programmer's Reference PDF */ const struct rig_caps k2_caps = { .rig_model = RIG_MODEL_K2, .model_name = "K2", .mfg_name = "Elecraft", .version = "20120615", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, /* Timing between bytes */ .post_write_delay = 100, /* Timing between command strings */ .timeout = 600, /* FA and FB make take up to 500 ms on band change */ .retry = 3, .has_get_func = K2_FUNC_ALL, .has_set_func = K2_FUNC_ALL, .has_get_level = K2_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(K2_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .extlevels = elecraft_ext_levels, .extparms = kenwood_cfg_params, .preamp = { 14, RIG_DBLST_END, }, .attenuator = { 10, RIG_DBLST_END, }, .max_rit = Hz(9990), .max_xit = Hz(9990), .max_ifshift = Hz(0), .vfo_ops = K2_VFO_OP, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END }, .rx_range_list1 = { {kHz(500),MHz(30),K2_MODES,-1,-1,K2_VFO,K2_ANTS}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { {kHz(1810),kHz(1850)-1,K2_MODES,10,W(15),K2_VFO,K2_ANTS}, /* 15W class */ {kHz(3500),kHz(3800)-1,K2_MODES,10,W(15),K2_VFO,K2_ANTS}, {MHz(7),kHz(7100),K2_MODES,10,W(15),K2_VFO,K2_ANTS}, {kHz(10100),kHz(10150),K2_MODES,10,W(15),K2_VFO,K2_ANTS}, {MHz(14),kHz(14350),K2_MODES,10,W(15),K2_VFO,K2_ANTS}, {kHz(18068),kHz(18168),K2_MODES,10,W(15),K2_VFO,K2_ANTS}, {MHz(21),kHz(21450),K2_MODES,10,W(15),K2_VFO,K2_ANTS}, {kHz(24890),kHz(24990),K2_MODES,10,W(15),K2_VFO,K2_ANTS}, {MHz(28),kHz(29700),K2_MODES,10,W(15),K2_VFO,K2_ANTS}, RIG_FRNG_END, }, /* tx range */ .rx_range_list2 = { {kHz(500),MHz(30),K2_MODES,-1,-1,K2_VFO,K2_ANTS}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {kHz(1800),MHz(2)-1,K2_MODES,10,W(15),K2_VFO,K2_ANTS}, /* 15W class */ {kHz(3500),MHz(4)-1,K2_MODES,10,W(15),K2_VFO,K2_ANTS}, {MHz(7),kHz(7300),K2_MODES,10,W(15),K2_VFO,K2_ANTS}, {kHz(10100),kHz(10150),K2_MODES,10,W(15),K2_VFO,K2_ANTS}, {MHz(14),kHz(14350),K2_MODES,10,W(15),K2_VFO,K2_ANTS}, {kHz(18068),kHz(18168),K2_MODES,10,W(15),K2_VFO,K2_ANTS}, {MHz(21),kHz(21450),K2_MODES,10,W(15),K2_VFO,K2_ANTS}, {kHz(24890),kHz(24990),K2_MODES,10,W(15),K2_VFO,K2_ANTS}, {MHz(28),kHz(29700),K2_MODES,10,W(15),K2_VFO,K2_ANTS}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {K2_MODES,10}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB, kHz(2.5)}, {RIG_MODE_CW|RIG_MODE_CWR, Hz(500)}, {RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(500)}, RIG_FLT_END, }, .priv = (void *)&k2_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .rig_open = k2_open, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_mode = k2_set_mode, .get_mode = k2_get_mode, .set_vfo = kenwood_set_vfo, .get_vfo = kenwood_get_vfo_if, .set_split_vfo = kenwood_set_split_vfo, .get_split_vfo = kenwood_get_split_vfo_if, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_xit = kenwood_set_xit, .get_xit = kenwood_get_xit, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt, .get_dcd = kenwood_get_dcd, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .set_ext_parm = kenwood_set_ext_parm, .get_ext_parm = kenwood_get_ext_parm, .set_level = kenwood_set_level, .get_level = kenwood_get_level, .get_ext_level = k2_get_ext_level, .vfo_op = kenwood_vfo_op, .set_trn = kenwood_set_trn, .get_powerstat = kenwood_get_powerstat, .get_trn = kenwood_get_trn, .set_ant = kenwood_set_ant, .get_ant = kenwood_get_ant, .send_morse = kenwood_send_morse, }; /* * K2 extension function definitions follow */ /* k2_open() * */ int k2_open(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; int err; struct kenwood_priv_data *priv = rig->state.priv; err = elecraft_open(rig); if (err != RIG_OK) return err; err = k2_probe_mdfw(rig, priv); if (err != RIG_OK) return err; return RIG_OK; } /* k2_set_mode() * * Based on the passed in bandwidth, looks up the nearest bandwidth filter * wider than the passed value and sets the radio accordingly. */ int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; int err; char f; char fcmd[16]; struct k2_filt_lst_s *flt; struct kenwood_priv_data *priv = rig->state.priv; shortfreq_t freq = 0; /* Select the filter array per mode. */ switch(mode) { case RIG_MODE_LSB: case RIG_MODE_USB: flt = &k2_fwmd_ssb; break; case RIG_MODE_CW: case RIG_MODE_CWR: flt = &k2_fwmd_cw; break; case RIG_MODE_RTTY: case RIG_MODE_RTTYR: if (priv->k2_md_rtty == 0) return -RIG_EINVAL; /* RTTY module not installed */ else flt = &k2_fwmd_rtty; break; default: return -RIG_EINVAL; } if (width < 0) width = labs(width); /* Step through the filter list looking for the best match * for the passed in width. The choice is to select the filter * that is wide enough for the width without being too narrow * if possible. */ if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); if (width > flt->filt_list[0].width || ((flt->filt_list[0].width >= width) && (width > flt->filt_list[1].width))) { width = flt->filt_list[0].width; f = '1'; } else if ((flt->filt_list[1].width >= width) && (width > flt->filt_list[2].width)) { width = flt->filt_list[1].width; f = '2'; } else if ((flt->filt_list[2].width >= width) && (width > flt->filt_list[3].width)) { width = flt->filt_list[2].width; f = '3'; } else if ((flt->filt_list[3].width >= width) && (width >= freq)) { width = flt->filt_list[3].width; f = '4'; } else { return -RIG_EINVAL; } /* Construct the filter command and set the radio mode and width*/ snprintf(fcmd, 8, "FW0000%c", f); /* kenwood_set_mode() ignores width value for K2/K3/TS-570 */ err = kenwood_set_mode(rig, vfo, mode, width); if (err != RIG_OK) return err; err = kenwood_simple_cmd(rig, "K22"); if (err != RIG_OK) return err; /* Set the filter slot */ err = kenwood_simple_cmd(rig, fcmd); if (err != RIG_OK) return err; err = kenwood_simple_cmd(rig, "K20"); if (err != RIG_OK) return err; return RIG_OK; } /* k2_get_mode() * * Uses the FW command in K22 mode to query the filter bandwidth reported * by the radio and returns it to the caller. */ int k2_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !mode || !width) return -RIG_EINVAL; int err; char buf[KENWOOD_MAX_BUF_LEN]; char tmp[16]; char *bufptr; pbwidth_t temp_w; err = kenwood_get_mode(rig, vfo, mode, &temp_w); if (err != RIG_OK) return err; err = kenwood_simple_cmd(rig, "K22"); if (err != RIG_OK) return err; err = kenwood_safe_transaction(rig, "FW", buf, KENWOOD_MAX_BUF_LEN, 9); if (err != RIG_OK) return err; err = kenwood_simple_cmd(rig, "K20"); if (err != RIG_OK) return err; /* Convert received filter string value's first four digits to width */ bufptr = buf; strncpy(tmp, bufptr + 2, 4); tmp[4] = '\0'; *width = atoi(tmp); rig_debug(RIG_DEBUG_VERBOSE, "%s: Mode: %d, Width: %04li\n", __func__, *mode, *width); return RIG_OK; } /* TQ command is a quick transmit status query--K2/K3 only. * * token Defined in elecraft.h or this file * val Type depends on token type from confparams structure: * NUMERIC: val.f * COMBO: val.i, starting from 0 Index to a string table. * STRING: val.cs for set, val.s for get * CHECKBUTTON: val.i 0/1 */ int k2_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !val) return -RIG_EINVAL; char buf[KENWOOD_MAX_BUF_LEN]; int err; const struct confparams *cfp; cfp = rig_ext_lookup_tok(rig, token); switch(token) { case TOK_TX_STAT: err = kenwood_safe_transaction(rig, "TQ", buf, KENWOOD_MAX_BUF_LEN, 4); if (err != RIG_OK) return err; if (cfp->type == RIG_CONF_CHECKBUTTON) { val->i = atoi(&buf[2]); } else { rig_debug(RIG_DEBUG_ERR, "%s: protocol error, invalid token type\n", __func__); return -RIG_EPROTO; } break; default: rig_debug(RIG_DEBUG_WARN, "%s: Unsupported get_ext_level %d\n", __func__, token); return -RIG_EINVAL; } return RIG_OK; } /* K2 private helper functions follow */ /* Probes for mode and filter settings, based on information * by Chris Bryant, G3WIE. */ int k2_probe_mdfw(RIG *rig, struct kenwood_priv_data *priv) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !priv) return -RIG_EINVAL; int err, i, c; char buf[KENWOOD_MAX_BUF_LEN]; char mode[16]; char fw[16]; char cmd[16]; /* The K2 extension level has been stored by elecraft_open(). Now set rig * to K22 for detailed query of mode and filter width values... */ err = kenwood_simple_cmd(rig, "K22"); if (err != RIG_OK) return err; /* Check for mode and store it for later. */ err = kenwood_safe_transaction(rig, "MD", buf, KENWOOD_MAX_BUF_LEN, 4); if (err != RIG_OK) return err; strcpy(mode, buf); /* Check for filter width and store it for later. */ err = kenwood_safe_transaction(rig, "FW", buf, KENWOOD_MAX_BUF_LEN, 9); if (err != RIG_OK) return err; strcpy(fw, buf); rig_debug(RIG_DEBUG_VERBOSE, "%s: Mode value: %s, Filter Width value: %s\n", __func__, mode, fw); /* Now begin the process of querying the available modes and filters. */ /* First try to put the K2 into RTTY mode and check if it's available. */ err = kenwood_simple_cmd(rig, "MD6"); if (err != RIG_OK) return err; /* Check for mode and test to see if K2 reports RTTY. */ err = kenwood_safe_transaction(rig, "MD", buf, KENWOOD_MAX_BUF_LEN, 4); if (err != RIG_OK) return err; if (strcmp("MD6", buf) == 0) priv->k2_md_rtty = 1; /* set flag for RTTY mode installed */ else priv->k2_md_rtty = 0; /* RTTY module not installed */ rig_debug(RIG_DEBUG_VERBOSE, "%s: RTTY flag is: %d\n", __func__, priv->k2_md_rtty); i = (priv->k2_md_rtty == 1) ? 2 : 1; /* Now loop through the modes checking for installed filters. */ for (c = 0; i > -1; i--, c++) { if (c == 0) strcpy(cmd, "MD1"); /* SSB */ else if (c == 1) strcpy(cmd, "MD3"); /* CW */ else if (c == 2) strcpy(cmd, "MD6"); /* RTTY */ else { /* Oops! */ err = k2_mdfw_rest(rig, mode, fw); if (err != RIG_OK) return err; return -RIG_EINVAL; } /* Now populate the Filter arrays */ err = k2_pop_fw_lst(rig, cmd); if (err != RIG_OK) return err; } /* Restore mode, filter, extension level */ if (strlen(fw) == 8) fw[7] = '\0'; /* Truncate AFSlot to set filter slot */ err = k2_mdfw_rest(rig, mode, fw); if (err != RIG_OK) return err; return RIG_OK; } /* Restore mode, filter, and ext_lvl to original values */ int k2_mdfw_rest(RIG *rig, const char *mode, const char *fw) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !mode || !fw) return -RIG_EINVAL; int err; if (strlen(mode) != 3 || strlen(fw) != 7) return -RIG_EINVAL; err = kenwood_simple_cmd(rig, mode); if (err != RIG_OK) return err; err = kenwood_simple_cmd(rig, fw); if (err != RIG_OK) return err; err = kenwood_simple_cmd(rig, "K20"); if (err != RIG_OK) return err; return RIG_OK; } /* Populate k2_filt_lst_s structure for each mode */ int k2_pop_fw_lst(RIG *rig, const char *cmd) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !cmd) return -RIG_EINVAL; int err, f; char fcmd[16]; char buf[KENWOOD_MAX_BUF_LEN]; char *bufptr; char tmp[16]; struct k2_filt_lst_s *flt; /* Store filter data in the correct structure depending on mode */ if (strcmp(cmd, "MD1") == 0) flt = &k2_fwmd_ssb; else if (strcmp(cmd, "MD3") == 0) flt = &k2_fwmd_cw; else if (strcmp(cmd, "MD6") == 0) flt = &k2_fwmd_rtty; else return -RIG_EINVAL; /* Set the mode */ err = kenwood_simple_cmd(rig, cmd); if (err != RIG_OK) return err; for (f = 1; f < 5; f++) { snprintf(fcmd, 8, "FW0000%d", f); err = kenwood_simple_cmd(rig, fcmd); if (err != RIG_OK) return err; err = kenwood_safe_transaction(rig, "FW", buf, KENWOOD_MAX_BUF_LEN, 9); if (err != RIG_OK) return err; /* buf should contain a string "FWxxxxfa;" which corresponds to: * xxxx = filter width in Hz * f = crystal filter slot number--1-4 * a = audio filter slot number--0-2 */ bufptr = buf; strncpy(tmp, bufptr + 2, 4); tmp[4] = '\0'; flt->filt_list[f-1].width = atoi(tmp); strncpy(tmp, bufptr + 6, 1); tmp[1] = '\0'; flt->filt_list[f-1].fslot = atoi(tmp); strncpy(tmp, bufptr + 7, 1); tmp[1] = '\0'; flt->filt_list[f-1].afslot = atoi(tmp); rig_debug(RIG_DEBUG_VERBOSE, "%s: Width: %04li, FSlot: %i, AFSlot %i\n", __func__, flt->filt_list[f-1].width, flt->filt_list[f-1].fslot, flt->filt_list[f-1].afslot); } return RIG_OK; } hamlib-1.2.15.3/kenwood/ic10.h0000644000175000017500000000515412044564477012513 00000000000000/* * Hamlib Kenwood backend - IC-10 header * Copyright (c) 2000-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _IC10_H #define _IC10_H 1 #define IC10_VER "0.6.1" int ic10_cmd_trim (char *data, int data_len); int ic10_transaction (RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len); int ic10_set_vfo(RIG *rig, vfo_t vfo); int ic10_get_vfo(RIG *rig, vfo_t *vfo); int ic10_set_split_vfo(RIG *rig, vfo_t vfo , split_t split, vfo_t txvfo); int ic10_get_split_vfo(RIG *rig, vfo_t vfo , split_t *split, vfo_t *txvfo); int ic10_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int ic10_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int ic10_set_ant(RIG *rig, vfo_t vfo, ant_t ant); int ic10_get_ant(RIG *rig, vfo_t vfo, ant_t *ant); int ic10_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int ic10_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); int ic10_set_parm(RIG *rig, setting_t parm, value_t val); int ic10_get_parm(RIG *rig, setting_t parm, value_t *val); int ic10_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int ic10_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int ic10_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); int ic10_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); int ic10_set_mem(RIG *rig, vfo_t vfo, int ch); int ic10_get_mem(RIG *rig, vfo_t vfo, int *ch); int ic10_set_channel(RIG *rig, const channel_t *chan); int ic10_get_channel(RIG *rig, channel_t *chan); int ic10_set_powerstat(RIG *rig, powerstat_t status); int ic10_get_powerstat(RIG *rig, powerstat_t *status); int ic10_set_trn(RIG *rig, int trn); int ic10_get_trn(RIG *rig, int *trn); int ic10_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); int ic10_scan(RIG * rig, vfo_t vfo, scan_t scan, int ch); const char* ic10_get_info(RIG *rig); int ic10_decode_event (RIG *rig); #define IC10_CHANNEL_CAPS \ .freq=1,\ .tx_freq=1,\ .mode=1,\ .tx_mode=1 #endif /* _IC10_H */ hamlib-1.2.15.3/kenwood/elecraft.h0000644000175000017500000000635112044564477013544 00000000000000/* * Hamlib Elecraft backend--support extensions to Kenwood commands * Copyright (C) 2010 by Nate Bargmann, n0nb@n0nb.us * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ELECRAFT_H #define _ELECRAFT_H 1 #include /* The Elecraft Programmer's Reference details the extension level that * a K2 or K3 may have in effect which modify certain commands. */ #define EXT_LEVEL_NONE -1 enum elec_ext_id_e { K20 = 0, /* K2 Normal mode */ K21, /* K2 Normal/rtty_off */ K22, /* K2 Extended mode */ K23, /* K2 Extended mode/rtty_off */ K30, /* K3 Normal mode */ K31 /* K3 Extended mode */ }; struct elec_ext_id_str { enum elec_ext_id_e level; const char *id; }; /* Data sub-modes are provided from the K3 via the DT command */ enum k3_data_submodes_e { K3_MODE_DATA_A = 0, /* DT0; */ K3_MODE_AFSK_A, /* DT1; */ K3_MODE_FSK_D, /* DT2; */ K3_MODE_PSK_D /* DT3; */ }; /* Private tokens used for ext_lvl function in Elecraft backends. * Extra levels which are rig specific should be coded in * the individual rig files and token #s >= 101. * * See Private Elecraft extra levels definitions in elecraft.c */ #define TOK_IF_FREQ TOKEN_BACKEND(101) /* K3 FI command */ #define TOK_TX_STAT TOKEN_BACKEND(102) /* K3 TQ command */ #define TOK_RIT_CLR TOKEN_BACKEND(103) /* K3 RC command */ /* Token structure assigned to .cfgparams in rig_caps */ extern const struct confparams elecraft_ext_levels[]; /* Elecraft extension function declarations */ int elecraft_open(RIG *rig); /* S-meter calibration tables */ /* K3 defines 16 values--0-15. * Table is RASTR value from SM command and dB relative to S9 == 0 * (see rig_get_level() in src/settings.c */ #define K3_SM_CAL { 16, \ { \ { 0, -54 }, \ { 1, -42 }, \ { 2, -36 }, \ { 3, -24 }, \ { 4, -12 }, \ { 5, -6 }, \ { 6, 0 }, \ { 7, 10 }, \ { 8, 15 }, \ { 9, 20 }, \ { 10, 30 }, \ { 11, 35 }, \ { 12, 40 }, \ { 13, 50 }, \ { 14, 55 }, \ { 15, 60 }, \ } } /* K3 defines 100 values--0-100 in high resolution mode. * Table is RASTR value from SMH command and dB relative to S9 == 0 * (see rig_get_level() in src/settings.c */ #define K3_SMH_CAL { 22, \ { \ { 0, -54 }, \ { 5, -48 }, \ { 9, -42 }, \ { 14, -36 }, \ { 22, -30 }, \ { 24, -24 }, \ { 28, -18 }, \ { 33, -12 }, \ { 38, -6 }, \ { 42, 0 }, \ { 47, 5 }, \ { 53, 10 }, \ { 58, 15 }, \ { 63, 20 }, \ { 68, 25 }, \ { 73, 30 }, \ { 78, 35 }, \ { 83, 40 }, \ { 88, 45 }, \ { 93, 50 }, \ { 98, 55 }, \ { 103, 60 }, \ } } #endif /* _ELECRAFT_H */ hamlib-1.2.15.3/kenwood/ts690.c0000644000175000017500000001425512044564477012641 00000000000000/* * Hamlib Kenwood backend - TS690 description * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "bandplan.h" #include "kenwood.h" #define TS690_ALL_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_CW|RIG_MODE_RTTYR|RIG_MODE_CWR|RIG_MODE_SSB) #define TS690_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_CWR) #define TS690_AM_TX_MODES RIG_MODE_AM /* FIXME: TBC */ #define TS690_FUNC_ALL (RIG_FUNC_LOCK|RIG_FUNC_AIP|RIG_FUNC_TONE) #define TS690_LEVEL_ALL (RIG_LEVEL_STRENGTH|RIG_LEVEL_AGC|RIG_LEVEL_METER|RIG_LEVEL_SWR|RIG_LEVEL_ALC) #define TS690_PARMS (RIG_PARM_ANN) /* optional */ #define TS690_VFO_OPS (RIG_OP_UP|RIG_OP_DOWN) #define TS690_SCAN_OPS (RIG_SCAN_VFO) #define TS690_VFO (RIG_VFO_A|RIG_VFO_B) #define TS690_ANTS (0) #define TS690_CHANNEL_CAPS { \ .freq=1,\ .mode=1,\ .tx_freq=1,\ .tx_mode=1,\ .split=1,\ .funcs=RIG_FUNC_TONE, \ .flags=RIG_CHFLAG_SKIP \ } static struct kenwood_priv_caps ts690_priv_caps = { .cmdtrm = EOM_KEN, }; /* * ts690 rig capabilities. * written from specs: * http://www.qsl.net/sm7vhs/radio/kenwood/ts690/specs.htm * * TODO: protocol to be checked with manual! * - how to set_split in vfo mode? * - ... */ const struct rig_caps ts690s_caps = { .rig_model = RIG_MODEL_TS690S, .model_name = "TS-690S", .mfg_name = "Kenwood", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 100, .timeout = 1000, .retry = 3, .has_get_func = TS690_FUNC_ALL, .has_set_func = TS690_FUNC_ALL, .has_get_level = TS690_LEVEL_ALL|RIG_LEVEL_RFPOWER, .has_set_level = RIG_LEVEL_SET(TS690_LEVEL_ALL), .has_get_parm = TS690_PARMS, .has_set_parm = RIG_LEVEL_SET(TS690_PARMS), /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = kHz(2.2), .max_xit = kHz(2.2), .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .vfo_ops = TS690_VFO_OPS, .scan_ops = TS690_SCAN_OPS, .chan_list = { { 0, 89, RIG_MTYPE_MEM, TS690_CHANNEL_CAPS }, /* TBC */ { 90, 99, RIG_MTYPE_EDGE, TS690_CHANNEL_CAPS }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(500),MHz(30),TS690_ALL_MODES,-1,-1,TS690_VFO}, {MHz(50),MHz(54),TS690_ALL_MODES,-1,-1,TS690_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { FRQ_RNG_HF(1,TS690_OTHER_TX_MODES, W(5),W(100),TS690_VFO,TS690_ANTS), FRQ_RNG_HF(1,TS690_AM_TX_MODES, W(4),W(40),TS690_VFO,TS690_ANTS), /* AM class */ FRQ_RNG_6m(1,TS690_OTHER_TX_MODES, W(2.5),W(50),TS690_VFO,TS690_ANTS), FRQ_RNG_6m(1,TS690_AM_TX_MODES, W(2),W(20),TS690_VFO,TS690_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30),TS690_ALL_MODES,-1,-1,TS690_VFO}, {MHz(50),MHz(54),TS690_ALL_MODES,-1,-1,TS690_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { FRQ_RNG_HF(2,TS690_OTHER_TX_MODES, W(5),W(100),TS690_VFO,TS690_ANTS), FRQ_RNG_HF(2,TS690_AM_TX_MODES, W(4),W(40),TS690_VFO,TS690_ANTS), /* AM class */ FRQ_RNG_6m(2,TS690_OTHER_TX_MODES, W(2.5),W(50),TS690_VFO,TS690_ANTS), FRQ_RNG_6m(2,TS690_AM_TX_MODES, W(2),W(20),TS690_VFO,TS690_ANTS), /* AM class */ RIG_FRNG_END, }, /* tx range */ .tuning_steps = { /* FIXME: TBC */ {TS690_ALL_MODES,1}, {TS690_ALL_MODES,10}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_FM, kHz(12)}, {RIG_MODE_FM|RIG_MODE_AM, kHz(6)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_CWR|RIG_MODE_RTTYR|RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_CWR|RIG_MODE_RTTYR|RIG_MODE_AM, Hz(500)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_CWR|RIG_MODE_RTTYR|RIG_MODE_AM, kHz(12)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_CWR|RIG_MODE_RTTYR, kHz(6)}, RIG_FLT_END, }, .priv = (void *)&ts690_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .rig_open = kenwood_open, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_xit = kenwood_set_xit, .get_xit = kenwood_get_xit, .set_mode = kenwood_set_mode, .get_mode = kenwood_get_mode_if, .set_vfo = kenwood_set_vfo, .get_vfo = kenwood_get_vfo_if, .set_split_vfo = kenwood_set_split_vfo, .get_split_vfo = kenwood_get_split_vfo_if, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt, .get_dcd = kenwood_get_dcd, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .set_level = kenwood_set_level, .get_level = kenwood_get_level, .set_ext_parm = kenwood_set_ext_parm, .get_ext_parm = kenwood_get_ext_parm, .vfo_op = kenwood_vfo_op, .set_mem = kenwood_set_mem, .get_mem = kenwood_get_mem_if, .set_trn = kenwood_set_trn, .get_trn = kenwood_get_trn, .set_powerstat = kenwood_set_powerstat, .get_powerstat = kenwood_get_powerstat, .reset = kenwood_reset, .scan = kenwood_scan, .get_channel = kenwood_get_channel, .set_channel = kenwood_set_channel, }; /* * Function definitions below */ hamlib-1.2.15.3/kenwood/ts790.c0000644000175000017500000001360712044564477012642 00000000000000/* * Hamlib Kenwood backend - TS-790 description * Copyright (c) 2000-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "kenwood.h" #define TS790_ALL_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_FM) #define TS790_HI_MODES (RIG_MODE_CW|RIG_MODE_FM) #define TS790_LO_MODES (RIG_MODE_SSB) /* func and levels to be checked */ #define TS790_FUNC_ALL (RIG_FUNC_TSQL|RIG_FUNC_LOCK|RIG_FUNC_MUTE) #define TS790_LEVEL_ALL (RIG_LEVEL_STRENGTH) #define TS790_VFO (RIG_VFO_A|RIG_VFO_B) #define TS790_VFO_OP (RIG_OP_UP|RIG_OP_DOWN) #define TS790_SCAN_OP (RIG_SCAN_VFO) #define TS790_CHANNEL_CAPS \ .freq=1,\ .mode=1,\ .tx_freq=1,\ .tx_mode=1,\ .split=1,\ .flags=RIG_CHFLAG_SKIP, \ .ctcss_tone=1 /* * Function definitions below */ static struct kenwood_priv_caps ts790_priv_caps = { .cmdtrm = EOM_KEN, }; /* * TS790 A/E rig capabilities. * Interface provided by optional IF-232C * * TODO: get_ts, ctcss_sql, set_rptr_shift * * part of infos comes from http://www.kenwood.net/ */ const struct rig_caps ts790_caps = { .rig_model = RIG_MODEL_TS790, .model_name = "TS-790", .mfg_name = "Kenwood", .version = BACKEND_VER ".2", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 0, .timeout = 1000, .retry = 3, .has_get_func = TS790_FUNC_ALL, .has_set_func = TS790_FUNC_ALL, .has_get_level = TS790_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(TS790_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .vfo_ops = TS790_VFO_OP, .scan_ops = TS790_SCAN_OP, .ctcss_list = kenwood38_ctcss_list, .preamp = { RIG_DBLST_END, }, .attenuator = { /* 12, */ RIG_DBLST_END, }, .max_rit = kHz(9.9), /* this is for FM, SSB/CW is 1.9kHz */ .max_xit = 0, .max_ifshift = 0, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 59, RIG_MTYPE_MEM, { TS790_CHANNEL_CAPS } }, RIG_CHAN_END, }, .rx_range_list1 = { {MHz(144),MHz(146),TS790_ALL_MODES,-1,-1,TS790_VFO}, {MHz(430),MHz(440),TS790_ALL_MODES,-1,-1,TS790_VFO}, #if 0 /* 23 cm option */ {MHz(1240),MHz(1300),TS790_ALL_MODES,-1,-1,TS790_VFO}, #endif RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { {MHz(144),MHz(146),TS790_LO_MODES,W(5),W(35),TS790_VFO}, {MHz(144),MHz(146),TS790_HI_MODES,W(5),W(45),TS790_VFO}, {MHz(430),MHz(440),TS790_LO_MODES,W(5),W(30),TS790_VFO}, {MHz(430),MHz(440),TS790_HI_MODES,W(5),W(40),TS790_VFO}, #if 0 {MHz(1240),MHz(1300),TS790_ALL_MODES,W(5),W(10),TS790_VFO}, #endif RIG_FRNG_END, }, /* tx range */ .rx_range_list2 = { {MHz(144),MHz(148),TS790_ALL_MODES,-1,-1,TS790_VFO}, {MHz(430),MHz(450),TS790_ALL_MODES,-1,-1,TS790_VFO}, #if 0 {MHz(1240),MHz(1300),TS790_ALL_MODES,-1,-1,TS790_VFO}, #endif RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {MHz(144),MHz(148),TS790_LO_MODES,W(5),W(35),TS790_VFO}, {MHz(144),MHz(148),TS790_HI_MODES,W(5),W(45),TS790_VFO}, {MHz(430),MHz(450),TS790_LO_MODES,W(5),W(30),TS790_VFO}, {MHz(430),MHz(450),TS790_HI_MODES,W(5),W(40),TS790_VFO}, #if 0 {MHz(1240),MHz(1300),TS790_ALL_MODES,W(5),W(10),TS790_VFO}, #endif RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {TS790_ALL_MODES,50}, {TS790_ALL_MODES,100}, {TS790_ALL_MODES,kHz(1)}, {TS790_ALL_MODES,kHz(5)}, {TS790_ALL_MODES,kHz(9)}, {TS790_ALL_MODES,kHz(10)}, {TS790_ALL_MODES,12500}, {TS790_ALL_MODES,kHz(20)}, {TS790_ALL_MODES,kHz(25)}, {TS790_ALL_MODES,kHz(100)}, {TS790_ALL_MODES,MHz(1)}, {TS790_ALL_MODES,0}, /* any tuning step */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR, kHz(2.1)}, {RIG_MODE_CW|RIG_MODE_CWR, Hz(500)}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .priv = (void *)&ts790_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_mode = kenwood_set_mode, .get_mode = kenwood_get_mode_if, .set_vfo = kenwood_set_vfo, .get_vfo = kenwood_get_vfo_if, .set_split_vfo = kenwood_set_split_vfo, .get_split_vfo = kenwood_get_split_vfo_if, .set_ctcss_tone = kenwood_set_ctcss_tone, .get_ctcss_tone = kenwood_get_ctcss_tone, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt, .get_dcd = kenwood_get_dcd, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .set_level = kenwood_set_level, .get_level = kenwood_get_level, .vfo_op = kenwood_vfo_op, .scan = kenwood_scan, .set_mem = kenwood_set_mem, .get_mem = kenwood_get_mem, .set_channel = kenwood_set_channel, .get_channel = kenwood_get_channel, .set_trn = kenwood_set_trn, .get_trn = kenwood_get_trn, .get_info = kenwood_get_info, }; hamlib-1.2.15.3/kenwood/ts950.c0000644000175000017500000001425312044564477012636 00000000000000/* * Hamlib Kenwood backend - TS950 description * Copyright (c) 2002-2012 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * Edited by Martin Ewing AA6E, March, 2012 * The '950 has a relatively small command set. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "kenwood.h" #define TS950_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB|RIG_MODE_FM|RIG_MODE_RTTY) #define TS950_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB|RIG_MODE_FM|RIG_MODE_RTTY) #define TS950_AM_TX_MODES RIG_MODE_AM #define TS950_VFO (RIG_VFO_A|RIG_VFO_B) #define TS950_GET_LEVEL (RIG_LEVEL_RAWSTR) #define cmd_trm(rig) ((struct kenwood_priv_caps *)(rig)->caps->priv)->cmdtrm static struct kenwood_priv_caps ts950_priv_caps = { .cmdtrm = EOM_KEN, }; /* * This backend should work with all models in the TS-950 series (TS-950S, SDX, etc.) * There are minor differences between the SDX and other models, but they are * in commands not implemented here. * * Reference: TS-950 series External Control Instruction Manual (1992) */ const struct rig_caps ts950sdx_caps = { .rig_model = RIG_MODEL_TS950SDX, .model_name = "TS-950SDX", .mfg_name = "Kenwood", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .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 = TS950_GET_LEVEL, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .parm_gran = {}, .ctcss_list = kenwood38_ctcss_list, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, /* atten settings are not available in CAT interface */ .attenuator = { 6, 12, 18, RIG_DBLST_END, }, .max_rit = kHz(9.99), .max_xit = kHz(9.99), .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 89, RIG_MTYPE_MEM }, /* TBC */ { 90, 99, RIG_MTYPE_EDGE }, 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),TS950_ALL_MODES,-1,-1,TS950_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { {kHz(1800),MHz(2)-1,TS950_OTHER_TX_MODES,5000,W(150),TS950_VFO}, /* 100W class */ {kHz(1800),MHz(2)-1,TS950_AM_TX_MODES,2000,W(40),TS950_VFO}, /* 25W class */ {kHz(3500),MHz(4)-1,TS950_OTHER_TX_MODES,5000,W(150),TS950_VFO}, {kHz(3500),MHz(4)-1,TS950_AM_TX_MODES,2000,W(40),TS950_VFO}, {MHz(7),kHz(7300),TS950_OTHER_TX_MODES,5000,W(150),TS950_VFO}, {MHz(7),kHz(7300),TS950_AM_TX_MODES,2000,W(40),TS950_VFO}, {kHz(10100),kHz(10150),TS950_OTHER_TX_MODES,5000,W(150),TS950_VFO}, {kHz(10100),kHz(10150),TS950_AM_TX_MODES,2000,W(40),TS950_VFO}, {MHz(14),kHz(14350),TS950_OTHER_TX_MODES,5000,W(150),TS950_VFO}, {MHz(14),kHz(14350),TS950_AM_TX_MODES,2000,W(40),TS950_VFO}, {kHz(18068),kHz(18168),TS950_OTHER_TX_MODES,5000,W(150),TS950_VFO}, {kHz(18068),kHz(18168),TS950_AM_TX_MODES,2000,W(40),TS950_VFO}, {MHz(21),kHz(21450),TS950_OTHER_TX_MODES,5000,W(150),TS950_VFO}, {MHz(21),kHz(21450),TS950_AM_TX_MODES,2000,W(40),TS950_VFO}, {kHz(24890),kHz(24990),TS950_OTHER_TX_MODES,5000,W(150),TS950_VFO}, {kHz(24890),kHz(24990),TS950_AM_TX_MODES,2000,W(40),TS950_VFO}, {MHz(28),kHz(29700),TS950_OTHER_TX_MODES,5000,W(150),TS950_VFO}, {MHz(28),kHz(29700),TS950_AM_TX_MODES,2000,W(40),TS950_VFO}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {TS950_ALL_MODES,50}, {TS950_ALL_MODES,100}, {TS950_ALL_MODES,kHz(1)}, {TS950_ALL_MODES,kHz(5)}, {TS950_ALL_MODES,kHz(9)}, {TS950_ALL_MODES,kHz(10)}, {TS950_ALL_MODES,12500}, {TS950_ALL_MODES,kHz(20)}, {TS950_ALL_MODES,kHz(25)}, {TS950_ALL_MODES,kHz(100)}, {TS950_ALL_MODES,MHz(1)}, {TS950_ALL_MODES,0}, /* any tuning step */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB, kHz(2.4)}, {RIG_MODE_CW, Hz(200)}, {RIG_MODE_RTTY, Hz(500)}, {RIG_MODE_AM, kHz(9)}, {RIG_MODE_FM, kHz(14)}, RIG_FLT_END, }, .priv = (void *)&ts950_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_xit = kenwood_set_xit, .get_xit = kenwood_get_xit, .set_mode = kenwood_set_mode, .get_mode = kenwood_get_mode_if, .set_vfo = kenwood_set_vfo, .get_vfo = kenwood_get_vfo_if, .set_ctcss_tone = kenwood_set_ctcss_tone, .get_ctcss_tone = kenwood_get_ctcss_tone, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt, .get_dcd = kenwood_get_dcd, /* Things that the '950 doesn't do ... * .set_func = kenwood_set_func, * .get_func = kenwood_get_func, * .set_level = kenwood_set_level, */ .get_level = kenwood_get_level, /* * .send_morse = kenwood_send_morse, */ .vfo_op = kenwood_vfo_op, .set_mem = kenwood_set_mem, .get_mem = kenwood_get_mem, .set_trn = kenwood_set_trn, .get_trn = kenwood_get_trn, .set_powerstat = kenwood_set_powerstat, .get_powerstat = kenwood_get_powerstat, .reset = kenwood_reset, }; hamlib-1.2.15.3/kenwood/ts870s.c0000644000175000017500000003363512044564477013027 00000000000000/* * Hamlib Kenwood backend - TS870S description * Copyright (c) 2000-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "kenwood.h" #include "bandplan.h" #define TS870S_ALL_MODES \ (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB \ |RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define TS870S_OTHER_TX_MODES \ (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define TS870S_AM_TX_MODES RIG_MODE_AM #define TS870S_FUNC_ALL \ (RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_NR \ |RIG_FUNC_BC|RIG_FUNC_ANF|RIG_FUNC_LOCK) #define TS870S_LEVEL_SET \ (RIG_LEVEL_ATT|RIG_LEVEL_SQL|RIG_LEVEL_AGC|RIG_LEVEL_RFPOWER \ |RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_MICGAIN|RIG_LEVEL_PREAMP) #define TS870S_LEVEL_GET \ (RIG_LEVEL_ATT|RIG_LEVEL_SQL|RIG_LEVEL_STRENGTH|RIG_LEVEL_SWR \ |RIG_LEVEL_COMP|RIG_LEVEL_ALC|RIG_LEVEL_AGC|RIG_LEVEL_RFPOWER \ |RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_MICGAIN|RIG_LEVEL_PREAMP) #define TS870S_VFO (RIG_VFO_A|RIG_VFO_B) #define TS870S_ANTS (RIG_ANT_1|RIG_ANT_2) static struct kenwood_priv_caps ts870s_priv_caps = { .cmdtrm = EOM_KEN, }; /* only the ts870s and ts2000 support get_vfo with the 'FR;' command NOTE: using byte 31 in 'IF' will also work. TODO: check other rigs */ static int ts870s_get_vfo(RIG *rig, vfo_t *vfo) { char vfobuf[50]; size_t vfo_len; int retval; /* query RX VFO */ vfo_len = 50; retval = kenwood_transaction (rig, "FR", 2, vfobuf, &vfo_len); if (retval != RIG_OK) return retval; if (vfo_len != 4 || vfobuf[1] != 'R') { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer %s, " "len=%d\n",__func__,vfobuf, vfo_len); return -RIG_ERJCTED; } /* TODO: replace 0,1,2,.. constants by defines */ switch (vfobuf[2]) { case '0': *vfo = RIG_VFO_A; break; case '1': *vfo = RIG_VFO_B; break; case '2': *vfo = RIG_VFO_MEM; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %c\n", __func__,vfobuf[2]); return -RIG_EPROTO; } return RIG_OK; } static int ts870s_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char buf[50]; size_t buf_len; int retval; buf_len = 50; retval = kenwood_transaction (rig, "MD", 2, buf, &buf_len); if (retval != RIG_OK) return retval; if (buf_len != 4 || buf[1] != 'D') { rig_debug(RIG_DEBUG_ERR,"%s: unexpected MD answer, len=%d\n", __func__,buf_len); return -RIG_ERJCTED; } switch (buf[2]) { case MD_CW: *mode = RIG_MODE_CW; break; case MD_CWR: *mode = RIG_MODE_CWR; break; case MD_USB: *mode = RIG_MODE_USB; break; case MD_LSB: *mode = RIG_MODE_LSB; break; case MD_FM: *mode = RIG_MODE_FM; break; case MD_AM: *mode = RIG_MODE_AM; break; case MD_FSK: *mode = RIG_MODE_RTTY; break; case MD_FSKR: *mode = RIG_MODE_RTTYR; break; case MD_NONE: *mode = RIG_MODE_NONE; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode '%c'\n", __func__,buf[2]); return -RIG_EINVAL; } buf_len = 50; retval = kenwood_transaction (rig, "FW", 2, buf, &buf_len); if (retval != RIG_OK) return retval; if (buf_len != 7 || buf[1] != 'W') { rig_debug(RIG_DEBUG_ERR,"%s: unexpected FW answer, len=%d\n", __func__,buf_len); return -RIG_ERJCTED; } *width = 10 * atoi(&buf[2]); return RIG_OK; } static int ts870s_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { char buf[16]; int kmode, retval; switch (mode) { case RIG_MODE_CW: kmode = MD_CW; break; case RIG_MODE_CWR: kmode = MD_CWR; break; case RIG_MODE_USB: kmode = MD_USB; break; case RIG_MODE_LSB: kmode = MD_LSB; break; case RIG_MODE_FM: kmode = MD_FM; break; case RIG_MODE_AM: kmode = MD_AM; break; case RIG_MODE_RTTY: kmode = MD_FSK; break; case RIG_MODE_RTTYR: kmode = MD_FSKR; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n", __func__,mode); return -RIG_EINVAL; } sprintf(buf, "MD%c", kmode); retval = kenwood_simple_cmd(rig, buf); if (retval != RIG_OK) return retval; /* * This rig will simply use an IF bandpass which is closest to width, * so we don't need to check the value... */ sprintf(buf, "FW%04d", (int)width/10); return kenwood_simple_cmd(rig, buf); } int ts870s_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { char levelbuf[16]; int intval; switch (level) { case RIG_LEVEL_RFPOWER: intval = val.f * 100; sprintf(levelbuf, "PC%03d", intval); return kenwood_simple_cmd(rig, levelbuf); break; default: return kenwood_set_level (rig, vfo, level, val); } return RIG_OK; } static int ts870s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { char lvlbuf[50]; size_t lvl_len; int lvl, retval; int i, ret, agclevel; lvl_len = 50; switch (level) { case RIG_LEVEL_STRENGTH: retval = kenwood_transaction (rig, "SM", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 7 || lvlbuf[1] != 'M') { rig_debug(RIG_DEBUG_ERR,"ts870s_get_level: " "wrong answer len=%d\n", lvl_len); return -RIG_ERJCTED; } /* Frontend expects: -54 = S0, 0 = S9 */ sscanf(lvlbuf+2, "%d", &val->i); val->i = (val->i * 3.6) - 54; break; case RIG_LEVEL_SWR: lvl_len = 50; retval = kenwood_transaction (rig, "RM", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; /* set meter to SWR if needed */ if (lvlbuf[2] != '1') { lvl_len = 0; retval = kenwood_transaction (rig, "RM1", 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; lvl_len = 50; retval = kenwood_transaction (rig, "RM", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; } lvlbuf[7]='\0'; i=atoi(&lvlbuf[3]); if(i == 30) val->f = 150.0; /* infinity :-) */ else val->f = 60.0/(30.0-(float)i)-1.0; break; case RIG_LEVEL_COMP: lvl_len = 50; retval = kenwood_transaction (rig, "RM", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; /* set meter to COMP if needed */ if (lvlbuf[2] != '2') { lvl_len = 0; retval = kenwood_transaction (rig, "RM2", 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; lvl_len = 50; retval = kenwood_transaction (rig, "RM", 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; } lvlbuf[7]='\0'; val->f=(float)atoi(&lvlbuf[3])/30.0; break; case RIG_LEVEL_ALC: lvl_len = 50; retval = kenwood_transaction (rig, "RM", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; /* set meter to ALC if needed */ if (lvlbuf[2] != '3') { lvl_len = 0; retval = kenwood_transaction (rig, "RM3", 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; lvl_len = 50; retval = kenwood_transaction (rig, "RM", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; } lvlbuf[7]='\0'; val->f=(float)atoi(&lvlbuf[3])/30.0; break; case RIG_LEVEL_ATT: retval = kenwood_transaction (rig, "RA", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 5) { rig_debug(RIG_DEBUG_ERR,"ts870s_get_level: " "unexpected answer len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+2, "%d", &lvl); if (lvl == 0) { val->i = 0; } else { for (i=0; istate.attenuator[i] == 0) { rig_debug(RIG_DEBUG_ERR,"ts870s_get_level: " "unexpected att level %d\n", lvl); return -RIG_EPROTO; } if (i != lvl) return -RIG_EINTERNAL; val->i = rig->state.attenuator[i-1]; } break; case RIG_LEVEL_RFPOWER: /* RFPOWER is 0..100 and not 0..255 like all the other levels*/ retval = kenwood_transaction (rig, "PC", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 6 || lvlbuf[1] != 'C') { rig_debug(RIG_DEBUG_ERR,"ts870s_get_level: " "wrong answer len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf (lvlbuf + 2, "%d", &lvl); val->f = lvl/100.; break; case RIG_LEVEL_AF: return get_kenwood_level(rig, "AG", 2, &val->f); case RIG_LEVEL_RF: return get_kenwood_level(rig, "RG", 2, &val->f); case RIG_LEVEL_SQL: return get_kenwood_level(rig, "SQ", 2, &val->f); case RIG_LEVEL_MICGAIN: return get_kenwood_level(rig, "MG", 2, &val->f); case RIG_LEVEL_AGC: ret = get_kenwood_level(rig, "GT", 2, &val->f); agclevel = 255 * val->f; if (agclevel == 0) val->i = 0; else if (agclevel < 85) val->i = 1; else if (agclevel < 170) val->i = 2; else if (agclevel <= 255) val->i = 3; return ret; case RIG_LEVEL_IF: case RIG_LEVEL_APF: case RIG_LEVEL_NR: case RIG_LEVEL_PBT_IN: case RIG_LEVEL_PBT_OUT: case RIG_LEVEL_CWPITCH: case RIG_LEVEL_KEYSPD: case RIG_LEVEL_NOTCHF: case RIG_LEVEL_BKINDL: case RIG_LEVEL_BALANCE: return -RIG_ENIMPL; case RIG_LEVEL_PREAMP: return -RIG_ENAVAIL; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_level %d", level); return -RIG_EINVAL; } return RIG_OK; } /* * ts870s rig capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! * RIT: Variable Range ±9.99 kHz * * part of infos comes from .http = //www.kenwood.net/ */ const struct rig_caps ts870s_caps = { .rig_model = RIG_MODEL_TS870S, .model_name = "TS-870S", .mfg_name = "Kenwood", .version = BACKEND_VER ".0", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 57600, .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 = TS870S_FUNC_ALL, .has_set_func = TS870S_FUNC_ALL, .has_get_level = TS870S_LEVEL_GET, .has_set_level = TS870S_LEVEL_SET, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = kenwood38_ctcss_list, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, /* FIXME: preamp list */ .attenuator = { 6, 12, 18, RIG_DBLST_END, }, .max_rit = kHz(9.99), .max_xit = kHz(9.99), .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 89, RIG_MTYPE_MEM }, /* TBC */ { 90, 99, RIG_MTYPE_EDGE }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100),MHz(30),TS870S_ALL_MODES,-1,-1,TS870S_VFO,TS870S_ANTS}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { FRQ_RNG_HF(1, TS870S_OTHER_TX_MODES, W(5), W(100), TS870S_VFO, TS870S_ANTS), /* 100W class */ FRQ_RNG_HF(1, TS870S_AM_TX_MODES, W(2), W(25), TS870S_VFO, TS870S_ANTS), /* 25W class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(30),TS870S_ALL_MODES,-1,-1,TS870S_VFO,TS870S_ANTS}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { FRQ_RNG_HF(2, TS870S_OTHER_TX_MODES, W(5), W(100), TS870S_VFO, TS870S_ANTS), /* 100W class */ FRQ_RNG_HF(2, TS870S_AM_TX_MODES, W(2), W(25), TS870S_VFO, TS870S_ANTS), /* 25W class */ RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {TS870S_ALL_MODES,50}, {TS870S_ALL_MODES,100}, {TS870S_ALL_MODES,kHz(1)}, {TS870S_ALL_MODES,kHz(5)}, {TS870S_ALL_MODES,kHz(9)}, {TS870S_ALL_MODES,kHz(10)}, {TS870S_ALL_MODES,12500}, {TS870S_ALL_MODES,kHz(20)}, {TS870S_ALL_MODES,kHz(25)}, {TS870S_ALL_MODES,kHz(100)}, {TS870S_ALL_MODES,MHz(1)}, {TS870S_ALL_MODES,0}, /* any tuning step */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB, Hz(200)}, {RIG_MODE_SSB, Hz(0)}, {RIG_MODE_SSB, Hz(600)}, {RIG_MODE_CW, Hz(400)}, {RIG_MODE_CW, Hz(100)}, {RIG_MODE_CW, Hz(1000)}, {RIG_MODE_RTTY, Hz(1000)}, {RIG_MODE_RTTY, Hz(500)}, {RIG_MODE_RTTY, Hz(1500)}, {RIG_MODE_AM, Hz(200)}, {RIG_MODE_AM, Hz(0)}, {RIG_MODE_AM, Hz(500)}, {RIG_MODE_FM, kHz(8)}, {RIG_MODE_FM, kHz(5)}, {RIG_MODE_FM, kHz(14)}, RIG_FLT_END, }, .priv = (void *)&ts870s_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_xit = kenwood_set_xit, .get_xit = kenwood_get_xit, .set_mode = ts870s_set_mode, .get_mode = ts870s_get_mode, .set_vfo = kenwood_set_vfo, .get_vfo = ts870s_get_vfo, .set_ctcss_tone = kenwood_set_ctcss_tone, .get_ctcss_tone = kenwood_get_ctcss_tone, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt, .get_dcd = kenwood_get_dcd, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .set_level = ts870s_set_level, .get_level = ts870s_get_level, .set_ant = kenwood_set_ant, .get_ant = kenwood_get_ant, .send_morse = kenwood_send_morse, .vfo_op = kenwood_vfo_op, .set_mem = kenwood_set_mem, .get_mem = kenwood_get_mem, .set_trn = kenwood_set_trn, .get_trn = kenwood_get_trn, .set_powerstat = kenwood_set_powerstat, .get_powerstat = kenwood_get_powerstat, .reset = kenwood_reset, }; /* * Function definitions below */ hamlib-1.2.15.3/kenwood/thg71.c0000644000175000017500000003172112044564477012703 00000000000000/* * Hamlib Kenwood backend - TH-G71 description * Copyright (c) 2003-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "kenwood.h" #include "th.h" #if 1 #define RIG_ASSERT(x) if (!(x)) { rig_debug(RIG_DEBUG_ERR, "Assertion failed on line %i\n",__LINE__); abort(); } #else #define RIG_ASSERT(x) #endif #define THG71_FUNC_ALL (\ RIG_FUNC_TBURST \ ) #define THG71_LEVEL_ALL (\ RIG_LEVEL_RAWSTR| \ RIG_LEVEL_SQL| \ RIG_LEVEL_RFPOWER\ ) #ifndef RIG_TONEMAX #define RIG_TONEMAX 38 #endif #define RIG_VFO_A_OP (RIG_OP_UP|RIG_OP_DOWN) #define ACKBUF_LEN 128 static rmode_t thg71_mode_table[KENWOOD_MODE_TABLE_MAX] = { [0] = RIG_MODE_FM, [1] = RIG_MODE_AM, }; static struct kenwood_priv_caps thg71_priv_caps = { .cmdtrm = EOM_TH, /* Command termination character */ .mode_table = thg71_mode_table, }; /* thg71 procs */ static int thg71_open(RIG *rig); static int thg71_decode_event (RIG *rig); static int thg71_get_mode (RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int thg71_set_vfo (RIG *rig, vfo_t vfo); static int thg71_get_vfo (RIG *rig, vfo_t *vfo); static int thg71_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); /* * th-g71 rig capabilities. * * http://www.iw5edi.com/ham-radio/files/TH-G71_Serial_Protocol.pdf */ const struct rig_caps thg71_caps = { .rig_model = RIG_MODEL_THG71, .model_name = "TH-G71", .mfg_name = "Kenwood", .version = TH_VER, .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_HANDHELD, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .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 = 1, .post_write_delay = 0, .timeout = 500, .retry = 3, .has_set_func = THG71_FUNC_ALL, .has_get_level = THG71_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(THG71_LEVEL_ALL), .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 5 } }, [LVL_SQL] = { .min = { .i = 0 }, .max = { .i = 5 } }, [LVL_RFPOWER] = { .min = { .i = 3 }, .max = { .i = 0 } }, }, .parm_gran = {}, .ctcss_list = kenwood38_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), .vfo_ops = RIG_VFO_A_OP, .targetable_vfo = RIG_TARGETABLE_NONE, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 6, .chan_list = { { 1, 199, RIG_MTYPE_MEM , {TH_CHANNEL_CAPS}}, /* normal MEM */ { 200,209, RIG_MTYPE_EDGE , {TH_CHANNEL_CAPS}}, /* L MEM */ { 210,219, RIG_MTYPE_EDGE , {TH_CHANNEL_CAPS}}, /* U MEM */ { 220,220, RIG_MTYPE_PRIO , {TH_CHANNEL_CAPS}}, /* Priority */ { 221,222, RIG_MTYPE_CALL , {TH_CHANNEL_CAPS}}, /* Call 0/1 */ { 223,231, RIG_MTYPE_BAND , {TH_CHANNEL_CAPS}}, /* Band VFO */ RIG_CHAN_END, }, /* no rx/tx_range_list */ /* computed in thg71_open */ .tuning_steps = { {RIG_MODE_FM,kHz(5)}, {RIG_MODE_FM,kHz(6.25)}, {RIG_MODE_FM,kHz(10)}, {RIG_MODE_FM,kHz(12.5)}, {RIG_MODE_FM,kHz(15)}, {RIG_MODE_FM,kHz(20)}, {RIG_MODE_FM,kHz(25)}, {RIG_MODE_FM,kHz(30)}, {RIG_MODE_FM,kHz(50)}, {RIG_MODE_FM,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_FM, kHz(12)}, {RIG_MODE_AM, kHz(9)}, RIG_FLT_END, }, .str_cal ={ 3, { { 0, -60 }, {1, -30 }, {5,-13}}}, /* guessed from technical manual */ .priv = (void *)&thg71_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .rig_open = thg71_open, .rig_close = NULL, .set_freq = th_set_freq, .get_freq = th_get_freq, .get_mode = thg71_get_mode, .set_vfo = thg71_set_vfo, .get_vfo = thg71_get_vfo, .set_mem = th_set_mem, .get_mem = th_get_mem, .set_channel = th_set_channel, .get_channel = th_get_channel, .set_trn = th_set_trn, .get_trn = th_get_trn, .set_func = thg71_set_func, .get_level = th_get_level, .set_level = th_set_level, .get_info = th_get_info, .vfo_op = th_vfo_op, .set_ptt = th_set_ptt, .get_dcd=th_get_dcd, .decode_event = thg71_decode_event, }; /* --------------------------------------------------------------------- */ int thg71_decode_event (RIG *rig) { char asyncbuf[ACKBUF_LEN]; int retval; size_t asyncbuf_len = ACKBUF_LEN; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); retval = kenwood_transaction(rig, NULL, 0, asyncbuf, &asyncbuf_len); if (retval != RIG_OK) return retval; rig_debug(RIG_DEBUG_TRACE, "%s: Decoding message\n", __func__); if (asyncbuf[0] == 'B' && asyncbuf[1] == 'U' && asyncbuf[2] == 'F') { freq_t freq, offset; int step, shift, rev, tone, ctcss, tonefq, ctcssfq; retval = sscanf(asyncbuf, "BUF 0,%"SCNfreq",%d,%d,%d,%d,%d,,%d,,%d,%"SCNfreq, &freq, &step, &shift, &rev, &tone, &ctcss, &tonefq, &ctcssfq, &offset); if (retval != 11) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected BUF message '%s'\n", __func__, asyncbuf); return -RIG_ERJCTED; } rig_debug(RIG_DEBUG_TRACE, "%s: Buffer (freq %"PRIfreq" Hz, mode %d)\n", __func__, freq); /* Callback execution */ if (rig->callbacks.vfo_event) { rig->callbacks.vfo_event(rig, RIG_VFO_A, rig->callbacks.vfo_arg); } if (rig->callbacks.freq_event) { rig->callbacks.freq_event(rig, RIG_VFO_A, freq, rig->callbacks.freq_arg); } /* if (rig->callbacks.mode_event) { rig->callbacks.mode_event(rig, RIG_VFO_A, mode, RIG_PASSBAND_NORMAL, rig->callbacks.mode_arg); } */ /* --------------------------------------------------------------------- */ } else if (asyncbuf[0] == 'S' && asyncbuf[1] == 'M') { int lev; retval = sscanf(asyncbuf, "SM 0,%d", &lev); if (retval != 2) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected SM message '%s'\n", __func__, asyncbuf); return -RIG_ERJCTED; } rig_debug(RIG_DEBUG_TRACE, "%s: Signal strength event - signal = %.3f\n", __func__, (float)(lev / 5.0)); /* Callback execution */ #if STILLHAVETOADDCALLBACK if (rig->callbacks.strength_event) rig->callbacks.strength_event(rig, RIG_VFO_0,(float)(lev / 5.0), rig->callbacks.strength_arg); #endif /* --------------------------------------------------------------------- */ } else if (asyncbuf[0] == 'B' && asyncbuf[1] == 'Y') { int busy; retval = sscanf(asyncbuf, "BY 0,%d", &busy); if (retval != 2) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected BY message '%s'\n", __func__, asyncbuf); return -RIG_ERJCTED; } rig_debug(RIG_DEBUG_TRACE, "%s: Busy event - status = '%s'\n", __func__, (busy == 0) ? "OFF" : "ON" ); return -RIG_ENIMPL; /* This event does not have a callback. */ /* --------------------------------------------------------------------- */ } else if (asyncbuf[0] == 'V' && asyncbuf[1] == 'M' && asyncbuf[2] == 'C') { vfo_t bandmode; retval = sscanf(asyncbuf, "VMC 0,%d", &bandmode); if (retval != 1) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected VMC message '%s'\n", __func__, asyncbuf); return -RIG_ERJCTED; } switch (bandmode) { case 0: bandmode = RIG_VFO_VFO; break; case 2: bandmode = RIG_VFO_MEM; break; /* case 3: bandmode = RIG_VFO_CALL; break; */ default: bandmode = RIG_VFO_CURR; break; } rig_debug(RIG_DEBUG_TRACE, "%s: Mode of Band event - %d\n", __func__, bandmode); /* TODO: This event does not have a callback! */ return -RIG_ENIMPL; /* --------------------------------------------------------------------- */ } else { rig_debug(RIG_DEBUG_ERR, "%s: Unsupported transceive cmd '%s'\n", __func__, asyncbuf); return -RIG_ENIMPL; } return RIG_OK; } /* --------------------------------------------------------------------- */ int thg71_get_mode (RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char ackbuf[ACKBUF_LEN]; int retval; size_t ack_len=ACKBUF_LEN; int step; freq_t freq; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); switch (vfo) { case RIG_VFO_CURR: break; case RIG_VFO_A: break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported VFO %d\n", __func__, vfo); return -RIG_EVFO; } /* try to guess from frequency */ retval = kenwood_transaction(rig, "FQ", 3, ackbuf, &ack_len); if (retval != RIG_OK) return retval; sscanf(ackbuf,"FQ %"SCNfreq",%d",&freq,&step); if(freq state.rx_range_list[i]=frng; if(frng.start> MHz(200)) frng.high_power=5.5; else frng.high_power=6; frng.low_power=mW(50); rig->state.tx_range_list[i]=frng; } rig->state.rx_range_list[i]= frend; rig->state.tx_range_list[i]= frend; rig->state.vfo_list=RIG_VFO_A | RIG_VFO_MEM ; return RIG_OK; } hamlib-1.2.15.3/kenwood/ts590.c0000644000175000017500000002554312044564477012642 00000000000000/* * Hamlib Kenwood backend - TS590 description * Copyright (c) 2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "hamlib/rig.h" #include "idx_builtin.h" #include "kenwood.h" #define TS590_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define TS590_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define TS590_AM_TX_MODES RIG_MODE_AM #define TS590_VFO (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define TS590_LEVEL_ALL (RIG_LEVEL_RFPOWER|RIG_LEVEL_AF|RIG_LEVEL_RF|\ RIG_LEVEL_CWPITCH|RIG_LEVEL_METER|RIG_LEVEL_SWR|RIG_LEVEL_ALC|\ RIG_LEVEL_SQL|RIG_LEVEL_AGC|RIG_LEVEL_STRENGTH) #define TS590_FUNC_ALL (RIG_FUNC_LOCK|RIG_FUNC_AIP|RIG_FUNC_TONE|\ RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_NR|RIG_FUNC_NR|RIG_FUNC_BC) #define TS590_VFO_OPS (RIG_OP_UP|RIG_OP_DOWN) #define TS590_SCAN_OPS (RIG_SCAN_VFO) #define TS590_ANTS (RIG_ANT_1|RIG_ANT_2) #define TS590_CHANNEL_CAPS { \ .freq=1,\ .mode=1,\ .tx_freq=1,\ .tx_mode=1,\ .split=1,\ .funcs=RIG_FUNC_TONE, \ .flags=RIG_CHFLAG_SKIP \ } static struct kenwood_priv_caps ts590_priv_caps = { .cmdtrm = EOM_KEN, }; /* * ts590 rig capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! */ const struct rig_caps ts590_caps = { .rig_model = RIG_MODEL_TS590S, .model_name = "TS-590S", .mfg_name = "Kenwood", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG_MICDATA, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 115200, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 0, .timeout = 500, .retry = 3, .preamp = {12, RIG_DBLST_END,}, .attenuator = {12, RIG_DBLST_END,}, .max_rit = kHz (9.99), .max_xit = kHz (9.99), .max_ifshift = Hz (0), .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .chan_list = { /* TBC */ { 0, 89, RIG_MTYPE_MEM, TS590_CHANNEL_CAPS }, { 90, 99, RIG_MTYPE_EDGE, TS590_CHANNEL_CAPS }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30), Hz(59999999), TS590_ALL_MODES, -1, -1, TS590_VFO, TS590_ANTS}, RIG_FRNG_END, }, /*!< Receive frequency range list for ITU region 1 */ .tx_range_list1 = { {kHz(1810), kHz(1850), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, /* 100W class */ {kHz(1810), kHz(1850), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, /* 25W class */ {kHz(3500), kHz(3800), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {kHz(3500), kHz(3800), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {MHz(7), kHz(7200), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {MHz(7), kHz(7200), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {kHz(10100), kHz(10150), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {kHz(10100), kHz(10150), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {MHz(14), kHz(14350), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {MHz(14), kHz(14350), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {kHz(18068), kHz(18168), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {kHz(18068), kHz(18168), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {MHz(21), kHz(21450), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {MHz(21), kHz(21450), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {kHz(24890), kHz(24990), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {kHz(24890), kHz(24990), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {MHz(28), kHz(29700), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {MHz(28), kHz(29700), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {MHz(50), kHz(52000), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {MHz(50), kHz(52000), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, RIG_FRNG_END, }, /*!< Transmit frequency range list for ITU region 1 */ .rx_range_list2 = { {kHz(30), Hz(59999999), TS590_ALL_MODES, -1, -1, TS590_VFO, TS590_ANTS}, RIG_FRNG_END, }, /*!< Receive frequency range list for ITU region 2 */ .tx_range_list2 = { {kHz(1800), MHz(2) - 1, TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, /* 100W class */ {kHz(1800), MHz(2) - 1, TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, /* 25W class */ {kHz(3500), MHz(4) - 1, TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {kHz(3500), MHz(4) - 1, TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {kHz(5250), kHz(5450), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {kHz(5250), kHz(5450), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {MHz(7), kHz(7300), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {MHz(7), kHz(7300), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {kHz(10100), kHz(10150), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {kHz(10100), kHz(10150), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {MHz(14), kHz(14350), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {MHz(14), kHz(14350), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {kHz(18068), kHz(18168), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {kHz(18068), kHz(18168), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {MHz(21), kHz(21450), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {MHz(21), kHz(21450), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {kHz(24890), kHz(24990), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {kHz(24890), kHz(24990), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {MHz(28), kHz(29700), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {MHz(28), kHz(29700), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, {MHz(50), kHz(52000), TS590_OTHER_TX_MODES, 5000, 100000, TS590_VFO, TS590_ANTS}, {MHz(50), kHz(52000), TS590_AM_TX_MODES, 5000, 25000, TS590_VFO, TS590_ANTS}, RIG_FRNG_END, }, /*!< Transmit frequency range list for ITU region 2 */ .tuning_steps = { {TS590_ALL_MODES,kHz(1)}, {TS590_ALL_MODES,Hz(2500)}, {TS590_ALL_MODES,kHz(5)}, {TS590_ALL_MODES,Hz(6250)}, {TS590_ALL_MODES,kHz(10)}, {TS590_ALL_MODES,Hz(12500)}, {TS590_ALL_MODES,kHz(15)}, {TS590_ALL_MODES,kHz(20)}, {TS590_ALL_MODES,kHz(25)}, {TS590_ALL_MODES,kHz(30)}, {TS590_ALL_MODES,kHz(100)}, {TS590_ALL_MODES,kHz(500)}, {TS590_ALL_MODES,MHz(1)}, {TS590_ALL_MODES,0}, /* any tuning step */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB, kHz(2.2)}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(500)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .priv = (void *) &ts590_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_rit = kenwood_set_rit, /* FIXME should this switch to rit mode or just set the frequency? */ .get_rit = kenwood_get_rit, .set_xit = kenwood_set_xit, /* FIXME should this switch to xit mode or just set the frequency? */ .get_xit = kenwood_get_xit, .set_mode = kenwood_set_mode, .get_mode = kenwood_get_mode, .set_vfo = kenwood_set_vfo, .get_vfo = kenwood_get_vfo_if, .set_split_vfo = kenwood_set_split_vfo, .get_split_vfo = kenwood_get_split_vfo_if, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt, .get_dcd = kenwood_get_dcd, .set_powerstat = kenwood_set_powerstat, .get_powerstat = kenwood_get_powerstat, .get_info = kenwood_get_info, .reset = kenwood_reset, .set_ant = kenwood_set_ant, .get_ant = kenwood_get_ant, .scan_ops = TS590_SCAN_OPS, .scan = kenwood_scan, /* not working, invalid arguments using rigctl; kenwood_scan does only support on/off and not tone and CTCSS scan */ .has_set_level = RIG_LEVEL_SET(TS590_LEVEL_ALL), .has_get_level = TS590_LEVEL_ALL, .set_level = kenwood_set_level, .get_level = kenwood_get_level, .has_get_func = TS590_FUNC_ALL, .has_set_func = TS590_FUNC_ALL, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .set_ctcss_tone = kenwood_set_ctcss_tone, .get_ctcss_tone = kenwood_get_ctcss_tone, .ctcss_list = kenwood38_ctcss_list, .set_trn = kenwood_set_trn, .get_trn = kenwood_get_trn, .send_morse = kenwood_send_morse, .set_mem = kenwood_set_mem, .get_mem = kenwood_get_mem, .set_channel = kenwood_set_channel, .get_channel = kenwood_get_channel, .vfo_ops = TS590_VFO_OPS, .vfo_op = kenwood_vfo_op, }; /* * Function definitions below */ hamlib-1.2.15.3/kenwood/th.h0000644000175000017500000000706312044564477012373 00000000000000/* * Hamlib Kenwood backend - TH handheld header * Copyright (c) 2001-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef __TH_H__ #define __TH_H__ 1 #include "idx_builtin.h" #define TH_VER "0.5" extern int th_transaction (RIG *rig, const char *cmdstr, char *data, size_t datasize); extern int th_get_vfo_char(RIG *rig, vfo_t *vfo, char *vfoch); extern int th_decode_event (RIG *rig); extern int th_set_freq (RIG *rig, vfo_t vfo, freq_t freq); extern int th_get_freq (RIG *rig, vfo_t vfo, freq_t *freq); extern int th_set_mode (RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); extern int th_get_mode (RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); extern int th_set_vfo(RIG *rig, vfo_t vfo); extern int th_get_vfo(RIG *rig, vfo_t *vfo); extern int tm_set_vfo_bc2 (RIG *rig, vfo_t vfo); extern int th_set_split_vfo (RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo); extern int th_get_split_vfo (RIG *rig, vfo_t vfo, split_t *split, vfo_t *txvfo); extern int th_set_trn(RIG *rig, int trn); extern int th_get_trn (RIG *rig, int *trn); extern int th_set_powerstat (RIG *rig, powerstat_t status); extern int th_get_powerstat (RIG *rig, powerstat_t *status); extern int th_set_func (RIG *rig, vfo_t vfo, setting_t func, int status); extern int th_get_func (RIG *rig, vfo_t vfo, setting_t func, int *status); extern int th_set_parm (RIG *rig, setting_t parm, value_t val); extern int th_get_parm (RIG *rig, setting_t parm, value_t *val); extern int th_get_level (RIG *rig, vfo_t vfo, setting_t level, value_t *val); extern int th_set_level (RIG *rig, vfo_t vfo, setting_t level, value_t val); extern int th_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone); extern int th_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone); extern int th_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone); extern int th_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone); extern int th_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code); extern int th_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *code); extern const char *th_get_info(RIG *rig); extern int th_set_mem(RIG *rig, vfo_t vfo, int ch); extern int th_get_mem(RIG *rig, vfo_t vfo, int *ch); extern int th_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); extern int th_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); extern int th_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); extern int th_get_channel(RIG *rig, channel_t *chan); extern int th_set_channel(RIG *rig, const channel_t *chan); extern int th_set_ant (RIG * rig, vfo_t vfo, ant_t ant); extern int th_get_ant (RIG * rig, vfo_t vfo, ant_t * ant); extern int th_reset(RIG *rig, reset_t reset); extern int th_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch); #define TH_CHANNEL_CAPS \ .freq=1,\ .tx_freq=1,\ .split=1,\ .mode=1,\ .width=1,\ .tuning_step=1,\ .rptr_shift=1,\ .rptr_offs=1,\ .funcs=RIG_FUNC_REV,\ .ctcss_tone=1,\ .ctcss_sql=1,\ .channel_desc=1 #endif /* __TH_H__ */ /* end of file */ hamlib-1.2.15.3/kenwood/ts140.c0000644000175000017500000001260312044564477012622 00000000000000/* * Hamlib Kenwood backend - TS140 description * Copyright (c) 2000-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "hamlib/rig.h" #include "bandplan.h" #include "kenwood.h" #define TS140_ALL_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_CWR) #define TS140_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_CWR) #define TS140_AM_TX_MODES RIG_MODE_AM #define TS140_VFO (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define TS140_ANTS (0) /* * vfo defines */ #define VFO_A '0' #define VFO_B '1' #define VFO_MEM '2' static struct kenwood_priv_caps ts140_priv_caps = { .cmdtrm = EOM_KEN, }; static int ts140_set_vfo(RIG *rig, vfo_t vfo) { char cmdbuf[16]; char vfo_function; switch (vfo) { case RIG_VFO_VFO: case RIG_VFO_A: vfo_function = VFO_A; break; case RIG_VFO_B: vfo_function = VFO_B; break; case RIG_VFO_MEM: vfo_function = VFO_MEM; break; case RIG_VFO_CURR: return RIG_OK; default: rig_debug(RIG_DEBUG_ERR,"ts140_set_vfo: unsupported VFO %d\n", vfo); return -RIG_EINVAL; } sprintf(cmdbuf, "FN%c", vfo_function); /* The 680 and 140 need this to set the VFO on the radio */ return kenwood_simple_cmd(rig, cmdbuf); } /* * ts140 rig capabilities. * GW0VNR 09042006 */ const struct rig_caps ts140_caps = { .rig_model = RIG_MODEL_TS140S, .model_name = "TS-140S", .mfg_name = "Kenwood", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 9600, /* Rig only capable of 4800 baud from factory and 9k6 with jumper change */ .serial_data_bits = 8, .serial_stop_bits = 2, /* TWO stop bits. This is correct. */ .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 0, .timeout = 300, .retry = 3, .has_get_func = RIG_FUNC_LOCK, .has_set_func = RIG_FUNC_LOCK, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* No PARAMS controllable */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .preamp = { RIG_DBLST_END, }, /* Not controllable */ .attenuator = { RIG_DBLST_END, }, /* Not controllable */ .max_rit = kHz(1.2), .max_xit = kHz(1.2), .max_ifshift = Hz(0), /* Not controllable */ .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 19, RIG_MTYPE_MEM }, { 20, 30, RIG_MTYPE_EDGE }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(50),kHz(34999),TS140_ALL_MODES,-1,-1,TS140_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { FRQ_RNG_HF(1,TS140_OTHER_TX_MODES,W(5),W(100),TS140_VFO,TS140_ANTS), FRQ_RNG_HF(1,TS140_AM_TX_MODES,W(2),W(40),TS140_VFO,TS140_ANTS), RIG_FRNG_END, }, .rx_range_list2 = { {kHz(50),kHz(34999),TS140_ALL_MODES,-1,-1,TS140_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { FRQ_RNG_HF(2,TS140_OTHER_TX_MODES,W(5),W(100),TS140_VFO,TS140_ANTS), FRQ_RNG_HF(2,TS140_AM_TX_MODES,W(2),W(40),TS140_VFO,TS140_ANTS), RIG_FRNG_END, }, /* tx range */ .tuning_steps = { /* FIXME: Done */ {TS140_ALL_MODES,10}, {TS140_ALL_MODES,100}, {TS140_ALL_MODES,kHz(1)}, {TS140_ALL_MODES,kHz(5)}, {TS140_ALL_MODES,kHz(9)}, {TS140_ALL_MODES,kHz(10)}, {TS140_ALL_MODES,12500}, {TS140_ALL_MODES,kHz(20)}, {TS140_ALL_MODES,kHz(25)}, {TS140_ALL_MODES,kHz(100)}, {TS140_ALL_MODES,MHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_AM, kHz(6)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_AM, kHz(2.2)}, {RIG_MODE_CWR, 600}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .priv = (void *)&ts140_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_mode = kenwood_set_mode, .get_mode = kenwood_get_mode_if, .set_vfo = ts140_set_vfo, .get_vfo = kenwood_get_vfo_if, .set_ptt = kenwood_set_ptt, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .vfo_op = kenwood_vfo_op, .set_mem = kenwood_set_mem, .get_mem = kenwood_get_mem_if, .reset = kenwood_reset, }; /* * Function definitions below */ hamlib-1.2.15.3/kenwood/ts480.c0000644000175000017500000003420312044564477012631 00000000000000/* * Hamlib Kenwood backend - TS480 description * Copyright (c) 2000-2004 by Stephane Fillod and Juergen Rinas * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "idx_builtin.h" #include "kenwood.h" #define TS480_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define TS480_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define TS480_AM_TX_MODES RIG_MODE_AM #define TS480_VFO (RIG_VFO_A|RIG_VFO_B) #define TS480_LEVEL_ALL (RIG_LEVEL_RFPOWER|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_AGC) #define TS480_FUNC_ALL (RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_NR|RIG_FUNC_NR|RIG_FUNC_BC) /* * kenwood_ts480_get_info * Assumes rig!=NULL */ static const char * kenwood_ts480_get_info (RIG * rig) { char firmbuf[50]; size_t firm_len; int retval; firm_len = 50; retval = kenwood_transaction (rig, "TY", 2, firmbuf, &firm_len); if (retval != RIG_OK) return NULL; if (firm_len != 6) { rig_debug (RIG_DEBUG_ERR, "kenwood_get_info: wrong answer len=%d\n", firm_len); return NULL; } switch (firmbuf[4]) { case '0': return "TS-480HX (200W)"; case '1': return "TS-480SAT (100W + AT)"; case '2': return "Japanese 50W type"; case '3': return "Japanese 20W type"; default: return "Firmware: unknown"; } } /* * kenwood_ts480_set_level * Assumes rig!=NULL * * set levels of most functions * * WARNING: the commands differ slightly from the general versions in kenwood.c * e.g.: "SQ"=>"SQ0" , "AG"=>"AG0" */ int kenwood_ts480_set_level (RIG * rig, vfo_t vfo, setting_t level, value_t val) { char levelbuf[16]; int kenwood_val; switch (level) { case RIG_LEVEL_RFPOWER: kenwood_val = val.f * 100; /* level for TS480SAT is from 0.. 100W in SSB */ sprintf (levelbuf, "PC%03d", kenwood_val); break; case RIG_LEVEL_AF: kenwood_val = val.f * 255; /* possible values for TS480 are 000.. 255 */ sprintf (levelbuf, "AG0%03d", kenwood_val); break; case RIG_LEVEL_RF: kenwood_val = val.f * 100; /* possible values for TS480 are 000.. 100 */ sprintf (levelbuf, "RG%03d", kenwood_val); break; case RIG_LEVEL_SQL: kenwood_val = val.f * 255; /* possible values for TS480 are 000.. 255 */ sprintf (levelbuf, "SQ0%03d", kenwood_val); break; case RIG_LEVEL_AGC: /* possible values for TS480 000(=off), 001(=fast), 002(=slow) */ /* hamlib argument is int, possible values rig.h:enum agc_level_e */ switch (val.i) { case RIG_AGC_OFF: kenwood_val = 0; break; case RIG_AGC_FAST: kenwood_val = 1; break; case RIG_AGC_SLOW: kenwood_val = 2; break; default: rig_debug (RIG_DEBUG_ERR, "Unsupported agc value"); return -RIG_EINVAL; }; sprintf (levelbuf, "GT%03d", kenwood_val); break; default: rig_debug (RIG_DEBUG_ERR, "Unsupported set_level %d", level); return -RIG_EINVAL; } return kenwood_simple_cmd(rig, levelbuf); } /* * kenwood_get_level * Assumes rig!=NULL, val!=NULL */ int kenwood_ts480_get_level (RIG * rig, vfo_t vfo, setting_t level, value_t * val) { char ackbuf[50]; size_t ack_len = 50; int levelint; int retval; switch (level) { case RIG_LEVEL_RFPOWER: retval = kenwood_transaction (rig, "PC", 2, ackbuf, &ack_len); if (RIG_OK != retval) return retval; if (6 != ack_len) return -RIG_EPROTO; if (1 != sscanf (&ackbuf[2], "%d", &levelint)) return -RIG_EPROTO; val->f = (float) levelint / 100.; return RIG_OK; case RIG_LEVEL_AF: retval = kenwood_transaction (rig, "AG0", 3, ackbuf, &ack_len); if (RIG_OK != retval) return retval; if (7 != ack_len) return -RIG_EPROTO; if (1 != sscanf (&ackbuf[3], "%d", &levelint)) return -RIG_EPROTO; val->f = (float) levelint / 255.; return RIG_OK; case RIG_LEVEL_RF: retval = kenwood_transaction (rig, "RG", 2, ackbuf, &ack_len); if (RIG_OK != retval) return retval; if (6 != ack_len) return -RIG_EPROTO; if (1 != sscanf (&ackbuf[2], "%d", &levelint)) return -RIG_EPROTO; val->f = (float) levelint / 100.; return RIG_OK; case RIG_LEVEL_SQL: retval = kenwood_transaction (rig, "SQ0", 3, ackbuf, &ack_len); if (RIG_OK != retval) return retval; if (7 != ack_len) return -RIG_EPROTO; if (1 != sscanf (&ackbuf[3], "%d", &levelint)) return -RIG_EPROTO; val->f = (float) levelint / 255.; return RIG_OK; case RIG_LEVEL_AGC: retval = kenwood_transaction (rig, "GT", 2, ackbuf, &ack_len); if (RIG_OK != retval) return retval; if (6 != ack_len) return -RIG_EPROTO; switch (ackbuf[4]) { case '0': val->i = RIG_AGC_OFF; break; case '1': val->i = RIG_AGC_FAST; break; case '2': val->i = RIG_AGC_SLOW; break; default: return -RIG_EPROTO; } return RIG_OK; case RIG_LEVEL_MICGAIN: case RIG_LEVEL_PREAMP: case RIG_LEVEL_IF: case RIG_LEVEL_APF: case RIG_LEVEL_NR: case RIG_LEVEL_PBT_IN: case RIG_LEVEL_PBT_OUT: case RIG_LEVEL_CWPITCH: case RIG_LEVEL_KEYSPD: case RIG_LEVEL_NOTCHF: case RIG_LEVEL_COMP: case RIG_LEVEL_BKINDL: case RIG_LEVEL_BALANCE: return -RIG_ENIMPL; default: rig_debug (RIG_DEBUG_ERR, "Unsupported get_level %d", level); return -RIG_EINVAL; } return RIG_OK; /* never reached */ } static struct kenwood_priv_caps ts480_priv_caps = { .cmdtrm = EOM_KEN, }; /* * ts480 rig capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! */ const struct rig_caps ts480_caps = { .rig_model = RIG_MODEL_TS480, .model_name = "TS-480", .mfg_name = "Kenwood", .version = BACKEND_VER ".5", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG_MICDATA, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 115200, .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, .preamp = {12, RIG_DBLST_END,}, .attenuator = {12, RIG_DBLST_END,}, .max_rit = kHz (9.99), .max_xit = kHz (9.99), .max_ifshift = Hz (0), .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .rx_range_list1 = { {kHz(100), Hz(59999999), TS480_ALL_MODES, -1, -1, TS480_VFO}, RIG_FRNG_END, }, /*!< Receive frequency range list for ITU region 1 */ .tx_range_list1 = { {kHz(1810), kHz(1850), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, /* 100W class */ {kHz(1810), kHz(1850), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, /* 25W class */ {kHz(3500), kHz(3800), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {kHz(3500), kHz(3800), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {MHz(7), kHz(7200), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {MHz(7), kHz(7200), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {kHz(10100), kHz(10150), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {kHz(10100), kHz(10150), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {MHz(14), kHz(14350), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {MHz(14), kHz(14350), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {kHz(18068), kHz(18168), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {kHz(18068), kHz(18168), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {MHz(21), kHz(21450), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {MHz(21), kHz(21450), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {kHz(24890), kHz(24990), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {kHz(24890), kHz(24990), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {MHz(28), kHz(29700), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {MHz(28), kHz(29700), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {MHz(50), kHz(52000), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {MHz(50), kHz(52000), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, RIG_FRNG_END, }, /*!< Transmit frequency range list for ITU region 1 */ .rx_range_list2 = { {kHz(100), Hz(59999999), TS480_ALL_MODES, -1, -1, TS480_VFO}, RIG_FRNG_END, }, /*!< Receive frequency range list for ITU region 2 */ .tx_range_list2 = { {kHz(1800), MHz(2) - 1, TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, /* 100W class */ {kHz(1800), MHz(2) - 1, TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, /* 25W class */ {kHz(3500), MHz(4) - 1, TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {kHz(3500), MHz(4) - 1, TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {kHz(5250), kHz(5450), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {kHz(5250), kHz(5450), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {MHz(7), kHz(7300), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {MHz(7), kHz(7300), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {kHz(10100), kHz(10150), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {kHz(10100), kHz(10150), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {MHz(14), kHz(14350), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {MHz(14), kHz(14350), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {kHz(18068), kHz(18168), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {kHz(18068), kHz(18168), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {MHz(21), kHz(21450), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {MHz(21), kHz(21450), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {kHz(24890), kHz(24990), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {kHz(24890), kHz(24990), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {MHz(28), kHz(29700), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {MHz(28), kHz(29700), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, {MHz(50), kHz(52000), TS480_OTHER_TX_MODES, 5000, 100000, TS480_VFO}, {MHz(50), kHz(52000), TS480_AM_TX_MODES, 5000, 25000, TS480_VFO}, RIG_FRNG_END, }, /*!< Transmit frequency range list for ITU region 2 */ .tuning_steps = { {TS480_ALL_MODES,kHz(1)}, {TS480_ALL_MODES,Hz(2500)}, {TS480_ALL_MODES,kHz(5)}, {TS480_ALL_MODES,Hz(6250)}, {TS480_ALL_MODES,kHz(10)}, {TS480_ALL_MODES,Hz(12500)}, {TS480_ALL_MODES,kHz(15)}, {TS480_ALL_MODES,kHz(20)}, {TS480_ALL_MODES,kHz(25)}, {TS480_ALL_MODES,kHz(30)}, {TS480_ALL_MODES,kHz(100)}, {TS480_ALL_MODES,kHz(500)}, {TS480_ALL_MODES,MHz(1)}, {TS480_ALL_MODES,0}, /* any tuning step */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB, kHz(2.4)}, {RIG_MODE_CW, Hz(200)}, {RIG_MODE_RTTY, Hz(500)}, {RIG_MODE_AM, kHz(9)}, {RIG_MODE_FM, kHz(14)}, RIG_FLT_END, }, .priv = (void *) &ts480_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_rit = kenwood_set_rit, /* FIXME should this switch to rit mode or just set the frequency? */ .get_rit = kenwood_get_rit, .set_xit = kenwood_set_xit, /* FIXME should this switch to xit mode or just set the frequency? */ .get_xit = kenwood_get_xit, .set_mode = kenwood_set_mode, .get_mode = kenwood_get_mode, .set_vfo = kenwood_set_vfo, .get_vfo = kenwood_get_vfo_if, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt, .get_dcd = kenwood_get_dcd, .set_powerstat = kenwood_set_powerstat, .get_powerstat = kenwood_get_powerstat, .get_info = kenwood_ts480_get_info, .reset = kenwood_reset, .set_ant = kenwood_set_ant, .get_ant = kenwood_get_ant, .scan = kenwood_scan, /* not working, invalid arguments using rigctl; kenwood_scan does only support on/off and not tone and CTCSS scan */ .has_set_level = TS480_LEVEL_ALL, .has_get_level = TS480_LEVEL_ALL, .set_level = kenwood_ts480_set_level, .get_level = kenwood_ts480_get_level, .has_get_func = TS480_FUNC_ALL, .has_set_func = TS480_FUNC_ALL, .set_func = kenwood_set_func, .get_func = kenwood_get_func, }; /* * my notes: * format with: indent --line-length 200 ts480.c * * for the TS480 the function NR and BC have tree state: NR0,1,2 and BC0,1,2 * this cannot be send through the on/off logic of set_function! */ /* * Function definitions below */ hamlib-1.2.15.3/kenwood/thf7.c0000644000175000017500000002232012044564477012614 00000000000000/* * Hamlib Kenwood backend - TH-F7 description * Copyright (c) 2001-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "tones.h" #include "kenwood.h" #include "th.h" #define THF7_MODES_TX (RIG_MODE_FM) #define THF7_HIGH_MODES (RIG_MODE_FM|RIG_MODE_AM|RIG_MODE_WFM) #define THF7_ALL_MODES (THF7_HIGH_MODES|RIG_MODE_SSB|RIG_MODE_CW) #define THF7_FUNC_ALL (RIG_FUNC_ARO|RIG_FUNC_LOCK|RIG_FUNC_BC) /* * How incredible, there's no RIG_LEVEL_STRENGTH! */ #define THF7_LEVEL_ALL (RIG_LEVEL_SQL|RIG_LEVEL_RFPOWER|RIG_LEVEL_ATT|\ RIG_LEVEL_BALANCE|RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY) #define THF7_PARMS (RIG_PARM_APO|RIG_PARM_BEEP|RIG_PARM_BACKLIGHT) #define THF7_VFO_OP (RIG_OP_UP|RIG_OP_DOWN) #define THF7_ANTS (RIG_ANT_1|RIG_ANT_2) /* * TODO: * scan_group can only be get. scan_group=channel_num%50; */ #define THF7_CHANNEL_CAPS \ TH_CHANNEL_CAPS,\ .flags=1, \ .dcs_code=1, \ .dcs_sql=1, #define THF7_CHANNEL_CAPS_WO_LO \ TH_CHANNEL_CAPS,\ .dcs_code=1, \ .dcs_sql=1, /* CTCSS 01..42 */ static const tone_t thf7_ctcss_list[] = { 670, 693, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, 1365, 1413, 1462, 1514, 1567, 1622, 1679, 1738, 1799, 1862, 1928, 2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541, 0 }; static rmode_t thf7_mode_table[KENWOOD_MODE_TABLE_MAX] = { [0] = RIG_MODE_FM, [1] = RIG_MODE_WFM, [2] = RIG_MODE_AM, [3] = RIG_MODE_LSB, [4] = RIG_MODE_USB, [5] = RIG_MODE_CW }; /* * Band A & B */ #define THF7_VFO (RIG_VFO_A|RIG_VFO_B) static struct kenwood_priv_caps thf7_priv_caps = { .cmdtrm = EOM_TH, /* Command termination character */ .mode_table = thf7_mode_table, }; static int thf7e_init(RIG *rig); static int thf7e_open(RIG *rig); static int thf7e_get_vfo (RIG *rig, vfo_t *vfo); static int thf7e_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); /* * TH-F7E rig capabilities. * * Manual, thanks to K6MAY: http://www.k6may.com/KenwoodTHF6Tip1.shtml * * TODO: * - set/get_ctcss_tone/sql through set/get_channel() and VR/VW * - emulate RIG_FUNC_TONE|RIG_FUNC_TSQL by setting ctcss_tone/sql to 0/non zero? */ const struct rig_caps thf7e_caps = { .rig_model = RIG_MODEL_THF7E, .model_name = "TH-F7E", .mfg_name = "Kenwood", .version = TH_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_HANDHELD, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .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 = 500, .retry = 3, .has_get_func = THF7_FUNC_ALL, .has_set_func = THF7_FUNC_ALL|RIG_FUNC_TBURST, .has_get_level = THF7_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(THF7_LEVEL_ALL), .has_get_parm = THF7_PARMS, .has_set_parm = THF7_PARMS, .level_gran = { [LVL_SQL] = { .min = { .i = 0 }, .max = { .i = 5 } }, [LVL_RFPOWER] = { .min = { .i = 2 }, .max = { .i = 0 } }, }, .parm_gran = {}, .ctcss_list = thf7_ctcss_list, .dcs_list = common_dcs_list, .preamp = { RIG_DBLST_END, }, .attenuator = { 20, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .vfo_ops = THF7_VFO_OP, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, /* TBC */ .bank_qty = 0, .chan_desc_sz = 8, .chan_list = { { 0, 399, RIG_MTYPE_MEM , {THF7_CHANNEL_CAPS}}, /* normal MEM */ { 400,409, RIG_MTYPE_EDGE, {THF7_CHANNEL_CAPS}}, /* L0-L9 lower scan limit */ { 410,419, RIG_MTYPE_EDGE, {THF7_CHANNEL_CAPS}}, /* U0-U9 upper scan limit */ { 420,429, RIG_MTYPE_MEM, {THF7_CHANNEL_CAPS}}, /* I0-I9 info */ { 430,431, RIG_MTYPE_PRIO, {THF7_CHANNEL_CAPS}}, /* PR0,PR1 priority */ { 432,434, RIG_MTYPE_CALL, {THF7_CHANNEL_CAPS_WO_LO}}, /* Call (for each ham band) */ { 435,449, RIG_MTYPE_BAND, {THF7_CHANNEL_CAPS_WO_LO}}, /* VFO */ /* 3 A-band VFO */ /* 11 B-band VFO */ /* TODO: 10 DTMF */ RIG_CHAN_END, }, .rx_range_list1 = { /* RIG_ANT_2 is internal bar antenna */ {MHz(144),MHz(146),THF7_MODES_TX,-1,-1,RIG_VFO_MEM|RIG_VFO_A,RIG_ANT_1}, {MHz(430),MHz(440),THF7_MODES_TX,-1,-1,RIG_VFO_MEM|RIG_VFO_A,RIG_ANT_1}, {kHz(100),MHz(470),THF7_ALL_MODES,-1,-1,RIG_VFO_MEM|RIG_VFO_B, RIG_ANT_1|RIG_ANT_2}, {MHz(470),GHz(1.3),THF7_HIGH_MODES,-1,-1,RIG_VFO_MEM|RIG_VFO_B,RIG_ANT_1}, RIG_FRNG_END }, .tx_range_list1 = { /* power actually depends on DC power supply */ {MHz(144),MHz(146),THF7_MODES_TX,W(0.05),W(5),RIG_VFO_MEM|RIG_VFO_A,RIG_ANT_1}, {MHz(430),MHz(440),THF7_MODES_TX,W(0.05),W(5),RIG_VFO_MEM|RIG_VFO_A,RIG_ANT_1}, RIG_FRNG_END }, /* region 2 is model TH-F6A in fact */ .rx_range_list2 = { /* RIG_ANT_2 is internal bar antenna */ {MHz(144),MHz(148),THF7_MODES_TX,-1,-1,RIG_VFO_MEM|RIG_VFO_A,RIG_ANT_1}, {MHz(222),MHz(225),THF7_MODES_TX,-1,-1,RIG_VFO_MEM|RIG_VFO_A,RIG_ANT_1}, {MHz(430),MHz(450),THF7_MODES_TX,-1,-1,RIG_VFO_MEM|RIG_VFO_A,RIG_ANT_1}, {kHz(100),MHz(470),THF7_ALL_MODES,-1,-1,RIG_VFO_MEM|RIG_VFO_B, RIG_ANT_1|RIG_ANT_2}, {MHz(470),GHz(1.3),THF7_HIGH_MODES,-1,-1,RIG_VFO_MEM|RIG_VFO_B,RIG_ANT_1}, RIG_FRNG_END }, .tx_range_list2 = { /* power actually depends on DC power supply */ {MHz(144),MHz(148),THF7_MODES_TX,W(0.05),W(5),RIG_VFO_MEM|RIG_VFO_A,RIG_ANT_1}, {MHz(222),MHz(225),THF7_MODES_TX,W(0.05),W(5),RIG_VFO_MEM|RIG_VFO_A,RIG_ANT_1}, {MHz(430),MHz(450),THF7_MODES_TX,W(0.05),W(5),RIG_VFO_MEM|RIG_VFO_A,RIG_ANT_1}, RIG_FRNG_END }, .tuning_steps = { /* This table is ordered according to protocol, from '0' to 'b' */ /* The steps are not available on every band/frequency limit 470MHz */ {THF7_ALL_MODES,kHz(5)}, {THF7_ALL_MODES,kHz(6.25)}, {THF7_ALL_MODES,kHz(8.33)}, {THF7_ALL_MODES,kHz(9)}, {THF7_ALL_MODES,kHz(10)}, {THF7_ALL_MODES,kHz(12.5)}, {THF7_ALL_MODES,kHz(15)}, {THF7_ALL_MODES,kHz(20)}, {THF7_ALL_MODES,kHz(25)}, {THF7_ALL_MODES,kHz(30)}, {THF7_ALL_MODES,kHz(50)}, {THF7_ALL_MODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { /* real width to be checked (missing specs) */ {RIG_MODE_FM, kHz(12)}, {RIG_MODE_FM, kHz(6)}, /* narrow FM */ {RIG_MODE_AM, kHz(9)}, {RIG_MODE_WFM, kHz(150)}, /* or 230? */ {RIG_MODE_SSB|RIG_MODE_CW, kHz(3)}, RIG_FLT_END, }, .priv = (void *)&thf7_priv_caps, .rig_init = thf7e_init, .rig_cleanup = kenwood_cleanup, .rig_open = thf7e_open, .set_freq = th_set_freq, .get_freq = th_get_freq, .set_mode = th_set_mode, .get_mode = th_get_mode, .set_vfo = th_set_vfo, .get_vfo = thf7e_get_vfo, .set_ptt = th_set_ptt, .get_dcd = th_get_dcd, .vfo_op = thf7e_vfo_op, .set_mem = th_set_mem, .get_mem = th_get_mem, .set_func = th_set_func, .get_func = th_get_func, .set_level = th_set_level, .get_level = th_get_level, .get_parm = th_get_parm, .set_parm = th_set_parm, .get_info = th_get_info, .set_channel = th_set_channel, .get_channel = th_get_channel, .set_ant = th_set_ant, .get_ant = th_get_ant, .reset = th_reset, }; int thf7e_init(RIG *rig) { rig->state.itu_region = RIG_ITU_REGION1; return kenwood_init(rig); } int thf7e_open(RIG *rig) { /* TH-F7E is Region 1 only. * Region 2 is supported by TH-F6A */ if (rig->state.itu_region != RIG_ITU_REGION1) return -RIG_ECONF; return kenwood_open(rig); } /* * th_get_vfo * Assumes rig!=NULL */ int thf7e_get_vfo(RIG *rig, vfo_t *vfo) { char vfoch; int retval; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); retval = th_get_vfo_char(rig, vfo, &vfoch); if (retval != RIG_OK) return retval; switch (vfoch) { case '0' : case '3' : /* Fine Step Enable */ break; case '1' : /* MR */ case '2' : /* CALL */ case '4' : /* INFO */ *vfo = RIG_VFO_MEM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unexpected VFO value '%c'\n", __func__, vfoch); return -RIG_EVFO; } return RIG_OK; } /* * thf7e_vfo_op */ int thf7e_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; switch(op) { case RIG_OP_UP: return kenwood_simple_cmd(rig, "UP"); case RIG_OP_DOWN: return kenwood_simple_cmd(rig, "DW"); /* Not implemented! case RIG_OP_BAND_UP: return kenwood_simple_cmd(rig, "BU"); case RIG_OP_BAND_DOWN: return kenwood_simple_cmd(rig, "BD"); */ default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported op %#x\n", __func__, op); return -RIG_EINVAL; } } hamlib-1.2.15.3/kenwood/tmd700.c0000644000175000017500000001552512044564477012770 00000000000000/* * Hamlib Kenwood backend - TM-D700 description * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "hamlib/rig.h" #include "kenwood.h" #include "th.h" #include "tones.h" #define TMD700_MODES (RIG_MODE_FM|RIG_MODE_AM) #define TMD700_MODES_TX (RIG_MODE_FM) /* TBC */ #define TMD700_FUNC_ALL (RIG_FUNC_TSQL| \ RIG_FUNC_AIP| \ RIG_FUNC_MON| \ RIG_FUNC_MUTE| \ RIG_FUNC_SQL| \ RIG_FUNC_TONE| \ RIG_FUNC_TBURST| \ RIG_FUNC_REV| \ RIG_FUNC_LOCK| \ RIG_FUNC_ARO) #define TMD700_LEVEL_ALL (RIG_LEVEL_STRENGTH| \ RIG_LEVEL_SQL| \ RIG_LEVEL_AF| \ RIG_LEVEL_RF|\ RIG_LEVEL_MICGAIN) #define TMD700_PARMS (RIG_PARM_BACKLIGHT|\ RIG_PARM_BEEP|\ RIG_PARM_APO) #define TMD700_VFO_OP (RIG_OP_UP|RIG_OP_DOWN) #define TMD700_CHANNEL_CAPS \ TH_CHANNEL_CAPS,\ .flags=1, \ .dcs_code=1, \ .dcs_sql=1, #define TMD700_CHANNEL_CAPS_WO_LO \ TH_CHANNEL_CAPS,\ .dcs_code=1, \ .dcs_sql=1, /* * TODO: Band A & B */ #define TMD700_VFO (RIG_VFO_A|RIG_VFO_B) static rmode_t tmd700_mode_table[KENWOOD_MODE_TABLE_MAX] = { [0] = RIG_MODE_FM, [1] = RIG_MODE_AM, }; static struct kenwood_priv_caps tmd700_priv_caps = { .cmdtrm = EOM_TH, /* Command termination character */ .mode_table = tmd700_mode_table, }; /* * TM-D700 rig capabilities. * * specs: http://www.geocities.jp/hkwatarin/TM-D700/English/spec.htm * protocol: http://www.qsl.net/k/k7jar//pages/D700Cmds.html */ const struct rig_caps tmd700_caps = { .rig_model = RIG_MODEL_TMD700, .model_name = "TM-D700", .mfg_name = "Kenwood", .version = TH_VER, .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_MOBILE|RIG_FLAG_APRS|RIG_FLAG_TNC, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 9600, .serial_rate_max = 57600, .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 = 1000, .retry = 3, .has_get_func = TMD700_FUNC_ALL, .has_set_func = TMD700_FUNC_ALL, .has_get_level = TMD700_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(TMD700_LEVEL_ALL), .has_get_parm = TMD700_PARMS, .has_set_parm = TMD700_PARMS, /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 7 } }, [LVL_SQL] = { .min = { .i = 0 }, .max = { .i = 0x1f }, .step = { .f = 1./0x1f } }, [LVL_RFPOWER] = { .min = { .i = 2 }, .max = { .i = 0 }, .step = { .f = 1./3. } }, [LVL_AF] = { .min = { .i = 0 }, .max = { .i = 0x3f }, .step = { .f = 1./0x3f } }, }, .parm_gran = {}, .ctcss_list = kenwood38_ctcss_list, .dcs_list = common_dcs_list, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .vfo_ops = TMD700_VFO_OP, .scan_ops = RIG_SCAN_VFO, .targetable_vfo = RIG_TARGETABLE_NONE, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 8, .chan_list = { { 1, 199, RIG_MTYPE_MEM , {TMD700_CHANNEL_CAPS}}, /* normal MEM */ { 200,219, RIG_MTYPE_EDGE , {TMD700_CHANNEL_CAPS}}, /* U/L MEM */ { 221,222, RIG_MTYPE_CALL, {TMD700_CHANNEL_CAPS_WO_LO}}, /* Call 0/1 */ RIG_CHAN_END, }, /* * TODO: Japan & TM-D700S, and Taiwan models */ .rx_range_list1 = { {MHz(118),MHz(470),TMD700_MODES,-1,-1,RIG_VFO_A}, {MHz(136),MHz(174),RIG_MODE_FM,-1,-1,RIG_VFO_B}, {MHz(300),MHz(524),RIG_MODE_FM,-1,-1,RIG_VFO_B}, {MHz(800),MHz(1300),RIG_MODE_FM,-1,-1,RIG_VFO_B}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { {MHz(144),MHz(146),TMD700_MODES_TX,W(5),W(50),RIG_VFO_A}, {MHz(430),MHz(440),TMD700_MODES_TX,W(5),W(35),RIG_VFO_A}, RIG_FRNG_END, }, /* tx range */ .rx_range_list2 = { {MHz(118),MHz(470),TMD700_MODES,-1,-1,RIG_VFO_A}, {MHz(136),MHz(174),RIG_MODE_FM,-1,-1,RIG_VFO_B}, {MHz(300),MHz(524),RIG_MODE_FM,-1,-1,RIG_VFO_B}, {MHz(800),MHz(1300),RIG_MODE_FM,-1,-1,RIG_VFO_B}, /* TODO: cellular blocked */ RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {MHz(144),MHz(148),TMD700_MODES_TX,W(5),W(50),RIG_VFO_A}, {MHz(430),MHz(450),TMD700_MODES_TX,W(5),W(35),RIG_VFO_A}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {TMD700_MODES,kHz(5)}, {TMD700_MODES,kHz(6.25)}, {TMD700_MODES,kHz(10)}, {TMD700_MODES,kHz(12.5)}, {TMD700_MODES,kHz(15)}, {TMD700_MODES,kHz(20)}, {TMD700_MODES,kHz(25)}, {TMD700_MODES,kHz(30)}, {TMD700_MODES,kHz(50)}, {TMD700_MODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_FM, kHz(12)}, {RIG_MODE_AM, kHz(9)}, /* TBC */ RIG_FLT_END, }, .priv = (void *)&tmd700_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = th_set_freq, .get_freq = th_get_freq, .set_mode = th_set_mode, .get_mode = th_get_mode, .set_vfo = tm_set_vfo_bc2, .get_vfo = th_get_vfo, .set_split_vfo = th_set_split_vfo, .get_split_vfo = th_get_split_vfo, .set_ctcss_tone = th_set_ctcss_tone, .get_ctcss_tone = th_get_ctcss_tone, .set_ctcss_sql = th_set_ctcss_sql, .get_ctcss_sql = th_get_ctcss_sql, .set_dcs_sql = th_set_dcs_sql, .get_dcs_sql = th_get_dcs_sql, .set_mem = th_set_mem, .get_mem = th_get_mem, .set_channel = th_set_channel, .get_channel = th_get_channel, .set_trn = th_set_trn, .get_trn = th_get_trn, .set_func = th_set_func, .get_func = th_get_func, .set_level = th_set_level, .get_level = th_get_level, .set_parm = th_set_parm, .get_parm = th_get_parm, .get_info = th_get_info, .get_dcd = th_get_dcd, .set_ptt = th_set_ptt, .vfo_op = th_vfo_op, .scan = th_scan, .decode_event = th_decode_event, }; /* end of file */ hamlib-1.2.15.3/kenwood/ts2000.c0000644000175000017500000007317012044564477012705 00000000000000/* * Hamlib Kenwood backend - TS2000 description * Copyright (c) 2000-2011 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "kenwood.h" #define TS2000_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define TS2000_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define TS2000_AM_TX_MODES RIG_MODE_AM #define TS2000_FUNC_ALL (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_BC|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_ANF|RIG_FUNC_COMP) #define TS2000_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_VOX|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_CWPITCH|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD|RIG_LEVEL_COMP|RIG_LEVEL_AGC|RIG_LEVEL_BKINDL|RIG_LEVEL_METER|RIG_LEVEL_VOXGAIN|RIG_LEVEL_ANTIVOX|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH) #define TS2000_MAINVFO (RIG_VFO_A|RIG_VFO_B) #define TS2000_SUBVFO (RIG_VFO_C) #define TS2000_VFO_OP (RIG_OP_UP|RIG_OP_DOWN|RIG_OP_BAND_UP|RIG_OP_BAND_DOWN) #define TS2000_SCAN_OP (RIG_SCAN_VFO) #define TS2000_ANTS (RIG_ANT_1|RIG_ANT_2) #define TS2000_STR_CAL {9, {\ {0x00, -54},\ {0x03, -48},\ {0x06, -36},\ {0x09, -24},\ {0x0C, -12},\ {0x0F, 0},\ {0x14, 20},\ {0x19, 40},\ {0x1E, 60}}\ } /* prototypes */ static int ts2000_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int ts2000_get_channel(RIG *rig, channel_t *chan); static int ts2000_set_channel(RIG *rig, const channel_t *chan); /* * 38 CTCSS sub-audible tones + 1750 tone */ const tone_t ts2000_ctcss_list[] = { 670, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, 1365, 1413, 1462, 1514, 1567, 1622, 1679, 1738, 1799, 1862, 1928, 2035, 2107, 2181, 2257, 2336, 2418, 2503, 17500, 0, }; /* * 103 available DCS codes */ static const tone_t ts2000_dcs_list[] = { 23, 25, 26, 31, 32, 36, 43, 47, 51, 53, 54, 65, 71, 72, 73, 74, 114, 115, 116, 122, 125, 131, 132, 134, 143, 145, 152, 155, 156, 162, 165, 172, 174, 205, 212, 223, 225, 226, 243, 244, 245, 246, 251, 252, 255, 261, 263, 265, 266, 271, 274, 306, 311, 315, 325, 331, 332, 343, 346, 351, 356, 364, 365, 371, 411, 412, 413, 423, 431, 432, 445, 446, 452, 454, 455, 462, 464, 465, 466, 503, 506, 516, 523, 526, 532, 546, 565, 606, 612, 624, 627, 631, 632, 654, 662, 664, 703, 712, 723, 731, 732, 734, 743, 754, 0, }; static struct kenwood_priv_caps ts2000_priv_caps = { .cmdtrm = EOM_KEN, }; /* memory capabilities */ #define TS2000_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .tx_freq=1, \ .tx_mode=1, \ .split=1, \ .rptr_shift=1, \ .rptr_offs=1, \ .funcs=RIG_FUNC_REV|RIG_FUNC_TONE|RIG_FUNC_TSQL,\ .tuning_step=1, \ .ctcss_tone=1, \ .ctcss_sql=1, \ .dcs_code=1, \ .dcs_sql=1, \ .scan_group=1, \ .flags=1, \ .channel_desc=1 \ } /* * ts2000 rig capabilities. * * part of infos comes from http://www.kenwood.net/ */ const struct rig_caps ts2000_caps = { .rig_model = RIG_MODEL_TS2000, .model_name = "TS-2000", .mfg_name = "Kenwood", .version = BACKEND_VER ".4", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 57600, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 50, /* ms */ .timeout = 200, .retry = 3, .has_get_func = TS2000_FUNC_ALL, .has_set_func = TS2000_FUNC_ALL, .has_get_level = TS2000_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(TS2000_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .vfo_ops = TS2000_VFO_OP, .scan_ops = TS2000_SCAN_OP, .ctcss_list = ts2000_ctcss_list, .dcs_list = ts2000_dcs_list, .preamp = { 20, RIG_DBLST_END, }, /* FIXME: real preamp? */ .attenuator = { 20, RIG_DBLST_END, }, .max_rit = kHz(20), .max_xit = kHz(20), .max_ifshift = kHz(1), .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 7, .chan_list = { { 0, 299, RIG_MTYPE_MEM, TS2000_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(300),MHz(60),TS2000_ALL_MODES,-1,-1,TS2000_MAINVFO,TS2000_ANTS}, {MHz(144),MHz(146),TS2000_ALL_MODES,-1,-1,TS2000_MAINVFO}, {MHz(430),MHz(440),TS2000_ALL_MODES,-1,-1,TS2000_MAINVFO}, {MHz(144),MHz(146),TS2000_ALL_MODES,-1,-1,TS2000_SUBVFO}, {MHz(430),MHz(440),TS2000_ALL_MODES,-1,-1,TS2000_SUBVFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { {kHz(1830),kHz(1850),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {kHz(1830),kHz(1850),TS2000_AM_TX_MODES,2000,25000,TS2000_MAINVFO,TS2000_ANTS}, {kHz(3500),kHz(3800),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {kHz(3500),kHz(3800),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {MHz(7),kHz(7100),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {MHz(7),kHz(7100),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {MHz(10.1),MHz(10.15),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {MHz(10.1),MHz(10.15),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {MHz(14),kHz(14350),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {MHz(14),kHz(14350),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {kHz(18068),kHz(18168),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {kHz(18068),kHz(18168),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {MHz(21),kHz(21450),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {MHz(21),kHz(21450),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {kHz(24890),kHz(24990),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {kHz(24890),kHz(24990),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {MHz(28),kHz(29700),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {MHz(28),kHz(29700),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {MHz(50),MHz(50.2),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {MHz(50),MHz(50.2),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {MHz(144),MHz(146),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO}, {MHz(144),MHz(146),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO}, {MHz(430),MHz(440),TS2000_OTHER_TX_MODES,W(5),W(50),TS2000_MAINVFO}, {MHz(430),MHz(440),TS2000_AM_TX_MODES,W(5),W(12.5),TS2000_MAINVFO}, RIG_FRNG_END, }, /* tx range */ .rx_range_list2 = { {kHz(300),MHz(60),TS2000_ALL_MODES,-1,-1,TS2000_MAINVFO,TS2000_ANTS}, {MHz(142),MHz(152),TS2000_ALL_MODES,-1,-1,TS2000_MAINVFO}, {MHz(420),MHz(450),TS2000_ALL_MODES,-1,-1,TS2000_MAINVFO}, {MHz(118),MHz(174),TS2000_ALL_MODES,-1,-1,TS2000_SUBVFO}, {MHz(220),MHz(512),TS2000_ALL_MODES,-1,-1,TS2000_SUBVFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {kHz(1800),MHz(2),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {kHz(1800),MHz(2),TS2000_AM_TX_MODES,2000,25000,TS2000_MAINVFO,TS2000_ANTS}, {kHz(3500),MHz(4),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {kHz(3500),MHz(4),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {MHz(7),kHz(7300),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {MHz(7),kHz(7300),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {MHz(10.1),MHz(10.15),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {MHz(10.1),MHz(10.15),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {MHz(14),kHz(14350),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {MHz(14),kHz(14350),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {kHz(18068),kHz(18168),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {kHz(18068),kHz(18168),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {MHz(21),kHz(21450),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {MHz(21),kHz(21450),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {kHz(24890),kHz(24990),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {kHz(24890),kHz(24990),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {MHz(28),kHz(29700),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {MHz(28),kHz(29700),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {MHz(50),MHz(54),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO,TS2000_ANTS}, {MHz(50),MHz(54),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO,TS2000_ANTS}, {MHz(144),MHz(148),TS2000_OTHER_TX_MODES,W(5),W(100),TS2000_MAINVFO}, {MHz(144),MHz(148),TS2000_AM_TX_MODES,W(5),W(25),TS2000_MAINVFO}, {MHz(430),MHz(450),TS2000_OTHER_TX_MODES,W(5),W(50),TS2000_MAINVFO}, {MHz(430),MHz(450),TS2000_AM_TX_MODES,W(5),W(12.5),TS2000_MAINVFO}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY,1}, {TS2000_ALL_MODES,10}, {TS2000_ALL_MODES,100}, {TS2000_ALL_MODES,kHz(1)}, {TS2000_ALL_MODES,kHz(2.5)}, {TS2000_ALL_MODES,kHz(5)}, {RIG_MODE_AM|RIG_MODE_FM,kHz(6.25)}, {TS2000_ALL_MODES,kHz(10)}, {RIG_MODE_AM|RIG_MODE_FM,kHz(12.5)}, {RIG_MODE_AM|RIG_MODE_FM,kHz(12.5)}, {RIG_MODE_AM|RIG_MODE_FM,kHz(15)}, {RIG_MODE_AM|RIG_MODE_FM,kHz(20)}, {RIG_MODE_AM|RIG_MODE_FM,kHz(25)}, {RIG_MODE_AM|RIG_MODE_FM,kHz(30)}, {RIG_MODE_AM|RIG_MODE_FM,kHz(50)}, {RIG_MODE_AM|RIG_MODE_FM,kHz(100)}, {TS2000_ALL_MODES,MHz(1)}, {TS2000_ALL_MODES,0}, /* any tuning step */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB, kHz(2.2)}, {RIG_MODE_CW, Hz(600)}, {RIG_MODE_RTTY, Hz(1500)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM|RIG_MODE_AM, kHz(12)}, RIG_FLT_END, }, .str_cal = TS2000_STR_CAL, .priv = (void *)&ts2000_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_xit = kenwood_set_xit, .get_xit = kenwood_get_xit, .set_mode = kenwood_set_mode, .get_mode = kenwood_get_mode, .set_vfo = kenwood_set_vfo, .get_vfo = kenwood_get_vfo_if, .set_ctcss_tone = kenwood_set_ctcss_tone_tn, .get_ctcss_tone = kenwood_get_ctcss_tone, .set_ctcss_sql = kenwood_set_ctcss_sql, .get_ctcss_sql = kenwood_get_ctcss_sql, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt, .get_dcd = kenwood_get_dcd, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .set_level = kenwood_set_level, .get_level = ts2000_get_level, .set_ant = kenwood_set_ant, .get_ant = kenwood_get_ant, .send_morse = kenwood_send_morse, .vfo_op = kenwood_vfo_op, .scan = kenwood_scan, .set_mem = kenwood_set_mem, .get_mem = kenwood_get_mem, .get_channel = ts2000_get_channel, .set_channel = ts2000_set_channel, .set_trn = kenwood_set_trn, .get_trn = kenwood_get_trn, .set_powerstat = kenwood_set_powerstat, .get_powerstat = kenwood_get_powerstat, .get_info = kenwood_get_info, .reset = kenwood_reset, }; /* * Function definitions below */ /* * ts2000_get_channel * Read command format: M|R|P1|P2|P3|P3|;| * P1: 0 - RX frequency, 1 - TX frequency Memory channel 290 ~ 299: P1=0 (start frequency), P1=1 (end frequency) P2 - bank number allowed values: , 0, 1 or 2 P3 - channel number 00-99 Returned value: M | R |P1 |P2 |P3 |P3 |P4 |P4 |P4 |P4 | P4 |P4 |P4 |P4 |P4 |P4 |P4 |P5 |P6 |P7 | P8 |P8 |P9 |P9 |P10|P10|P10|P11|P12|P13| P13|P13|P13|P13|P13|P13|P13|P13|P14|P14| P15|P16|P16|P16|P16|P16|P16|P16|P16| ; | P1 - P3 described above P4: Frequency in Hz (11-digit). P5: Mode. 1: LSB, 2: USB, 3: CW, 4: FM, 5: AM, 6: FSK, 7: CR-R, 8: Reserved, 9: FSK-R P6: Lockout status. 0: Lockout OFF, 1: Lockout ON. P7: 0: OFF, 1: TONE, 2: CTCSS, 3: DCS. P8: Tone Number. Allowed values 01 (67Hz) - 38 (250.3Hz) P9: CTCSS tone number. Allowed values 01 (67Hz) - 38 (250.3Hz) P10: DCS code. Allowed values 000 (023 DCS code) to 103 (754 DCS code). P11: REVERSE status. P12: SHIFT status. 0: Simplex, 1: +, 2: –, 3: = (All E-types) P13: Offset frequency in Hz (9-digit). Allowed values 000000000 - 059950000 in steps of 50000. Unused digits must be 0. P14: Step size. Allowed values: for SSB, CW, FSK mode: 00 - 03 00: 1 kHz, 01: 2.5 kHz, 02: 5 kHz, 03: 10 kHz for AM, FM mode: 00 - 09 00: 5 kHz, 01: 6.25 kHz, 02: 10 kHz, 03: 12.5 kHz, 04: 15 kHz, 05: 20 kHz, 06: 25 kHz, 07: 30 kHz, 08: 50 kHz, 09: 100 kHz P15: Memory Group number (0 ~ 9). P16: Memory name. A maximum of 8 characters. */ int ts2000_get_channel(RIG *rig, channel_t *chan) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !chan || chan->vfo != RIG_VFO_MEM) return -RIG_EINVAL; int err; char buf[52]; size_t buf_size = 52; char cmd[8]; struct kenwood_priv_caps *caps = kenwood_caps(rig); /* put channel num in the command string */ sprintf(cmd, "MR0%03d;", chan->channel_num); err = kenwood_transaction(rig, cmd, strlen(cmd), buf, &buf_size ); if (err != RIG_OK) return err; memset(chan, 0x00, sizeof(channel_t)); chan->vfo = RIG_VFO_MEM; /* parse from right to left */ /* XXX based on the available documentation, there is no command * to read out the filters of a given memory channel. The rig, however, * stores this information. */ /* Replace ';' with '\0' */ buf[ buf_size-1 ] = '\0'; /* First check if a name is assigned. Name is returned at positions 41-48 (counting from 0) */ if( buf_size > 41 ){ // rig_debug(RIG_DEBUG_VERBOSE, "Copying channel description: %s\n", &buf[ 41 ] ); strcpy( chan->channel_desc, &buf[ 41 ] ); } /* Memory group no */ chan->scan_group = buf[ 40 ] - '0'; /* Fileds 38-39 contain tuning step as a number 00 - 09. Tuning step depends on this number and the mode, just save it for now */ buf[ 40 ] = '\0'; int tmp; tmp = atoi( &buf[ 38] ); /* Offset frequency */ buf[ 38 ] = '\0'; chan->rptr_offs = atoi( &buf[ 29 ] ); /* Shift type WARNING: '=' shift type not programmed */ if( buf[ 28 ] == '1' ){ chan->rptr_shift = RIG_RPT_SHIFT_PLUS; }else{ if( buf[ 28 ] == '2' ){ chan->rptr_shift = RIG_RPT_SHIFT_MINUS; }else{ chan->rptr_shift = RIG_RPT_SHIFT_NONE; } } /* Reverse status */ if( buf[27] == '1' ){ chan->funcs |= RIG_FUNC_REV; } /* Check for tone, CTCSS and DCS */ /* DCS code first */ if( buf[ 19 ] == '3' ){ if( rig->caps->dcs_list ){ buf[ 27 ] = '\0'; chan->dcs_code = rig->caps->dcs_list[ atoi( &buf[ 24 ] ) ]; chan->dcs_sql = chan->dcs_code; chan->ctcss_tone = 0; chan->ctcss_sql = 0; } }else{ chan->dcs_code = 0; chan->dcs_sql = 0; /* CTCSS code Caution, CTCSS codes, unlike DCS codes, are numbered from 1! */ buf[ 24 ] = '\0'; if( buf[ 19 ] == '2' ){ chan->funcs |= RIG_FUNC_TSQL; if (rig->caps->ctcss_list){ chan->ctcss_sql = rig->caps->ctcss_list[ atoi( &buf[22] )-1 ]; chan->ctcss_tone = 0; } }else{ chan->ctcss_sql = 0; /* CTCSS tone */ if( buf[ 19 ] == '1' ){ chan->funcs |= RIG_FUNC_TONE; buf[ 22 ] = '\0'; if (rig->caps->ctcss_list) chan->ctcss_tone = rig->caps->ctcss_list[ atoi( &buf[20] )-1 ]; }else{ chan->ctcss_tone = 0; } } } /* memory lockout */ if (buf[18] == '1') chan->flags |= RIG_CHFLAG_SKIP; /* mode */ chan->mode = kenwood2rmode(buf[17] - '0', caps->mode_table); /* Now we have the mode, let's finish the tuning step */ if( (chan->mode == RIG_MODE_AM) || (chan->mode == RIG_MODE_FM) ){ switch (tmp){ case 0: chan->tuning_step = kHz(5); break; case 1: chan->tuning_step = kHz(6.25); break; case 2: chan->tuning_step = kHz(10); break; case 3: chan->tuning_step = kHz(12.5); break; case 4: chan->tuning_step = kHz(15); break; case 5: chan->tuning_step = kHz(20); break; case 6: chan->tuning_step = kHz(25); break; case 7: chan->tuning_step = kHz(30); break; case 8: chan->tuning_step = kHz(50); break; case 9: chan->tuning_step = kHz(100); break; default: chan->tuning_step = 0; } }else{ switch (tmp){ case 0: chan->tuning_step = kHz(1); break; case 1: chan->tuning_step = kHz(2.5); break; case 2: chan->tuning_step = kHz(5); break; case 3: chan->tuning_step = kHz(10); break; default: chan->tuning_step = 0; } } /* Frequency */ buf[17] = '\0'; chan->freq = atoi(&buf[6]); if (chan->freq == RIG_FREQ_NONE) return -RIG_ENAVAIL; buf[6] = '\0'; chan->channel_num = atoi(&buf[3]); /* Check split freq */ cmd[2] = '1'; buf_size = 52; err = kenwood_transaction(rig, cmd, strlen(cmd), buf, &buf_size ); if (err != RIG_OK) return err; chan->tx_mode = kenwood2rmode(buf[17] - '0', caps->mode_table); buf[17] = '\0'; chan->tx_freq = atoi(&buf[6]); if (chan->freq == chan->tx_freq) { chan->tx_freq = RIG_FREQ_NONE; chan->tx_mode = RIG_MODE_NONE; chan->split = RIG_SPLIT_OFF; } else chan->split = RIG_SPLIT_ON; return RIG_OK; } int ts2000_set_channel(RIG *rig, const channel_t *chan) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !chan) return -RIG_EINVAL; char buf[55]; char mode, tx_mode = 0; int err; int tone = 0; struct kenwood_priv_caps *caps = kenwood_caps(rig); mode = rmode2kenwood(chan->mode, caps->mode_table); if (mode < 0 ) { rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode '%s'\n", __func__, rig_strrmode(chan->mode)); return -RIG_EINVAL; } if (chan->split == RIG_SPLIT_ON) { tx_mode = rmode2kenwood(chan->tx_mode, caps->mode_table); if (tx_mode < 0 ) { rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode '%s'\n", __func__, rig_strrmode(chan->tx_mode)); return -RIG_EINVAL; } } /* find tone */ char sqltype = '0'; if (chan->ctcss_tone) { for (; rig->caps->ctcss_list[tone] != 0; tone++) { if (chan->ctcss_tone == rig->caps->ctcss_list[tone]) break; } if (chan->ctcss_tone != rig->caps->ctcss_list[tone]) tone = -1; else sqltype = '1'; }else{ tone = -1; /* -1 because we will add 1 when outputing; this is necessary as CTCSS codes are numbered from 1 */ } /* find CTCSS code */ short code = 0; if (chan->ctcss_sql) { for (; rig->caps->ctcss_list[code] != 0; code++) { if (chan->ctcss_sql == rig->caps->ctcss_list[code]) break; } if (chan->ctcss_sql != rig->caps->ctcss_list[code]) code = -1; else sqltype = '2'; }else{ code = -1; } /* find DCS code */ short dcscode = 0; if (chan->dcs_code) { for (; rig->caps->dcs_list[dcscode] != 0; dcscode++) { if (chan->dcs_code == rig->caps->dcs_list[dcscode]) break; } if (chan->dcs_code != rig->caps->dcs_list[dcscode]) dcscode = 0; else sqltype = '3'; }else{ dcscode = 0; } char shift = '0'; if( chan->rptr_shift == RIG_RPT_SHIFT_PLUS ){ shift = '1'; } if( chan->rptr_shift == RIG_RPT_SHIFT_MINUS ){ shift = '2'; } int tstep = 0; if( (chan->mode == RIG_MODE_AM) || (chan->mode == RIG_MODE_FM) ){ switch( chan->tuning_step ){ case s_kHz(6.25): tstep = 1; break; case s_kHz(10): tstep = 2; break; case s_kHz(12.5): tstep = 3; break; case s_kHz(15): tstep = 4; break; case s_kHz(20): tstep = 5; break; case s_kHz(25): tstep = 6; break; case s_kHz(30): tstep = 7; break; case s_kHz(50): tstep = 8; break; case s_kHz(100): tstep = 9; break; default: tstep = 0; } }else{ switch( chan->tuning_step ){ case s_kHz(2.5): tstep = 1; break; case s_kHz(5): tstep = 2; break; case s_kHz(10): tstep = 3; break; default: tstep = 0; } } /* P-number 2-3 4 5 6 7 8 9 101112 13 141516 */ sprintf(buf, "MW0%03d%011u%c%c%c%02d%02d%03d%c%c%09d0%c%c%s;", chan->channel_num, (unsigned) chan->freq, /* 4 - frequency */ '0' + mode, /* 5 - mode */ (chan->flags & RIG_CHFLAG_SKIP) ? '1' : '0', /* 6 - lockout status */ sqltype, /* 7 - squelch and tone type */ tone+1, /* 8 - tone code */ code+1, /* 9 - CTCSS code */ dcscode, /* 10 - DCS code */ (chan->funcs & RIG_FUNC_REV ) ? '1' : '0',/* 11 - Reverse status */ shift, /* 12 - shift type */ (int) chan->rptr_offs, /* 13 - offset frequency */ tstep + '0', /* 14 - Step size */ chan->scan_group + '0', /* 15 - Memory group no */ chan->channel_desc /* 16 - description */ ); rig_debug( RIG_DEBUG_VERBOSE, "The command will be: %s\n", buf ); size_t tmp=0; err = kenwood_transaction(rig, buf, strlen(buf), NULL, &tmp ); if (err != RIG_OK) return err; if( chan->split == RIG_SPLIT_ON ){ sprintf(buf, "MW1%03d%011u%c%c%c%02d%02d%03d%c%c%09d0%c%c%s;\n", chan->channel_num, (unsigned) chan->tx_freq, /* 4 - frequency */ '0' + tx_mode, /* 5 - mode */ (chan->flags & RIG_CHFLAG_SKIP) ? '1' : '0', /* 6 - lockout status */ sqltype, /* 7 - squelch and tone type */ tone+1, /* 8 - tone code */ code+1, /* 9 - CTCSS code */ dcscode+1, /* 10 - DCS code */ (chan->funcs & RIG_FUNC_REV ) ? '1' : '0',/* 11 - Reverse status */ shift, /* 12 - shift type */ (int) chan->rptr_offs, /* 13 - offset frequency */ tstep + '0', /* 14 - Step size */ chan->scan_group + '0', /* Memory group no */ chan->channel_desc /* 16 - description */ ); rig_debug( RIG_DEBUG_VERBOSE, "Split, the command will be: %s\n", buf ); tmp = 0; err = kenwood_transaction(rig, buf, strlen(buf), NULL, &tmp ); } return err; } /* * ts2000_get_level * Assumes rig!=NULL, val!=NULL */ int ts2000_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { char lvlbuf[50]; size_t lvl_len; int lvl, retval, ret, agclevel; lvl_len = 50; switch (level) { case RIG_LEVEL_PREAMP: retval = kenwood_transaction (rig, "PA", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if ((lvl_len != 5)){ /*TS-2000 returns 5 chars for PA; */ rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer len=%d\n", __func__, lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+2, "%d", &lvl); if (lvl < 10) /* just checking for main receiver preamp setting */ val->i = 0; if (lvl > 9) val->i = rig->state.preamp[0]; break; case RIG_LEVEL_ATT: retval = kenwood_transaction (rig, "RA", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if ((lvl_len != 7)){ /* TS-2000 returns 7 chars for RA; */ rig_debug(RIG_DEBUG_ERR,"ts2000_get_level: " "unexpected answer len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+2, "%d", &lvl); if (lvl < 100) /* just checking main band attenuator */ val->i = 0; if (lvl > 99) val->i = rig->state.attenuator[0]; /* Since the TS-2000 only has one step on the attenuator */ break; case RIG_LEVEL_VOX: retval = kenwood_transaction (rig, "VD", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 7) { rig_debug(RIG_DEBUG_ERR,"ts2000_get_level: " "unexpected answer len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+2, "%d", &lvl); val->i = lvl / 100; break; case RIG_LEVEL_AF: retval = kenwood_transaction (rig, "AG0", 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 7) { rig_debug(RIG_DEBUG_ERR,"ts2000_get_level: " "unexpected answer len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+2, "%d", &lvl); val->f = lvl / 255.0; break; case RIG_LEVEL_RF: retval = kenwood_transaction (rig, "RG", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 6) { rig_debug(RIG_DEBUG_ERR,"ts2000_get_level: " "unexpected answer len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+2, "%d", &lvl); val->f = lvl / 255.0; break; case RIG_LEVEL_SQL: retval = kenwood_transaction (rig, "SQ0", 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 7) { rig_debug(RIG_DEBUG_ERR,"ts2000_get_level: " "unexpected answer len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+3, "%d", &lvl); val->f = lvl / 255.0; break; case RIG_LEVEL_CWPITCH: retval = kenwood_transaction (rig, "EX0310000", 9, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 12) { rig_debug(RIG_DEBUG_ERR,"ts2000_get_level: " "unexpected answer len=%d answer=%s\n", lvl_len, lvlbuf); return -RIG_ERJCTED; } sscanf(lvlbuf+8, "%d", &lvl); val->i = 400 + (50 * lvl); break; case RIG_LEVEL_RFPOWER: retval = kenwood_transaction (rig, "PC", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 6) { rig_debug(RIG_DEBUG_ERR,"ts2000_get_level: " "unexpected answer len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+3, "%d", &lvl); val->f = lvl / 100.0; /* FIXME: for 1.2GHZ need to divide by 10 */ break; case RIG_LEVEL_MICGAIN: retval = kenwood_transaction (rig, "MG", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 6) { rig_debug(RIG_DEBUG_ERR,"ts2000_get_level: " "unexpected answer len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+2, "%d", &lvl); val->f = lvl / 100.0; break; case RIG_LEVEL_KEYSPD: retval = kenwood_transaction (rig, "KS", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 6) { rig_debug(RIG_DEBUG_ERR,"ts2000_get_level: " "unexpected answer len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+2, "%d", &lvl); val->i = lvl; break; case RIG_LEVEL_NOTCHF: return -RIG_ENIMPL; break; case RIG_LEVEL_COMP: retval = kenwood_transaction (rig, "PL", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 9) { rig_debug(RIG_DEBUG_ERR,"ts2000_get_level: " "unexpected answer len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+2, "%d", &lvl); lvl = lvl / 1000; val->f = lvl / 100.0; break; case RIG_LEVEL_AGC: /* FIX ME: ts2000 returns 0 -20 for AGC */ ret = get_kenwood_level(rig, "GT", 2, &val->f); agclevel = 255.0 * val->f; if (agclevel == 0) val->i = 0; else if (agclevel < 85) val->i = 1; else if (agclevel < 170) val->i = 2; else if (agclevel <= 255) val->i = 3; return ret; break; case RIG_LEVEL_BKINDL: retval = kenwood_transaction (rig, "SD", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 7) { rig_debug(RIG_DEBUG_ERR,"ts2000_get_level: " "unexpected answer len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+2, "%d", &lvl); val->i = lvl / 100; break; case RIG_LEVEL_BALANCE: return -RIG_ENIMPL; break; case RIG_LEVEL_METER: retval = kenwood_transaction (rig, "RM", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 8) { rig_debug(RIG_DEBUG_ERR,"ts2000_get_level: " "unexpected answer len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+2, "%d", &lvl); val->i = lvl / 10000; break; case RIG_LEVEL_VOXGAIN: retval = kenwood_transaction (rig, "VG", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 6) { rig_debug(RIG_DEBUG_ERR,"ts2000_get_level: " "unexpected answer len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+2, "%d", &lvl); val->f = lvl / 9.0; break; case RIG_LEVEL_ANTIVOX: return -RIG_ENIMPL; break; case RIG_LEVEL_RAWSTR: case RIG_LEVEL_STRENGTH: retval = kenwood_transaction (rig, "SM0", 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (( (lvl_len !=8)) || lvlbuf[1] != 'M') { /* TS-2000 returns 8 bytes for S meter level */ rig_debug(RIG_DEBUG_ERR,"%s: wrong answer len=%d\n", __func__, lvl_len); return -RIG_ERJCTED; } /* Frontend expects: -54 = S0, 0 = S9 */ sscanf(lvlbuf+3, "%d", &val->i); /* TS-2000 main receiver returns values from 0 - 30 */ /* so scale the value */ if (level == RIG_LEVEL_STRENGTH) val->i = (val->i * 3.6) - 54; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_level %d", level); return -RIG_EINVAL; } return RIG_OK; } hamlib-1.2.15.3/kenwood/kenwood.c0000644000175000017500000015346012044564477013424 00000000000000/* * Hamlib Kenwood backend - main file * Copyright (c) 2000-2011 by Stephane Fillod * Copyright (C) 2009 Alessandro Zummo * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "register.h" #include "cal.h" #include "kenwood.h" struct kenwood_id { rig_model_t model; int id; }; struct kenwood_id_string { rig_model_t model; const char *id; }; #define UNKNOWN_ID -1 /* * Identification number as returned by "ID;" * Please, if the model number of your rig is listed as UNKNOWN_ID, * send the value to for inclusion. Thanks --SF * * TODO: sort this list with most frequent rigs first. */ static const struct kenwood_id kenwood_id_list[] = { { RIG_MODEL_TS940, 1 }, { RIG_MODEL_TS811, 2 }, { RIG_MODEL_TS711, 3 }, { RIG_MODEL_TS440, 4 }, { RIG_MODEL_R5000, 5 }, { RIG_MODEL_TS790, 7 }, { RIG_MODEL_TS950SDX, 8 }, /* reported as RIG_MODEL_TS950SD originally */ { RIG_MODEL_TS850, 9 }, { RIG_MODEL_TS450S, 10 }, { RIG_MODEL_TS690S, 11 }, { RIG_MODEL_TS870S, 15 }, { RIG_MODEL_TRC80, 16 }, { RIG_MODEL_TS570D, 17 }, /* Elecraft K2|K3 also returns 17 */ { RIG_MODEL_TS570S, 18 }, { RIG_MODEL_TS2000, 19 }, { RIG_MODEL_TS480, 20 }, { RIG_MODEL_TS590S, 21 }, /* TBC */ { RIG_MODEL_NONE, UNKNOWN_ID }, /* end marker */ }; /* XXX numeric ids have been tested only with the TS-450 */ static const struct kenwood_id_string kenwood_id_string_list[] = { { RIG_MODEL_TS940, "001" }, { RIG_MODEL_TS811, "002" }, { RIG_MODEL_TS711, "003" }, { RIG_MODEL_TS440, "004" }, { RIG_MODEL_R5000, "005" }, { RIG_MODEL_TS790, "007" }, { RIG_MODEL_TS950SDX, "008" }, /* reported as RIG_MODEL_TS950SD originally */ { RIG_MODEL_TS850, "009" }, { RIG_MODEL_TS450S, "010" }, { RIG_MODEL_TS690S, "011" }, { RIG_MODEL_TS870S, "015" }, { RIG_MODEL_TS570D, "017" }, /* Elecraft K2|K3 also returns 17 */ { RIG_MODEL_TS570S, "018" }, { RIG_MODEL_TS2000, "019" }, { RIG_MODEL_TS480, "020" }, { RIG_MODEL_TS590S, "021" }, /* TBC */ { RIG_MODEL_THD7A, "TH-D7" }, { RIG_MODEL_THD7AG, "TH-D7G" }, { RIG_MODEL_TMD700, "TM-D700" }, { RIG_MODEL_TMD710, "TM-D710" }, { RIG_MODEL_THD72A, "TH-D72" }, { RIG_MODEL_TMV7, "TM-V7" }, { RIG_MODEL_TMV71, "TM-V71" }, { RIG_MODEL_THF6A, "TH-F6" }, { RIG_MODEL_THF7E, "TH-F7" }, { RIG_MODEL_THG71, "TH-G71" }, { RIG_MODEL_NONE, NULL }, /* end marker */ }; rmode_t kenwood_mode_table[KENWOOD_MODE_TABLE_MAX] = { [0] = RIG_MODE_NONE, [1] = RIG_MODE_LSB, [2] = RIG_MODE_USB, [3] = RIG_MODE_CW, [4] = RIG_MODE_FM, [5] = RIG_MODE_AM, [6] = RIG_MODE_RTTY, [7] = RIG_MODE_CWR, [8] = RIG_MODE_NONE, /* TUNE mode */ [9] = RIG_MODE_RTTYR }; /* * 38 CTCSS sub-audible tones */ const tone_t kenwood38_ctcss_list[] = { 670, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, 1365, 1413, 1462, 1514, 1567, 1622, 1679, 1738, 1799, 1862, 1928, 2035, 2107, 2181, 2257, 2336, 2418, 2503, 0, }; /* * 42 CTCSS sub-audible tones */ const tone_t kenwood42_ctcss_list[] = { 670, 693, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, 1365, 1413, 1462, 1514, 1567, 1622, 1679, 1738, 1799, 1862, 1928, 2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541, 0, }; /* Token definitions for .cfgparams in rig_caps * * See enum rig_conf_e and struct confparams in rig.h */ const struct confparams kenwood_cfg_params[] = { { TOK_FINE, "fine", "Fine", "Fine step mode", NULL, RIG_CONF_CHECKBUTTON, { } }, { TOK_VOICE, "voice", "Voice", "Voice recall", NULL, RIG_CONF_BUTTON, { } }, { TOK_XIT, "xit", "XIT", "XIT", NULL, RIG_CONF_CHECKBUTTON, { } }, { TOK_RIT, "rit", "RIT", "RIT", NULL, RIG_CONF_CHECKBUTTON, { } }, { RIG_CONF_END, NULL, } }; /** * kenwood_transaction * Assumes rig!=NULL rig->state!=NULL rig->caps!=NULL * * Parameters: * cmdstr: Command to be sent to the rig. cmdstr can also be NULL, * indicating that only a reply is needed (nothing will be sent). * cmd_len: Not used * data: Buffer for reply string. Can be NULL, indicating that no reply * is needed and will return with RIG_OK after command was sent. * datasize: in: Size of buffer. It is the caller's responsibily to provide * a large enough buffer for all possible replies for a command. * out: Location where to store number of bytes read. * * returns: * RIG_OK - if no error occured. * RIG_EIO - if an I/O error occured while sending/receiving data. * RIG_ETIMEOUT - if timeout expires without any characters received. * RIG_REJECTED - if a negative acknowledge was received or command not * recognized by rig. */ int kenwood_transaction(RIG *rig, const char *cmdstr, int cmd_len, char *data, size_t *datasize) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !datasize) return -RIG_EINVAL; struct kenwood_priv_caps *caps = kenwood_caps(rig); struct rig_state *rs; int retval; char cmdtrm[2]; /* Default Command/Reply termination char */ int retry_read = 0; rs = &rig->state; rs->hold_decode = 1; rig_debug(RIG_DEBUG_TRACE, "%s: cmdstr = %s\n", __func__, cmdstr); cmdtrm[0] = caps->cmdtrm; cmdtrm[1] = '\0'; transaction_write: serial_flush(&rs->rigport); if (cmdstr) { char *cmd; int len = strlen(cmdstr); cmd = malloc(len + 2); if (cmd == NULL) { retval = -RIG_ENOMEM; goto transaction_quit; } memcpy(cmd, cmdstr, len); /* XXX the if is temporary, until all invocations are fixed */ if (cmdstr[len - 1] != ';' && cmdstr[len - 1] != '\r') { cmd[len] = caps->cmdtrm; len++; } retval = write_block(&rs->rigport, cmd, len); free(cmd); if (retval != RIG_OK) goto transaction_quit; } if (data == NULL || *datasize <= 0) { rig->state.hold_decode = 0; return RIG_OK; /* don't want a reply */ } memset(data,0,*datasize); retval = read_string(&rs->rigport, data, *datasize, cmdtrm, strlen(cmdtrm)); if (retval < 0) { if (retry_read++ < rig->state.rigport.retry) goto transaction_write; goto transaction_quit; } else *datasize = retval; /* Check that command termination is correct */ if (strchr(cmdtrm, data[strlen(data)-1])==NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, data); if (retry_read++ < rig->state.rigport.retry) goto transaction_write; retval = -RIG_EPROTO; goto transaction_quit; } if (strlen(data) == 2) { switch (data[0]) { case 'N': /* Command recognised by rig but invalid data entered. */ rig_debug(RIG_DEBUG_VERBOSE, "%s: NegAck for '%s'\n", __func__, cmdstr); retval = -RIG_ENAVAIL; goto transaction_quit; case 'O': /* Too many characters sent without a carriage return */ rig_debug(RIG_DEBUG_VERBOSE, "%s: Overflow for '%s'\n", __func__, cmdstr); if (retry_read++ < rig->state.rigport.retry) goto transaction_write; retval = -RIG_EPROTO; goto transaction_quit; case 'E': /* Communication error */ rig_debug(RIG_DEBUG_VERBOSE, "%s: Communication error for '%s'\n", __func__, cmdstr); if (retry_read++ < rig->state.rigport.retry) goto transaction_write; retval = -RIG_EIO; goto transaction_quit; case '?': /* Command not understood by rig */ rig_debug(RIG_DEBUG_ERR, "%s: Unknown command '%s'\n", __func__, cmdstr); if (retry_read++ < rig->state.rigport.retry) goto transaction_write; retval = -RIG_ERJCTED; goto transaction_quit; } } /* always give back a null terminated string without * the command terminator. */ if (strlen(data) > 0) data[strlen(data) - 1] = '\0'; /* not elegant, but works */ else data[0] = '\0'; /* * Check that we received the correct reply. The first two characters * should be the same as command. */ if (cmdstr && (data[0] != cmdstr[0] || data[1] != cmdstr[1])) { /* * TODO: When RIG_TRN is enabled, we can pass the string * to the decoder for callback. That way we don't ignore * any commands. */ rig_debug(RIG_DEBUG_ERR, "%s: wrong reply %c%c for command %c%c\n", __func__, data[0], data[1], cmdstr[0], cmdstr[1]); if (retry_read++ < rig->state.rigport.retry) goto transaction_write; retval = -RIG_EPROTO; goto transaction_quit; } retval = RIG_OK; transaction_quit: rs->hold_decode = 0; return retval; } /** * kenwood_safe_transaction * A wrapper for kenwood_transaction to check returned data against * expected length, * * Parameters: * cmd Same as kenwood_transaction() cmdstr * buf Same as kenwwod_transaction() data * buf_size Same as kenwood_transaction() datasize * expected Value of expected string length * * Returns: * RIG_OK - if no error occured. * RIG_EPROTO if returned string and expected are not equal * Error from kenwood_transaction() if any * */ int kenwood_safe_transaction(RIG *rig, const char *cmd, char *buf, size_t buf_size, size_t expected) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !buf) return -RIG_EINVAL; int err; if (expected == 0) buf_size = 0; err = kenwood_transaction(rig, cmd, strlen(cmd), buf, &buf_size); if (err != RIG_OK) return err; if (buf_size != expected) { rig_debug(RIG_DEBUG_ERR, "%s: wrong answer; len for cmd %s: " "expected = %d, got %d\n", __func__, cmd, expected, buf_size); return -RIG_EPROTO; } return RIG_OK; } rmode_t kenwood2rmode(unsigned char mode, const rmode_t mode_table[]) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (mode >= KENWOOD_MODE_TABLE_MAX) return RIG_MODE_NONE; return mode_table[mode]; } char rmode2kenwood(rmode_t mode, const rmode_t mode_table[]) { int i; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); for(i = 0; i < KENWOOD_MODE_TABLE_MAX; i++) { if (mode_table[i] == mode) return i; } return -1; } int kenwood_init(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; struct kenwood_priv_data *priv; struct kenwood_priv_caps *caps = kenwood_caps(rig); priv = malloc(sizeof(struct kenwood_priv_data)); if (priv == NULL) return -RIG_ENOMEM; memset(priv, 0x00, sizeof(struct kenwood_priv_data)); priv->split = RIG_SPLIT_OFF; rig->state.priv = priv; /* default mode_table */ if (caps->mode_table == NULL) caps->mode_table = kenwood_mode_table; /* default if_len */ if (caps->if_len == 0) caps->if_len = 38; rig_debug(RIG_DEBUG_TRACE, "%s: if_len = %d\n", __func__, caps->if_len); return RIG_OK; } int kenwood_cleanup(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } int kenwood_open(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; int err, i; char *idptr; char id[KENWOOD_MAX_BUF_LEN]; /* get id in buffer, will be null terminated */ err = kenwood_get_id(rig, id); if (err != RIG_OK) { rig_debug(RIG_DEBUG_ERR, "%s: cannot get identification\n", __func__); return err; } /* id is something like 'IDXXX' or 'ID XXX' */ if (strlen(id) < 5) { rig_debug(RIG_DEBUG_ERR, "%s: unknown id type (%s)\n", __func__, id); return -RIG_EPROTO; } /* check for a white space and skip it */ idptr = &id[2]; if (*idptr == ' ') idptr++; /* compare id string */ for (i = 0; kenwood_id_string_list[i].model != RIG_MODEL_NONE; i++) { if (strcmp(kenwood_id_string_list[i].id, idptr) != 0) continue; /* found matching id, verify driver */ rig_debug(RIG_DEBUG_TRACE, "%s: found match %s\n", __func__, kenwood_id_string_list[i].id); if (kenwood_id_string_list[i].model == rig->caps->rig_model) return RIG_OK; /* driver mismatch */ rig_debug(RIG_DEBUG_ERR, "%s: wrong driver selected (%d instead of %d)\n", __func__, rig->caps->rig_model, kenwood_id_string_list[i].model); return -RIG_EINVAL; } rig_debug(RIG_DEBUG_ERR, "%s: your rig (%s) is unknown\n", __func__, id); return -RIG_EPROTO; } /* ID * Reads transceiver ID number * * caller must give a buffer of KENWOOD_MAX_BUF_LEN size * */ int kenwood_get_id(RIG *rig, char *buf) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; size_t size = KENWOOD_MAX_BUF_LEN; return kenwood_transaction(rig, "ID", 2, buf, &size); } /* IF * Retrieves the transceiver status * */ static int kenwood_get_if(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; struct kenwood_priv_data *priv = rig->state.priv; struct kenwood_priv_caps *caps = kenwood_caps(rig); return kenwood_safe_transaction(rig, "IF", priv->info, KENWOOD_MAX_BUF_LEN, caps->if_len); } /* FR FT * Sets the RX/TX VFO or M.CH mode of the transceiver, does not set split * VFO, but leaves it unchanged if in split VFO mode. * */ int kenwood_set_vfo(RIG *rig, vfo_t vfo) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; struct kenwood_priv_data *priv = rig->state.priv; char cmdbuf[6]; int retval; char vfo_function; switch (vfo) { case RIG_VFO_VFO: case RIG_VFO_A: vfo_function = '0'; break; case RIG_VFO_B: vfo_function = '1'; break; case RIG_VFO_MEM: vfo_function = '2'; break; case RIG_VFO_CURR: return RIG_OK; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo); return -RIG_EINVAL; } sprintf(cmdbuf, "FR%c", vfo_function); /* set RX VFO */ retval = kenwood_simple_cmd(rig, cmdbuf); if (retval != RIG_OK) return retval; /* If split mode on, the don't change TxVFO */ if (priv->split != RIG_SPLIT_OFF) return RIG_OK; /* set TX VFO */ cmdbuf[1] = 'T'; return kenwood_simple_cmd(rig, cmdbuf); } /* FR FT * Sets the split RX/TX VFO or M.CH mode of the transceiver. * */ int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; struct kenwood_priv_data *priv = rig->state.priv; char cmdbuf[6]; int retval; unsigned char vfo_function; if(vfo != RIG_VFO_CURR) { switch (vfo) { case RIG_VFO_VFO: case RIG_VFO_A: vfo_function = '0'; break; case RIG_VFO_B: vfo_function = '1'; break; case RIG_VFO_MEM: vfo_function = '2'; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo); return -RIG_EINVAL; } /* set RX VFO */ sprintf(cmdbuf, "FR%c", vfo_function); retval = kenwood_simple_cmd(rig, cmdbuf); if (retval != RIG_OK) return retval; } /* Split off means Rx and Tx are the same */ if (split == RIG_SPLIT_OFF) { txvfo = vfo; if (txvfo == RIG_VFO_CURR) { retval = rig_get_vfo(rig, &txvfo); if (retval != RIG_OK) return retval; } } switch (txvfo) { case RIG_VFO_VFO: case RIG_VFO_A: vfo_function = '0'; break; case RIG_VFO_B: vfo_function = '1'; break; case RIG_VFO_MEM: vfo_function = '2'; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, txvfo); return -RIG_EINVAL; } /* set TX VFO */ sprintf(cmdbuf, "FT%c", vfo_function); retval = kenwood_simple_cmd(rig, cmdbuf); if (retval != RIG_OK) return retval; /* Remember whether split is on, for kenwood_set_vfo */ priv->split = split; return RIG_OK; } /* IF * Gets split VFO status from kenwood_get_if() * */ int kenwood_get_split_vfo_if(RIG *rig, vfo_t rxvfo, split_t *split, vfo_t *txvfo) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !split || !txvfo) return -RIG_EINVAL; struct kenwood_priv_data *priv = rig->state.priv; int retval; retval = kenwood_get_if(rig); if (retval != RIG_OK) return retval; switch (priv->info[32]) { case '0': *split = RIG_SPLIT_OFF; break; case '1': *split = RIG_SPLIT_ON; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported split %c\n", __func__, priv->info[32]); return -RIG_EPROTO; } /* Remember whether split is on, for kenwood_set_vfo */ priv->split = *split; /* TODO: find where is the txvfo.. */ return RIG_OK; } /* * kenwood_get_vfo_if using byte 31 of the IF information field */ int kenwood_get_vfo_if(RIG *rig, vfo_t *vfo) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !vfo) return -RIG_EINVAL; int retval; struct kenwood_priv_data *priv = rig->state.priv; retval = kenwood_get_if(rig); if (retval != RIG_OK) return retval; switch (priv->info[30]) { case '0': *vfo = RIG_VFO_A; break; case '1': *vfo = RIG_VFO_B; break; case '2': *vfo = RIG_VFO_MEM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %c\n", __func__, priv->info[30]); return -RIG_EPROTO; } return RIG_OK; } /* * kenwood_set_freq */ int kenwood_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; char freqbuf[16]; unsigned char vfo_letter; vfo_t tvfo; tvfo = (vfo==RIG_VFO_CURR || vfo==RIG_VFO_VFO) ? rig->state.current_vfo : vfo; switch (tvfo) { case RIG_VFO_A: vfo_letter = 'A'; break; case RIG_VFO_B: vfo_letter = 'B'; break; case RIG_VFO_C: vfo_letter = 'C'; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo); return -RIG_EINVAL; } sprintf(freqbuf, "F%c%011ld", vfo_letter, (long)freq); return kenwood_simple_cmd(rig, freqbuf); } int kenwood_get_freq_if(RIG *rig, vfo_t vfo, freq_t *freq) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !freq) return -RIG_EINVAL; struct kenwood_priv_data *priv = rig->state.priv; char freqbuf[50]; int retval; retval = kenwood_get_if(rig); if (retval != RIG_OK) return retval; memcpy(freqbuf, priv->info, 15); freqbuf[14] = '\0'; sscanf(freqbuf + 2, "%"SCNfreq, freq); return RIG_OK; } /* * kenwood_get_freq */ int kenwood_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !freq) return -RIG_EINVAL; char freqbuf[50]; char cmdbuf[4]; int retval; unsigned char vfo_letter; vfo_t tvfo; tvfo = (vfo == RIG_VFO_CURR || vfo==RIG_VFO_VFO) ? rig->state.current_vfo : vfo; /* memory frequency cannot be read with an Fx command, use IF */ if (tvfo == RIG_VFO_MEM) { return kenwood_get_freq_if(rig, vfo, freq); } switch (tvfo) { case RIG_VFO_A: vfo_letter = 'A'; break; case RIG_VFO_B: vfo_letter = 'B'; break; case RIG_VFO_C: vfo_letter = 'C'; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %d\n", __func__, vfo); return -RIG_EINVAL; } sprintf(cmdbuf, "F%c", vfo_letter); retval = kenwood_safe_transaction(rig, cmdbuf, freqbuf, 50, 14); if (retval != RIG_OK) return retval; sscanf(freqbuf+2, "%"SCNfreq, freq); return RIG_OK; } int kenwood_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !rit) return -RIG_EINVAL; int retval; char buf[6]; struct kenwood_priv_data *priv = rig->state.priv; retval = kenwood_get_if(rig); if (retval != RIG_OK) return retval; memcpy(buf, &priv->info[18], 5); buf[5] = '\0'; *rit = atoi(buf); return RIG_OK; } /* * rit can only move up/down by 10 Hz, so we use a loop... */ int kenwood_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; char buf[4]; int retval, i; if (rit == 0) return kenwood_simple_cmd(rig, "RC"); sprintf(buf, "R%c", (rit > 0) ? 'U' : 'D'); retval = kenwood_simple_cmd(rig, "RC"); if (retval != RIG_OK) return retval; for (i = 0; i < abs(rint(rit/10)); i++) retval = kenwood_simple_cmd(rig, buf); return retval; } /* * rit and xit are the same */ int kenwood_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !rit) return -RIG_EINVAL; return kenwood_get_rit(rig, vfo, rit); } int kenwood_set_xit(RIG *rig, vfo_t vfo, shortfreq_t rit) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; return kenwood_set_rit(rig, vfo, rit); } int kenwood_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; return kenwood_simple_cmd(rig, scan == RIG_SCAN_STOP ? "SC0" : "SC1"); } /* * 000 No select * 002 FM Wide * 003 FM Narrow * 005 AM * 007 SSB * 009 CW * 010 CW NARROW */ /* XXX revise */ static int kenwood_set_filter(RIG *rig, pbwidth_t width) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; char *cmd; if (width <= Hz(250)) cmd = "FL010009"; else if(width <= Hz(500)) cmd = "FL009009"; else if(width <= kHz(2.7)) cmd = "FL007007"; else if(width <= kHz(6)) cmd = "FL005005"; else cmd = "FL002002"; return kenwood_simple_cmd(rig, cmd); } /* * kenwood_set_mode */ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; struct kenwood_priv_caps *caps = kenwood_caps(rig); char buf[6]; char kmode; int err; kmode = rmode2kenwood(mode, caps->mode_table); if (kmode < 0 ) { rig_debug(RIG_DEBUG_WARN, "%s: unsupported mode '%s'\n", __func__, rig_strrmode(mode)); return -RIG_EINVAL; } sprintf(buf, "MD%c", '0' + kmode); err = kenwood_simple_cmd(rig, buf); if (err != RIG_OK) return err; if (rig->caps->rig_model == RIG_MODEL_TS450S || rig->caps->rig_model == RIG_MODEL_TS690S || rig->caps->rig_model == RIG_MODEL_TS850 || rig->caps->rig_model == RIG_MODEL_TS950SDX) { err = kenwood_set_filter(rig, width); /* non fatal */ } return RIG_OK; } static int kenwood_get_filter(RIG *rig, pbwidth_t *width) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !width) return -RIG_EINVAL; int err, f, f1, f2; char buf[10]; err = kenwood_safe_transaction(rig, "FL", buf, sizeof(buf), 9); if (err != RIG_OK) return err; buf[8] = '\0'; f2 = atoi(&buf[5]); buf[5] = '\0'; f1 = atoi(&buf[2]); if (f2 > f1) f = f2; else f = f1; switch (f) { case 2: *width = kHz(12); break; case 3: case 5: *width = kHz(6); break; case 7: *width = kHz(2.7); break; case 9: *width = Hz(500); break; case 10: *width = Hz(250); break; } return RIG_OK; } /* * kenwood_get_mode */ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !mode || !width) return -RIG_EINVAL; struct kenwood_priv_caps *caps = kenwood_caps(rig); char modebuf[10]; int retval; retval = kenwood_safe_transaction(rig, "MD", modebuf, 6, 4); if (retval != RIG_OK) return retval; *mode = kenwood2rmode(modebuf[2] - '0', caps->mode_table); /* XXX ? */ *width = rig_passband_normal(rig, *mode); return RIG_OK; } /* This is used when the radio does not support MD; for mode reading */ int kenwood_get_mode_if(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !mode || !width) return -RIG_EINVAL; int err; struct kenwood_priv_caps *caps = kenwood_caps(rig); struct kenwood_priv_data *priv = rig->state.priv; err = kenwood_get_if(rig); if (err != RIG_OK) return err; *mode = kenwood2rmode(priv->info[29] - '0', caps->mode_table); *width = rig_passband_normal(rig, *mode); if (rig->caps->rig_model == RIG_MODEL_TS450S || rig->caps->rig_model == RIG_MODEL_TS690S || rig->caps->rig_model == RIG_MODEL_TS850 || rig->caps->rig_model == RIG_MODEL_TS950SDX) { err = kenwood_get_filter(rig, width); /* non fatal */ } return RIG_OK; } int kenwood_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; char levelbuf[16]; int i, kenwood_val; if (RIG_LEVEL_IS_FLOAT(level)) kenwood_val = val.f * 255; else kenwood_val = val.i; switch (level) { case RIG_LEVEL_RFPOWER: /* XXX check level range */ sprintf(levelbuf, "PC%03d", kenwood_val); break; case RIG_LEVEL_AF: sprintf(levelbuf, "AG%03d", kenwood_val); break; case RIG_LEVEL_RF: /* XXX check level range */ sprintf(levelbuf, "RG%03d", kenwood_val); break; case RIG_LEVEL_SQL: sprintf(levelbuf, "SQ%03d", kenwood_val); break; case RIG_LEVEL_AGC: if (kenwood_val > 3) kenwood_val = 3; /* 0.. 255 */ sprintf(levelbuf, "GT%03d", 84*kenwood_val); break; case RIG_LEVEL_ATT: /* set the attenuator if a correct value is entered */ if (val.i == 0) sprintf(levelbuf, "RA00"); else { for (i=0; istate.attenuator[i]; i++) { if (val.i == rig->state.attenuator[i]) { sprintf(levelbuf, "RA%02d", i+1); break; } } if (val.i != rig->state.attenuator[i]) return -RIG_EINVAL; } break; case RIG_LEVEL_PREAMP: /* set the preamp if a correct value is entered */ if (val.i == 0) sprintf(levelbuf, "PA0"); else { for (i=0; istate.preamp[i]; i++) { if (val.i == rig->state.preamp[i]) { sprintf(levelbuf, "PA%01d", i+1); break; } } if (val.i != rig->state.preamp[i]) return -RIG_EINVAL; } break; case RIG_LEVEL_SLOPE_HIGH: if(val.i>20 || val.i < 0) return -RIG_EINVAL; sprintf(levelbuf, "SH%02d",(val.i)); break; case RIG_LEVEL_SLOPE_LOW: if(val.i>20 || val.i < 0) return -RIG_EINVAL; sprintf(levelbuf, "SL%02d",(val.i)); break; case RIG_LEVEL_CWPITCH: if(val.i > 1000 || val.i < 400) return -RIG_EINVAL; sprintf(levelbuf, "PT%02d", (val.i / 50) - 8); break; case RIG_LEVEL_KEYSPD: if(val.i > 50 || val.i < 5) return -RIG_EINVAL; sprintf(levelbuf, "KS%03d", val.i); break; default: rig_debug(RIG_DEBUG_ERR, "Unsupported set_level %d", level); return -RIG_EINVAL; } return kenwood_simple_cmd(rig, levelbuf); } int get_kenwood_level(RIG *rig, const char *cmd, int cmd_len, float *f) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !cmd || !f) return -RIG_EINVAL; char lvlbuf[10]; int retval; int lvl; retval = kenwood_safe_transaction(rig, cmd, lvlbuf, 10, 6); if (retval != RIG_OK) return retval; /* 000..255 */ sscanf(lvlbuf+2, "%d", &lvl); *f = (float)lvl/255.0; return RIG_OK; }; /* * kenwood_get_level */ int kenwood_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !val) return -RIG_EINVAL; char lvlbuf[50]; int retval; int lvl; int i, ret, agclevel; size_t lvl_len; switch (level) { case RIG_LEVEL_RAWSTR: retval = kenwood_safe_transaction(rig, "SM", lvlbuf, 10, 7); if (retval != RIG_OK) return retval; /* XXX atoi ? */ sscanf(lvlbuf+2, "%d", &val->i); /* rawstr */ break; case RIG_LEVEL_STRENGTH: retval = kenwood_safe_transaction(rig, "SM", lvlbuf, 10, 7); if (retval != RIG_OK) return retval; sscanf(lvlbuf+2, "%d", &val->i); /* rawstr */ if (rig->caps->str_cal.size) val->i = (int) rig_raw2val(val->i, &rig->caps->str_cal); else val->i = (val->i * 4) - 54; break; case RIG_LEVEL_ATT: retval = kenwood_safe_transaction(rig, "RA", lvlbuf, 50, 5); if (retval != RIG_OK) return retval; sscanf(lvlbuf+2, "%d", &lvl); if (lvl == 0) { val->i = 0; } else { for (i=0; istate.attenuator[i] == 0) { rig_debug(RIG_DEBUG_ERR, "%s: " "unexpected att level %d\n", __func__, lvl); return -RIG_EPROTO; } } if (i != lvl) return -RIG_EINTERNAL; val->i = rig->state.attenuator[i-1]; } break; case RIG_LEVEL_PREAMP: retval = kenwood_safe_transaction(rig, "PA", lvlbuf, 50, 4); if (retval != RIG_OK) return retval; if (lvlbuf[2] == '0') val->i = 0; else if (isdigit(lvlbuf[2])) { lvl = lvlbuf[2]-'0'; for (i=0; istate.preamp[i] == 0) { rig_debug(RIG_DEBUG_ERR,"%s: " "unexpected preamp level %d\n", __func__, lvl); return -RIG_EPROTO; } } if (i != lvl) return -RIG_EINTERNAL; val->i = rig->state.preamp[i-1]; } else { rig_debug(RIG_DEBUG_ERR,"%s: " "unexpected preamp char '%c'\n", __func__, lvlbuf[2]); return -RIG_EPROTO; } break; case RIG_LEVEL_RFPOWER: return get_kenwood_level(rig, "PC", 3, &val->f); case RIG_LEVEL_AF: return get_kenwood_level(rig, "AG", 3, &val->f); case RIG_LEVEL_RF: return get_kenwood_level(rig, "RG", 3, &val->f); case RIG_LEVEL_SQL: return get_kenwood_level(rig, "SQ", 3, &val->f); case RIG_LEVEL_MICGAIN: return get_kenwood_level(rig, "MG", 3, &val->f); case RIG_LEVEL_AGC: ret = get_kenwood_level(rig, "GT", 3, &val->f); agclevel = 255 * val->f; if (agclevel == 0) val->i = 0; else if (agclevel < 85) val->i = 1; else if (agclevel < 170) val->i = 2; else if (agclevel <= 255) val->i = 3; return ret; case RIG_LEVEL_SLOPE_LOW: lvl_len = 50; retval = kenwood_transaction (rig, "SL", 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; lvlbuf[4]='\0'; val->i=atoi(&lvlbuf[2]); break; case RIG_LEVEL_SLOPE_HIGH: lvl_len = 50; retval = kenwood_transaction (rig, "SH", 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; lvlbuf[4]='\0'; val->i=atoi(&lvlbuf[2]); break; case RIG_LEVEL_CWPITCH: retval = kenwood_safe_transaction(rig, "PT", lvlbuf, 50, 5); if (retval != RIG_OK) return retval; sscanf(lvlbuf+2, "%d", &val->i); val->i = (val->i * 1000) + 1000; /* 00 - 08 */ break; case RIG_LEVEL_KEYSPD: retval = kenwood_safe_transaction(rig, "KS", lvlbuf, 50, 6); if (retval != RIG_OK) return retval; sscanf(lvlbuf+2, "%d", &val->i); break; case RIG_LEVEL_IF: case RIG_LEVEL_APF: case RIG_LEVEL_NR: case RIG_LEVEL_PBT_IN: case RIG_LEVEL_PBT_OUT: case RIG_LEVEL_NOTCHF: case RIG_LEVEL_COMP: case RIG_LEVEL_BKINDL: case RIG_LEVEL_BALANCE: return -RIG_ENIMPL; default: rig_debug(RIG_DEBUG_ERR, "Unsupported get_level %d", level); return -RIG_EINVAL; } return RIG_OK; } int kenwood_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; char buf[6]; /* longest cmd is GTxxx */ switch (func) { case RIG_FUNC_NB: sprintf(buf, "NB%c", (status == 0) ? '0' : '1'); return kenwood_simple_cmd(rig, buf); case RIG_FUNC_ABM: sprintf(buf, "AM%c", (status == 0) ? '0' : '1'); return kenwood_simple_cmd(rig, buf); case RIG_FUNC_COMP: sprintf(buf, "PR%c", (status == 0) ? '0' : '1'); return kenwood_simple_cmd(rig, buf); case RIG_FUNC_TONE: sprintf(buf, "TO%c", (status == 0) ? '0' : '1'); return kenwood_simple_cmd(rig, buf); case RIG_FUNC_TSQL: sprintf(buf, "CT%c", (status == 0) ? '0' : '1'); return kenwood_simple_cmd(rig, buf); case RIG_FUNC_VOX: sprintf(buf, "VX%c", (status == 0) ? '0' : '1'); return kenwood_simple_cmd(rig, buf); case RIG_FUNC_FAGC: sprintf(buf, "GT00%c", (status == 0) ? '4' : '2'); return kenwood_simple_cmd(rig, buf); case RIG_FUNC_NR: sprintf(buf, "NR%c", (status == 0) ? '0' : '1'); return kenwood_simple_cmd(rig, buf); case RIG_FUNC_BC: sprintf(buf, "BC%c", (status == 0) ? '0' : '1'); return kenwood_simple_cmd(rig, buf); case RIG_FUNC_ANF: sprintf(buf, "NT%c", (status == 0) ? '0' : '1'); return kenwood_simple_cmd(rig, buf); case RIG_FUNC_LOCK: sprintf(buf, "LK%c", (status == 0) ? '0' : '1'); return kenwood_simple_cmd(rig, buf); case RIG_FUNC_AIP: sprintf(buf, "MX%c", (status == 0) ? '0' : '1'); return kenwood_simple_cmd(rig, buf); default: rig_debug(RIG_DEBUG_ERR, "Unsupported set_func %#x", func); return -RIG_EINVAL; } return -RIG_EINVAL; } /* * works for any 'format 1' command * answer is always 4 bytes: two byte command id, status and terminator */ static int get_kenwood_func(RIG *rig, const char *cmd, int *status) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !cmd || !status) return -RIG_EINVAL; int retval; char buf[10]; retval = kenwood_safe_transaction(rig, cmd, buf, 10, 4); if (retval != RIG_OK) return retval; *status = buf[2] == '0' ? 0 : 1; return RIG_OK; }; /* * kenwood_get_func */ int kenwood_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !status) return -RIG_EINVAL; char fctbuf[20]; int retval; switch (func) { case RIG_FUNC_FAGC: retval = kenwood_safe_transaction(rig, "GT", fctbuf, 20, 6); if (retval != RIG_OK) return retval; *status = fctbuf[4] != '4' ? 1 : 0; return RIG_OK; case RIG_FUNC_NB: return get_kenwood_func(rig, "NB", status); case RIG_FUNC_ABM: return get_kenwood_func(rig, "AM", status); case RIG_FUNC_COMP: return get_kenwood_func(rig, "PR", status); case RIG_FUNC_TONE: return get_kenwood_func(rig, "TO", status); case RIG_FUNC_TSQL: return get_kenwood_func(rig, "CT", status); case RIG_FUNC_VOX: return get_kenwood_func(rig, "VX", status); case RIG_FUNC_NR: return get_kenwood_func(rig, "NR", status); /* FIXME on TS2000 */ case RIG_FUNC_BC: return get_kenwood_func(rig, "BC", status); case RIG_FUNC_ANF: return get_kenwood_func(rig, "NT", status); case RIG_FUNC_LOCK: return get_kenwood_func(rig, "LK", status); case RIG_FUNC_AIP: return get_kenwood_func(rig, "MX", status); default: rig_debug(RIG_DEBUG_ERR, "Unsupported get_func %#x", func); return -RIG_EINVAL; } return -RIG_EINVAL; } /* * kenwood_set_ctcss_tone * Assumes rig->caps->ctcss_list != NULL * * Warning! This is untested stuff! May work at least on TS-870S * Please owners report to me , thanks. --SF */ int kenwood_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; const struct rig_caps *caps; char tonebuf[16]; int i; caps = rig->caps; /* TODO: replace 200 by something like RIGTONEMAX */ for (i = 0; caps->ctcss_list[i] != 0 && i<200; i++) { if (caps->ctcss_list[i] == tone) break; } if (caps->ctcss_list[i] != tone) return -RIG_EINVAL; /* TODO: replace menu no 57 by a define */ sprintf(tonebuf, "EX%03d%04d", 57, i+1); return kenwood_simple_cmd(rig, tonebuf); } int kenwood_set_ctcss_tone_tn(RIG *rig, vfo_t vfo, tone_t tone) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; const struct rig_caps *caps = rig->caps; char buf[6]; int i; /* XXX 40 is a fixed constant */ for (i = 0; caps->ctcss_list[i] != 0 && i < 40; i++) { if (tone == caps->ctcss_list[i]) break; } if (tone != caps->ctcss_list[i]) return -RIG_EINVAL; sprintf(buf, "TN%02d", i + 1); return kenwood_simple_cmd(rig, buf); } /* * kenwood_get_ctcss_tone * Assumes rig->state.priv != NULL */ int kenwood_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !tone) return -RIG_EINVAL; struct kenwood_priv_data *priv = rig->state.priv; const struct rig_caps *caps; char tonebuf[3]; int i, retval; unsigned int tone_idx; caps = rig->caps; retval = kenwood_get_if(rig); if (retval != RIG_OK) return retval; memcpy(tonebuf, &priv->info[34], 2); tonebuf[2] = '\0'; tone_idx = atoi(tonebuf); if (tone_idx == 0) { rig_debug(RIG_DEBUG_ERR, "%s: CTCSS tone is zero (%s)\n", __func__, tonebuf); return -RIG_EPROTO; } /* check this tone exists. That's better than nothing. */ for (i = 0; ictcss_list[i] == 0) { rig_debug(RIG_DEBUG_ERR, "%s: CTCSS NG (%04d)\n", __func__, tone_idx); return -RIG_EPROTO; } } *tone = caps->ctcss_list[tone_idx-1]; return RIG_OK; } int kenwood_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; const struct rig_caps *caps = rig->caps; char buf[6]; int i; for (i = 0; caps->ctcss_list[i] != 0 && i < 40; i++) { if (tone == caps->ctcss_list[i]) break; } if (tone != caps->ctcss_list[i]) return -RIG_EINVAL; sprintf(buf, "CN%02d", i + 1); return kenwood_simple_cmd(rig, buf); } int kenwood_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !tone) return -RIG_EINVAL; const struct rig_caps *caps; char tonebuf[6]; int i, retval; unsigned int tone_idx; caps = rig->caps; retval = kenwood_safe_transaction(rig, "CT", tonebuf, 6, 5); if (retval != RIG_OK) return retval; tone_idx = atoi(tonebuf+2); if (tone_idx == 0) { rig_debug(RIG_DEBUG_ERR, "%s: CTCSS is zero (%s)\n", __func__, tonebuf); return -RIG_EPROTO; } /* check this tone exists. That's better than nothing. */ for (i = 0; ictcss_list[i] == 0) { rig_debug(RIG_DEBUG_ERR, "%s: CTCSS NG (%04d)\n", __func__, tone_idx); return -RIG_EPROTO; } } *tone = caps->ctcss_list[tone_idx-1]; return RIG_OK; } /* * set the aerial/antenna to use */ int kenwood_set_ant(RIG * rig, vfo_t vfo, ant_t ant) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; const char *cmd; switch (ant) { case RIG_ANT_1: cmd = "AN1"; break; case RIG_ANT_2: cmd = "AN2"; break; case RIG_ANT_3: cmd = "AN3"; break; case RIG_ANT_4: cmd = "AN4"; break; default: return -RIG_EINVAL; } return kenwood_simple_transaction(rig, cmd, 4); } int kenwood_set_ant_no_ack(RIG * rig, vfo_t vfo, ant_t ant) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; const char *cmd; switch (ant) { case RIG_ANT_1: cmd = "AN1"; break; case RIG_ANT_2: cmd = "AN2"; break; case RIG_ANT_3: cmd = "AN3"; break; case RIG_ANT_4: cmd = "AN4"; break; default: return -RIG_EINVAL; } return kenwood_simple_cmd(rig, cmd); } /* * get the aerial/antenna in use */ int kenwood_get_ant (RIG *rig, vfo_t vfo, ant_t *ant) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !ant) return -RIG_EINVAL; char ackbuf[6]; int retval; retval = kenwood_safe_transaction(rig, "AN", ackbuf, 6, 4); if (retval != RIG_OK) return retval; if (ackbuf[2] < '1' || ackbuf[2] > '9') return -RIG_EPROTO; *ant = RIG_ANT_N(ackbuf[2]-'1'); /* XXX check that the returned antenna is valid for the current rig */ return RIG_OK; } /* * kenwood_get_ptt */ int kenwood_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !ptt) return -RIG_EINVAL; struct kenwood_priv_data *priv = rig->state.priv; int retval; retval = kenwood_get_if(rig); if (retval != RIG_OK) return retval; *ptt = priv->info[28] == '0' ? RIG_PTT_OFF : RIG_PTT_ON; return RIG_OK; } int kenwood_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { const char *ptt_cmd; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; switch (ptt) { case RIG_PTT_ON: ptt_cmd = "TX"; break; case RIG_PTT_ON_MIC: ptt_cmd = "TX0"; break; case RIG_PTT_ON_DATA: ptt_cmd = "TX1"; break; case RIG_PTT_OFF: ptt_cmd = "RX"; break; default: return -RIG_EINVAL; } return kenwood_simple_cmd(rig, ptt_cmd); } int kenwood_set_ptt_safe(RIG *rig, vfo_t vfo, ptt_t ptt) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; int err; ptt_t current_ptt; err = kenwood_get_ptt(rig, vfo, ¤t_ptt); if (err != RIG_OK) return err; if (current_ptt == ptt) return RIG_OK; return kenwood_simple_cmd(rig, (ptt == RIG_PTT_ON) ? "TX" : "RX"); } /* * kenwood_get_dcd */ int kenwood_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !dcd) return -RIG_EINVAL; char busybuf[10]; int retval; retval = kenwood_safe_transaction(rig, "BY", busybuf, 10, 4); if (retval != RIG_OK) return retval; *dcd = (busybuf[2] == '1') ? RIG_DCD_ON : RIG_DCD_OFF; return RIG_OK; } /* * kenwood_set_trn */ int kenwood_set_trn(RIG *rig, int trn) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; return kenwood_simple_transaction(rig, (trn == RIG_TRN_RIG) ? "AI1" : "AI0", 4); } /* * kenwood_get_trn */ int kenwood_get_trn(RIG *rig, int *trn) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !trn) return -RIG_EINVAL; char trnbuf[6]; int retval; retval = kenwood_safe_transaction(rig, "AI", trnbuf, 6, 4); if (retval != RIG_OK) return retval; *trn = trnbuf[2] != '0' ? RIG_TRN_RIG : RIG_TRN_OFF; return RIG_OK; } /* * kenwood_set_powerstat */ int kenwood_set_powerstat(RIG *rig, powerstat_t status) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; return kenwood_simple_transaction(rig, (status == RIG_POWER_ON) ? "PS1" : "PS0", 4); } /* * kenwood_get_powerstat */ int kenwood_get_powerstat(RIG *rig, powerstat_t *status) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !status) return -RIG_EINVAL; char pwrbuf[6]; int retval; retval = kenwood_safe_transaction(rig, "PS", pwrbuf, 6, 4); if (retval != RIG_OK) return retval; *status = pwrbuf[2] == '0' ? RIG_POWER_OFF : RIG_POWER_ON; return RIG_OK; } /* * kenwood_reset */ int kenwood_reset(RIG *rig, reset_t reset) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; char rstbuf[6]; char rst; switch(reset) { case RIG_RESET_VFO: rst = '1'; break; case RIG_RESET_MASTER: rst = '2'; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported reset %d\n", __func__, reset); return -RIG_EINVAL; } sprintf(rstbuf, "SR%c", rst); /* this command has no answer */ return kenwood_simple_cmd(rig, rstbuf); } /* * kenwood_send_morse */ int kenwood_send_morse(RIG *rig, vfo_t vfo, const char *msg) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !msg) return -RIG_EINVAL; char morsebuf[30], m2[30]; int msg_len, buff_len, retval; const char *p; p = msg; msg_len = strlen(msg); while(msg_len > 0) { /* * TODO: check with "KY" if char buffer is available. * if not, sleep. * * Make the total message segments 28 characters * in length because Kenwood demands it. * Spaces fill in the message end. */ buff_len = msg_len > 24 ? 24 : msg_len; strncpy(m2, p, 24); m2[24] = '\0'; /* the command must consist of 28 bytes */ sprintf(morsebuf, "KY %-24s", m2); retval = kenwood_simple_cmd(rig, morsebuf); if (retval != RIG_OK) return retval; msg_len -= buff_len; p += buff_len; } return RIG_OK; } /* * kenwood_vfo_op */ int kenwood_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; switch(op) { case RIG_OP_UP: return kenwood_simple_cmd(rig, "UP"); case RIG_OP_DOWN: return kenwood_simple_cmd(rig, "DN"); case RIG_OP_BAND_UP: return kenwood_simple_cmd(rig, "BU"); case RIG_OP_BAND_DOWN: return kenwood_simple_cmd(rig, "BD"); default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported op %#x\n", __func__, op); return -RIG_EINVAL; } } /* * kenwood_set_mem */ int kenwood_set_mem(RIG *rig, vfo_t vfo, int ch) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; char buf[8]; /* * "MCbmm;" * where b is the bank number, mm the memory number. * b can be a space */ sprintf(buf, "MC %02d", ch); return kenwood_simple_cmd(rig, buf); } /* * kenwood_get_mem */ int kenwood_get_mem(RIG *rig, vfo_t vfo, int *ch) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !ch) return -RIG_EINVAL; char membuf[10]; int retval; /* * "MCbmm;" * where b is the bank number, mm the memory number. * b can be a space */ retval = kenwood_safe_transaction(rig, "MC", membuf, 10, 6); if (retval != RIG_OK) return retval; *ch = atoi(membuf+2); return RIG_OK; } int kenwood_get_mem_if(RIG *rig, vfo_t vfo, int *ch) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !ch) return -RIG_EINVAL; int err; char buf[4]; struct kenwood_priv_data *priv = rig->state.priv; err = kenwood_get_if(rig); if (err != RIG_OK) return err; memcpy(buf, &priv->info[26], 2); buf[2] = '\0'; *ch = atoi(buf); return RIG_OK; } int kenwood_get_channel(RIG *rig, channel_t *chan) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !chan) return -RIG_EINVAL; int err; char buf[26]; char cmd[8]; struct kenwood_priv_caps *caps = kenwood_caps(rig); /* put channel num in the command string */ sprintf(cmd, "MR0 %02d", chan->channel_num); err = kenwood_safe_transaction(rig, cmd, buf, 26, 24); if (err != RIG_OK) return err; memset(chan, 0x00, sizeof(channel_t)); chan->vfo = RIG_VFO_VFO; /* MR0 1700005890000510 ; * MRs ccfffffffffffMLTtt ; */ /* parse from right to left */ /* XXX based on the available documentation, there is no command * to read out the filters of a given memory channel. The rig, however, * stores this information. */ if (buf[19] == '0' || buf[19] == ' ') chan->ctcss_tone = 0; else { buf[22] = '\0'; if (rig->caps->ctcss_list) chan->ctcss_tone = rig->caps->ctcss_list[atoi(&buf[20])]; } /* memory lockout */ if (buf[18] == '1') chan->flags |= RIG_CHFLAG_SKIP; chan->mode = kenwood2rmode(buf[17] - '0', caps->mode_table); buf[17] = '\0'; chan->freq = atoi(&buf[6]); if (chan->freq == RIG_FREQ_NONE) return -RIG_ENAVAIL; buf[6] = '\0'; chan->channel_num = atoi(&buf[4]); /* split freq */ cmd[2] = '1'; err = kenwood_safe_transaction(rig, cmd, buf, 26, 24); if (err != RIG_OK) return err; chan->tx_mode = kenwood2rmode(buf[17] - '0', caps->mode_table); buf[17] = '\0'; chan->tx_freq = atoi(&buf[6]); if (chan->freq == chan->tx_freq) { chan->tx_freq = RIG_FREQ_NONE; chan->tx_mode = RIG_MODE_NONE; chan->split = RIG_SPLIT_OFF; } else chan->split = RIG_SPLIT_ON; return RIG_OK; } int kenwood_set_channel(RIG *rig, const channel_t *chan) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !chan) return -RIG_EINVAL; char buf[26]; char mode, tx_mode = 0; int err; int tone = 0; struct kenwood_priv_caps *caps = kenwood_caps(rig); mode = rmode2kenwood(chan->mode, caps->mode_table); if (mode < 0 ) { rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode '%s'\n", __func__, rig_strrmode(chan->mode)); return -RIG_EINVAL; } if (chan->split == RIG_SPLIT_ON) { tx_mode = rmode2kenwood(chan->tx_mode, caps->mode_table); if (tx_mode < 0 ) { rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode '%s'\n", __func__, rig_strrmode(chan->tx_mode)); return -RIG_EINVAL; } } /* find tone */ if (chan->ctcss_tone) { for (tone = 0; rig->caps->ctcss_list[tone] != 0; tone++) { if (chan->ctcss_tone == rig->caps->ctcss_list[tone]) break; } if (chan->ctcss_tone != rig->caps->ctcss_list[tone]) tone = 0; } sprintf(buf, "MW0 %02d%011d%c%c%c%02d ", /* note the space at the end */ chan->channel_num, (int) chan->freq, '0' + mode, (chan->flags & RIG_CHFLAG_SKIP) ? '1' : '0', chan->ctcss_tone ? '1' : '0', chan->ctcss_tone ? (tone + 1) : 0); err = kenwood_simple_cmd(rig, buf); if (err != RIG_OK) return err; sprintf(buf, "MW1 %02d%011d%c%c%c%02d ", chan->channel_num, (chan->split == RIG_SPLIT_ON) ? ((int) chan->tx_freq) : 0, (chan->split == RIG_SPLIT_ON) ? ('0' + tx_mode) : '0', (chan->flags & RIG_CHFLAG_SKIP) ? '1' : '0', chan->ctcss_tone ? '1' : '0', chan->ctcss_tone ? (tone + 1) : 0); return kenwood_simple_cmd(rig, buf); } int kenwood_set_ext_parm(RIG *rig, token_t token, value_t val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; char buf[4]; switch (token) { case TOK_VOICE: return kenwood_simple_cmd(rig, "VR"); case TOK_FINE: sprintf(buf, "FS%c", (val.i == 0) ? '0' : '1'); return kenwood_simple_cmd(rig, buf); case TOK_XIT: sprintf(buf, "XT%c", (val.i == 0) ? '0' : '1'); return kenwood_simple_cmd(rig, buf); case TOK_RIT: sprintf(buf, "RT%c", (val.i == 0) ? '0' : '1'); return kenwood_simple_cmd(rig, buf); } return -RIG_EINVAL; } int kenwood_get_ext_parm(RIG *rig, token_t token, value_t *val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !val) return -RIG_EINVAL; int err; struct kenwood_priv_data *priv = rig->state.priv; switch (token) { case TOK_FINE: return get_kenwood_func(rig, "FS", &val->i); case TOK_XIT: err = kenwood_get_if(rig); if (err != RIG_OK) return err; val->i = (priv->info[24] == '1') ? 1 : 0; return RIG_OK; case TOK_RIT: err = kenwood_get_if(rig); if (err != RIG_OK) return err; val->i = (priv->info[23] == '1') ? 1 : 0; return RIG_OK; } return -RIG_ENIMPL; } /* * kenwood_get_info * supposed to work only for TS2000... */ const char* kenwood_get_info(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return "*rig == NULL"; char firmbuf[10]; int retval; retval = kenwood_safe_transaction(rig, "TY", firmbuf, 10, 6); if (retval != RIG_OK) return NULL; switch (firmbuf[4]) { case '0': return "Firmware: Overseas type"; case '1': return "Firmware: Japanese 100W type"; case '2': return "Firmware: Japanese 20W type"; default: return "Firmware: unknown"; } } #define IDBUFSZ 16 /* * proberigs_kenwood * * Notes: * There's only one rig possible per port. * * rig_model_t probeallrigs_kenwood(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data) */ DECLARE_PROBERIG_BACKEND(kenwood) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); char idbuf[IDBUFSZ]; int id_len=-1, i, k_id; int retval=-1; int rates[] = { 115200, 57600, 38400, 19200, 9600, 4800, 1200, 0 }; /* possible baud rates */ int rates_idx; if (!port) return RIG_MODEL_NONE; if (port->type.rig != RIG_PORT_SERIAL) return RIG_MODEL_NONE; port->write_delay = port->post_write_delay = 0; port->parm.serial.stop_bits = 2; port->retry = 1; /* * try for all different baud rates */ for (rates_idx = 0; rates[rates_idx]; rates_idx++) { port->parm.serial.rate = rates[rates_idx]; port->timeout = 2*1000/rates[rates_idx] + 50; retval = serial_open(port); if (retval != RIG_OK) return RIG_MODEL_NONE; retval = write_block(port, "ID;", 3); id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2); close(port->fd); if (retval != RIG_OK || id_len < 0) continue; } if (retval != RIG_OK || id_len < 0 || !strcmp(idbuf, "ID;")) return RIG_MODEL_NONE; /* * reply should be something like 'IDxxx;' */ if (id_len != 5 || id_len != 6) { idbuf[7] = '\0'; rig_debug(RIG_DEBUG_VERBOSE, "probe_kenwood: protocol error, " " expected %d, received %d: %s\n", 6, id_len, idbuf); return RIG_MODEL_NONE; } /* first, try ID string */ for (i=0; kenwood_id_string_list[i].model != RIG_MODEL_NONE; i++) { if (!strncmp(kenwood_id_string_list[i].id, idbuf+2, 16)) { rig_debug(RIG_DEBUG_VERBOSE, "probe_kenwood: " "found %s\n", idbuf+2); if (cfunc) (*cfunc)(port, kenwood_id_string_list[i].model, data); return kenwood_id_string_list[i].model; } } /* then, try ID numbers */ k_id = atoi(idbuf+2); /* * Elecraft K2 returns same ID as TS570 */ if (k_id == 17) { retval = serial_open(port); if (retval != RIG_OK) return RIG_MODEL_NONE; retval = write_block(port, "K2;", 3); id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2); close(port->fd); if (retval != RIG_OK) return RIG_MODEL_NONE; /* * reply should be something like 'K2n;' */ if (id_len == 4 || !strcmp(idbuf, "K2")) { rig_debug(RIG_DEBUG_VERBOSE, "probe_kenwood: found K2\n"); if (cfunc) (*cfunc)(port, RIG_MODEL_K2, data); return RIG_MODEL_K2; } } for (i=0; kenwood_id_list[i].model != RIG_MODEL_NONE; i++) { if (kenwood_id_list[i].id == k_id) { rig_debug(RIG_DEBUG_VERBOSE, "probe_kenwood: " "found %03d\n", k_id); if (cfunc) (*cfunc)(port, kenwood_id_list[i].model, data); return kenwood_id_list[i].model; } } /* * not found in known table.... * update kenwood_id_list[]! */ rig_debug(RIG_DEBUG_WARN, "probe_kenwood: found unknown device " "with ID %03d, please report to Hamlib " "developers.\n", k_id); return RIG_MODEL_NONE; } /* * initrigs_kenwood is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(kenwood) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); // rig_debug(RIG_DEBUG_VERBOSE, "kenwood: _init called\n"); rig_register(&ts950sdx_caps); rig_register(&ts50s_caps); rig_register(&ts140_caps); rig_register(&ts450s_caps); rig_register(&ts570d_caps); rig_register(&ts570s_caps); rig_register(&ts680s_caps); rig_register(&ts690s_caps); rig_register(&ts790_caps); rig_register(&ts850_caps); rig_register(&ts870s_caps); rig_register(&ts930_caps); rig_register(&ts2000_caps); rig_register(&trc80_caps); rig_register(&k2_caps); rig_register(&k3_caps); rig_register(&ts440_caps); rig_register(&ts940_caps); rig_register(&ts711_caps); rig_register(&ts811_caps); rig_register(&r5000_caps); rig_register(&tmd700_caps); rig_register(&thd7a_caps); rig_register(&thd72a_caps); rig_register(&thf7e_caps); rig_register(&thg71_caps); rig_register(&tmv7_caps); rig_register(&tmd710_caps); rig_register(&ts590_caps); rig_register(&ts590_caps); rig_register(&ts480_caps); rig_register(&thf6a_caps); rig_register(&transfox_caps); return RIG_OK; } hamlib-1.2.15.3/kenwood/tmd710.c0000644000175000017500000005667012044564477012777 00000000000000/* * Hamlib Kenwood backend - TM-D710 description * Copyright (c) 2011 by Charles Suprin * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "hamlib/rig.h" #include "kenwood.h" #include "th.h" #include "tones.h" #include "num_stdio.h" #include "misc.h" static int tmd710_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int tmd710_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int tmd710_set_vfo (RIG *rig, vfo_t vfo); static int tmd710_get_vfo(RIG *rig, vfo_t *vfo); static int tmd710_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts); static int tmd710_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts); static int tmd710_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone); static int tmd710_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone); static int tmd710_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone); static int tmd710_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone); static int tmd710_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int tmd710_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int tmd710_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift); static int tmd710_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t* shift); static int tmd710_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offset); static int tmd710_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t* offset); #define TMD710_MODES (RIG_MODE_FM|RIG_MODE_AM) #define TMD710_MODES_TX (RIG_MODE_FM) /* TBC */ #define TMD710_FUNC_ALL (RIG_FUNC_TSQL| \ RIG_FUNC_AIP| \ RIG_FUNC_MON| \ RIG_FUNC_MUTE| \ RIG_FUNC_SQL| \ RIG_FUNC_TONE| \ RIG_FUNC_TBURST| \ RIG_FUNC_REV| \ RIG_FUNC_LOCK| \ RIG_FUNC_ARO) #define TMD710_LEVEL_ALL (RIG_LEVEL_STRENGTH| \ RIG_LEVEL_SQL| \ RIG_LEVEL_AF| \ RIG_LEVEL_RF|\ RIG_LEVEL_MICGAIN) #define TMD710_PARMS (RIG_PARM_BACKLIGHT|\ RIG_PARM_BEEP|\ RIG_PARM_APO) #define TMD710_VFO_OP (RIG_OP_UP|RIG_OP_DOWN) #define TMD710_CHANNEL_CAPS \ TH_CHANNEL_CAPS,\ .flags=1, \ .dcs_code=1, \ .dcs_sql=1, #define TMD710_CHANNEL_CAPS_WO_LO \ TH_CHANNEL_CAPS,\ .dcs_code=1, \ .dcs_sql=1, /* * TODO: Band A & B */ #define TMD710_VFO (RIG_VFO_A|RIG_VFO_B) static rmode_t tmd710_mode_table[KENWOOD_MODE_TABLE_MAX] = { [0] = RIG_MODE_FM, [1] = RIG_MODE_AM, }; static struct kenwood_priv_caps tmd710_priv_caps = { .cmdtrm = EOM_TH, /* Command termination character */ .mode_table = tmd710_mode_table, }; /* * TM-D710 rig capabilities. * * specs: * protocol: kd7dvd.us/equipment/tm-d710a/manuals/control_commands.pdf */ const struct rig_caps tmd710_caps = { .rig_model = RIG_MODEL_TMD710, .model_name = "TM-D710", .mfg_name = "Kenwood", .version = TH_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_MOBILE|RIG_FLAG_APRS|RIG_FLAG_TNC, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 9600, .serial_rate_max = 57600, .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 = 1000, .retry = 3, .has_get_func = TMD710_FUNC_ALL, .has_set_func = TMD710_FUNC_ALL, .has_get_level = TMD710_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(TMD710_LEVEL_ALL), .has_get_parm = TMD710_PARMS, .has_set_parm = TMD710_PARMS, /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 7 } }, [LVL_SQL] = { .min = { .i = 0 }, .max = { .i = 0x1f }, .step = { .f = 1./0x1f } }, [LVL_RFPOWER] = { .min = { .i = 2 }, .max = { .i = 0 }, .step = { .f = 1./3. } }, [LVL_AF] = { .min = { .i = 0 }, .max = { .i = 0x3f }, .step = { .f = 1./0x3f } }, }, .parm_gran = {}, .ctcss_list = kenwood42_ctcss_list, .dcs_list = common_dcs_list, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .vfo_ops = TMD710_VFO_OP, .scan_ops = RIG_SCAN_VFO, .targetable_vfo = RIG_TARGETABLE_NONE, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 8, .chan_list = { { 1, 199, RIG_MTYPE_MEM , {TMD710_CHANNEL_CAPS}}, /* normal MEM */ { 200,219, RIG_MTYPE_EDGE , {TMD710_CHANNEL_CAPS}}, /* U/L MEM */ { 221,222, RIG_MTYPE_CALL, {TMD710_CHANNEL_CAPS_WO_LO}}, /* Call 0/1 */ RIG_CHAN_END, }, /* * TODO: Japan & TM-D700S, and Taiwan models */ .rx_range_list1 = { {MHz(118),MHz(470),TMD710_MODES,-1,-1,RIG_VFO_A}, {MHz(136),MHz(174),RIG_MODE_FM,-1,-1,RIG_VFO_B}, {MHz(300),MHz(524),RIG_MODE_FM,-1,-1,RIG_VFO_B}, {MHz(800),MHz(1300),RIG_MODE_FM,-1,-1,RIG_VFO_B}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { {MHz(144),MHz(146),TMD710_MODES_TX,W(5),W(50),RIG_VFO_A}, {MHz(430),MHz(440),TMD710_MODES_TX,W(5),W(35),RIG_VFO_A}, RIG_FRNG_END, }, /* tx range */ .rx_range_list2 = { {MHz(118),MHz(470),TMD710_MODES,-1,-1,RIG_VFO_A}, {MHz(136),MHz(174),RIG_MODE_FM,-1,-1,RIG_VFO_B}, {MHz(300),MHz(524),RIG_MODE_FM,-1,-1,RIG_VFO_B}, {MHz(800),MHz(1300),RIG_MODE_FM,-1,-1,RIG_VFO_B}, /* TODO: cellular blocked */ RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {MHz(144),MHz(148),TMD710_MODES_TX,W(5),W(50),RIG_VFO_A}, {MHz(430),MHz(450),TMD710_MODES_TX,W(5),W(35),RIG_VFO_A}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {TMD710_MODES,kHz(5)}, {TMD710_MODES,kHz(6.25)}, {TMD710_MODES,kHz(10)}, {TMD710_MODES,kHz(12.5)}, {TMD710_MODES,kHz(15)}, {TMD710_MODES,kHz(20)}, {TMD710_MODES,kHz(25)}, {TMD710_MODES,kHz(30)}, {TMD710_MODES,kHz(50)}, {TMD710_MODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_FM, kHz(12)}, {RIG_MODE_AM, kHz(9)}, /* TBC */ RIG_FLT_END, }, .priv = (void *)&tmd710_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = tmd710_set_freq, .get_freq = tmd710_get_freq, .set_mode = tmd710_set_mode, .get_mode = tmd710_get_mode, .set_vfo = tmd710_set_vfo, .get_vfo = tmd710_get_vfo, .set_ts = tmd710_set_ts, .get_ts = tmd710_get_ts, .set_ctcss_tone = tmd710_set_ctcss_tone, .get_ctcss_tone = tmd710_get_ctcss_tone, .set_ctcss_sql = tmd710_set_ctcss_sql, .get_ctcss_sql = tmd710_get_ctcss_sql, //.set_split_vfo = th_set_split_vfo, //.get_split_vfo = th_get_split_vfo, //.set_dcs_sql = th_set_dcs_sql, //.get_dcs_sql = th_get_dcs_sql, //.set_mem = th_set_mem, //.get_mem = th_get_mem, //.set_channel = th_set_channel, //.get_channel = th_get_channel, //.set_trn = th_set_trn, //.get_trn = th_get_trn, //.set_func = th_set_func, //.get_func = th_get_func, //.set_level = th_set_level, //.get_level = th_get_level, //.set_parm = th_set_parm, //.get_parm = th_get_parm, //.get_info = th_get_info, //.get_dcd = th_get_dcd, //.set_ptt = th_set_ptt, //.vfo_op = th_vfo_op, //.scan = th_scan, .set_rptr_shift = tmd710_set_rptr_shift, .get_rptr_shift = tmd710_get_rptr_shift, .set_rptr_offs = tmd710_set_rptr_offs, .get_rptr_offs = tmd710_get_rptr_offs, .decode_event = th_decode_event, }; /* structure for handling fo radio command */ typedef struct { int vfo; freq_t freq; int step; int shift; int reverse; int tone; int ct; int dsc; int tone_freq; int ct_freq; int dsc_val; int offset; int mode; } tmd710_fo; /* the d710 has a single command FO that queries and sets many values */ /* this pulls that string from the radio given a vfo */ /* push/pull language is uses for stuff inside 710 driver rather than get/set */ int tmd710_pull_fo(RIG * rig,vfo_t vfo, tmd710_fo *fo_struct) { char cmdbuf[50]; char buf[50]; int vfonum = 0; int retval; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); switch (vfo) { case (RIG_VFO_CURR): vfonum = rig->state.current_vfo==RIG_VFO_B; break; case (RIG_VFO_A): vfonum = 0; break; case (RIG_VFO_B): vfonum = 1; break; } // if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo) //return kenwood_wrong_vfo(__func__, vfo); snprintf(cmdbuf,49,"FO %d",vfonum); retval = kenwood_safe_transaction(rig, cmdbuf, buf, sizeof(buf), 49); if (retval != RIG_OK) return retval; retval = num_sscanf(buf, "FO %x,%"SCNfreq",%x,%x,%x,%x,%x,%x,%d,%d,%d,%d,%d", &fo_struct->vfo, &fo_struct->freq, &fo_struct->step, &fo_struct->shift, &fo_struct->reverse, &fo_struct->tone, &fo_struct->ct, &fo_struct->dsc, &fo_struct->tone_freq, &fo_struct->ct_freq, &fo_struct->dsc_val, &fo_struct->offset, &fo_struct->mode); if (retval != 13) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, buf); return -RIG_ERJCTED; } return RIG_OK; } int tmd710_push_fo(RIG * rig,vfo_t vfo, tmd710_fo *fo_struct) { char cmdbuf[50]; char buf[50]; int retval; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); //if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo) // return kenwood_wrong_vfo(__func__, vfo); snprintf(cmdbuf,49,"FO %1d,%010.0f,%1d,%1d,%1d,%1d,%1d,%1d,%02d,%02d,%03d,%08d,%1d", fo_struct->vfo, fo_struct->freq, fo_struct->step, fo_struct->shift, fo_struct->reverse, fo_struct->tone, fo_struct->ct, fo_struct->dsc, fo_struct->tone_freq, fo_struct->ct_freq, fo_struct->dsc_val, fo_struct->offset, fo_struct->mode); retval = kenwood_safe_transaction(rig, cmdbuf, buf, sizeof(buf), 49); if (retval != RIG_OK) return retval; retval = num_sscanf(buf, "FO %x,%"SCNfreq",%x,%x,%x,%x,%x,%x,%d,%d,%d,%d,%d", &fo_struct->vfo, &fo_struct->freq, &fo_struct->step, &fo_struct->shift, &fo_struct->reverse, &fo_struct->tone, &fo_struct->ct, &fo_struct->dsc, &fo_struct->tone_freq, &fo_struct->ct_freq, &fo_struct->dsc_val, &fo_struct->offset, &fo_struct->mode); if (retval != 13) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, buf); return -RIG_ERJCTED; } return RIG_OK; } /* * th_set_freq * Assumes rig!=NULL */ int tmd710_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { int retval; tmd710_fo fo_struct; long freq5,freq625,freq_sent; int step; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); // if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo) // return kenwood_wrong_vfo(__func__, vfo); retval = tmd710_pull_fo (rig,vfo,&fo_struct); if (retval != RIG_OK){ return retval; } freq5=round(freq/5000)*5000; freq625=round(freq/6250)*6250; if (abs(freq5-freq)= MHz(470) ? 4 : step; fo_struct.freq = freq_sent >= MHz(470) ? (round(freq_sent/10000)*10000) : freq_sent; retval=tmd710_push_fo (rig, vfo, &fo_struct); return retval; } /* * th_get_freq * Assumes rig!=NULL, freq!=NULL */ int tmd710_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { tmd710_fo fo_struct; int retval; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); //if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo) // return kenwood_wrong_vfo(__func__, vfo); retval = tmd710_pull_fo(rig,vfo,&fo_struct); *freq = fo_struct.freq;; return retval; } /* * tmd710_set_ctcss_tone * Assumes rig!=NULL, freq!=NULL */ static int tmd710_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone) { int retval,k,stepind = -1; tmd710_fo fo_struct; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); for (k=0;k<42;k++) { if (rig->caps->ctcss_list[k]==tone) { stepind = k; break; } } if (stepind == -1) { rig_debug(RIG_DEBUG_ERR, "%s: Unsupported tone value '%d'\n", __func__, tone); return -RIG_EINVAL; } retval = tmd710_pull_fo(rig,vfo,&fo_struct); if (retval == RIG_OK) { fo_struct.tone_freq = stepind; retval = tmd710_push_fo(rig,vfo,&fo_struct); } return retval; } /* * tmd710_get_ctcss_tone * Assumes rig!=NULL, freq!=NULL */ int tmd710_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone) { tmd710_fo fo_struct; int retval; const struct rig_caps *caps; caps = rig->caps; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); //if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo) // return kenwood_wrong_vfo(__func__, vfo); retval = tmd710_pull_fo(rig,vfo,&fo_struct); if (retval == RIG_OK) { *tone = caps->ctcss_list[fo_struct.tone_freq]; } return retval; } /* * tmd710_set_ts * Assumes rig!=NULL, freq!=NULL */ static int tmd710_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone) { int retval,k,stepind = -1; tmd710_fo fo_struct; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); for (k=0;k<42;k++) { if (rig->caps->ctcss_list[k]==tone) { stepind = k; break; } } if (stepind == -1) { rig_debug(RIG_DEBUG_ERR, "%s: Unsupported tone value '%d'\n", __func__, tone); return -RIG_EINVAL; } retval = tmd710_pull_fo(rig,vfo,&fo_struct); if (retval == RIG_OK) { fo_struct.ct_freq = stepind; retval = tmd710_push_fo(rig,vfo,&fo_struct); } return retval; } /* * tmd710_get_ctcss_sql * Assumes rig!=NULL, freq!=NULL */ int tmd710_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone) { tmd710_fo fo_struct; int retval; const struct rig_caps *caps; caps = rig->caps; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); //if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo) // return kenwood_wrong_vfo(__func__, vfo); retval = tmd710_pull_fo(rig,vfo,&fo_struct); if (retval == RIG_OK) { *tone = caps->ctcss_list[fo_struct.ct_freq]; } return retval; } /* * tmd710_set_mode * Assumes rig!=NULL, freq!=NULL */ static int tmd710_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { int retval; tmd710_fo fo_struct; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); retval = tmd710_pull_fo(rig,vfo,&fo_struct); if (retval == RIG_OK) { if ((mode == RIG_MODE_FM) && (width ==15000)) { fo_struct.mode = 0; } else if ((mode == RIG_MODE_FM) && (width == 6250)) { fo_struct.mode = 1; }else if (mode == RIG_MODE_AM) { fo_struct.mode = 1; } else { rig_debug(RIG_DEBUG_ERR, "%s: Illegal value from radio '%ld'\n", __func__, mode); return -RIG_EINVAL; } retval = tmd710_push_fo(rig,vfo,&fo_struct); } return retval; } /* * tmd710_get_mode * Assumes rig!=NULL, freq!=NULL */ int tmd710_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { tmd710_fo fo_struct; int retval; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); retval = tmd710_pull_fo(rig,vfo,&fo_struct); if (retval == RIG_OK) { switch (fo_struct.mode) { case 0: *mode = RIG_MODE_FM; *width = 15000; break; case 1: *mode = RIG_MODE_FM; *width = 6250; break; case 2: *mode = RIG_MODE_AM; *width = 4000; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Illegal value from radio '%ld'\n", __func__, mode); return -RIG_EINVAL; } } return retval; } /* * tmd710_set_ts * Assumes rig!=NULL, freq!=NULL */ static int tmd710_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) { int retval,k,stepind = -1; tmd710_fo fo_struct; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); for (k=0;kcaps->tuning_steps[k].modes==RIG_MODE_NONE) && (rig->caps->tuning_steps[k].ts==0)) break; else if (rig->caps->tuning_steps[k].ts==ts) { stepind = k; break; } } if (stepind == -1) { rig_debug(RIG_DEBUG_ERR, "%s: Unsupported step value '%ld'\n", __func__, ts); return -RIG_EINVAL; } retval = tmd710_pull_fo(rig,vfo,&fo_struct); if (retval == RIG_OK) { fo_struct.step = stepind; retval = tmd710_push_fo(rig,vfo,&fo_struct); } return retval; } /* * tmd710_get_ts * Assumes rig!=NULL, freq!=NULL */ static int tmd710_get_ts(RIG *rig, vfo_t vfo, shortfreq_t* ts) { int retval; tmd710_fo fo_struct; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); retval = tmd710_pull_fo(rig,vfo,&fo_struct); if (retval == RIG_OK) { *ts = rig->caps->tuning_steps[fo_struct.step].ts; } return retval; } /* * tmd710_get_rptr_shft * Assumes rig!=NULL, freq!=NULL */ int tmd710_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift) { int retval; tmd710_fo fo_struct; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); retval = tmd710_pull_fo(rig,vfo,&fo_struct); if (retval == RIG_OK) { switch (shift) { case RIG_RPT_SHIFT_NONE: fo_struct.shift = 0; break; case RIG_RPT_SHIFT_PLUS: fo_struct.shift = 1; break; case RIG_RPT_SHIFT_MINUS: fo_struct.shift = 2; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unexpected shift value '%d'\n", __func__, fo_struct.shift); return -RIG_EPROTO; break; } } return retval; } /* * tmd710_get_rptr_shft * Assumes rig!=NULL, freq!=NULL */ int tmd710_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t* shift) { int retval; tmd710_fo fo_struct; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); retval = tmd710_pull_fo(rig,vfo,&fo_struct); if (retval == RIG_OK) { switch (fo_struct.shift) { case 0: *shift = RIG_RPT_SHIFT_NONE; break; case 1: *shift = RIG_RPT_SHIFT_PLUS; break; case 2: *shift = RIG_RPT_SHIFT_MINUS; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unexpected shift value '%d'\n", __func__, fo_struct.shift); return -RIG_EPROTO; break; } } return retval; } /* * th_set_rptr_offs * Assumes rig!=NULL */ int tmd710_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t freq) { int retval; tmd710_fo fo_struct; long freq5,freq625,freq_sent; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); // if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo) // return kenwood_wrong_vfo(__func__, vfo); retval = tmd710_pull_fo (rig,vfo,&fo_struct); if (retval != RIG_OK){ return retval; } freq5=round(freq/5000)*5000; freq625=round(freq/6250)*6250; if (abs(freq5-freq)= MHz(470) ? (round(freq_sent/10000)*10000) : freq_sent; retval=tmd710_push_fo (rig, vfo, &fo_struct); return retval; } /* * tmd710_get_rptr_offs * Assumes rig!=NULL, freq!=NULL */ int tmd710_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs) { tmd710_fo fo_struct; int retval; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); //if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo) // return kenwood_wrong_vfo(__func__, vfo); retval = tmd710_pull_fo(rig,vfo,&fo_struct); if (retval == RIG_OK) *rptr_offs = fo_struct.offset; return retval; } int tmd710_get_vfo_char(RIG *rig, vfo_t *vfo, char *vfoch) { char cmdbuf[10], buf[10], vfoc; size_t buf_size=10; int retval; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); /* Get VFO band */ retval = kenwood_transaction(rig, "BC", 2, buf, &buf_size); if (retval != RIG_OK) return retval; switch (buf_size) { case 7: /*intended for D700 BC 0,0*/ if ((buf[0]=='B') &&(buf[1]=='C') && (buf[2]==' ') && (buf[4]=',')){ vfoc = buf[3]; } else { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected answer format '%s'\n", __func__, buf); return -RIG_EPROTO; } break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unexpected answer length '%c'\n", __func__, buf_size); return -RIG_EPROTO; break; } switch (vfoc) { case '0': *vfo = RIG_VFO_A; break; case '1': *vfo = RIG_VFO_B; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unexpected VFO value '%c'\n", __func__, buf[3]); return -RIG_EVFO; } rig->state.current_vfo = *vfo; /* Get mode of the VFO band */ snprintf(cmdbuf, 9, "VM %c", vfoc); retval = kenwood_safe_transaction(rig, cmdbuf, buf, 10, 7); if (retval != RIG_OK) return retval; *vfoch = buf[5]; return RIG_OK; } /* * tmd710_get_vfo * Assumes rig!=NULL */ int tmd710_get_vfo(RIG *rig, vfo_t *vfo) { char vfoch; int retval; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); retval = tmd710_get_vfo_char(rig, vfo, &vfoch); if (retval != RIG_OK) return retval; switch (vfoch) { case '0' : case '1' : break; case '2' : *vfo = RIG_VFO_MEM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unexpected VFO value '%c'\n", __func__, vfoch); return -RIG_EVFO; } return RIG_OK; } /* * tm_set_vfo_bc2 * Apply to split-capable models (with BC command taking 2 args): TM-V7, TM-D700 * * Assumes rig!=NULL */ int tmd710_set_vfo (RIG *rig, vfo_t vfo) { struct kenwood_priv_data *priv = rig->state.priv; char vfobuf[16], ackbuf[16]; int vfonum, txvfonum, vfomode=0; int retval; size_t ack_len; rig_debug(RIG_DEBUG_TRACE, "%s: called %s\n", __func__, rig_strvfo(vfo)); switch (vfo) { case RIG_VFO_A: case RIG_VFO_VFO: vfonum = 0; /* put back split mode when toggling */ txvfonum = (priv->split == RIG_SPLIT_ON && rig->state.tx_vfo == RIG_VFO_B) ? 1 : vfonum; break; case RIG_VFO_B: vfonum = 1; /* put back split mode when toggling */ txvfonum = (priv->split == RIG_SPLIT_ON && rig->state.tx_vfo == RIG_VFO_A) ? 0 : vfonum; break; case RIG_VFO_MEM: /* get current band */ snprintf(vfobuf, 10, "BC"); ack_len=16; retval = kenwood_transaction(rig, vfobuf, strlen(vfobuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; txvfonum = vfonum = ackbuf[3]-'0'; vfomode = 2; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported VFO %d\n", __func__, vfo); return -RIG_EVFO; } snprintf(vfobuf,9, "VM %d,%d", vfonum, vfomode); retval = kenwood_cmd(rig, vfobuf); if (retval != RIG_OK) return retval; if (vfo == RIG_VFO_MEM) return RIG_OK; snprintf(vfobuf, 15, "BC %d,%d", vfonum, txvfonum); retval = kenwood_cmd(rig, vfobuf); if (retval != RIG_OK) return retval; return RIG_OK; } /* end of file */ hamlib-1.2.15.3/kenwood/ts440.c0000644000175000017500000001304412044564477012625 00000000000000/* * Hamlib Kenwood backend - TS440 description * Copyright (c) 2000-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "kenwood.h" #include "ic10.h" #define TS440_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define TS440_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define TS440_AM_TX_MODES RIG_MODE_AM #define TS440_FUNC_ALL RIG_FUNC_LOCK #define TS440_LEVEL_ALL RIG_LEVEL_NONE #define TS440_VFO (RIG_VFO_A|RIG_VFO_B) #define TS440_VFO_OPS (RIG_OP_UP|RIG_OP_DOWN) #define TS440_SCAN_OPS (RIG_SCAN_VFO) static struct kenwood_priv_caps ts440_priv_caps = { .cmdtrm = EOM_KEN, .if_len = 38, }; /* * ts440 rig capabilities. * * TODO: scan, get/set_channel, RIT/XIT, Voice Recall, split * * part of infos comes from .http = //www.n7uic.net/radio/kenwood/ts440/specs.htm * .http = //public.srce.hr/9A1CDD/mods/kenwood/knwdif.mod * .http = //www.ifrance.fr/clucas/modposte/ts440/mod440.htm * */ const struct rig_caps ts440_caps = { .rig_model = RIG_MODEL_TS440, .model_name = "TS-440", .mfg_name = "Kenwood", .version = BACKEND_VER "." IC10_VER, .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 20, .post_write_delay = 30, .timeout = 200, .retry = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = TS440_FUNC_ALL, .has_get_level = TS440_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(TS440_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9990), .max_xit = Hz(9990), .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_FREQ, .vfo_ops = TS440_VFO_OPS, .scan_ops = TS440_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 99, RIG_MTYPE_MEM, {IC10_CHANNEL_CAPS} }, 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),TS440_ALL_MODES,-1,-1,TS440_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {kHz(1800),MHz(2)-1,TS440_OTHER_TX_MODES,5000,W(200),TS440_VFO}, {kHz(1800),MHz(2)-1,TS440_AM_TX_MODES,2000,W(110),TS440_VFO}, {kHz(3500),MHz(4)-1,TS440_OTHER_TX_MODES,5000,W(200),TS440_VFO}, {kHz(3500),MHz(4)-1,TS440_AM_TX_MODES,2000,W(110),TS440_VFO}, {MHz(7),kHz(7300),TS440_OTHER_TX_MODES,5000,W(200),TS440_VFO}, {MHz(7),kHz(7300),TS440_AM_TX_MODES,2000,W(110),TS440_VFO}, {kHz(10100),kHz(10150),TS440_OTHER_TX_MODES,5000,W(200),TS440_VFO}, {kHz(10100),kHz(10150),TS440_AM_TX_MODES,2000,W(110),TS440_VFO}, {MHz(14),kHz(14350),TS440_OTHER_TX_MODES,5000,W(200),TS440_VFO}, {MHz(14),kHz(14350),TS440_AM_TX_MODES,2000,W(110),TS440_VFO}, {kHz(18068),kHz(18168),TS440_OTHER_TX_MODES,5000,W(200),TS440_VFO}, {kHz(18068),kHz(18168),TS440_AM_TX_MODES,2000,W(110),TS440_VFO}, {MHz(21),kHz(21450),TS440_OTHER_TX_MODES,5000,W(200),TS440_VFO}, {MHz(21),kHz(21450),TS440_AM_TX_MODES,2000,W(110),TS440_VFO}, {kHz(24890),kHz(24990),TS440_OTHER_TX_MODES,5000,W(200),TS440_VFO}, {kHz(24890),kHz(24990),TS440_AM_TX_MODES,2000,W(110),TS440_VFO}, {MHz(28),kHz(29700),TS440_OTHER_TX_MODES,5000,W(200),TS440_VFO}, {MHz(28),kHz(29700),TS440_AM_TX_MODES,2000,W(110),TS440_VFO}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {TS440_ALL_MODES,10}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.2)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .priv = (void *)&ts440_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = ic10_get_freq, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_xit = kenwood_set_xit, .get_xit = kenwood_get_xit, .set_mode = kenwood_set_mode, .get_mode = ic10_get_mode, .set_vfo = ic10_set_vfo, .get_vfo = ic10_get_vfo, .set_split_vfo = ic10_set_split_vfo, .get_split_vfo = ic10_get_split_vfo, .set_ptt = kenwood_set_ptt, .get_ptt = ic10_get_ptt, .set_func = kenwood_set_func, .vfo_op = kenwood_vfo_op, .set_mem = kenwood_set_mem, .get_mem = ic10_get_mem, .set_trn = kenwood_set_trn, .scan = kenwood_scan, .set_channel = ic10_set_channel, .get_channel = ic10_get_channel, .decode_event = ic10_decode_event, }; /* * Function definitions below */ hamlib-1.2.15.3/kenwood/ts50s.c0000644000175000017500000001617612044564477012736 00000000000000/* * Hamlib Kenwood backend - TS50 description * Copyright (c) 2002-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "kenwood.h" #define TS50_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define TS50_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define TS50_AM_TX_MODES RIG_MODE_AM #define TS50_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_TSQL|RIG_FUNC_TONE|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_NR|RIG_FUNC_LOCK|RIG_FUNC_BC) #define TS50_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQL|RIG_LEVEL_STRENGTH|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN) #define TS50_VFO (RIG_VFO_A|RIG_VFO_B) #define TS50_VFO_OP (RIG_OP_UP|RIG_OP_DOWN) static struct kenwood_priv_caps ts50_priv_caps = { .cmdtrm = EOM_KEN, }; /* * ts50 rig capabilities. * * part of infos comes from .http = //www.kenwood.net/ */ const struct rig_caps ts50s_caps = { .rig_model = RIG_MODEL_TS50, .model_name = "TS-50S", .mfg_name = "Kenwood", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_MOBILE, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 57600, .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 = TS50_FUNC_ALL, .has_set_func = TS50_FUNC_ALL, .has_get_level = TS50_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(TS50_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, /* FIXME: preamp list */ .attenuator = { 18, RIG_DBLST_END, }, .max_rit = kHz(1.1), .max_xit = Hz(0), .max_ifshift = Hz(0), .vfo_ops = TS50_VFO_OP, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 89, RIG_MTYPE_MEM }, { 90, 99, RIG_MTYPE_EDGE }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(500),MHz(30),TS50_ALL_MODES,-1,-1,TS50_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { {kHz(1810),kHz(1850)-1,TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, /* 100W class */ {kHz(1800),MHz(2)-1,TS50_AM_TX_MODES,5000,25000,TS50_VFO}, /* 25W class */ {kHz(3500),kHz(3800)-1,TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {kHz(3500),kHz(3800)-1,TS50_AM_TX_MODES,5000,25000,TS50_VFO}, {MHz(7),kHz(7100),TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {MHz(7),kHz(7100),TS50_AM_TX_MODES,5000,25000,TS50_VFO}, {kHz(10100),kHz(10150),TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {kHz(10100),kHz(10150),TS50_AM_TX_MODES,5000,25000,TS50_VFO}, {MHz(14),kHz(14350),TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {MHz(14),kHz(14350),TS50_AM_TX_MODES,5000,25000,TS50_VFO}, {kHz(18068),kHz(18168),TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {kHz(18068),kHz(18168),TS50_AM_TX_MODES,5000,25000,TS50_VFO}, {MHz(21),kHz(21450),TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {MHz(21),kHz(21450),TS50_AM_TX_MODES,5000,25000,TS50_VFO}, {kHz(24890),kHz(24990),TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {kHz(24890),kHz(24990),TS50_AM_TX_MODES,5000,25000,TS50_VFO}, {MHz(28),kHz(29700),TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {MHz(28),kHz(29700),TS50_AM_TX_MODES,5000,25000,TS50_VFO}, RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30),TS50_ALL_MODES,-1,-1,TS50_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { {kHz(1800),MHz(2)-1,TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, /* 100W class */ {kHz(1800),MHz(2)-1,TS50_AM_TX_MODES,5000,25000,TS50_VFO}, /* 25W class */ {kHz(3500),MHz(4)-1,TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {kHz(3500),MHz(4)-1,TS50_AM_TX_MODES,5000,25000,TS50_VFO}, {MHz(7),kHz(7300),TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {MHz(7),kHz(7300),TS50_AM_TX_MODES,5000,25000,TS50_VFO}, {kHz(10100),kHz(10150),TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {kHz(10100),kHz(10150),TS50_AM_TX_MODES,5000,25000,TS50_VFO}, {MHz(14),kHz(14350),TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {MHz(14),kHz(14350),TS50_AM_TX_MODES,5000,25000,TS50_VFO}, {kHz(18068),kHz(18168),TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {kHz(18068),kHz(18168),TS50_AM_TX_MODES,5000,25000,TS50_VFO}, {MHz(21),kHz(21450),TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {MHz(21),kHz(21450),TS50_AM_TX_MODES,5000,25000,TS50_VFO}, {kHz(24890),kHz(24990),TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {kHz(24890),kHz(24990),TS50_AM_TX_MODES,5000,25000,TS50_VFO}, {MHz(28),kHz(29700),TS50_OTHER_TX_MODES,5000,100000,TS50_VFO}, {MHz(28),kHz(29700),TS50_AM_TX_MODES,5000,25000,TS50_VFO}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {TS50_ALL_MODES,50}, {TS50_ALL_MODES,100}, {TS50_ALL_MODES,kHz(1)}, {TS50_ALL_MODES,kHz(5)}, {TS50_ALL_MODES,kHz(9)}, {TS50_ALL_MODES,kHz(10)}, {TS50_ALL_MODES,12500}, {TS50_ALL_MODES,kHz(20)}, {TS50_ALL_MODES,kHz(25)}, {TS50_ALL_MODES,kHz(100)}, {TS50_ALL_MODES,MHz(1)}, {TS50_ALL_MODES,0}, /* any tuning step */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.2)}, {RIG_MODE_AM, kHz(5)}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .priv = (void *)&ts50_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_xit = kenwood_set_xit, .get_xit = kenwood_get_xit, .set_mode = kenwood_set_mode, .get_mode = kenwood_get_mode, .set_vfo = kenwood_set_vfo, .get_vfo = kenwood_get_vfo_if, .set_ctcss_tone = kenwood_set_ctcss_tone, .get_ctcss_tone = kenwood_get_ctcss_tone, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt, .get_dcd = kenwood_get_dcd, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .set_level = kenwood_set_level, .get_level = kenwood_get_level, .vfo_op = kenwood_vfo_op, .set_mem = kenwood_set_mem, .get_mem = kenwood_get_mem, .set_trn = kenwood_set_trn, .get_trn = kenwood_get_trn, .set_powerstat = kenwood_set_powerstat, .get_powerstat = kenwood_get_powerstat, .reset = kenwood_reset, }; /* * Function definitions below */ hamlib-1.2.15.3/kenwood/ic10.c0000644000175000017500000005345312044564477012513 00000000000000/* * Hamlib Kenwood backend - IC-10 interface for: * TS-940, TS-811, TS-711, TS-440, and R-5000 * * Copyright (c) 2000-2010 by Stephane Fillod and others * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include /* character class tests */ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "register.h" #include "kenwood.h" #include "ic10.h" /**** * ic10_cmd_trim * gobbles up additional spaces at the end of a line * ****/ int ic10_cmd_trim (char *data, int data_len) { int i; rig_debug(RIG_DEBUG_TRACE, "%s: incoming data_len is '%d'\n", __func__, data_len); /* suck up additional spaces at end of the data buffer */ for (i=data_len; !isdigit(data[i-1]); i--) { data_len = data_len-1; rig_debug(RIG_DEBUG_TRACE,"%s: data['%d'] is '%c'\n", __func__, i-1, data[i-1]); rig_debug(RIG_DEBUG_TRACE,"%s: For i='%d' data_len is now '%d'\n", __func__, i, data_len); } rig_debug(RIG_DEBUG_TRACE, "%s: finished loop.. i='%d' data_len='%d' data[i-1]='%c'\n", __func__, i, data_len, data[i-1]); return data_len; } /** * ic10_transaction * Assumes rig!=NULL rig->state!=NULL rig->caps!=NULL **/ int ic10_transaction (RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval; struct rig_state *rs; rs = &rig->state; serial_flush(&rs->rigport); retval = write_block(&rs->rigport, cmd, cmd_len); if (retval != RIG_OK) return retval; if (!data || !data_len) return 0; retval = read_string(&rs->rigport, data, 50, ";", 1); if (retval == -RIG_ETIMEOUT) retval = 0; if (retval < 0) return retval; *data_len = retval; return RIG_OK; } /* * Get the anwser of IF command, with retry handling */ static int get_ic10_if (RIG *rig, char *data) { struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv; int i, data_len, retval=!RIG_OK; for (i=0; retval!=RIG_OK && i < rig->caps->retry; i++) { data_len = 38; retval = ic10_transaction (rig, "IF;", 3, data, &data_len); if (retval != RIG_OK) continue; if (retval == RIG_OK && (data_len < priv->if_len || data[0] != 'I' || data[1] != 'F')) { rig_debug(RIG_DEBUG_WARN,"%s: unexpected answer %s, len=%d\n", __func__, data, data_len); retval = -RIG_ERJCTED; } } return retval; } /* * ic10_set_vfo * Assumes rig!=NULL */ int ic10_set_vfo(RIG *rig, vfo_t vfo) { char ackbuf[16], cmdbuf[6]; int cmd_len, retval, ack_len; char vfo_function; switch (vfo) { case RIG_VFO_VFO: case RIG_VFO_A: vfo_function = '0'; break; case RIG_VFO_B: vfo_function = '1'; break; case RIG_VFO_MEM: vfo_function = '2'; break; case RIG_VFO_CURR: return RIG_OK; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %d\n", __func__, vfo); return -RIG_EINVAL; } cmd_len = sprintf(cmdbuf, "FN%c;", vfo_function); retval = ic10_transaction (rig, cmdbuf, cmd_len, ackbuf, &ack_len); return retval; } /* * ic10_get_vfo * Assumes rig!=NULL, !vfo */ int ic10_get_vfo(RIG *rig, vfo_t *vfo) { struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv; char vfobuf[50]; unsigned char c; int retval, iflen; /* query RX VFO */ retval = get_ic10_if(rig, vfobuf); if (retval != RIG_OK) return retval; /* trim extra spaces */ iflen = ic10_cmd_trim(vfobuf, priv->if_len); /* IFggmmmkkkhhh snnnzrx yytdfcp */ /* IFggmmmkkkhhhxxxxxrrrrrssxcctmfcp */ c = vfobuf[iflen - 3]; switch (c) { case '0': *vfo = RIG_VFO_A; break; case '1': *vfo = RIG_VFO_B; break; case '2': *vfo = RIG_VFO_MEM; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %c\n", __func__, c); return -RIG_EPROTO; } return RIG_OK; } int ic10_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo) { char ackbuf[16]; int ack_len; return ic10_transaction (rig, split==RIG_SPLIT_ON? "SP1;":"SP0;", 4, ackbuf, &ack_len); } int ic10_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *txvfo) { struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv; char infobuf[50]; int retval, iflen; retval = get_ic10_if (rig, infobuf); if (retval != RIG_OK) return retval; /* trim extra spaces */ iflen = ic10_cmd_trim(infobuf, priv->if_len); /* IFggmmmkkkhhh snnnzrx yytdfcp */ /* IFggmmmkkkhhhxxxxxrrrrrssxcctmfcp */ *split = infobuf[iflen-1] == '0' ? RIG_SPLIT_OFF : RIG_SPLIT_ON; return RIG_OK; } /* * ic10_get_mode * Assumes rig!=NULL, !vfo */ int ic10_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv; char modebuf[50]; unsigned char c; int retval, iflen; /* query RX VFO */ retval = get_ic10_if (rig, modebuf); if (retval != RIG_OK) return retval; /* trim extra spaces */ iflen = ic10_cmd_trim(modebuf, priv->if_len); /* IFggmmmkkkhhh snnnzrx yytdfcp */ /* IFggmmmkkkhhhxxxxxrrrrrssxcctmfcp */ c = modebuf[iflen-4]; switch (c) { case MD_CW : *mode = RIG_MODE_CW; break; case MD_USB : *mode = RIG_MODE_USB; break; case MD_LSB : *mode = RIG_MODE_LSB; break; case MD_FM : *mode = RIG_MODE_FM; break; case MD_AM : *mode = RIG_MODE_AM; break; case MD_FSK : *mode = RIG_MODE_RTTY; break; case MD_NONE: *mode = RIG_MODE_NONE; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode '%c'\n", __func__, c); return -RIG_EINVAL; } *width = rig_passband_normal(rig, *mode); return RIG_OK; } /* * ic10_set_mode * Assumes rig!=NULL */ int ic10_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { char modebuf[6], ackbuf[16]; int mode_len, ack_len, retval; char mode_letter; switch (mode) { case RIG_MODE_LSB : mode_letter = MD_LSB; break; case RIG_MODE_USB : mode_letter = MD_USB; break; case RIG_MODE_CW : mode_letter = MD_CW; break; case RIG_MODE_FM : mode_letter = MD_FM; break; case RIG_MODE_AM : mode_letter = MD_AM; break; case RIG_MODE_RTTY : mode_letter = MD_FSK; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n", __func__,mode); return -RIG_EINVAL; } mode_len = sprintf(modebuf,"MD%c;", mode_letter); retval = ic10_transaction (rig, modebuf, mode_len, ackbuf, &ack_len); return retval; } /* * ic10_get_freq * Assumes rig!=NULL, freq!=NULL */ int ic10_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { char infobuf[50]; int retval; if (vfo != RIG_VFO_CURR) { /* targeted freq retrieval */ return kenwood_get_freq(rig, vfo, freq); } retval = get_ic10_if (rig, infobuf); if (retval != RIG_OK) return retval; /* IFggmmmkkkhhh snnnzrx yytdfcp */ /* IFggmmmkkkhhhxxxxxrrrrrssxcctmfcp */ infobuf[13] = '\0'; sscanf(infobuf+2, "%011"SCNfreq, freq); return RIG_OK; } /* * ic10_set_freq * Assumes rig!=NULL */ int ic10_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char freqbuf[16], ackbuf[16]; int freq_len, ack_len, retval; unsigned char vfo_letter; vfo_t tvfo; if(vfo==RIG_VFO_CURR) tvfo=rig->state.current_vfo; else tvfo=vfo; switch (tvfo) { case RIG_VFO_A: vfo_letter = 'A'; break; case RIG_VFO_B: vfo_letter = 'B'; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %d\n", __func__,vfo); return -RIG_EINVAL; } freq_len = sprintf(freqbuf,"F%c%011"PRIll";", vfo_letter, (int64_t)freq); retval = ic10_transaction (rig, freqbuf, freq_len, ackbuf, &ack_len); return retval; } /* * ic10_set_ant * Assumes rig!=NULL */ int ic10_set_ant(RIG *rig, vfo_t vfo, ant_t ant) { char buf[6], ackbuf[16]; int len, ack_len, retval; len = sprintf(buf,"AN%c;", ant==RIG_ANT_1?'1':'2'); retval = ic10_transaction(rig, buf, len, ackbuf, &ack_len); return retval; } /* * ic10_get_ant * Assumes rig!=NULL, ptt!=NULL */ int ic10_get_ant(RIG *rig, vfo_t vfo, ant_t *ant) { char infobuf[50]; int info_len, retval; info_len = 4; retval = ic10_transaction (rig, "AN;", 3, infobuf, &info_len); if (retval != RIG_OK) return retval; if (info_len < 4 || infobuf[0] != 'A' || infobuf[1] != 'N') { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer len=%d\n", __func__,info_len); return -RIG_ERJCTED; } *ant = infobuf[2] == '1' ? RIG_ANT_1 : RIG_ANT_2; return RIG_OK; } /* * ic10_get_ptt * Assumes rig!=NULL, ptt!=NULL */ int ic10_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv; char infobuf[50]; int retval, iflen; retval = get_ic10_if (rig, infobuf); if (retval != RIG_OK) return retval; /* trim extra spaces */ iflen = ic10_cmd_trim(infobuf, priv->if_len); /* IFggmmmkkkhhh snnnzrx yytdfcp */ /* IFggmmmkkkhhhxxxxxrrrrrssxcctmfcp */ *ptt = infobuf[iflen-5] == '0' ? RIG_PTT_OFF : RIG_PTT_ON; return RIG_OK; } /* * ic10_set_ptt * Assumes rig!=NULL */ int ic10_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { char pttbuf[4], ackbuf[16]; int ptt_len, ack_len, retval; unsigned char ptt_letter; switch (ptt) { case RIG_PTT_OFF: ptt_letter = 'R'; break; case RIG_PTT_ON : ptt_letter = 'T'; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported PTT %d\n", __func__,ptt); return -RIG_EINVAL; } ptt_len = sprintf(pttbuf,"%cX;", ptt_letter); retval = ic10_transaction (rig, pttbuf, ptt_len, ackbuf, &ack_len); return retval; } /* * ic10_get_mem * Assumes rig!=NULL */ int ic10_get_mem(RIG *rig, vfo_t vfo, int *ch) { struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv; char membuf[50]; int retval, iflen; retval = get_ic10_if (rig, membuf); if (retval != RIG_OK) return retval; /* trim extra spaces */ iflen = ic10_cmd_trim(membuf, priv->if_len); /* IFggmmmkkkhhh snnnzrx yytdfcp */ /* IFggmmmkkkhhhxxxxxrrrrrssxcctmfcp */ membuf[iflen-5] = '\0'; *ch = atoi(membuf+priv->if_len-7); return RIG_OK; } /* * ic10_set_mem * Assumes rig!=NULL */ int ic10_set_mem(RIG *rig, vfo_t vfo, int ch) { char membuf[8], ackbuf[16]; int mem_len, ack_len, retval; mem_len = sprintf(membuf, "MC %02d;", ch); retval = ic10_transaction (rig, membuf, mem_len, ackbuf, &ack_len); return retval; } int ic10_get_channel(RIG *rig, channel_t *chan) { char membuf[16],infobuf[32]; int retval,info_len,len; len = sprintf(membuf,"MR0 %02d;",chan->channel_num); info_len = 24; retval = ic10_transaction(rig, membuf, len, infobuf, &info_len); if (retval != RIG_OK && info_len > 17) return retval; /* MRn rrggmmmkkkhhhdz ; */ switch (infobuf[17]) { case MD_CW : chan->mode = RIG_MODE_CW; break; case MD_USB : chan->mode = RIG_MODE_USB; break; case MD_LSB : chan->mode = RIG_MODE_LSB; break; case MD_FM : chan->mode = RIG_MODE_FM; break; case MD_AM : chan->mode = RIG_MODE_AM; break; case MD_FSK : chan->mode = RIG_MODE_RTTY; break; case MD_NONE: chan->mode = RIG_MODE_NONE; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode '%c'\n", __func__,infobuf[17]); return -RIG_EINVAL; } chan->width = rig_passband_normal(rig, chan->mode); /* infobuf[17] = ' '; */ infobuf[17] = '\0'; sscanf(infobuf+6, "%011"SCNfreq, &chan->freq); chan->vfo=RIG_VFO_MEM; /* TX VFO (Split channel only) */ len = sprintf(membuf,"MR1 %02d;",chan->channel_num); info_len = 24; retval = ic10_transaction(rig, membuf, len, infobuf, &info_len); if (retval == RIG_OK && info_len > 17) { /* MRn rrggmmmkkkhhhdz ; */ switch (infobuf[17]) { case MD_CW : chan->tx_mode = RIG_MODE_CW; break; case MD_USB : chan->tx_mode = RIG_MODE_USB; break; case MD_LSB : chan->tx_mode = RIG_MODE_LSB; break; case MD_FM : chan->tx_mode = RIG_MODE_FM; break; case MD_AM : chan->tx_mode = RIG_MODE_AM; break; case MD_FSK : chan->tx_mode = RIG_MODE_RTTY; break; case MD_NONE: chan->tx_mode = RIG_MODE_NONE; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode '%c'\n", __func__,infobuf[17]); return -RIG_EINVAL; } chan->tx_width = rig_passband_normal(rig, chan->tx_mode); /* infobuf[17] = ' '; */ infobuf[17] = '\0'; sscanf(infobuf+6, "%011"SCNfreq, &chan->tx_freq); } return RIG_OK; } int ic10_set_channel(RIG *rig, const channel_t *chan) { char membuf[32],ackbuf[32]; int retval,ack_len,len,md; int64_t freq; freq = (int64_t) chan->freq; switch (chan->mode) { case RIG_MODE_CW : md = MD_CW; break; case RIG_MODE_USB : md = MD_USB; break; case RIG_MODE_LSB : md = MD_LSB; break; case RIG_MODE_FM : md = MD_FM; break; case RIG_MODE_AM : md = MD_AM; break; case RIG_MODE_RTTY: md = MD_FSK; break; case RIG_MODE_NONE: md = MD_NONE; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n", __func__,chan->mode); return -RIG_EINVAL; } /* MWnxrrggmmmkkkhhhdzxxxx; */ len = sprintf(membuf,"MW0 %02d%011"PRIll"%c0 ;", chan->channel_num, freq, md ); retval = ic10_transaction(rig, membuf, len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; /* TX VFO (Split channel only) */ freq = chan->tx_freq; switch (chan->tx_mode) { case RIG_MODE_CW: md = MD_CW; break; case RIG_MODE_USB: md = MD_USB; break; case RIG_MODE_LSB: md = MD_LSB; break; case RIG_MODE_FM: md = MD_FM; break; case RIG_MODE_AM: md = MD_AM; break; case RIG_MODE_RTTY: md = MD_FSK; break; case RIG_MODE_NONE: md = MD_NONE; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n", __func__,chan->tx_mode); return -RIG_EINVAL; } /* MWnxrrggmmmkkkhhhdzxxxx; */ len = sprintf(membuf,"MW1 %02d%011"PRIll"%c0 ;", chan->channel_num, freq, md ); retval = ic10_transaction(rig, membuf, len, ackbuf, &ack_len); return RIG_OK; } /* * ic10_get_func * Assumes rig!=NULL, val!=NULL */ int ic10_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { char cmdbuf[6],fctbuf[50]; int cmdlen, fct_len, retval; fct_len = 4; switch (func) { case RIG_FUNC_LOCK: cmdlen = sprintf(cmdbuf,"LK;"); break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported get_func %#x", __func__,func); return -RIG_EINVAL; } retval = ic10_transaction (rig, cmdbuf, cmdlen, fctbuf, &fct_len); if (retval != RIG_OK) return retval; if (fct_len != 4) { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer len=%d\n", __func__,fct_len); return -RIG_ERJCTED; } *status = fctbuf[2] == '0' ? 0 : 1; return RIG_OK; } /* * ic10_set_func * Assumes rig!=NULL, val!=NULL */ int ic10_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { char cmdbuf[4], fctbuf[16], ackbuf[16]; int cmdlen, fct_len, ack_len; switch (func) { case RIG_FUNC_LOCK: cmdlen = sprintf(cmdbuf,"LK"); if (cmdlen < 0) return -RIG_ETRUNC; break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported set_func %#x", __func__,func); return -RIG_EINVAL; } fct_len = sprintf(fctbuf,"%s%c;", cmdbuf, status==0?'0':'1'); if (fct_len < 0) return -RIG_ETRUNC; return ic10_transaction (rig, fctbuf, fct_len, ackbuf, &ack_len); return RIG_OK; } /* * ic10_set_parm * Assumes rig!=NULL */ int ic10_set_parm(RIG *rig, setting_t parm, value_t val) { char cmdbuf[50]; int cmd_len; int hours; int minutes; int seconds; switch (parm) { case RIG_PARM_TIME: minutes = val.i/60; hours = minutes/60; seconds = val.i-(minutes*60); minutes = minutes%60; cmd_len = sprintf(cmdbuf, "CK1%02d%02d%02d;", hours, minutes, seconds); return ic10_transaction (rig, cmdbuf, cmd_len, NULL, NULL); break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported set_parm %d\n", __func__,parm); return -RIG_EINVAL; } return RIG_OK; } /* * ic10_get_parm * Assumes rig!=NULL, val!=NULL */ int ic10_get_parm(RIG *rig, setting_t parm, value_t *val) { int retval, lvl_len, i; char lvlbuf[50]; switch (parm) { case RIG_PARM_TIME: lvl_len = 10; retval = ic10_transaction (rig, "CK1;", 4, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; /* "CK1hhmmss;"*/ if (lvl_len != 10) { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer len=%d\n", __func__,lvl_len); return -RIG_ERJCTED; } /* convert ASCII to numeric 0..9 */ for (i=3; i<9; i++) { lvlbuf[i] -= '0'; } val->i = ((10*lvlbuf[3] + lvlbuf[4])*60 + /* hours */ 10*lvlbuf[5] + lvlbuf[6])*60 + /* minutes */ 10*lvlbuf[7] + lvlbuf[8]; /* seconds */ break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported get_parm %d\n", __func__,parm); return -RIG_EINVAL; } return RIG_OK; } /* * ic10_set_powerstat * Assumes rig!=NULL */ int ic10_set_powerstat(RIG *rig, powerstat_t status) { char pwrbuf[16], ackbuf[16]; int pwr_len, ack_len; pwr_len = sprintf(pwrbuf,"PS%c;", status==RIG_POWER_ON?'1':'0'); return ic10_transaction (rig, pwrbuf, pwr_len, ackbuf, &ack_len); } /* * ic10_get_powerstat * Assumes rig!=NULL, trn!=NULL */ int ic10_get_powerstat(RIG *rig, powerstat_t *status) { char pwrbuf[50]; int pwr_len, retval; pwr_len = 4; retval = ic10_transaction (rig, "PS;", 3, pwrbuf, &pwr_len); if (retval != RIG_OK) return retval; if (pwr_len != 4) { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer len=%d\n", __func__,pwr_len); return -RIG_ERJCTED; } *status = pwrbuf[2] == '0' ? RIG_POWER_OFF : RIG_POWER_ON; return RIG_OK; } /* * ic10_set_trn * Assumes rig!=NULL */ int ic10_set_trn(RIG *rig, int trn) { char trnbuf[16], ackbuf[16]; int trn_len, ack_len; trn_len = sprintf(trnbuf,"AI%c;", trn==RIG_TRN_RIG?'1':'0'); return ic10_transaction (rig, trnbuf, trn_len, ackbuf, &ack_len); } /* * ic10_get_trn * Assumes rig!=NULL, trn!=NULL */ int ic10_get_trn(RIG *rig, int *trn) { char trnbuf[50]; int trn_len, retval; trn_len = 38; retval = ic10_transaction (rig, "AI;", 3, trnbuf, &trn_len); if (retval != RIG_OK) return retval; if (trn_len != 38) { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer len=%d\n", __func__,trn_len); return -RIG_ERJCTED; } *trn = trnbuf[2] != '0' ? RIG_TRN_RIG : RIG_TRN_OFF; return RIG_OK; } /* * ic10_vfo_op * Assumes rig!=NULL */ int ic10_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { char *cmd, ackbuf[16]; int ack_len; switch(op) { case RIG_OP_UP : cmd = "UP;"; break; case RIG_OP_DOWN : cmd = "DN;"; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported op %#x\n", __func__,op); return -RIG_EINVAL; } return ic10_transaction (rig, cmd, 3, ackbuf, &ack_len); } /* * ic10_scan * Assumes rig!=NULL, val!=NULL */ int ic10_scan(RIG * rig, vfo_t vfo, scan_t scan, int ch) { char ackbuf[16]; int ack_len; return ic10_transaction (rig, scan==RIG_SCAN_STOP? "SC0;":"SC1;", 4, ackbuf, &ack_len); } /* * ic10_get_info * Assumes rig!=NULL */ const char* ic10_get_info(RIG *rig) { char firmbuf[50]; int firm_len, retval; firm_len = 6; retval = ic10_transaction (rig, "ID;", 3, firmbuf, &firm_len); if (retval != RIG_OK) return NULL; if (firm_len != 6) { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer len=%d\n", __func__,firm_len); return NULL; } switch (firmbuf[4]) { case '4': return "ID: TS-440S"; case '5': return "ID: R-5000"; default: return "ID: unknown"; } } /* * ic10_decode_event is called by sa_sigio, when some asynchronous * data has been received from the rig. */ int ic10_decode_event (RIG *rig) { struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv; char asyncbuf[128],c; int retval,async_len=128, iflen; vfo_t vfo; freq_t freq; rmode_t mode; ptt_t ptt; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); retval = ic10_transaction(rig, NULL, 0, asyncbuf, &async_len); if (retval != RIG_OK) return retval; rig_debug(RIG_DEBUG_TRACE, "%s: Decoding message\n", __func__); /* --------------------------------------------------------------------- */ if (async_lenif_len || asyncbuf[0] != 'I' || asyncbuf[1] != 'F') { rig_debug(RIG_DEBUG_ERR, "%s: Unsupported transceive cmd '%s'\n", __func__, asyncbuf); return -RIG_ENIMPL; } /* trim extra spaces */ iflen = ic10_cmd_trim(asyncbuf, priv->if_len); /* IFggmmmkkkhhh snnnzrx yytdfcp */ /* IFggmmmkkkhhhxxxxxrrrrrssxcctmfcp */ c = asyncbuf[iflen-3]; switch (c) { case '0': vfo = RIG_VFO_A; break; case '1': vfo = RIG_VFO_B; break; case '2': vfo = RIG_VFO_MEM; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %c\n", __func__, c); return -RIG_EPROTO; } c = asyncbuf[iflen-4]; switch (c) { case MD_CW : mode = RIG_MODE_CW; break; case MD_USB : mode = RIG_MODE_USB; break; case MD_LSB : mode = RIG_MODE_LSB; break; case MD_FM : mode = RIG_MODE_FM; break; case MD_AM : mode = RIG_MODE_AM; break; case MD_FSK : mode = RIG_MODE_RTTY; break; case MD_NONE: mode = RIG_MODE_NONE; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode '%c'\n", __func__,c); return -RIG_EINVAL; } ptt = asyncbuf[iflen-5] == '0' ? RIG_PTT_OFF : RIG_PTT_ON; asyncbuf[13] = '\0'; sscanf(asyncbuf+2, "%011"SCNfreq, &freq); /* Callback execution */ if (rig->callbacks.vfo_event) { rig->callbacks.vfo_event(rig, vfo, rig->callbacks.vfo_arg); } if (rig->callbacks.freq_event) { rig->callbacks.freq_event(rig, vfo, freq, rig->callbacks.freq_arg); } if (rig->callbacks.mode_event) { rig->callbacks.mode_event(rig, vfo, mode, RIG_PASSBAND_NORMAL, rig->callbacks.mode_arg); } if (rig->callbacks.ptt_event) { rig->callbacks.ptt_event(rig, vfo, ptt, rig->callbacks.ptt_arg); } return RIG_OK; } hamlib-1.2.15.3/kenwood/Makefile.in0000644000175000017500000005570612044564553013656 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = kenwood DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_kenwood_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = ts850.lo ts870s.lo ts570.lo ts450s.lo ts950.lo \ ts50s.lo ts790.lo ts2000.lo k2.lo k3.lo ts930.lo ts680.lo \ ts690.lo ts140.lo ts480.lo trc80.lo ts590.lo am__objects_2 = thd7.lo thf7.lo thg71.lo tmd700.lo tmv7.lo thf6a.lo \ thd72.lo tmd710.lo am__objects_3 = ts440.lo ts940.lo ts711.lo ts811.lo r5000.lo am_hamlib_kenwood_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ $(am__objects_3) kenwood.lo th.lo ic10.lo elecraft.lo \ transfox.lo hamlib_kenwood_la_OBJECTS = $(am_hamlib_kenwood_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_kenwood_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_kenwood_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_kenwood_la_SOURCES) DIST_SOURCES = $(hamlib_kenwood_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ TSSRCLIST = ts850.c ts870s.c ts570.c ts450s.c ts950.c ts50s.c \ ts790.c ts2000.c k2.c k3.c ts930.c \ ts680.c ts690.c ts140.c ts480.c trc80.c ts590.c IC10SRCLIST = ts440.c ts940.c ts711.c ts811.c r5000.c THSRCLIST = thd7.c thf7.c thg71.c tmd700.c tmv7.c thf6a.c thd72.c tmd710.c pkglib_LTLIBRARIES = hamlib-kenwood.la hamlib_kenwood_la_SOURCES = $(TSSRCLIST) $(THSRCLIST) $(IC10SRCLIST) \ kenwood.c th.c ic10.c elecraft.c transfox.c hamlib_kenwood_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_kenwood_la_LIBADD = $(top_builddir)/src/libhamlib.la @MATH_LIBS@ EXTRA_DIST = README.kenwood README.k2 README.k3 noinst_HEADERS = kenwood.h th.h ic10.h elecraft.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu kenwood/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu kenwood/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-kenwood.la: $(hamlib_kenwood_la_OBJECTS) $(hamlib_kenwood_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_kenwood_la_LINK) -rpath $(pkglibdir) $(hamlib_kenwood_la_OBJECTS) $(hamlib_kenwood_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elecraft.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic10.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/k2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/k3.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kenwood.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r5000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/th.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thd7.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thd72.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thf6a.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thf7.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thg71.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmd700.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmd710.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmv7.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transfox.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trc80.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts140.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts2000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts440.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts450s.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts480.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts50s.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts570.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts590.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts680.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts690.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts711.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts790.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts811.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts850.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts870s.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts930.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts940.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts950.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/kenwood/th.c0000644000175000017500000013632512044564477012372 00000000000000/* * Hamlib Kenwood backend - TH handheld primitives * Copyright (c) 2001-2010 by Stephane Fillod * Copyright (C) 2010 by Alessandro Zummo * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "kenwood.h" #include "th.h" #include "serial.h" #include "misc.h" #include "num_stdio.h" /* Note: Currently the code assumes the command termination is a * single character. */ #define ACKBUF_LEN 64 /* * th_decode_event is called by sa_sigio, when some asynchronous * data has been received from the rig. */ int th_decode_event (RIG *rig) { char asyncbuf[128]; int retval; size_t async_len=128; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); retval = kenwood_transaction(rig, NULL, 0, asyncbuf, &async_len); if (retval != RIG_OK) return retval; rig_debug(RIG_DEBUG_TRACE, "%s: Decoding message\n", __func__); if (async_len> 3 && asyncbuf[0] == 'B' && asyncbuf[1] == 'U' && asyncbuf[2] == 'F') { vfo_t vfo; freq_t freq, offset; int mode; int step, shift, rev, tone, ctcss, tonefq, ctcssfq; retval = num_sscanf(asyncbuf, "BUF %d,%"SCNfreq",%X,%d,%d,%d,%d,,%d,,%d,%"SCNfreq",%d", &vfo, &freq, &step, &shift, &rev, &tone, &ctcss, &tonefq, &ctcssfq, &offset, &mode); if (retval != 11) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected BUF message '%s'\n", __func__, asyncbuf); return -RIG_ERJCTED; } /* Calibration and conversions */ vfo = (vfo == 0) ? RIG_VFO_A : RIG_VFO_B; mode = (mode == 0) ? RIG_MODE_FM : RIG_MODE_AM; rig_debug(RIG_DEBUG_TRACE, "%s: Buffer (vfo %d, freq %"PRIfreq" Hz, mode %d)\n", __func__, vfo, freq, mode); /* Callback execution */ if (rig->callbacks.vfo_event) { rig->callbacks.vfo_event(rig, vfo, rig->callbacks.vfo_arg); } if (rig->callbacks.freq_event) { rig->callbacks.freq_event(rig, vfo, freq, rig->callbacks.freq_arg); } if (rig->callbacks.mode_event) { rig->callbacks.mode_event(rig, vfo, mode, RIG_PASSBAND_NORMAL, rig->callbacks.mode_arg); } } else if (async_len> 2 && asyncbuf[0] == 'S' && asyncbuf[1] == 'M') { vfo_t vfo; int lev; retval = sscanf(asyncbuf, "SM %d,%d", &vfo, &lev); if (retval != 2) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected SM message '%s'\n", __func__, asyncbuf); return -RIG_ERJCTED; } /* Calibration and conversions */ vfo = (vfo == 0) ? RIG_VFO_A : RIG_VFO_B; rig_debug(RIG_DEBUG_TRACE, "%s: Signal strength event - signal = %.3f\n", __func__, (float)(lev / 5.0)); /* Callback execution */ #if STILLHAVETOADDCALLBACK if (rig->callbacks.strength_event) rig->callbacks.strength_event(rig, vfo,(float)(lev / 5.0), rig->callbacks.strength_arg); #endif } else if (async_len > 2 && asyncbuf[0] == 'B' && asyncbuf[1] == 'Y') { vfo_t vfo; int busy; retval = sscanf(asyncbuf, "BY %d,%d", &vfo, &busy); if (retval != 2) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected BY message '%s'\n", __func__, asyncbuf); return -RIG_ERJCTED; } vfo = (vfo == 0) ? RIG_VFO_A : RIG_VFO_B; rig_debug(RIG_DEBUG_TRACE, "%s: Busy event - status = '%s'\n", __func__, (busy == 0) ? "OFF" : "ON" ); return -RIG_ENIMPL; /* This event does not have a callback. */ } else if (async_len > 2 && asyncbuf[0] == 'B' && asyncbuf[1] == 'C') { vfo_t vfo; retval = sscanf(asyncbuf, "BC %d", &vfo); if (retval != 1) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected BC message '%s'\n", __func__, asyncbuf); return -RIG_ERJCTED; } vfo = (vfo == 0) ? RIG_VFO_A : RIG_VFO_B; rig_debug(RIG_DEBUG_TRACE, "%s: VFO event - vfo = %d\n", __func__, vfo); if (rig->callbacks.vfo_event) rig->callbacks.vfo_event(rig, vfo, rig->callbacks.vfo_arg); } else { rig_debug(RIG_DEBUG_ERR, "%s: Unsupported transceive cmd '%s'\n", __func__, asyncbuf); return -RIG_ENIMPL; } return RIG_OK; } static int kenwood_wrong_vfo(const char *func, vfo_t vfo) { rig_debug(RIG_DEBUG_ERR, "%s: Unsupported VFO: %d\n", func, vfo); return -RIG_ENTARGET; } /* * th_set_freq * Assumes rig!=NULL */ int th_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char buf[20]; int step; freq_t freq5,freq625,freq_sent; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo) return kenwood_wrong_vfo(__func__, vfo); freq5=round(freq/5000)*5000; freq625=round(freq/6250)*6250; if (abs(freq5-freq)= MHz(470) ? 4 : step; freq_sent = freq_sent >= MHz(470) ? (round(freq_sent/10000)*10000) : freq_sent; sprintf(buf, "FQ %011"PRIll",%X", (int64_t) freq_sent, step); return kenwood_cmd(rig, buf); } /* * th_get_freq * Assumes rig!=NULL, freq!=NULL */ int th_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { char buf[20]; int retval, step; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo) return kenwood_wrong_vfo(__func__, vfo); *freq = 0; retval = kenwood_safe_transaction(rig, "FQ", buf, sizeof(buf), 17); if (retval != RIG_OK) return retval; retval = num_sscanf(buf, "FQ %"SCNfreq",%x", freq, &step); if (retval != 2) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, buf); return -RIG_ERJCTED; } return RIG_OK; } /* * th_set_mode * Assumes rig!=NULL */ int th_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { char kmode, mdbuf[8]; int retval; const struct kenwood_priv_caps *priv=(const struct kenwood_priv_caps *)rig->caps->priv; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo) return kenwood_wrong_vfo(__func__, vfo); if (priv->mode_table) { kmode = rmode2kenwood(mode, priv->mode_table); if (kmode == -1) { rig_debug(RIG_DEBUG_WARN, "%s: Unsupported Mode value '%s'\n", __func__, rig_strrmode(mode)); return -RIG_EINVAL; } kmode += '0'; } else { switch (mode) { case RIG_MODE_FM: kmode = '0'; break; /* TH-D7A(G) modes */ case RIG_MODE_AM: kmode = '1'; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported Mode %d\n", __func__, mode); return -RIG_EINVAL; } } sprintf(mdbuf, "MD %c", kmode); retval = kenwood_cmd(rig, mdbuf); if (retval != RIG_OK) return retval; return RIG_OK; } /* * th_get_mode * Assumes rig!=NULL, mode!=NULL */ int th_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char buf[ACKBUF_LEN]; int retval; const struct kenwood_priv_caps *priv=(const struct kenwood_priv_caps *)rig->caps->priv; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo) return kenwood_wrong_vfo(__func__, vfo); retval = kenwood_safe_transaction(rig, "MD", buf, sizeof(buf), 5); if (retval != RIG_OK) return retval; if (buf[3] < '0' || buf[3] > '9') { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, buf); return -RIG_ERJCTED; } if (priv->mode_table) { *mode = kenwood2rmode(buf[3]-'0', priv->mode_table); if (*mode == RIG_MODE_NONE) { rig_debug(RIG_DEBUG_ERR, "%s: Unsupported Mode (table)value '%c'\n", __func__, buf[3]); return -RIG_EINVAL; } } else { switch (buf[3]) { case '0': *mode = RIG_MODE_FM; break; /* TH-D7A(G) modes */ case '1': *mode = RIG_MODE_AM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported Mode value '%c'\n", __func__, buf[3]); return -RIG_EINVAL; } } if (width) *width = RIG_PASSBAND_NORMAL; return RIG_OK; } /* * th_set_vfo * Apply to non-split models: TH-F7, TH-D7 * * Assumes rig!=NULL */ int th_set_vfo(RIG *rig, vfo_t vfo) { const char *cmd; int retval; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); /* from thf7.c * The band must be active before selecting VFO or MEM. * The dilemma is whether MEM should be applied to Band A or Band B. * Remember, not all bands have the same capability * TODO: if (RIG_VFO_MEM) query current band with BC, then do appropriate VMC */ /* set band */ if (vfo != RIG_VFO_MEM) { switch (vfo) { case RIG_VFO_A: case RIG_VFO_VFO: case RIG_VFO_MAIN: cmd = "BC 0"; break; case RIG_VFO_B: case RIG_VFO_SUB: cmd = "BC 1"; break; default: return kenwood_wrong_vfo(__func__, vfo); } retval = kenwood_simple_transaction(rig, cmd, 5); if (retval != RIG_OK) return retval; } /* No "VMC" cmd on THD72A */ if (rig->caps->rig_model == RIG_MODEL_THD72A) return RIG_OK; /* set vfo */ switch (vfo) { case RIG_VFO_A: case RIG_VFO_VFO: case RIG_VFO_MAIN: cmd = "VMC 0,0"; break; case RIG_VFO_B: case RIG_VFO_SUB: cmd = "VMC 1,0"; break; case RIG_VFO_MEM: if (rig->caps->rig_model == RIG_MODEL_THF7E || rig->caps->rig_model == RIG_MODEL_THF6A) cmd = "VMC 0,1"; else cmd = "VMC 0,2"; break; default: return kenwood_wrong_vfo(__func__, vfo); } return kenwood_cmd(rig, cmd); } int th_get_vfo_char(RIG *rig, vfo_t *vfo, char *vfoch) { char cmdbuf[10], buf[10], vfoc; size_t buf_size=10; int retval; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); /* Get VFO band */ retval = kenwood_transaction(rig, "BC", 2, buf, &buf_size); if (retval != RIG_OK) return retval; switch (buf_size) { case 5: /*original case BC 0*/ vfoc = buf[3]; break; case 7: /*intended for D700 BC 0,0*/ if ((buf[0]=='B') &&(buf[1]=='C') && (buf[2]==' ') && (buf[4]=',')){ vfoc = buf[3]; } else { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected answer format '%s'\n", __func__, buf); return -RIG_EPROTO; } break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unexpected answer length '%c'\n", __func__, buf_size); return -RIG_EPROTO; break; } switch (vfoc) { case '0': *vfo = RIG_VFO_A; break; case '1': *vfo = RIG_VFO_B; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unexpected VFO value '%c'\n", __func__, buf[3]); return -RIG_EVFO; } /* No "VMC" on THD72A */ if (rig->caps->rig_model == RIG_MODEL_THD72A) { *vfoch = '0'; /* FIXME: fake */ return RIG_OK; } /* Get mode of the VFO band */ sprintf(cmdbuf, "VMC %c", vfoc); retval = kenwood_safe_transaction(rig, cmdbuf, buf, 10, 8); if (retval != RIG_OK) return retval; *vfoch = buf[6]; return RIG_OK; } /* * th_get_vfo * Assumes rig!=NULL */ int th_get_vfo(RIG *rig, vfo_t *vfo) { char vfoch; int retval; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); retval = th_get_vfo_char(rig, vfo, &vfoch); if (retval != RIG_OK) return retval; switch (vfoch) { case '0' : case '1' : break; case '2' : *vfo = RIG_VFO_MEM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unexpected VFO value '%c'\n", __func__, vfoch); return -RIG_EVFO; } return RIG_OK; } /* * tm_set_vfo_bc2 * Apply to split-capable models (with BC command taking 2 args): TM-V7, TM-D700 * * Assumes rig!=NULL */ int tm_set_vfo_bc2 (RIG *rig, vfo_t vfo) { struct kenwood_priv_data *priv = rig->state.priv; char vfobuf[16], ackbuf[16]; int vfonum, txvfonum, vfomode=0; int retval; size_t ack_len; rig_debug(RIG_DEBUG_TRACE, "%s: called %s\n", __func__, rig_strvfo(vfo)); switch (vfo) { case RIG_VFO_A: case RIG_VFO_VFO: vfonum = 0; /* put back split mode when toggling */ txvfonum = (priv->split == RIG_SPLIT_ON && rig->state.tx_vfo == RIG_VFO_B) ? 1 : vfonum; break; case RIG_VFO_B: vfonum = 1; /* put back split mode when toggling */ txvfonum = (priv->split == RIG_SPLIT_ON && rig->state.tx_vfo == RIG_VFO_A) ? 0 : vfonum; break; case RIG_VFO_MEM: /* get current band */ sprintf(vfobuf, "BC"); ack_len=16; retval = kenwood_transaction(rig, vfobuf, strlen(vfobuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; txvfonum = vfonum = ackbuf[3]-'0'; vfomode = 2; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported VFO %d\n", __func__, vfo); return -RIG_EVFO; } sprintf(vfobuf, "VMC %d,%d", vfonum, vfomode); retval = kenwood_cmd(rig, vfobuf); if (retval != RIG_OK) return retval; if (vfo == RIG_VFO_MEM) return RIG_OK; sprintf(vfobuf, "BC %d,%d", vfonum, txvfonum); retval = kenwood_cmd(rig, vfobuf); if (retval != RIG_OK) return retval; return RIG_OK; } int th_set_split_vfo (RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo) { struct kenwood_priv_data *priv = rig->state.priv; char vfobuf[16]; int vfonum, txvfonum; int retval; rig_debug(RIG_DEBUG_TRACE, "%s: called %s\n", __func__, rig_strvfo(vfo)); if (vfo == RIG_VFO_CURR) { retval = rig_get_vfo(rig, &vfo); if (retval != RIG_OK) return retval; } switch (vfo) { case RIG_VFO_A: case RIG_VFO_VFO: vfonum = 0; if (split == RIG_SPLIT_ON && txvfo != RIG_VFO_B) return -RIG_EINVAL; txvfonum = split == RIG_SPLIT_ON ? 1 : vfonum; break; case RIG_VFO_B: vfonum = 1; if (split == RIG_SPLIT_ON && txvfo != RIG_VFO_A) return -RIG_EINVAL; txvfonum = split == RIG_SPLIT_ON ? 0 : vfonum; break; default: return -RIG_EINVAL; } /* Set VFO mode. To be done for TX vfo also? */ sprintf(vfobuf, "VMC %d,0", vfonum); retval = kenwood_cmd(rig, vfobuf); if (retval != RIG_OK) return retval; sprintf(vfobuf, "BC %d,%d", vfonum, txvfonum); retval = kenwood_cmd(rig, vfobuf); if (retval != RIG_OK) return retval; /* Remember whether split is on, for th_set_vfo */ priv->split = split; return RIG_OK; } int th_get_split_vfo (RIG *rig, vfo_t vfo, split_t *split, vfo_t *txvfo) { struct kenwood_priv_data *priv = rig->state.priv; char buf[10]; int retval; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); /* Get VFO band */ retval = kenwood_safe_transaction(rig, "BC", buf, 10, 5); if (retval != RIG_OK) return retval; switch (buf[5]) { case '0': *txvfo = RIG_VFO_A; break; case '1': *txvfo = RIG_VFO_B; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unexpected txVFO value '%c'\n", __func__, buf[5]); return -RIG_EPROTO; } *split = (buf[3] == buf[5]) ? RIG_SPLIT_OFF : RIG_SPLIT_ON; /* Remember whether split is on, for th_set_vfo */ priv->split = *split; return RIG_OK; } /* * th_set_trn * Assumes rig!=NULL */ int th_set_trn(RIG *rig, int trn) { return kenwood_cmd(rig, (trn == RIG_TRN_RIG) ? "AI 1" : "AI 0"); } /* * th_get_trn * Assumes rig!=NULL */ int th_get_trn(RIG *rig, int *trn) { char buf[ACKBUF_LEN]; int retval; size_t ack_len=ACKBUF_LEN; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); retval = kenwood_transaction(rig, "AI", 3, buf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len < 4 ) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, buf); return -RIG_ERJCTED; } *trn = (buf[3] != '0') ? RIG_TRN_RIG : RIG_TRN_OFF; return RIG_OK; } /* * th_get_kenwood_func * Assumes rig!=NULL, status!=NULL */ static int th_get_kenwood_func(RIG *rig, const char *cmd, int *status) { char buf[8]; int retval, len, expected; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); len = strlen(cmd); expected = len + 3; retval = kenwood_safe_transaction(rig, cmd, buf, sizeof(buf), expected); if (retval != RIG_OK) return retval; if (status) *status = (buf[len+1] == '0') ? 0 : 1; return RIG_OK; }; /* * th_get_func * Assumes rig!=NULL, status!=NULL * * Assumes vfo == RIG_VFO_CURR, any other value is handled by the frontend. */ int th_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { rig_debug(RIG_DEBUG_TRACE, "%s: called (0x%04x)\n", __func__, func); switch (func) { case RIG_FUNC_MUTE: return th_get_kenwood_func(rig, "MUTE", status); case RIG_FUNC_MON: return th_get_kenwood_func(rig, "MON", status); case RIG_FUNC_TONE: return th_get_kenwood_func(rig, "TO", status); case RIG_FUNC_TSQL: return th_get_kenwood_func(rig, "CT", status); case RIG_FUNC_REV: return th_get_kenwood_func(rig, "REV", status); case RIG_FUNC_ARO: return th_get_kenwood_func(rig, "ARO", status); case RIG_FUNC_AIP: return th_get_kenwood_func(rig, "AIP", status); case RIG_FUNC_LOCK: return th_get_kenwood_func(rig, "LK", status); case RIG_FUNC_BC: return th_get_kenwood_func(rig, "BC", status); default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported function %#x\n", __func__, func); return -RIG_EINVAL; } } static int th_tburst(RIG *rig, vfo_t vfo, int status) { return kenwood_cmd(rig, (status == 1) ? "TT" : "RX"); } /* * th_set_kenwood_func * Assumes rig!=NULL, status!=NULL */ static int th_set_kenwood_func(RIG *rig, const char *cmd, int status) { #define BUFSZ 16 char buf[BUFSZ]; rig_debug(RIG_DEBUG_TRACE, "%s: cmd = %s, status = %d\n", __func__, cmd, status); strncpy(buf, cmd, BUFSZ-2); buf[BUFSZ-1] = '\0'; strncat(buf, status ? " 1" : " 0", BUFSZ-1); return kenwood_cmd(rig, buf); } /* * th_get_func * Assumes rig!=NULL, status!=NULL * * Assumes vfo == RIG_VFO_CURR, any other value is handled by the frontend. */ int th_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { rig_debug(RIG_DEBUG_TRACE, "%s: called (0x%04x)\n", __func__, func); switch (func) { case RIG_FUNC_MUTE: return th_set_kenwood_func(rig, "MUTE", status); case RIG_FUNC_MON: return th_set_kenwood_func(rig, "MON", status); case RIG_FUNC_TONE: return th_set_kenwood_func(rig, "TO", status); case RIG_FUNC_TSQL: return th_set_kenwood_func(rig, "CT", status); case RIG_FUNC_REV: return th_set_kenwood_func(rig, "REV", status); case RIG_FUNC_ARO: return th_set_kenwood_func(rig, "ARO", status); case RIG_FUNC_AIP: return th_set_kenwood_func(rig, "AIP", status); case RIG_FUNC_LOCK: return th_set_kenwood_func(rig, "LK", status); case RIG_FUNC_BC: return th_set_kenwood_func(rig, "NSFT", status); case RIG_FUNC_TBURST: return th_tburst(rig, vfo, status); default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported function %#x\n", __func__, func); return -RIG_EINVAL; } return RIG_OK; } int th_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) { rig_debug(RIG_DEBUG_TRACE, "%s: called (0x%04x)\n", __func__, scan); return th_set_kenwood_func(rig, "SC", scan == RIG_SCAN_STOP ? 0 : 1); } /* * th_get_parm * Assumes rig!=NULL, status!=NULL */ int th_get_parm(RIG *rig, setting_t parm, value_t *val) { char buf[16]; int ret, status; rig_debug(RIG_DEBUG_TRACE, "%s: called (0x%04x)\n", __func__, parm); switch (parm) { case RIG_PARM_BEEP: ret = th_get_kenwood_func(rig, "BEP", &status); if (ret != RIG_OK) return ret; val->i = status ? 1 : 0; return RIG_OK; case RIG_PARM_APO: ret = kenwood_safe_transaction(rig, "APO", buf, sizeof(buf), 6); if (ret != RIG_OK) return ret; val->i = (buf[4]-'0')*30; return RIG_OK; case RIG_PARM_BACKLIGHT: if (rig->caps->rig_model == RIG_MODEL_TMD700) { ret = kenwood_safe_transaction(rig, "DIM", buf, sizeof(buf), 5); if (ret != RIG_OK) return ret; val->f = buf[4] == '0' ? 0 : (float)(5-(buf[4]-'0'))/4.; } else { ret = th_get_kenwood_func(rig, "LMP", &status); if (ret != RIG_OK) return ret; val->f = status ? 1.0 : 0; } return RIG_OK; default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported parm %#x\n", __func__, parm); return -RIG_EINVAL; } return RIG_OK; } int th_set_parm(RIG *rig, setting_t parm, value_t val) { rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); switch (parm) { case RIG_PARM_BACKLIGHT: if (rig->caps->rig_model == RIG_MODEL_TMD700) { return th_set_kenwood_func(rig, "DIM", (val.f > 0) ? 1 : 0); /* FIXME */ } else { return th_set_kenwood_func(rig, "LMP", (val.f > 0) ? 1 : 0); } case RIG_PARM_BEEP: return th_set_kenwood_func(rig, "BEP", val.i); case RIG_PARM_APO: if (val.i > 30) return kenwood_cmd(rig, "APO 2"); else if (val.i > 0) return kenwood_cmd(rig, "APO 1"); else return kenwood_cmd(rig, "APO 0"); default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported parm %#x\n", __func__, parm); return -RIG_EINVAL; } return RIG_OK; } /* * th_get_level * Assumes rig!=NULL, val!=NULL */ int th_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { char vch, buf[10], ackbuf[20]; int retval, v, l; size_t ack_len = sizeof(ackbuf); vfo_t tvfo; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); tvfo = (vfo == RIG_VFO_CURR) ? rig->state.current_vfo : vfo; switch (tvfo) { case RIG_VFO_A: case RIG_VFO_VFO: case RIG_VFO_MEM: vch = '0'; break; case RIG_VFO_B: vch = '1'; break; default: return kenwood_wrong_vfo(__func__, vfo); } switch (level) { case RIG_LEVEL_RAWSTR: sprintf(buf, "SM %c", vch); // XXX use kenwood_safe_transaction retval = kenwood_transaction(rig, buf, strlen(buf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; retval = sscanf(ackbuf, "SM %d,%d", &v, &l); if (retval != 2 || l < rig->caps->level_gran[LVL_RAWSTR].min.i || l > rig->caps->level_gran[LVL_RAWSTR].max.i) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, ackbuf); return -RIG_ERJCTED; } val->i = l; break; case RIG_LEVEL_SQL: sprintf(buf, "SQ %c", vch); retval = kenwood_safe_transaction(rig, buf, ackbuf, 10, 8); if (retval != RIG_OK) return retval; retval = sscanf(ackbuf, "SQ %d,%x", &v, &l); if (retval != 2 || l < rig->caps->level_gran[LVL_SQL].min.i || l > rig->caps->level_gran[LVL_SQL].max.i) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, ackbuf); return -RIG_ERJCTED; } /* range [0.0 ... 1.0] */ val->f = (float)(l-rig->caps->level_gran[LVL_SQL].min.i) / (float)(rig->caps->level_gran[LVL_SQL].max.i-rig->caps->level_gran[LVL_SQL].min.i); break; case RIG_LEVEL_AF: sprintf(buf, "AG %c", vch); retval = kenwood_transaction(rig, buf, strlen(buf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; retval = sscanf(ackbuf, "AG %d,%x", &v, &l); if (retval != 2 || l < rig->caps->level_gran[LVL_AF].min.i || l > rig->caps->level_gran[LVL_AF].max.i) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, ackbuf); return -RIG_ERJCTED; } /* range [0.0 ... 1.0] */ val->f = (float)(l-rig->caps->level_gran[LVL_AF].min.i) / (float)(rig->caps->level_gran[LVL_AF].max.i-rig->caps->level_gran[LVL_AF].min.i); break; case RIG_LEVEL_RFPOWER: sprintf(buf, "PC %c",vch); retval = kenwood_transaction(rig, buf, strlen(buf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; retval = sscanf(ackbuf, "PC %d,%d", &v, &l); if (retval != 2 || l < 0 || l > 3) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, ackbuf); return -RIG_ERJCTED; } /* range [0.0 ... 1.0] */ val->f = (float)(l-rig->caps->level_gran[LVL_RFPOWER].min.i) / (float)(rig->caps->level_gran[LVL_RFPOWER].max.i-rig->caps->level_gran[LVL_RFPOWER].min.i); break; case RIG_LEVEL_BALANCE: retval = kenwood_safe_transaction(rig, "BAL", ackbuf, 10, 6); if (retval != RIG_OK) return retval; if (ackbuf[4] < '0' || ackbuf[4] > '9') return -RIG_EPROTO; val->f = (float)('4'-ackbuf[4])/('4'-'0'); break; case RIG_LEVEL_ATT: retval = kenwood_safe_transaction(rig, "ATT", ackbuf, 10, 6); if (retval != RIG_OK) return retval; if (ackbuf[4] < '0' || ackbuf[4] > '9') return -RIG_EPROTO; if (ackbuf[4] == '0') val->i = 0; else val->i = rig->state.attenuator[ackbuf[4]-'1']; break; case RIG_LEVEL_VOXGAIN: retval = kenwood_safe_transaction(rig, "VXG", ackbuf, 10, 6); if (retval != RIG_OK) return retval; if (ackbuf[4] < '0' || ackbuf[4] > '9') return -RIG_EPROTO; val->f = (ackbuf[4] == '0') / 9; break; case RIG_LEVEL_VOXDELAY: /* "VXD" */ return -RIG_ENIMPL; default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported Level %d\n", __func__, level); return -RIG_EINVAL; } return RIG_OK; } int th_set_level (RIG *rig, vfo_t vfo, setting_t level, value_t val) { char vch, buf[12]; vfo_t tvfo; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); tvfo = (vfo == RIG_VFO_CURR) ? rig->state.current_vfo : vfo; switch (tvfo) { case RIG_VFO_A: case RIG_VFO_VFO: case RIG_VFO_MEM: vch = '0'; break; case RIG_VFO_B: vch = '1'; break; default: return kenwood_wrong_vfo(__func__, vfo); } switch (level) { case RIG_LEVEL_RFPOWER : sprintf(buf, "PC %c,%01d", vch, (int)(val.f*(rig->caps->level_gran[LVL_RFPOWER].max.i - rig->caps->level_gran[LVL_RFPOWER].min.i)) + rig->caps->level_gran[LVL_RFPOWER].min.i); return kenwood_cmd(rig, buf); case RIG_LEVEL_SQL : sprintf(buf, "SQ %c,%02x", vch, (int)(val.f*(rig->caps->level_gran[LVL_SQL].max.i-rig->caps->level_gran[LVL_SQL].min.i)) + rig->caps->level_gran[LVL_SQL].min.i); return kenwood_cmd(rig, buf); case RIG_LEVEL_AF : sprintf(buf, "AG %c,%02x", vch, (int)(val.f * 32.0)); return kenwood_cmd(rig, buf); case RIG_LEVEL_ATT : sprintf(buf, "ATT %c", val.i ? '1' : '0'); return kenwood_cmd(rig, buf); case RIG_LEVEL_BALANCE : sprintf(buf, "BAL %c", '4' - (int) (val.f * ('4'-'0'))); return kenwood_cmd(rig, buf); case RIG_LEVEL_VOXGAIN: sprintf(buf, "VXG %d", (int) (val.f * 9)); return kenwood_cmd(rig, buf); case RIG_LEVEL_VOXDELAY: /* "VXD" */ return -RIG_ENIMPL; default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported Level %d\n", __func__, level); return -RIG_EINVAL; } } #ifndef RIG_TONEMAX #define RIG_TONEMAX 38 #endif /* * th_set_ctcss_tone * Assumes rig!=NULL, rig->caps->ctcss_list != NULL */ int th_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone) { const struct rig_caps *caps; char tonebuf[16],ackbuf[ACKBUF_LEN]; int i, retval; size_t ack_len; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); caps = rig->caps; for (i = 0; caps->ctcss_list[i] != 0 && i < RIG_TONEMAX; i++) { if (caps->ctcss_list[i] == tone) break; } if (caps->ctcss_list[i] != tone) return -RIG_EINVAL; i += (i == 0) ? 1 : 2; /* Correct for TH-D7A index anomally */ sprintf(tonebuf, "TN %02d", i); ack_len = ACKBUF_LEN; retval = kenwood_transaction(rig, tonebuf, strlen(tonebuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; return RIG_OK; } /* * th_get_ctcss_tone * Assumes rig!=NULL, rig->caps!=NULL */ int th_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone) { struct rig_caps *caps; char buf[ACKBUF_LEN]; int retval; size_t ack_len=ACKBUF_LEN; unsigned int tone_idx; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); caps = rig->caps; retval = kenwood_transaction(rig, "TN", 4, buf, &ack_len); if (retval != RIG_OK) return retval; retval = sscanf(buf, "TN %d", (int*)&tone_idx); if (retval != 1) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, buf); return -RIG_EPROTO; } /* verify tone index for TH-7DA rig */ if (tone_idx <= 0 || tone_idx == 2 || tone_idx > 39) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected CTCSS tone no (%04d)\n", __func__, tone_idx); return -RIG_EPROTO; } tone_idx -= (tone_idx == 1) ? 1 : 2; /* Correct for TH-D7A index anomaly */ *tone = caps->ctcss_list[tone_idx]; return RIG_OK; } /* * th_set_ctcss_sql * Assumes rig!=NULL, rig->caps->ctcss_list != NULL */ int th_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone) { const struct rig_caps *caps; char tonebuf[16],ackbuf[ACKBUF_LEN]; int i, retval; size_t ack_len; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); caps = rig->caps; for (i = 0; caps->ctcss_list[i] != 0 && i < RIG_TONEMAX; i++) { if (caps->ctcss_list[i] == tone) break; } if (caps->ctcss_list[i] != tone) return -RIG_EINVAL; i += (i == 0) ? 1 : 2; /* Correct for TH-D7A index anomally */ sprintf(tonebuf, "CTN %02d", i); ack_len = ACKBUF_LEN; retval = kenwood_transaction(rig, tonebuf, strlen(tonebuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; return RIG_OK; } /* * thd7_get_ctcss_sql * Assumes rig!=NULL, rig->caps!=NULL */ int th_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone) { struct rig_caps *caps; char buf[ACKBUF_LEN]; int retval; size_t ack_len=ACKBUF_LEN; unsigned int tone_idx; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); caps = rig->caps; retval = kenwood_transaction(rig, "CTN", 4, buf, &ack_len); if (retval != RIG_OK) return retval; retval = sscanf(buf, "CTN %d", (int*)&tone_idx); if (retval != 1) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, buf); return -RIG_EPROTO; } /* verify tone index for TH-7DA rig */ if (tone_idx <= 0 || tone_idx == 2 || tone_idx > 39) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected CTCSS no (%04d)\n", __func__, tone_idx); return -RIG_EPROTO; } tone_idx -= (tone_idx == 1) ? 1 : 2; /* Correct for TH-7DA index anomaly */ *tone = caps->ctcss_list[tone_idx]; return RIG_OK; } #ifndef RIG_CODEMAX #define RIG_CODEMAX 104 #endif /* * th_set_dcs_sql * Assumes rig!=NULL, rig->caps->dcs_list != NULL */ int th_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code) { const struct rig_caps *caps; char codebuf[16]; int i, retval; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); caps = rig->caps; if (code == 0) { return kenwood_simple_cmd(rig, "DCS 0"); } for (i = 0; caps->dcs_list[i] != 0 && i < RIG_CODEMAX; i++) { if (caps->dcs_list[i] == code) break; } if (caps->dcs_list[i] != code) return -RIG_EINVAL; retval = kenwood_simple_cmd(rig, "DCS 1"); if (retval != RIG_OK) return retval; sprintf(codebuf, "DCSN %04d", (i+1)*10); retval = kenwood_simple_cmd(rig, codebuf); if (retval != RIG_OK) return retval; return RIG_OK; } /* * th_get_dcs_sql * Assumes rig!=NULL, rig->caps!=NULL */ int th_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *code) { struct rig_caps *caps; char buf[ACKBUF_LEN]; int retval; size_t ack_len=ACKBUF_LEN; unsigned int code_idx; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); caps = rig->caps; retval = kenwood_transaction(rig, "DCS", 3, buf, &ack_len); if (retval != RIG_OK) return retval; retval = sscanf(buf, "DCSN %u", (int*)&code_idx); if (retval != 1) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, buf); return -RIG_EPROTO; } if (code_idx == 0) { *code = 0; /* disabled */ return RIG_OK; } ack_len=ACKBUF_LEN; retval = kenwood_transaction(rig, "DCSN", 4, buf, &ack_len); if (retval != RIG_OK) return retval; retval = sscanf(buf, "DCSN %u", (int*)&code_idx); if (retval != 1) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __func__, buf); return -RIG_EPROTO; } /* verify code index for TM-D700 rig */ if (code_idx <= 10 || code_idx > 1040) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected DCS no (%04u)\n", __func__, code_idx); return -RIG_EPROTO; } code_idx = (code_idx/10)-1; *code = caps->dcs_list[code_idx]; return RIG_OK; } const char * th_get_info(RIG *rig) { static char firmbuf[50]; int retval; size_t firm_len=50; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); memset(firmbuf, 0, sizeof(firmbuf)); retval = kenwood_transaction(rig, "ID", 3, firmbuf, &firm_len); if (retval != RIG_OK) return NULL; if (firm_len < 3) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected reply '%s', len=%d\n", __func__, firmbuf, firm_len); return NULL; } return &firmbuf[2]; } /* * th_set_mem * Assumes rig!=NULL */ int th_set_mem(RIG *rig, vfo_t vfo, int ch) { unsigned char vsel; char membuf[10], ackbuf[10]; int retval; vfo_t tvfo; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); tvfo = (vfo == RIG_VFO_CURR) ? rig->state.current_vfo : vfo; switch (tvfo) { case RIG_VFO_VFO: case RIG_VFO_MEM: case RIG_VFO_A: vsel = '0'; break; case RIG_VFO_B: vsel = '1'; break; default: return kenwood_wrong_vfo(__func__, vfo); } retval = rig_set_vfo(rig, RIG_VFO_MEM); if (retval != RIG_OK) return retval; sprintf(membuf, "MC %c,%03i", vsel, ch); retval = kenwood_safe_transaction(rig, membuf, ackbuf, 10, 9); if (retval != RIG_OK) return retval; return RIG_OK; } /* Get mem works only when the display is * in memory mode */ int th_get_mem(RIG *rig, vfo_t vfo, int *ch) { char *membuf, buf[10]; int retval; vfo_t tvfo,cvfo; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); /* store current VFO */ cvfo = rig->state.current_vfo; /* check if we should switch VFO */ if (cvfo != RIG_VFO_MEM) { retval = rig_set_vfo(rig, RIG_VFO_MEM); if (retval != RIG_OK) return retval; } tvfo = (vfo == RIG_VFO_CURR) ? cvfo : vfo; switch (tvfo) { case RIG_VFO_VFO: case RIG_VFO_MEM: case RIG_VFO_A: membuf = "MC 0"; break; case RIG_VFO_B: membuf = "MC 1"; break; default: return kenwood_wrong_vfo(__func__, vfo); } retval = kenwood_safe_transaction(rig, membuf, buf, 10, 9); if (retval != RIG_OK) return retval; buf[8] = '\0'; *ch = atoi(&buf[5]); /* switch back if appropriate */ if (cvfo != RIG_VFO_MEM) { retval = rig_set_vfo(rig, cvfo); if (retval != RIG_OK) return retval; } return RIG_OK; } int th_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); return kenwood_cmd(rig, (ptt == RIG_PTT_ON) ? "TX" : "RX"); } int th_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { char *cmd, buf[8]; int retval; if (vfo == RIG_VFO_CURR) { retval = th_get_vfo(rig, &vfo); if (retval != RIG_OK) return retval; } switch (vfo) { case RIG_VFO_VFO: case RIG_VFO_A: case RIG_VFO_MAIN: cmd = "BY 0"; break; case RIG_VFO_B: case RIG_VFO_SUB: cmd = "BY 1"; break; default: return kenwood_wrong_vfo(__func__, vfo); } retval = kenwood_safe_transaction(rig, cmd, buf, sizeof(buf), 7); if (retval != RIG_OK) return retval; switch (buf[5]) { case '0' : *dcd = RIG_DCD_OFF; return RIG_OK; case '1' : *dcd = RIG_DCD_ON; return RIG_OK; default : rig_debug(RIG_DEBUG_ERR, "%s: unexpected reply '%s', len=%d\n", __func__, buf); } return -RIG_ERJCTED; } int th_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); if (vfo != RIG_VFO_CURR && vfo != rig->state.current_vfo) return kenwood_wrong_vfo(__func__, vfo); switch (op) { case RIG_OP_UP: return kenwood_cmd(rig, "UP"); case RIG_OP_DOWN: return kenwood_cmd(rig, "DW"); case RIG_OP_TO_VFO: return kenwood_cmd(rig, "MSH"); default: return -RIG_EINVAL; } } /* get and set channel tested on thg71&thf7e */ /* must work on other th and tm kenwood rigs */ /* --------------------------------------------------------------------- */ int th_get_channel(RIG *rig, channel_t *chan) { char membuf[64],ackbuf[ACKBUF_LEN]; int retval; size_t ack_len; freq_t freq,offset; char req[16],scf[128]; int step, shift, rev, tone, ctcss, tonefq, ctcssfq, dcs, dcscode, mode, lockout; const char *mr_extra; int channel_num; vfo_t vfo; const struct kenwood_priv_caps *priv=(const struct kenwood_priv_caps *)rig->caps->priv; const chan_t *chan_caps; if (chan->vfo == RIG_VFO_MEM) { chan_caps = rig_lookup_mem_caps(rig, chan->channel_num); if (!chan_caps) return -RIG_ECONF; } else { /* TODO: stuff channel_num (out of current freq) and chan_caps */ return -RIG_ENIMPL; } channel_num = chan->channel_num; vfo = chan->vfo; memset(chan, 0, sizeof(channel_t)); chan->channel_num = channel_num; chan->vfo = vfo; if (rig->caps->rig_model == RIG_MODEL_THF7E || rig->caps->rig_model == RIG_MODEL_THF6A) mr_extra = ""; else mr_extra = "0, "; channel_num -= chan_caps->start; switch (chan_caps->type) { case RIG_MTYPE_MEM: if (chan_caps[1].type == RIG_MTYPE_PRIO) { /* Info */ sprintf(req, "MR %s0,I-%01d",mr_extra,channel_num); } else sprintf(req, "MR %s0,%03d",mr_extra,channel_num); break; case RIG_MTYPE_EDGE: if (chan_caps[1].type == RIG_MTYPE_EDGE) { sprintf(req, "MR %s0,L%01d",mr_extra,channel_num); sprintf(chan->channel_desc, "L%01d",channel_num); } else { sprintf(req, "MR %s0,U%01d",mr_extra,channel_num); sprintf(chan->channel_desc, "U%01d",channel_num); } break; case RIG_MTYPE_PRIO: if (chan_caps->start == chan_caps->end) { sprintf(req, "MR %s0,PR",mr_extra); sprintf(chan->channel_desc, "Pr"); } else { sprintf(req, "MR %s0,PR%01d",mr_extra,channel_num+1); sprintf(chan->channel_desc, "Pr%01d",channel_num+1); } break; case RIG_MTYPE_CALL: sprintf(req, "CR 0,%01d",channel_num); if (chan->channel_num==chan_caps->start) sprintf(chan->channel_desc, "Call V"); else if (chan->channel_num==chan_caps->end) sprintf(chan->channel_desc, "Call U"); else sprintf(chan->channel_desc, "Call"); break; case RIG_MTYPE_BAND: sprintf(req, "VR %01X",channel_num); sprintf(chan->channel_desc, "BAND %01X",channel_num); break; default: return -RIG_EINVAL; } sprintf(membuf, "%s",req); ack_len=ACKBUF_LEN; retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; /* * TODO: dcs/mode/lockout are not there on TH-G71 */ mode = RIG_MODE_NONE; rev = lockout = dcs = dcscode = 0; strcpy(scf,req); if (chan_caps->mem_caps.dcs_sql) { /* Step can be hexa * Lockout is optional on some channels */ strcat(scf, ",%"SCNfreq",%x,%d,%d,%d,%d,%d,%d,%d,%d,%"SCNfreq",%d,%d"); retval = num_sscanf(ackbuf, scf, &freq, &step, &shift, &rev, &tone, &ctcss, &dcs, &tonefq, &ctcssfq, &dcscode, &offset, &mode, &lockout); if (retval < 12) { rig_debug(RIG_DEBUG_WARN, "%s: sscanf failed %d\n", __func__, retval); return -RIG_EPROTO; } } else { strcat(scf, ",%"SCNfreq",%x,%d,%d,%d,%d,,%d,,%d,%"SCNfreq); retval = num_sscanf(ackbuf, scf, &freq, &step, &shift, &rev, &tone, &ctcss, &tonefq, &ctcssfq, &offset); if (retval != 9) { rig_debug(RIG_DEBUG_WARN, "%s: sscanf failed %d\n", __func__, retval); } } chan->funcs = rev ? RIG_FUNC_REV : 0; chan->flags = lockout ? RIG_CHFLAG_SKIP : 0; chan->freq=freq; chan->vfo=RIG_VFO_MEM; chan->tuning_step=rig->state.tuning_steps[step].ts; if (priv->mode_table) { chan->mode = kenwood2rmode(mode, priv->mode_table); if (chan->mode == RIG_MODE_NONE) { rig_debug(RIG_DEBUG_ERR, "%s: Unsupported Mode value '%d'\n", __func__, mode); return -RIG_EPROTO; } } else { /* No mode info (TH-G71, TMV7,..), * guess it from current freq */ chan->mode = (freq < MHz(136)) ? RIG_MODE_AM : RIG_MODE_FM; } chan->width=rig_passband_normal(rig, chan->mode); switch (shift) { case 0 : chan->rptr_shift=RIG_RPT_SHIFT_NONE; break; case 1 : chan->rptr_shift=RIG_RPT_SHIFT_PLUS; break; case 2 : chan->rptr_shift=RIG_RPT_SHIFT_MINUS; offset = -offset; break; default: rig_debug(RIG_DEBUG_ERR, "%s: not supported shift %d\n", __func__, shift); chan->rptr_shift=RIG_RPT_SHIFT_NONE; } chan->rptr_offs=offset; /* FIXME: ctcss_list for t[fm]*.c */ //chan->ctcss_tone=rig->caps->ctcss_list[tonefq==1?0:tonefq-2]; // chan->ctcss_sql=rig->caps->ctcss_list[ctcssfq==1?0:ctcssfq-2]; if (tone) chan->ctcss_tone=rig->caps->ctcss_list[tonefq]; else chan->ctcss_tone=0; if (ctcss) chan->ctcss_sql=rig->caps->ctcss_list[ctcssfq]; else chan->ctcss_sql=0; if (dcs) chan->dcs_sql=chan->dcs_code=rig->caps->dcs_list[dcscode]; else chan->dcs_sql=chan->dcs_code=0; chan->tx_freq=RIG_FREQ_NONE; if (shift==RIG_RPT_SHIFT_NONE && ((chan_caps->type==RIG_MTYPE_MEM && chan_caps->start == 0) || chan_caps->type==RIG_MTYPE_CALL)) { /* split ? */ req[3+strlen(mr_extra)]='1'; sprintf(membuf, "%s",req); ack_len=ACKBUF_LEN; retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len); if (retval == RIG_OK) { strcpy(scf,req); strcat(scf, ",%"SCNfreq",%x"); retval = num_sscanf(ackbuf, scf, &freq, &step); chan->tx_freq=freq; chan->split=RIG_SPLIT_ON; } } /* If not set already by special channels.. */ if (chan->channel_desc[0] == '\0') { if (chan_caps[1].type == RIG_MTYPE_PRIO) sprintf(membuf, "MNA %sI-%01d",mr_extra,channel_num); else sprintf(membuf, "MNA %s%03d",mr_extra,channel_num); ack_len=ACKBUF_LEN; /* Get memory name */ retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len > rig->caps->chan_desc_sz) ack_len = rig->caps->chan_desc_sz; strncpy(chan->channel_desc,ackbuf+strlen(membuf)+1,ack_len); chan->channel_desc[ack_len] = '\0'; } return RIG_OK; } static int find_tone_index(const tone_t *tone_list, tone_t tone) { int i; for (i = 0; tone_list[i] != 0 && i < RIG_TONEMAX; i++) { if (tone_list[i] == tone) return i; } return -1; } /* --------------------------------------------------------------------- */ int th_set_channel(RIG *rig, const channel_t *chan) { char membuf[ACKBUF_LEN],ackbuf[ACKBUF_LEN]; int retval; size_t ack_len; char req[64]; char lockoutstr[8]; int channel_num, step, shift, rev, tone, ctcss, tonefq, ctcssfq, dcs, dcscode, mode, lockout; const char *mr_extra; const struct kenwood_priv_caps *priv=(const struct kenwood_priv_caps *)rig->caps->priv; const chan_t *chan_caps; const char *channel_desc; channel_num = chan->channel_num; for (step=0; rig->state.tuning_steps[step].ts!=0;step++) if (chan->tuning_step<=rig->state.tuning_steps[step].ts) break; switch (chan->rptr_shift) { case RIG_RPT_SHIFT_NONE : shift=0; break; case RIG_RPT_SHIFT_PLUS: shift=1; break; case RIG_RPT_SHIFT_MINUS: shift=2; break; default: rig_debug(RIG_DEBUG_ERR, "%s: not supported shift %d\n", __func__, chan->rptr_shift); return -RIG_EINVAL; } if (chan->ctcss_tone==0) { tone=0; tonefq=8; } else { tone=1; tonefq = find_tone_index(rig->caps->ctcss_list, chan->ctcss_tone); if (tonefq == -1) return -RIG_EINVAL; tonefq++; } if (chan->ctcss_sql==0) { ctcss=0; ctcssfq=8; } else { ctcss=1; ctcssfq = find_tone_index(rig->caps->ctcss_list, chan->ctcss_sql); if (tonefq == -1) return -RIG_EINVAL; ctcssfq++; } if (chan->dcs_code==0 && chan->dcs_sql==0) { dcs=0; dcscode=0; } else { dcs=1; dcscode = find_tone_index(rig->caps->dcs_list, chan->dcs_sql); if (dcscode == -1) return -RIG_EINVAL; } if (chan->vfo == RIG_VFO_MEM) { chan_caps = rig_lookup_mem_caps(rig, chan->channel_num); if (!chan_caps) return -RIG_ECONF; channel_num -= chan_caps->start; } else return -RIG_ENIMPL; if (rig->caps->rig_model == RIG_MODEL_THF7E || rig->caps->rig_model == RIG_MODEL_THF6A) mr_extra = ""; else mr_extra = "0, "; channel_desc = NULL; switch (chan_caps->type) { case RIG_MTYPE_MEM: if (chan_caps[1].type == RIG_MTYPE_PRIO) { /* Info */ sprintf(req, "MW %s0,I-%01d",mr_extra,channel_num); channel_desc = chan->channel_desc; } else { /* Regular */ sprintf(req, "MW %s0,%03d",mr_extra,channel_num); channel_desc = chan->channel_desc; } break; case RIG_MTYPE_EDGE: if (chan_caps[1].type == RIG_MTYPE_EDGE) { sprintf(req, "MW %s0,L%01d",mr_extra,channel_num); } else { sprintf(req, "MW %s0,U%01d",mr_extra,channel_num); } break; case RIG_MTYPE_PRIO: if (chan_caps->start == chan_caps->end) { sprintf(req, "MW %s0,PR",mr_extra); } else { sprintf(req, "MW %s0,PR%01d",mr_extra,channel_num+1); } break; case RIG_MTYPE_CALL: sprintf(req, "CW 0,%01d",channel_num); break; case RIG_MTYPE_BAND: sprintf(req, "VW %01X",channel_num); break; default: return -RIG_EINVAL; } rev = chan->funcs & RIG_FUNC_REV ? 1 : 0; lockout = chan->flags & RIG_CHFLAG_SKIP ? 1 : 0; if (chan_caps->mem_caps.flags) sprintf(lockoutstr, ",%d", lockout); else strcpy(lockoutstr, ""); if (chan_caps->mem_caps.flags && chan_caps->mem_caps.dcs_sql) { if (!priv->mode_table) { rig_debug(RIG_DEBUG_ERR, "%s: Buggy backend, no mode_table '%d'\n", __func__, chan->mode); return -RIG_ENIMPL; } mode = rmode2kenwood(chan->mode, priv->mode_table); if (mode == -1) { rig_debug(RIG_DEBUG_ERR, "%s: Unsupported Mode value '%d'\n", __func__, chan->mode); return -RIG_EINVAL; } /* Step can be hexa */ retval = sprintf(membuf, "%s,%011"PRIll",%X,%d,%d,%d,%d,%d,%02d,%02d,%03d,%09"PRIll",%d%s", req, (int64_t)chan->freq, step, shift, rev, tone, ctcss, dcs, tonefq, ctcssfq, dcscode, (int64_t)abs(chan->rptr_offs), mode, lockoutstr ); } else { /* Without DCS,mode */ retval = sprintf(membuf, "%s,%011"PRIll",%X,%d,%d,%d,%d,,%02d,,%02d,%09"PRIll"%s", req, (int64_t)chan->freq, step, shift, rev, tone, ctcss, tonefq, ctcssfq, (int64_t)abs(chan->rptr_offs), lockoutstr ); } ack_len = ACKBUF_LEN; retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; /* split ? */ if (chan->tx_freq!=RIG_FREQ_NONE && ((chan_caps->type==RIG_MTYPE_MEM && chan_caps->start == 0) || chan_caps->type==RIG_MTYPE_CALL)) { req[3+strlen(mr_extra)]='1'; sprintf(membuf, "%s,%011"PRIll",%X", req,(int64_t)chan->tx_freq, step); ack_len=ACKBUF_LEN; retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; } if (channel_desc) { /* Memory name */ ack_len=ACKBUF_LEN; /* TODO: check strlen(channel_desc) < rig->caps->chan_desc_sz */ if (chan_caps[1].type == RIG_MTYPE_PRIO) sprintf(membuf, "MNA %sI-%01d,%s",mr_extra,channel_num,channel_desc); else sprintf(membuf, "MNA %s%03d,%s",mr_extra,channel_num,channel_desc); retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; } return RIG_OK; } /* * set the aerial/antenna to use */ int th_set_ant(RIG * rig, vfo_t vfo, ant_t ant) { const char *cmd; rig_debug(RIG_DEBUG_TRACE, "%s: ant = %d\n", __func__, ant); switch (ant) { case RIG_ANT_1: cmd = "ANT 0"; break; case RIG_ANT_2: cmd = "ANT 1"; break; case RIG_ANT_3: cmd = "ANT 2"; break; default: return -RIG_EINVAL; } return kenwood_cmd(rig, cmd); } /* * get the aerial/antenna in use */ int th_get_ant(RIG * rig, vfo_t vfo, ant_t * ant) { char buf[8]; int retval; rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); retval = kenwood_safe_transaction(rig, "ANT", buf, sizeof(buf), 6); if (retval != RIG_OK) return retval; if (buf[4] < '0' || buf[4] > '9') return -RIG_EPROTO; *ant = RIG_ANT_N(buf[4] - '0'); rig_debug(RIG_DEBUG_TRACE, "%s: ant = %d\n", __func__, *ant); return RIG_OK; } /* TH-F7: 1 VFO, 2 Menu, 3 Full */ /* TM-D700: 1 Master! */ int th_reset(RIG *rig, reset_t reset) { switch(reset) { case RIG_RESET_VFO: return kenwood_simple_cmd(rig, "SR 1"); case RIG_RESET_MASTER: return kenwood_simple_cmd(rig, "SR 3"); default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported reset %d\n", __func__, reset); return -RIG_EINVAL; } } hamlib-1.2.15.3/kenwood/ts811.c0000644000175000017500000001150512044564477012627 00000000000000/* * Hamlib Kenwood backend - TS-811 description * Copyright (c) 2000-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "kenwood.h" #include "ic10.h" #define TS811_ALL_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) /* func and levels to be checked */ #define TS811_FUNC_ALL (RIG_FUNC_TSQL|RIG_FUNC_LOCK|RIG_FUNC_MUTE) #define TS811_LEVEL_ALL (RIG_LEVEL_STRENGTH) #define TS811_VFO (RIG_VFO_A|RIG_VFO_B) #define TS811_VFO_OP (RIG_OP_UP|RIG_OP_DOWN) #define TS811_SCAN_OP (RIG_SCAN_VFO) static struct kenwood_priv_caps ts811_priv_caps = { .cmdtrm = EOM_KEN, .if_len = 29, }; /* * ts811 rig capabilities. * * specs: http://www.qsl.net/sm7vhs/radio/kenwood/ts811/specs.htm * * TODO: protocol to be check with manual! */ const struct rig_caps ts811_caps = { .rig_model = RIG_MODEL_TS811, .model_name = "TS-811", .mfg_name = "Kenwood", .version = BACKEND_VER "." IC10_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 0, .timeout = 1000, .retry = 3, .has_get_func = TS811_FUNC_ALL, .has_set_func = TS811_FUNC_ALL, .has_get_level = TS811_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(TS811_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .vfo_ops = TS811_VFO_OP, .scan_ops = TS811_SCAN_OP, .ctcss_list = kenwood38_ctcss_list, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = kHz(9.9), .max_xit = 0, .max_ifshift = 0, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, /* FIXME: split memories, call channel, etc. */ .chan_list = { { 1, 59, RIG_MTYPE_MEM, {IC10_CHANNEL_CAPS} }, RIG_CHAN_END, }, .rx_range_list1 = { {MHz(430),MHz(440),TS811_ALL_MODES,-1,-1,TS811_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { {MHz(430),MHz(440),TS811_ALL_MODES,W(5),W(25),TS811_VFO}, RIG_FRNG_END, }, /* tx range */ .rx_range_list2 = { {MHz(430),MHz(450),TS811_ALL_MODES,-1,-1,TS811_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {MHz(430),MHz(450),TS811_ALL_MODES,W(5),W(25),TS811_VFO}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {TS811_ALL_MODES,50}, {TS811_ALL_MODES,100}, {TS811_ALL_MODES,kHz(1)}, {TS811_ALL_MODES,kHz(5)}, {TS811_ALL_MODES,kHz(9)}, {TS811_ALL_MODES,kHz(10)}, {TS811_ALL_MODES,12500}, {TS811_ALL_MODES,kHz(20)}, {TS811_ALL_MODES,kHz(25)}, {TS811_ALL_MODES,kHz(100)}, {TS811_ALL_MODES,MHz(1)}, {TS811_ALL_MODES,0}, /* any tuning step */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.2)}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .priv = (void *)&ts811_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = ic10_get_freq, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_xit = kenwood_set_xit, .get_xit = kenwood_get_xit, .set_mode = kenwood_set_mode, .get_mode = ic10_get_mode, .set_vfo = ic10_set_vfo, .get_vfo = ic10_get_vfo, .set_split_vfo = ic10_set_split_vfo, .get_split_vfo = ic10_get_split_vfo, .set_ptt = kenwood_set_ptt, .get_ptt = ic10_get_ptt, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .vfo_op = kenwood_vfo_op, .set_mem = kenwood_set_mem, .get_mem = ic10_get_mem, .set_trn = kenwood_set_trn, .scan = kenwood_scan, .set_ctcss_tone = kenwood_set_ctcss_tone, .get_ctcss_tone = kenwood_get_ctcss_tone, .set_level = kenwood_set_level, .get_level = kenwood_get_level, .set_channel = ic10_set_channel, .get_channel = ic10_get_channel, .decode_event = ic10_decode_event, }; /* * Function definitions below */ hamlib-1.2.15.3/kenwood/kenwood.h0000644000175000017500000001741312044564477013426 00000000000000/* * Hamlib Kenwood backend - main header * Copyright (c) 2000-2011 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _KENWOOD_H #define _KENWOOD_H 1 #include #include "token.h" #define BACKEND_VER "0.8" #define EOM_KEN ';' #define EOM_TH '\r' #define KENWOOD_MODE_TABLE_MAX 10 #define KENWOOD_MAX_BUF_LEN 50 /* max answer len, arbitrary */ /* Tokens for Parameters common to multiple rigs. * Use token # >= 1 or <= 100. Defined here so they will be * available in Kenwood name space. */ #define TOK_VOICE TOKEN_BACKEND(1) #define TOK_FINE TOKEN_BACKEND(2) #define TOK_XIT TOKEN_BACKEND(3) #define TOK_RIT TOKEN_BACKEND(4) /* Token structure assigned to .cfgparams in rig_caps */ extern const struct confparams kenwood_cfg_params[]; /* * modes in use by the "MD" command */ #define MD_NONE '0' #define MD_LSB '1' #define MD_USB '2' #define MD_CW '3' #define MD_FM '4' #define MD_AM '5' #define MD_FSK '6' #define MD_CWR '7' #define MD_FSKR '9' struct kenwood_priv_caps { char cmdtrm; /* Command termination chars (ken=';' or th='\r') */ int if_len; /* length of IF; anwser */ rmode_t *mode_table; }; struct kenwood_priv_data { char info[KENWOOD_MAX_BUF_LEN]; split_t split; /* current split state */ int k2_ext_lvl; /* Initial K2 extension level */ int k3_ext_lvl; /* Initial K3 extension level */ int k2_md_rtty; /* K2 RTTY mode available flag, 1 = RTTY, 0 = N/A */ char k3_fw_rev[KENWOOD_MAX_BUF_LEN]; /* K3 firmware revision level */ }; #define kenwood_caps(rig) ((struct kenwood_priv_caps *)(rig)->caps->priv) extern rmode_t kenwood_mode_table[KENWOOD_MODE_TABLE_MAX]; extern const tone_t kenwood38_ctcss_list[]; extern const tone_t kenwood42_ctcss_list[]; int kenwood_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, size_t *data_len); int kenwood_safe_transaction(RIG *rig, const char *cmd, char *buf, size_t buf_size, size_t expected); rmode_t kenwood2rmode(unsigned char mode, const rmode_t mode_table[]); char rmode2kenwood(rmode_t mode, const rmode_t mode_table[]); int kenwood_init(RIG *rig); int kenwood_cleanup(RIG *rig); int kenwood_open(RIG *rig); int kenwood_set_vfo(RIG *rig, vfo_t vfo); int kenwood_get_vfo_if(RIG *rig, vfo_t *vfo); int kenwood_set_split_vfo(RIG *rig, vfo_t vfo , split_t split, vfo_t txvfo); int kenwood_get_split_vfo_if(RIG *rig, vfo_t rxvfo, split_t *split, vfo_t *txvfo); int kenwood_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int kenwood_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int kenwood_get_freq_if(RIG *rig, vfo_t vfo, freq_t *freq); int kenwood_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit); int kenwood_get_rit(RIG *rig, vfo_t vfo, shortfreq_t * rit); int kenwood_set_xit(RIG * rig, vfo_t vfo, shortfreq_t rit); int kenwood_get_xit(RIG *rig, vfo_t vfo, shortfreq_t * rit); int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int kenwood_get_mode_if(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int kenwood_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int kenwood_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int kenwood_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int kenwood_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); int kenwood_set_ext_parm(RIG *rig, token_t token, value_t val); int kenwood_get_ext_parm(RIG *rig, token_t token, value_t *val); int kenwood_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone); int kenwood_set_ctcss_tone_tn(RIG *rig, vfo_t vfo, tone_t tone); int kenwood_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone); int kenwood_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone); int kenwood_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone); int kenwood_set_powerstat(RIG *rig, powerstat_t status); int kenwood_get_powerstat(RIG *rig, powerstat_t *status); int kenwood_reset(RIG *rig, reset_t reset); int kenwood_send_morse(RIG *rig, vfo_t vfo, const char *msg); int kenwood_set_ant (RIG * rig, vfo_t vfo, ant_t ant); int kenwood_set_ant_no_ack(RIG * rig, vfo_t vfo, ant_t ant); int kenwood_get_ant (RIG * rig, vfo_t vfo, ant_t * ant); int kenwood_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); int kenwood_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); int kenwood_set_ptt_safe(RIG *rig, vfo_t vfo, ptt_t ptt); int kenwood_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); int kenwood_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); int kenwood_set_mem(RIG *rig, vfo_t vfo, int ch); int kenwood_get_mem(RIG *rig, vfo_t vfo, int *ch); int kenwood_get_mem_if(RIG *rig, vfo_t vfo, int *ch); int kenwood_get_channel(RIG *rig, channel_t *chan); int kenwood_set_channel(RIG *rig, const channel_t *chan); int kenwood_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch); const char * kenwood_get_info(RIG *rig); int kenwood_get_id(RIG *rig, char *buf); int kenwood_set_trn(RIG *rig, int trn); int kenwood_get_trn(RIG *rig, int *trn); /* only use if returned string has length 6, e.g. 'SQ011;' */ int get_kenwood_level(RIG *rig, const char *cmd, int cmd_len, float *f); extern const struct rig_caps ts950sdx_caps; extern const struct rig_caps ts50s_caps; extern const struct rig_caps ts140_caps; extern const struct rig_caps ts450s_caps; extern const struct rig_caps ts570d_caps; extern const struct rig_caps ts570s_caps; extern const struct rig_caps ts680s_caps; extern const struct rig_caps ts690s_caps; extern const struct rig_caps ts790_caps; extern const struct rig_caps ts850_caps; extern const struct rig_caps ts870s_caps; extern const struct rig_caps ts930_caps; extern const struct rig_caps ts2000_caps; extern const struct rig_caps k2_caps; extern const struct rig_caps k3_caps; extern const struct rig_caps trc80_caps; extern const struct rig_caps thd7a_caps; extern const struct rig_caps thd72a_caps; extern const struct rig_caps tmd700_caps; extern const struct rig_caps thf7a_caps; extern const struct rig_caps thf7e_caps; extern const struct rig_caps thg71_caps; extern const struct rig_caps tmv7_caps; extern const struct rig_caps tmd710_caps; extern const struct rig_caps ts440_caps; extern const struct rig_caps ts940_caps; extern const struct rig_caps ts711_caps; extern const struct rig_caps ts811_caps; extern const struct rig_caps r5000_caps; extern const struct rig_caps ts480_caps; extern const struct rig_caps ts590_caps; extern const struct rig_caps thf6a_caps; extern const struct rig_caps transfox_caps; /* use when not interested in the answer, but want to check its len */ static int inline kenwood_simple_transaction(RIG *rig, const char *cmd, size_t expected) { char buf[20]; return kenwood_safe_transaction(rig, cmd, buf, sizeof(buf), expected); } /* no answer needed at all */ static int inline kenwood_simple_cmd(RIG *rig, const char *cmd) { char buf[20]; return kenwood_safe_transaction(rig, cmd, buf, sizeof(buf), 0); } /* answer is the same as the command */ static int inline kenwood_cmd(RIG *rig, const char *cmd) { char buf[20]; int lenz = strlen(cmd)+1; if (lenz > sizeof(buf)) return -RIG_ENOMEM; else return kenwood_safe_transaction(rig, cmd, buf, sizeof(buf), lenz); } #endif /* _KENWOOD_H */ hamlib-1.2.15.3/kenwood/ts450s.c0000644000175000017500000001752212044564477013016 00000000000000/* * Hamlib Kenwood backend - TS450S description * Copyright (c) 2000-2011 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "kenwood.h" #include "bandplan.h" #define TS450S_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define TS450S_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define TS450S_AM_TX_MODES RIG_MODE_AM #define TS450S_FUNC_ALL (RIG_FUNC_LOCK|RIG_FUNC_AIP|RIG_FUNC_TONE) #define TS450S_LEVEL_ALL (RIG_LEVEL_STRENGTH|RIG_LEVEL_CWPITCH|RIG_LEVEL_METER|RIG_LEVEL_SWR|RIG_LEVEL_ALC) #define TS450S_VFO (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define TS450S_VFO_OPS (RIG_OP_UP|RIG_OP_DOWN) #define TS450S_SCAN_OPS (RIG_SCAN_VFO) #define TS450S_CHANNEL_CAPS { \ .freq=1,\ .mode=1,\ .tx_freq=1,\ .tx_mode=1,\ .split=1,\ .funcs=RIG_FUNC_TONE, \ .flags=RIG_CHFLAG_SKIP \ } static struct kenwood_priv_caps ts450_priv_caps = { .cmdtrm = EOM_KEN, }; static const struct confparams ts450_ext_parms[] = { { TOK_FINE, "fine", "Fine", "Fine step mode", NULL, RIG_CONF_CHECKBUTTON, { } }, { TOK_VOICE, "voice", "Voice", "Voice recall", NULL, RIG_CONF_BUTTON, { } }, { TOK_XIT, "xit", "XIT", "XIT", NULL, RIG_CONF_CHECKBUTTON, { } }, { TOK_RIT, "rit", "RIT", "RIT", NULL, RIG_CONF_CHECKBUTTON, { } }, { RIG_CONF_END, NULL, } }; static int ts450_open(RIG *rig) { int err; int maxtries; err = kenwood_open(rig); if (err != RIG_OK) return err; maxtries = rig->state.rigport.retry; /* no retry for this command that may be missing */ rig->state.rigport.retry = 0; err = kenwood_simple_transaction(rig, "TO", 3); if (err != RIG_OK) { rig_debug(RIG_DEBUG_VERBOSE, "%s: tone unit not detected\n", __func__); rig->state.has_set_func &= ~RIG_FUNC_TONE; rig->state.has_get_func &= ~RIG_FUNC_TONE; } rig->state.rigport.retry = maxtries; return RIG_OK; } /* * ts450s rig capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! * RIT: Variable Range ±9.99 kHz * * TODO: protocol to be checked with manual (identical to TS690) * - get_channel/set_channel: MR/MW * - how to set_split in vfo mode? * - ... * * specs: http://www.qsl.net/sm7vhs/radio/kenwood/ts450/specs.htm * infos comes from http://www.cnham.com/ts450/ts_450_ex_control.pdf */ const struct rig_caps ts450s_caps = { .rig_model = RIG_MODEL_TS450S, .model_name = "TS-450S", .mfg_name = "Kenwood", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 10, .timeout = 1000, .retry = 3, .has_get_func = TS450S_FUNC_ALL, .has_set_func = TS450S_FUNC_ALL, .has_get_level = TS450S_LEVEL_ALL | RIG_LEVEL_RFPOWER, .has_set_level = RIG_LEVEL_SET(TS450S_LEVEL_ALL), .has_get_parm = 0, .has_set_parm = 0, .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .extparms = ts450_ext_parms, .ctcss_list = NULL, /* hw dip-switch */ .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, /* can't be controlled */ .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .vfo_ops = TS450S_VFO_OPS, .scan_ops = TS450S_SCAN_OPS, .chan_list = { { 0, 89, RIG_MTYPE_MEM, TS450S_CHANNEL_CAPS }, /* TBC */ { 90, 99, RIG_MTYPE_EDGE, TS450S_CHANNEL_CAPS }, RIG_CHAN_END, }, .rx_range_list1 = { { kHz(500), MHz(30), TS450S_ALL_MODES, -1, -1, TS450S_VFO }, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { FRQ_RNG_HF(1,TS450S_OTHER_TX_MODES, W(5),W(100),TS450S_VFO,0), FRQ_RNG_HF(1,TS450S_AM_TX_MODES, W(2),W(40),TS450S_VFO,0), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30),TS450S_ALL_MODES,-1,-1,TS450S_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {kHz(1800),MHz(2)-1,TS450S_OTHER_TX_MODES,5000,100000,TS450S_VFO}, /* 100W class */ {kHz(1800),MHz(2)-1,TS450S_AM_TX_MODES,2000,40000,TS450S_VFO}, /* 40W class */ {kHz(3500),MHz(4)-1,TS450S_OTHER_TX_MODES,5000,100000,TS450S_VFO}, {kHz(3500),MHz(4)-1,TS450S_AM_TX_MODES,2000,40000,TS450S_VFO}, {MHz(7),kHz(7300),TS450S_OTHER_TX_MODES,5000,100000,TS450S_VFO}, {MHz(7),kHz(7300),TS450S_AM_TX_MODES,2000,40000,TS450S_VFO}, {kHz(10100),kHz(10150),TS450S_OTHER_TX_MODES,5000,100000,TS450S_VFO}, {kHz(10100),kHz(10150),TS450S_AM_TX_MODES,2000,40000,TS450S_VFO}, {MHz(14),kHz(14350),TS450S_OTHER_TX_MODES,5000,100000,TS450S_VFO}, {MHz(14),kHz(14350),TS450S_AM_TX_MODES,2000,40000,TS450S_VFO}, {kHz(18068),kHz(18168),TS450S_OTHER_TX_MODES,5000,100000,TS450S_VFO}, {kHz(18068),kHz(18168),TS450S_AM_TX_MODES,2000,40000,TS450S_VFO}, {MHz(21),kHz(21450),TS450S_OTHER_TX_MODES,5000,100000,TS450S_VFO}, {MHz(21),kHz(21450),TS450S_AM_TX_MODES,2000,40000,TS450S_VFO}, {kHz(24890),kHz(24990),TS450S_OTHER_TX_MODES,5000,100000,TS450S_VFO}, {kHz(24890),kHz(24990),TS450S_AM_TX_MODES,2000,40000,TS450S_VFO}, {MHz(28),kHz(29700),TS450S_OTHER_TX_MODES,5000,100000,TS450S_VFO}, {MHz(28),kHz(29700),TS450S_AM_TX_MODES,2000,40000,TS450S_VFO}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { { TS450S_ALL_MODES, 1 }, { TS450S_ALL_MODES, 10}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_FM, kHz(12) }, {RIG_MODE_FM|RIG_MODE_AM, kHz(6)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_CWR|RIG_MODE_RTTYR|RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_CWR|RIG_MODE_RTTYR|RIG_MODE_AM, Hz(500)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_CWR|RIG_MODE_RTTYR|RIG_MODE_AM, kHz(12)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_CWR|RIG_MODE_RTTYR, kHz(6)}, RIG_FLT_END, }, .priv = (void *)&ts450_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .rig_open = ts450_open, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_xit = kenwood_set_xit, .get_xit = kenwood_get_xit, .set_mode = kenwood_set_mode, .get_mode = kenwood_get_mode_if, .set_vfo = kenwood_set_vfo, .get_vfo = kenwood_get_vfo_if, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt, .get_dcd = kenwood_get_dcd, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .set_level = kenwood_set_level, .get_level = kenwood_get_level, .set_ext_parm = kenwood_set_ext_parm, .get_ext_parm = kenwood_get_ext_parm, .vfo_op = kenwood_vfo_op, .set_mem = kenwood_set_mem, .get_mem = kenwood_get_mem_if, .set_trn = kenwood_set_trn, .get_trn = kenwood_get_trn, .set_powerstat = kenwood_set_powerstat, .get_powerstat = kenwood_get_powerstat, .reset = kenwood_reset, .scan = kenwood_scan, .get_channel = kenwood_get_channel, .set_channel = kenwood_set_channel, }; hamlib-1.2.15.3/kenwood/README.k20000644000175000017500000000273512044564477013003 00000000000000Elecraft K2 notes and Hamlib errata by Nate Bargmann, N0NB. The K2 shares some backend code with the K3. This code can be found in elecraft.[c|h] while any K2 specific is found in k2.c As always, comments and bug reports should be submitted to hamlib-developer@lists.sourceforge.net elecraft_open() =============== The kenwood_open() function fails for the Elecraft radios as the function checks the backend to be certain the ID from the radio matches the backend that called the function. As the ID command of the Elecraft radios returns "017" which corresponds to the TS-570, the backend test fails. Rather than muck up a working function, I chose to implement an independent elecraft_open which not only checks for the existence of a connected radio that returns an ID of "017", it also checks for K2 or K3 extensions and sets a pair of private variables that may be used later for advanced functions. This way the backend should be able to reliably test for either a K2 or K3 (needs more testing with the K2). This function also probes the K2 for the RTTY option and then installed filters and bandwidths. This information is stored in a structure and used later. The probe adds about 10 seconds to the rig_open. kenwood_get/set_ext_parms() =========================== These functions are used to get and set RIT/XIT on and off. The special token names of 'rit' and 'xit' are used with the P/p commands of rigctl[d] for the 'parm'. Set/returned value is 0 or 1 for off or on. hamlib-1.2.15.3/kenwood/transfox.c0000644000175000017500000001763612044564477013626 00000000000000/* * Hamlib backend - SigFox Transfox description * Copyright (c) 2011 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * See the file 'COPYING.LIB' in the main Hamlib distribution directory for * the complete text of the GNU Lesser Public License version 2.1. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "kenwood.h" #define TRANSFOX_MODES (RIG_MODE_USB) /* SDR */ #define TRANSFOX_FUNC_ALL (RIG_FUNC_NONE) #define TRANSFOX_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_PREAMP) #define TRANSFOX_VFO (RIG_VFO_A) #define TRANSFOX_VFO_OP (RIG_OP_NONE) #define TRANSFOX_ANTS (RIG_ANT_1) /* kenwood_transaction() will add this to command strings * sent to the rig and remove it from strings returned from * the rig, so no need to append ';' manually to command strings. */ static struct kenwood_priv_caps transfox_priv_caps = { .cmdtrm = EOM_KEN, }; /* TRANSFOX specific rig_caps API function declarations */ static int transfox_open(RIG *rig); static const char* transfox_get_info(RIG *rig); static int transfox_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); static int transfox_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int transfox_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); /* * Transfox rig capabilities. * This SDR only share some basic Kenwood's protocol. * * Part of info comes from http://www.sigfox-system.com/TransFox-FE?lang=en */ const struct rig_caps transfox_caps = { .rig_model = RIG_MODEL_TRANSFOX, .model_name = "Transfox", .mfg_name = "SigFox", .version = "20111223", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TUNER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 9600, .serial_rate_max = 19200, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, /* Timing between bytes */ .post_write_delay = 10, /* Timing between command strings */ .timeout = 500, .retry = 3, .has_get_func = TRANSFOX_FUNC_ALL, .has_set_func = TRANSFOX_FUNC_ALL, .has_get_level = TRANSFOX_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(TRANSFOX_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .parm_gran = {}, .extparms = NULL, .preamp = { 22, 44, RIG_DBLST_END, }, .attenuator = { 10, 20, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .vfo_ops = TRANSFOX_VFO_OP, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END }, .rx_range_list1 = { {MHz(1),MHz(1450),TRANSFOX_MODES,-1,-1,TRANSFOX_VFO,TRANSFOX_ANTS}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { {MHz(1),MHz(1450),TRANSFOX_MODES,mW(100),mW(100),TRANSFOX_VFO,TRANSFOX_ANTS}, RIG_FRNG_END, }, /* tx range */ .rx_range_list2 = { {MHz(1),MHz(1450),TRANSFOX_MODES,-1,-1,TRANSFOX_VFO,TRANSFOX_ANTS}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {MHz(1),MHz(1450),TRANSFOX_MODES,mW(100),mW(100),TRANSFOX_VFO,TRANSFOX_ANTS}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {TRANSFOX_MODES,1}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {TRANSFOX_MODES, kHz(192)}, RIG_FLT_END, }, .priv = (void *)&transfox_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .rig_open = transfox_open, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_level = transfox_set_level, .get_level = transfox_get_level, .set_ptt = kenwood_set_ptt, .get_ptt = transfox_get_ptt, .get_info = transfox_get_info, #if 0 .set_trn = transfox_set_trn, .get_trn = transfox_get_trn, .scan = transfox_scan, .set_conf = transfox_set_conf, .get_conf = transfox_get_conf, #endif }; /* * TRANSFOX extension function definitions follow */ /* transfox_open() * */ int transfox_open(RIG *rig) { rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); rig->state.current_vfo = RIG_VFO_A; /* do not call kenwood_open(rig), rig has no "ID" command */ return RIG_OK; } int transfox_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { char buf[8]; int retval; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); retval = kenwood_safe_transaction(rig, "Cs", buf, 8, 2); if (retval != RIG_OK) return retval; *ptt = buf[0] == 'T' ? RIG_PTT_ON : RIG_PTT_OFF; return RIG_OK; } const char* transfox_get_info(RIG *rig) { static char firmbuf[32]; size_t firmlen = sizeof firmbuf; int retval; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); firmbuf[0] = '\0'; retval = kenwood_transaction(rig, "CS", 2, firmbuf, &firmlen); if (retval != RIG_OK) return NULL; return firmbuf; } int transfox_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { int ret = RIG_OK; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); switch (level) { case RIG_LEVEL_ATT: if (val.i == 0) { ret = kenwood_simple_cmd(rig, "C30"); if (ret != RIG_OK) return ret; ret = kenwood_simple_cmd(rig, "C20"); if (ret != RIG_OK) return ret; } else if (val.i == 10) { ret = kenwood_simple_cmd(rig, "C30"); if (ret != RIG_OK) return ret; ret = kenwood_simple_cmd(rig, "C21"); if (ret != RIG_OK) return ret; } else if (val.i == 20) { ret = kenwood_simple_cmd(rig, "C31"); if (ret != RIG_OK) return ret; ret = kenwood_simple_cmd(rig, "C21"); if (ret != RIG_OK) return ret; } break; case RIG_LEVEL_PREAMP: if (val.i == 0) { ret = kenwood_simple_cmd(rig, "C30"); if (ret != RIG_OK) return ret; ret = kenwood_simple_cmd(rig, "C20"); if (ret != RIG_OK) return ret; } else if (val.i == 22) { ret = kenwood_simple_cmd(rig, "C30"); if (ret != RIG_OK) return ret; ret = kenwood_simple_cmd(rig, "C22"); if (ret != RIG_OK) return ret; } else if (val.i == 44) { ret = kenwood_simple_cmd(rig, "C32"); if (ret != RIG_OK) return ret; ret = kenwood_simple_cmd(rig, "C22"); if (ret != RIG_OK) return ret; } break; default: rig_debug(RIG_DEBUG_ERR, "Unsupported set_level %d", level); return -RIG_EINVAL; } return ret; } int transfox_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { char lvlbuf[16]; int retval; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); switch (level) { case RIG_LEVEL_ATT: retval = kenwood_safe_transaction(rig, "C2x", lvlbuf, 8, 3); if (retval != RIG_OK) return retval; val->i = (lvlbuf[2] == '1') ? 10 : 0; retval = kenwood_safe_transaction(rig, "C3x", lvlbuf, 8, 3); if (retval != RIG_OK) return retval; val->i += (lvlbuf[2] == '1') ? 10 : 0; break; case RIG_LEVEL_PREAMP: retval = kenwood_safe_transaction(rig, "C2x", lvlbuf, 8, 3); if (retval != RIG_OK) return retval; val->i = (lvlbuf[2] == '2') ? 22 : 0; retval = kenwood_safe_transaction(rig, "C3x", lvlbuf, 8, 3); if (retval != RIG_OK) return retval; val->i += (lvlbuf[2] == '2') ? 22 : 0; break; default: rig_debug(RIG_DEBUG_ERR, "Unsupported get_level %x", level); return -RIG_EINVAL; } return RIG_OK; } hamlib-1.2.15.3/kenwood/ts680.c0000644000175000017500000001341212044564477012632 00000000000000/* * Hamlib Kenwood backend - TS680 description * Copyright (c) 2000-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "hamlib/rig.h" #include "bandplan.h" #include "kenwood.h" #define TS680_ALL_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_CWR) #define TS680_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_CWR) #define TS680_AM_TX_MODES RIG_MODE_AM #define TS680_VFO (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define TS680_ANTS (0) /* * vfo defines */ #define VFO_A '0' #define VFO_B '1' #define VFO_MEM '2' static struct kenwood_priv_caps ts680_priv_caps = { .cmdtrm = EOM_KEN, }; static int ts680_set_vfo(RIG *rig, vfo_t vfo) { char cmdbuf[16]; char vfo_function; switch (vfo) { case RIG_VFO_VFO: case RIG_VFO_A: vfo_function = VFO_A; break; case RIG_VFO_B: vfo_function = VFO_B; break; case RIG_VFO_MEM: vfo_function = VFO_MEM; break; case RIG_VFO_CURR: return RIG_OK; default: rig_debug(RIG_DEBUG_ERR,"ts680_set_vfo: unsupported VFO %d\n", vfo); return -RIG_EINVAL; } sprintf(cmdbuf, "FN%c", vfo_function); /* The 680 and 140 need this to set the VFO on the radio */ return kenwood_simple_cmd(rig, cmdbuf); } /* * ts680 rig capabilities. * GW0VNR 09042006 */ const struct rig_caps ts680s_caps = { .rig_model = RIG_MODEL_TS680S, .model_name = "TS-680S", .mfg_name = "Kenwood", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 9600, /* Rig only capable of 4800 baud from factory and 9k6 with jumper change */ .serial_data_bits = 8, .serial_stop_bits = 2, /* TWO stop bits. This is correct. */ .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 0, .timeout = 300, .retry = 3, .has_get_func = RIG_FUNC_LOCK, .has_set_func = RIG_FUNC_LOCK, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* No PARAMS controllable */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .preamp = { RIG_DBLST_END, }, /* Not controllable */ .attenuator = { RIG_DBLST_END, }, /* Not controllable */ .max_rit = kHz(1.2), .max_xit = kHz(1.2), .max_ifshift = Hz(0), /* Not controllable */ .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 19, RIG_MTYPE_MEM }, { 20, 30, RIG_MTYPE_EDGE }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(50),kHz(34999),TS680_ALL_MODES,-1,-1,TS680_VFO}, {MHz(45),kHz(59999),TS680_ALL_MODES,-1,-1,TS680_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { FRQ_RNG_HF(1,TS680_OTHER_TX_MODES,W(5),W(100),TS680_VFO,TS680_ANTS), FRQ_RNG_HF(1,TS680_AM_TX_MODES,W(2),W(40),TS680_VFO,TS680_ANTS), FRQ_RNG_6m(1,TS680_OTHER_TX_MODES,W(1),W(10),TS680_VFO,TS680_ANTS), FRQ_RNG_6m(1,TS680_AM_TX_MODES,W(1),W(4),TS680_VFO,TS680_ANTS), RIG_FRNG_END, }, .rx_range_list2 = { {kHz(50),kHz(34999),TS680_ALL_MODES,-1,-1,TS680_VFO}, {MHz(45),kHz(59999),TS680_ALL_MODES,-1,-1,TS680_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { FRQ_RNG_HF(2,TS680_OTHER_TX_MODES,W(5),W(100),TS680_VFO,TS680_ANTS), FRQ_RNG_HF(2,TS680_AM_TX_MODES,W(2),W(40),TS680_VFO,TS680_ANTS), FRQ_RNG_6m(2,TS680_OTHER_TX_MODES,W(1),W(10),TS680_VFO,TS680_ANTS), FRQ_RNG_6m(2,TS680_AM_TX_MODES,W(1),W(4),TS680_VFO,TS680_ANTS), RIG_FRNG_END, }, /* tx range */ .tuning_steps = { /* FIXME: Done */ {TS680_ALL_MODES,10}, {TS680_ALL_MODES,100}, {TS680_ALL_MODES,kHz(1)}, {TS680_ALL_MODES,kHz(5)}, {TS680_ALL_MODES,kHz(9)}, {TS680_ALL_MODES,kHz(10)}, {TS680_ALL_MODES,12500}, {TS680_ALL_MODES,kHz(20)}, {TS680_ALL_MODES,kHz(25)}, {TS680_ALL_MODES,kHz(100)}, {TS680_ALL_MODES,MHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_AM, kHz(6)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_AM, kHz(2.2)}, {RIG_MODE_CWR, 600}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .priv = (void *)&ts680_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_mode = kenwood_set_mode, .get_mode = kenwood_get_mode_if, .set_vfo = ts680_set_vfo, .get_vfo = kenwood_get_vfo_if, .set_ptt = kenwood_set_ptt, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .vfo_op = kenwood_vfo_op, .set_mem = kenwood_set_mem, .get_mem = kenwood_get_mem_if, .reset = kenwood_reset, }; /* * Function definitions below */ hamlib-1.2.15.3/kenwood/thd7.c0000644000175000017500000001273112044564477012617 00000000000000/* * Hamlib Kenwood backend - TH-D7 description * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "kenwood.h" #include "th.h" #if 1 #define RIG_ASSERT(x) if (!(x)) { rig_debug(RIG_DEBUG_ERR, "Assertion failed on line %i\n",__LINE__); abort(); } #else #define RIG_ASSERT(x) #endif #define THD7_MODES (RIG_MODE_FM|RIG_MODE_AM) #define THD7_MODES_TX (RIG_MODE_FM) #define THD7_FUNC_ALL (RIG_FUNC_TSQL| \ RIG_FUNC_AIP| \ RIG_FUNC_MON| \ RIG_FUNC_SQL| \ RIG_FUNC_TONE| \ RIG_FUNC_REV| \ RIG_FUNC_LOCK| \ RIG_FUNC_ARO) #define THD7_LEVEL_ALL (RIG_LEVEL_STRENGTH| \ RIG_LEVEL_SQL| \ RIG_LEVEL_AF| \ RIG_LEVEL_RF|\ RIG_LEVEL_MICGAIN) #define THD7_PARMS (RIG_PARM_BACKLIGHT) #define THD7_VFO_OP (RIG_OP_UP|RIG_OP_DOWN) /* * TODO: Band A & B */ #define THD7_VFO (RIG_VFO_A|RIG_VFO_B) static rmode_t td7_mode_table[KENWOOD_MODE_TABLE_MAX] = { [0] = RIG_MODE_FM, [1] = RIG_MODE_AM, }; static struct kenwood_priv_caps thd7_priv_caps = { .cmdtrm = EOM_TH, /* Command termination character */ .mode_table = td7_mode_table, }; /* * th-d7a rig capabilities. * * http://www.qsl.net/ta1dx/kenwood/thd7kom.htm */ const struct rig_caps thd7a_caps = { .rig_model = RIG_MODEL_THD7A, .model_name = "TH-D7A", .mfg_name = "Kenwood", .version = TH_VER, .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_HANDHELD|RIG_FLAG_APRS|RIG_FLAG_TNC|RIG_FLAG_DXCLUSTER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .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 = 3, .has_get_func = THD7_FUNC_ALL, .has_set_func = THD7_FUNC_ALL, .has_get_level = THD7_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(THD7_LEVEL_ALL), .has_get_parm = THD7_PARMS, .has_set_parm = THD7_PARMS, /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 5 } }, [LVL_SQL] = { .min = { .i = 0 }, .max = { .i = 5 } }, [LVL_RFPOWER] = { .min = { .i = 3 }, .max = { .i = 0 } }, }, .parm_gran = {}, .ctcss_list = kenwood38_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), .vfo_ops = THD7_VFO_OP, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 6, .chan_list = { { 1, 199, RIG_MTYPE_MEM , {TH_CHANNEL_CAPS}}, /* normal MEM */ { 200,219, RIG_MTYPE_EDGE , {TH_CHANNEL_CAPS}}, /* U/L MEM */ { 221,222, RIG_MTYPE_CALL, {TH_CHANNEL_CAPS}}, /* Call 0/1 */ RIG_CHAN_END, }, .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {MHz(144),MHz(148),THD7_MODES,-1,-1,THD7_VFO}, {MHz(430),MHz(440),THD7_MODES,-1,-1,THD7_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {MHz(144),MHz(148),THD7_MODES_TX,W(5.5),W(5.5),THD7_VFO}, {MHz(430),MHz(440),THD7_MODES_TX,W(5.5),W(5.5),THD7_VFO}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {THD7_MODES,kHz(5)}, {THD7_MODES,kHz(6.25)}, {THD7_MODES,kHz(10)}, {THD7_MODES,kHz(12.5)}, {THD7_MODES,kHz(15)}, {THD7_MODES,kHz(20)}, {THD7_MODES,kHz(25)}, {THD7_MODES,kHz(30)}, {THD7_MODES,kHz(50)}, {THD7_MODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_FM, kHz(14)}, {RIG_MODE_AM, kHz(9)}, RIG_FLT_END, }, .priv = (void *)&thd7_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = th_set_freq, .get_freq = th_get_freq, .set_mode = th_set_mode, .get_mode = th_get_mode, .set_vfo = th_set_vfo, .get_vfo = th_get_vfo, .set_ctcss_tone = th_set_ctcss_tone, .get_ctcss_tone = th_get_ctcss_tone, .set_ctcss_sql = th_set_ctcss_sql, .get_ctcss_sql = th_get_ctcss_sql, .set_mem = th_set_mem, .get_mem = th_get_mem, .set_channel = th_set_channel, .get_channel = th_get_channel, .set_trn = th_set_trn, .get_trn = th_get_trn, .get_func = th_get_func, .get_level = th_get_level, .get_parm = th_get_parm, .get_info = th_get_info, .get_dcd = kenwood_get_dcd, .decode_event = th_decode_event, }; /* end of file */ hamlib-1.2.15.3/kenwood/ts570.c0000644000175000017500000007452012044564477012637 00000000000000/* * Hamlib Kenwood backend - TS570 description * Copyright (c) 2001-2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "kenwood.h" #include "ic10.h" #define TS570_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define TS570_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define TS570_AM_TX_MODES RIG_MODE_AM #define TS570_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_TSQL|RIG_FUNC_TONE|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_NR|RIG_FUNC_LOCK|RIG_FUNC_BC|RIG_FUNC_TUNER) #define TS570_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQL|RIG_LEVEL_STRENGTH|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_SLOPE_LOW|RIG_LEVEL_SLOPE_HIGH) #define TS570_VFO (RIG_VFO_A|RIG_VFO_B) #define TS570_VFO_OP (RIG_OP_UP|RIG_OP_DOWN) #define TS570_SCAN_OPS (RIG_SCAN_VFO) #define TS570_ANTS (RIG_ANT_1|RIG_ANT_2) static struct kenwood_priv_caps ts570_priv_caps = { .cmdtrm = EOM_KEN, }; static int ts570_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char buf[50]; size_t buf_len; int retval; buf_len = 50; retval = kenwood_transaction (rig, "MD", 2, buf, &buf_len); if (retval != RIG_OK) return retval; if (buf_len != 4 || buf[1] != 'D') { rig_debug(RIG_DEBUG_ERR,"ts570_get_mode: unexpected MD answer, len=%d\n", buf_len); return -RIG_ERJCTED; } switch (buf[2]) { case MD_CW: *mode = RIG_MODE_CW; break; case MD_CWR: *mode = RIG_MODE_CWR; break; case MD_USB: *mode = RIG_MODE_USB; break; case MD_LSB: *mode = RIG_MODE_LSB; break; case MD_FM: *mode = RIG_MODE_FM; break; case MD_AM: *mode = RIG_MODE_AM; break; case MD_FSK: *mode = RIG_MODE_RTTY; break; case MD_FSKR: *mode = RIG_MODE_RTTYR; break; case MD_NONE: *mode = RIG_MODE_NONE; break; default: rig_debug(RIG_DEBUG_ERR,"ts570_get_mode: " "unsupported mode '%c'\n", buf[2]); return -RIG_EINVAL; } /* * Use FW (Filter Width) for CW and RTTY, * SL (dsp Slope Low cut-off) for all the other modes. * This is how it works on the TS870S, which does not have SL/SH commands. * TODO: combine SL and SH to set/read bandwidth.... */ switch (*mode) { case RIG_MODE_CW: case RIG_MODE_CWR: case RIG_MODE_RTTY: case RIG_MODE_RTTYR: buf_len = 50; retval = kenwood_transaction (rig, "FW", 2, buf, &buf_len); if (retval != RIG_OK) return retval; if (buf_len != 7 || buf[1] != 'W') { rig_debug(RIG_DEBUG_ERR, "ts570_get_mode: unexpected FW answer, len=%d\n", buf_len); return -RIG_ERJCTED; } *width = atoi(&buf[2]); break; case RIG_MODE_USB: case RIG_MODE_LSB: case RIG_MODE_FM: case RIG_MODE_AM: buf_len = 50; retval = kenwood_transaction (rig, "SL", 2, buf, &buf_len); if (retval != RIG_OK) return retval; if (buf_len != 5 || buf[1] != 'L') { rig_debug(RIG_DEBUG_ERR, "ts570_get_mode: unexpected SL answer, len=%d\n", buf_len); return -RIG_ERJCTED; } *width = 50 * atoi(&buf[2]); break; default: return -RIG_EINVAL; } return RIG_OK; } static char mode_to_char(rmode_t mode) { switch (mode) { case RIG_MODE_CW: return(MD_CW); case RIG_MODE_CWR: return(MD_CWR); case RIG_MODE_USB: return(MD_USB); case RIG_MODE_LSB: return(MD_LSB); case RIG_MODE_FM: return(MD_FM); case RIG_MODE_AM: return(MD_AM); case RIG_MODE_RTTY: return(MD_FSK); case RIG_MODE_RTTYR: return(MD_FSKR); default: rig_debug(RIG_DEBUG_WARN,"ts570_mode_to_char %s: unsupported mode %d\n", __func__,mode); } return(RIG_MODE_NONE); } static int ts570_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { char buf[16]; int kmode, retval; if ((kmode = mode_to_char(mode)) == RIG_MODE_NONE) return -RIG_EINVAL; sprintf(buf, "MD%c", kmode); retval = kenwood_simple_cmd(rig, buf); if (retval != RIG_OK) return retval; switch (mode) { case RIG_MODE_CW: case RIG_MODE_CWR: case RIG_MODE_RTTY: case RIG_MODE_RTTYR: sprintf(buf, "FW%04d", (int)width); retval = kenwood_simple_cmd(rig, buf); if (retval != RIG_OK) return retval; break; case RIG_MODE_USB: case RIG_MODE_LSB: case RIG_MODE_FM: case RIG_MODE_AM: sprintf(buf, "SL%02d", (int)width/50); retval = kenwood_simple_cmd(rig, buf); if (retval != RIG_OK) return retval; break; default: return -RIG_EINVAL; } return RIG_OK; } /* * extends kenwood_set_func * Assumes rig!=NULL, val!=NULL */ int ts570_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { char fctbuf[6]; /* Filter unimplemented RIG_FUNC_TUNER and allow settings 0..2 for * RIG_FUNC_NR. * Send all other requests to kenwood_set_func() */ switch (func) { case RIG_FUNC_NR: if ((status < 0) || (status >2)) return -RIG_EINVAL; sprintf(fctbuf,"NR%01d", status); return kenwood_simple_cmd(rig, fctbuf); case RIG_FUNC_TUNER: sprintf(fctbuf,"AC %c0", (0==status)?'0':'1'); return kenwood_simple_cmd(rig, fctbuf); default: return kenwood_set_func(rig, vfo, func, status); } return RIG_OK; } /* * extends kenwood_get_func * Assumes rig!=NULL, val!=NULL */ int ts570_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { char fctbuf[50]; size_t fct_len; int retval; fct_len = 50; /* filter unimplemented RIG_FUNC_TUNER * and send all other requests to kenwood_get_func() */ switch (func) { case RIG_FUNC_NR: retval = kenwood_transaction (rig, "NR", 2, fctbuf, &fct_len); if (retval != RIG_OK) return retval; if (fct_len != 4) { rig_debug(RIG_DEBUG_ERR,"kenwood_get_func: " "wrong answer len=%d\n", fct_len); return -RIG_ERJCTED; } *status = atoi(&fctbuf[2]); break; case RIG_FUNC_TUNER: retval = kenwood_transaction (rig, "AC", 2, fctbuf, &fct_len); if (retval != RIG_OK) return retval; if (fct_len != 6) { rig_debug(RIG_DEBUG_ERR,"kenwood_get_func: " "wrong answer len=%d\n", fct_len); return -RIG_ERJCTED; } *status = fctbuf[3] == '0' ? 0 : 1; break; default: return kenwood_get_func(rig, vfo, func, status); } return RIG_OK; } /* * ts570_set_level * Assumes rig!=NULL * * set levels of most functions */ int ts570_set_level (RIG * rig, vfo_t vfo, setting_t level, value_t val) { char levelbuf[16]; int kenwood_val; int i; switch (level) { case RIG_LEVEL_PREAMP: kenwood_val = val.i; /* set the preamplifier if a correct value is entered */ if (kenwood_val == 0) sprintf(levelbuf, "PA0"); else for (i=0; istate.preamp[i]) { sprintf(levelbuf, "PA%01d", i+1); break; /* found - stop searching */ } else return -RIG_EINVAL; return kenwood_simple_cmd(rig, levelbuf); case RIG_LEVEL_RFPOWER: /* level for TS570D is from 0.. 100W in SSB and CW */ kenwood_val = val.f * 100; sprintf (levelbuf, "PC%03d", kenwood_val); return kenwood_simple_cmd(rig, levelbuf); case RIG_LEVEL_MICGAIN: /* level is from 0..100 */ kenwood_val = val.f * 100; sprintf (levelbuf, "MG%03d", kenwood_val); return kenwood_simple_cmd(rig, levelbuf); default: return kenwood_set_level (rig, vfo, level, val); } return RIG_OK; /* never reached */ } /* * ts570_get_level * Assumes rig!=NULL, val!=NULL */ int ts570_get_level (RIG * rig, vfo_t vfo, setting_t level, value_t * val) { char ackbuf[50]; size_t ack_len = 50; int levelint; int retval; int i; switch (level) { case RIG_LEVEL_RFPOWER: /* ts570d returns 5..100 measured in watt */ retval = kenwood_transaction (rig, "PC", 2, ackbuf, &ack_len); if (RIG_OK != retval) return retval; if (6 != ack_len) return -RIG_EPROTO; if (1 != sscanf (&ackbuf[2], "%d", &levelint)) return -RIG_EPROTO; val->f = (float) levelint / 100.; return RIG_OK; case RIG_LEVEL_MICGAIN: /* reads from 0..100 */ retval = kenwood_transaction (rig, "MG", 2, ackbuf, &ack_len); if (RIG_OK != retval) return retval; if (6 != ack_len) return -RIG_EPROTO; if (1 != sscanf (&ackbuf[2], "%d", &levelint)) return -RIG_EPROTO; val->f = (float) levelint / 100.; return RIG_OK; case RIG_LEVEL_PREAMP: retval = kenwood_transaction (rig, "PA", 2, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (4 != ack_len) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer len=%d\n", __func__, ack_len); return -RIG_ERJCTED; } sscanf(ackbuf+2, "%d", &levelint); if (levelint == 0) { val->i = 0; } else { for (i=0; istate.preamp[i] == 0) { rig_debug(RIG_DEBUG_ERR,"%s: " "unexpected att level %d\n", __func__, levelint); return -RIG_EPROTO; } if (i != levelint) return -RIG_EINTERNAL; val->i = rig->state.preamp[i-1]; } break; default: return kenwood_get_level (rig, vfo, level, val); } return RIG_OK; /* never reached */ } /* * ts570_get_split_vfo */ int ts570_get_split_vfo(RIG * rig, vfo_t vfo, split_t * split, vfo_t * tx_vfo) { char ack[10]; size_t acklen = 10; char ack2[10]; size_t ack2len = 10; int retval; retval = kenwood_transaction(rig, "FR", 2, ack, &acklen); if (retval != RIG_OK) return retval; retval = kenwood_transaction(rig, "FT", 2, ack2, &ack2len); if (retval != RIG_OK) return retval; if (ack[2] != ack2[2]) { *split = RIG_SPLIT_ON; switch (ack2[2]) { case '0': *tx_vfo = RIG_VFO_A; break; case '1': *tx_vfo = RIG_VFO_B; break; case '2': *tx_vfo = RIG_VFO_MEM; break; default: rig_debug(RIG_DEBUG_ERR, "ts570_get_split_vfo: unknown tx vfo: %d\n", ack2[2]); return -RIG_EINVAL; } } else { *split = RIG_SPLIT_OFF; *tx_vfo = RIG_VFO_CURR; } return RIG_OK; } #define cmd_trm(rig) ((struct kenwood_priv_caps *)(rig)->caps->priv)->cmdtrm /* * ts570_set_split_vfo */ int ts570_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo) { char cmdbuf[16], ackbuf[20]; int cmd_len, retval; size_t ack_len; unsigned char vfo_function; if(vfo !=RIG_VFO_CURR) { switch (vfo) { case RIG_VFO_VFO: case RIG_VFO_A: vfo_function = '0'; break; case RIG_VFO_B: vfo_function = '1'; break; case RIG_VFO_MEM: vfo_function = '2'; break; default: rig_debug(RIG_DEBUG_ERR,"ts570_set_split_vfo: unsupported VFO %d\n", vfo); return -RIG_EINVAL; } /* set RX VFO */ cmd_len = sprintf(cmdbuf, "FR%c%c", vfo_function, cmd_trm(rig)); if (cmd_len < 0) return -RIG_ETRUNC; retval = kenwood_simple_cmd(rig, cmdbuf); if (retval != RIG_OK) return retval; } if(split==RIG_SPLIT_ON) { switch (txvfo) { case RIG_VFO_VFO: case RIG_VFO_A: vfo_function = '0'; break; case RIG_VFO_B: vfo_function = '1'; break; case RIG_VFO_MEM: vfo_function = '2'; break; default: rig_debug(RIG_DEBUG_ERR,"ts570_set_split_vfo: unsupported VFO %d\n", txvfo); return -RIG_EINVAL; } /* set TX VFO */ cmd_len = sprintf(cmdbuf, "FT%c%c", vfo_function, cmd_trm(rig)); if (cmd_len < 0) return -RIG_ETRUNC; retval = kenwood_simple_cmd(rig, cmdbuf); if (retval != RIG_OK) return retval; } else /* RIG_SPLIT_OFF */ if(vfo==RIG_VFO_CURR) { /* switch to current RX VFO */ /* first ask for it */ ack_len = 10; retval = kenwood_transaction(rig, "FR", 2, ackbuf, &ack_len); if (retval != RIG_OK) return retval; /* and then set it to both vfo's */ vfo_function = ackbuf[2]; cmd_len = sprintf(cmdbuf, "FT%c%c", vfo_function, cmd_trm(rig)); if (cmd_len < 0) return -RIG_ETRUNC; retval = kenwood_simple_cmd(rig, cmdbuf); if (retval != RIG_OK) return retval; } return RIG_OK; } /* memory capabilities */ #define TS570_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .tx_freq=1, \ .tx_mode=1, \ .split=1, \ .ctcss_tone=1 \ } int ts570_set_channel (RIG * rig, const channel_t * chan) { char cmdbuf[30], membuf[30]; int retval, cmd_len; size_t mem_len; int num,freq,tx_freq,tone; char mode,tx_mode,tones; num=chan->channel_num; freq=(int)chan->freq; mode=mode_to_char(chan->mode); if(chan->split==RIG_SPLIT_ON) { tx_freq=(int)chan->tx_freq; tx_mode=mode_to_char(chan->tx_mode); } else { tx_freq=0; tx_mode='\0'; } for (tone = 1; rig->caps->ctcss_list[tone-1] != 0 && tone<39; tone++) { if (rig->caps->ctcss_list[tone-1] == chan->ctcss_tone) break; } if(chan->ctcss_tone!=0) { tones='1'; } else { tones='0'; tone=0; } cmd_len = sprintf(cmdbuf, "MW0 %02d%011d%c0%c%02d ", num,freq,mode,tones,tone); if (cmd_len < 0) return -RIG_ETRUNC; mem_len = 0; retval = kenwood_transaction (rig, cmdbuf, cmd_len, membuf, &mem_len); if (retval != RIG_OK) return retval; cmd_len = sprintf(cmdbuf, "MW1 %02d%011d%c0%c%02d ", num,tx_freq,tx_mode,tones,tone); if (cmd_len < 0) return -RIG_ETRUNC; mem_len = 0; retval = kenwood_transaction (rig, cmdbuf, cmd_len, membuf, &mem_len); if (retval != RIG_OK) return retval; return RIG_OK; } int ts570_get_xit(RIG *rig, vfo_t vfo, shortfreq_t * rit) { char infobuf[50]; int retval; size_t info_len; info_len = 50; retval = kenwood_transaction (rig, "IF", 2, infobuf, &info_len); if (retval != RIG_OK) return retval; if (info_len != 38 || infobuf[1] != 'F') { rig_debug(RIG_DEBUG_ERR,"kenwood_get_rit: wrong answer len=%d\n", info_len); return -RIG_ERJCTED; } if (infobuf[24] == '0') { /* RIT off? */ *rit = 0; } else { infobuf[23] = '\0'; *rit = atoi(&infobuf[18]); } return RIG_OK; } int ts570_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit) { char buf[50], infobuf[50]; unsigned char c; int retval, len, i; size_t info_len; info_len = 0; if (rit == 0) { retval = kenwood_transaction(rig, "RT0", 3, infobuf, &info_len); if (retval != RIG_OK) return retval; else return RIG_OK; } else { retval = kenwood_transaction(rig, "RT1", 3, infobuf, &info_len); if (retval != RIG_OK) return retval; } if (rit > 0) c = 'U'; else c = 'D'; len = sprintf(buf, "R%c", c); if (len < 0) return -RIG_ETRUNC; info_len = 0; retval = kenwood_transaction(rig, "RC", 2, infobuf, &info_len); if (retval != RIG_OK) return retval; for (i = 0; i < abs(rint(rit/10)); i++) { info_len = 0; retval = kenwood_transaction(rig, buf, len, infobuf, &info_len); if (retval != RIG_OK) return retval; } return RIG_OK; } int ts570_set_xit(RIG * rig, vfo_t vfo, shortfreq_t rit) { char buf[50], infobuf[50]; unsigned char c; int retval, len, i; size_t info_len; info_len = 0; if (rit == 0) { retval = kenwood_transaction(rig, "XT0", 3, infobuf, &info_len); if (retval != RIG_OK) return retval; else return RIG_OK; } else { retval = kenwood_transaction(rig, "XT1", 3, infobuf, &info_len); if (retval != RIG_OK) return retval; } if (rit > 0) c = 'U'; else c = 'D'; len = sprintf(buf, "R%c", c); if (len < 0) return -RIG_ETRUNC; info_len = 0; retval = kenwood_transaction(rig, "RC", 2, infobuf, &info_len); if (retval != RIG_OK) return retval; for (i = 0; i < abs(rint(rit/10)); i++) { info_len = 0; retval = kenwood_transaction(rig, buf, len, infobuf, &info_len); if (retval != RIG_OK) return retval; } return RIG_OK; } /* * ts570 rig capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! * RIT: Variable Range ±9.99 kHz * * part of infos comes from .http = //www.kenwood.net/ */ const struct rig_caps ts570s_caps = { .rig_model = RIG_MODEL_TS570S, .model_name = "TS-570S", .mfg_name = "Kenwood", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 57600, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 30, .timeout = 1000, .retry = 3, .has_get_func = TS570_FUNC_ALL, .has_set_func = TS570_FUNC_ALL, .has_get_level = TS570_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(TS570_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = kenwood38_ctcss_list, .dcs_list = NULL, .preamp = { 12, RIG_DBLST_END, }, .attenuator = { 18, RIG_DBLST_END, }, .max_rit = Hz(9990), .max_xit = Hz(9990), .max_ifshift = Hz(0), .vfo_ops = TS570_VFO_OP, .scan_ops = TS570_SCAN_OPS, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 89, RIG_MTYPE_MEM, TS570_MEM_CAP }, { 90, 99, RIG_MTYPE_EDGE, TS570_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(500),MHz(60),TS570_ALL_MODES,-1,-1,TS570_VFO,TS570_ANTS}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { {kHz(1810),kHz(1850)-1,TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, /* 100W class */ {kHz(1800),MHz(2)-1,TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, /* 25W class */ {kHz(3500),kHz(3800)-1,TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(3500),kHz(3800)-1,TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(7),kHz(7100),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(7),kHz(7100),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {kHz(10100),kHz(10150),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(10100),kHz(10150),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(14),kHz(14350),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(14),kHz(14350),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {kHz(18068),kHz(18168),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(18068),kHz(18168),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(21),kHz(21450),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(21),kHz(21450),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {kHz(24890),kHz(24990),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(24890),kHz(24990),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(28),kHz(29700),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(28),kHz(29700),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(50),MHz(54),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(50),MHz(54),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, RIG_FRNG_END, }, /* tx range */ .rx_range_list2 = { {kHz(500),MHz(60),TS570_ALL_MODES,-1,-1,TS570_VFO,TS570_ANTS}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {kHz(1800),MHz(2)-1,TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, /* 100W class */ {kHz(1800),MHz(2)-1,TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, /* 25W class */ {kHz(3500),MHz(4)-1,TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(3500),MHz(4)-1,TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(7),kHz(7300),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(7),kHz(7300),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {kHz(10100),kHz(10150),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(10100),kHz(10150),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(14),kHz(14350),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(14),kHz(14350),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {kHz(18068),kHz(18168),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(18068),kHz(18168),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(21),kHz(21450),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(21),kHz(21450),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {kHz(24890),kHz(24990),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(24890),kHz(24990),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(28),kHz(29700),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(28),kHz(29700),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(50),MHz(54),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(50),MHz(54),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {TS570_ALL_MODES,50}, {TS570_ALL_MODES,100}, {TS570_ALL_MODES,kHz(1)}, {TS570_ALL_MODES,kHz(5)}, {TS570_ALL_MODES,kHz(9)}, {TS570_ALL_MODES,kHz(10)}, {TS570_ALL_MODES,12500}, {TS570_ALL_MODES,kHz(20)}, {TS570_ALL_MODES,kHz(25)}, {TS570_ALL_MODES,kHz(100)}, {TS570_ALL_MODES,MHz(1)}, {TS570_ALL_MODES,0}, /* any tuning step */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB, kHz(2.4)}, {RIG_MODE_CW, Hz(200)}, {RIG_MODE_RTTY, Hz(500)}, {RIG_MODE_AM, kHz(9)}, {RIG_MODE_FM, kHz(14)}, RIG_FLT_END, }, .priv = (void *)&ts570_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = ic10_get_freq, .set_rit = ts570_set_rit, .get_rit = kenwood_get_rit, .set_xit = ts570_set_xit, .get_xit = ts570_get_xit, .set_mode = ts570_set_mode, .get_mode = ts570_get_mode, .set_vfo = kenwood_set_vfo, .get_vfo = kenwood_get_vfo_if, .set_split_vfo = ts570_set_split_vfo, .get_split_vfo = ts570_get_split_vfo, .set_ctcss_tone = kenwood_set_ctcss_tone, .get_ctcss_tone = kenwood_get_ctcss_tone, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt, .get_dcd = kenwood_get_dcd, .set_func = ts570_set_func, .get_func = ts570_get_func, .set_ant = kenwood_set_ant_no_ack, .get_ant = kenwood_get_ant, .set_level = ts570_set_level, .get_level = ts570_get_level, .send_morse = kenwood_send_morse, .vfo_op = kenwood_vfo_op, .set_mem = kenwood_set_mem, .get_mem = kenwood_get_mem, .get_channel = kenwood_get_channel, .set_channel = ts570_set_channel, .set_trn = kenwood_set_trn, .get_trn = kenwood_get_trn, .set_powerstat = kenwood_set_powerstat, .get_powerstat = kenwood_get_powerstat, .scan = kenwood_scan, .reset = kenwood_reset, }; /* * ts570d rig capabilities, which is basically the ts570s without 6m. * Notice that some rigs share the same functions. * Also this struct is READONLY! * RIT: Variable Range ±9.99 kHz * * part of infos comes from .http = //www.kenwood.net/ */ const struct rig_caps ts570d_caps = { .rig_model = RIG_MODEL_TS570D, .model_name = "TS-570D", .mfg_name = "Kenwood", .version = BACKEND_VER ".2", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 57600, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 30, .timeout = 1000, .retry = 3, .has_get_func = TS570_FUNC_ALL, .has_set_func = TS570_FUNC_ALL, .has_get_level = TS570_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(TS570_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = kenwood38_ctcss_list, .dcs_list = NULL, .preamp = { 12, RIG_DBLST_END, }, .attenuator = { 18, RIG_DBLST_END, }, .max_rit = Hz(9990), .max_xit = Hz(9990), .max_ifshift = Hz(0), .vfo_ops = TS570_VFO_OP, .scan_ops = TS570_SCAN_OPS, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 89, RIG_MTYPE_MEM, TS570_MEM_CAP }, { 90, 99, RIG_MTYPE_EDGE, TS570_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(500),MHz(30),TS570_ALL_MODES,-1,-1,TS570_VFO,TS570_ANTS}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { {kHz(1810),kHz(1850)-1,TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, /* 100W class */ {kHz(1800),MHz(2)-1,TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, /* 25W class */ {kHz(3500),kHz(3800)-1,TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(3500),kHz(3800)-1,TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(7),kHz(7100),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(7),kHz(7100),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {kHz(10100),kHz(10150),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(10100),kHz(10150),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(14),kHz(14350),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(14),kHz(14350),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {kHz(18068),kHz(18168),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(18068),kHz(18168),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(21),kHz(21450),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(21),kHz(21450),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {kHz(24890),kHz(24990),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(24890),kHz(24990),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(28),kHz(29700),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(28),kHz(29700),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, RIG_FRNG_END, }, /* tx range */ .rx_range_list2 = { {kHz(500),MHz(30),TS570_ALL_MODES,-1,-1,TS570_VFO,TS570_ANTS}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {kHz(1800),MHz(2)-1,TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, /* 100W class */ {kHz(1800),MHz(2)-1,TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, /* 25W class */ {kHz(3500),MHz(4)-1,TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(3500),MHz(4)-1,TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(7),kHz(7300),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(7),kHz(7300),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {kHz(10100),kHz(10150),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(10100),kHz(10150),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(14),kHz(14350),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(14),kHz(14350),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {kHz(18068),kHz(18168),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(18068),kHz(18168),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(21),kHz(21450),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(21),kHz(21450),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {kHz(24890),kHz(24990),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {kHz(24890),kHz(24990),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, {MHz(28),kHz(29700),TS570_OTHER_TX_MODES,5000,100000,TS570_VFO,TS570_ANTS}, {MHz(28),kHz(29700),TS570_AM_TX_MODES,5000,25000,TS570_VFO,TS570_ANTS}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {TS570_ALL_MODES,50}, {TS570_ALL_MODES,100}, {TS570_ALL_MODES,kHz(1)}, {TS570_ALL_MODES,kHz(5)}, {TS570_ALL_MODES,kHz(9)}, {TS570_ALL_MODES,kHz(10)}, {TS570_ALL_MODES,12500}, {TS570_ALL_MODES,kHz(20)}, {TS570_ALL_MODES,kHz(25)}, {TS570_ALL_MODES,kHz(100)}, {TS570_ALL_MODES,MHz(1)}, {TS570_ALL_MODES,0}, /* any tuning step */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB, Hz(500)}, {RIG_MODE_SSB, Hz(0)}, {RIG_MODE_SSB, kHz(1)}, {RIG_MODE_CW, Hz(400)}, {RIG_MODE_CW, Hz(100)}, {RIG_MODE_CW, Hz(1000)}, {RIG_MODE_RTTY, Hz(1000)}, {RIG_MODE_RTTY, Hz(500)}, {RIG_MODE_RTTY, Hz(1500)}, {RIG_MODE_AM, Hz(500)}, {RIG_MODE_AM, Hz(0)}, {RIG_MODE_AM, kHz(1)}, {RIG_MODE_FM, Hz(500)}, {RIG_MODE_FM, Hz(0)}, {RIG_MODE_FM, kHz(1)}, RIG_FLT_END, }, .priv = (void *)&ts570_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = ic10_get_freq, .set_rit = ts570_set_rit, .get_rit = kenwood_get_rit, .set_xit = ts570_set_xit, .get_xit = ts570_get_xit, .set_mode = ts570_set_mode, .get_mode = ts570_get_mode, .set_vfo = kenwood_set_vfo, .get_vfo = kenwood_get_vfo_if, .set_split_vfo = ts570_set_split_vfo, .get_split_vfo = ts570_get_split_vfo, .set_ctcss_tone = kenwood_set_ctcss_tone, .get_ctcss_tone = kenwood_get_ctcss_tone, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt, .get_dcd = kenwood_get_dcd, .set_func = ts570_set_func, .get_func = ts570_get_func, .set_ant = kenwood_set_ant_no_ack, .get_ant = kenwood_get_ant, .set_level = ts570_set_level, .get_level = ts570_get_level, .send_morse = kenwood_send_morse, .vfo_op = kenwood_vfo_op, .set_mem = kenwood_set_mem, .get_mem = kenwood_get_mem, .get_channel = kenwood_get_channel, .set_channel = ts570_set_channel, .set_trn = kenwood_set_trn, .get_trn = kenwood_get_trn, .set_powerstat = kenwood_set_powerstat, .get_powerstat = kenwood_get_powerstat, .scan = kenwood_scan, .reset = kenwood_reset, }; hamlib-1.2.15.3/kenwood/README.k30000644000175000017500000001262512044564477013003 00000000000000Elecraft K3 notes and Hamlib errata by Nate Bargmann, N0NB. While the K3 uses a large set of commands compatible with the standard Kenwood commands, a number are extended and others have side effects that are peculiar to the K3. As such, a separate set of elecraft.[c|h] files have been written to support the K2 and K3 in the best possible way using shared code when possible. K3 specific code can be found in k3.c As always, comments and bug reports should be submitted to hamlib-developer@lists.sourceforge.net elecraft_open() =============== The kenwood_open() function fails for the Elecraft radios as the function checks the backend to be certain the ID from the radio matches the backend that called the function. As the ID command of the Elecraft radios returns "017" which corresponds to the TS-570, the backend test fails. Rather than muck up a working function, I chose to implement an independent elecraft_open which not only checks for the existence of a connected radio that returns an ID of "017", it also checks for K2 or K3 extensions and sets a pair of private variables that may be used later for advanced functions. This way the backend should be able to reliably test for either a K2 or K3 (needs more testing with the K2). k3_set_vfo() ============ The K3's use of VFO A and VFO B differs from other rigs in that VFO A is *always* the main or upper display and VFO B is *always* the sub or lower display. The A/B panel button simply swaps the contents of the two displays. The K3 manual states that VFO A is always the receive frequency and VFO B is the transmit frequency in split mode. This is complicated somewhat when the second receiver is installed and VFO B serves as its display frequency *and* the transmit frequency in split mode. Got that? Good! As a result of the above, I found that using the kenwood_set_vfo function had the side effect of clearing the rig out of split mode when the VFO was set to RIG_VFO_B. The Kenwood command 'FT1;' is used to make VFO B the transmitting VFO while this command will cause the K3 to enter split mode. Likewise, the Kenwood command 'FR1;' is used to set VFO B as the receiving VFO while the K3 exits split mode when it receives *any* set value for 'FR'. My solution is to simply issue the 'SWT11;' command which emulates tapping the A/B button on the K3's front panel to swap the displays when the k3_set_vfo function is called with RIG_VFO_B. Any other vfo value leaves the display alone. Feedback on improving this function is welcome. k3_get_mode() k3_get_mode() =========================== As an extension to the common Kenwood mode definitions, the K3 implements the custom 'DT' command which can query and set its data sub-modes. These are as follows: DT0 DATA A DT1 AFSK A DT2 FSK D DT3 PSK D The main difference is that DT0 and DT1 are for soundcard audio modes from a computer such as PSK31, MFSK, Olivia, etc. with DT1 being "optimized for RTTY". Conversely, DT2 and DT3 utilize "direct FSK in" on the accessory jack as well as enable the K3's internal encoding/decoding of RTTY and PSK31 modes (outside the realm of Hamlib). As implemented the k3_get_mode function will query the data sub-mode when the kenwood_get_mode function returns RIG_MODE_RTTY or RIG_MODE_RTTYR. As of k3 backend version 20101027 the following will be returned: MD6 MD9 DT0 RIG_MODE_PKTUSB RIG_MODE_PKTLSB DT1 RIG_MODE_RTTY RIG_MODE_RTTYR DT2 N/A N/A DT3 N/A N/A Perhaps it would be preferable to return the RTTY modes when DT2 is detected. Feedback is requested. Mode setting is little different as the MD and DT values will be set as above for the Hamlib RIG_MODE values. Feedback is requested on whether RTTY/RTTYR should map to AFSK A (DT1) or FSK D (DT2). The K3 can set any bandwidth in any mode using its custom 'BW' command. Band- width values are sent to the K3 in 10 Hz increments and the K3 will round down to the nearest 100 Hz values from 10 to 40 Hz. It will round down to the nearest 50 Hz values from 50 to 90 Hz. As an example, sending 'BW0236' (2360 in rigctl) will set the bandwidth to 2350 Hz (rounded down by the K3). The k3_get_mode function will query and return the actual bandwidth in use in Hertz. k3_set_ext_level() ================== This function is used to set the K3 for some extra level functions (rigctl command examples shown). To clear the RIT and XIT offset, use the 'L' command with the token name 'ritclr' for 'Level' to set in rigctl[d]. The prompted value is not used and can be safely set to 0. Use this level to clear the RIT and XIT offsets when it is not desired to turn RIT|XIT off. k3_get_ext_level() ================== This function is used to query the K3 for some extra information (rigctl command examples shown). To query the IF center frequency, use the 'l' command with the token name 'ifctr' for 'Level' to read in rigctl[d]. Value returned is 8210000.0 + queried value from rig (see K3 Programmers Reference, FI command). Returned type is a floating point value. To query the TX status, use the 'l' command with the token name 'txst' for 'Level' to read in rigctl[d]. Value returned is 1 for K3 in transmit mode and 0 for receive mode. Returned type is an integer. kenwood_get/set_ext_parms() =========================== These functions are used to get and set RIT/XIT on and off. The special token names of 'rit' and 'xit' are used with the P/p commands of rigctl[d] for the 'parm'. Set/returned value is 0 or 1 for off or on. hamlib-1.2.15.3/kenwood/ts940.c0000644000175000017500000001151712044564477012635 00000000000000/* * Hamlib Kenwood backend - TS940 description * Copyright (c) 2000-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "bandplan.h" #include "kenwood.h" #include "ic10.h" #define TS940_ALL_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_CW|RIG_MODE_SSB) #define TS940_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define TS940_AM_TX_MODES RIG_MODE_AM #define TS940_FUNC_ALL RIG_FUNC_LOCK #define TS940_LEVEL_ALL RIG_LEVEL_NONE #define TS940_VFO (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define TS940_ANTS (0) #define TS940_VFO_OPS (RIG_OP_UP|RIG_OP_DOWN) #define TS940_SCAN_OPS (RIG_SCAN_VFO) static struct kenwood_priv_caps ts940_priv_caps = { .cmdtrm = EOM_KEN, .if_len = 29, }; /* * ts940 rig capabilities. * written from specs: * http://www.qsl.net/sm7vhs/radio/kenwood/ts940/specs.htm * * TODO: protocol to be check with manual! */ const struct rig_caps ts940_caps = { .rig_model = RIG_MODEL_TS940, .model_name = "TS-940S", .mfg_name = "Kenwood", .version = BACKEND_VER "." IC10_VER, .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 100, .post_write_delay = 150, .timeout = 200, .retry = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = TS940_FUNC_ALL, .has_get_level = TS940_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(TS940_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .preamp = { RIG_DBLST_END, }, /* FIXME: preamp list */ .attenuator = { RIG_DBLST_END, }, /* TBC */ .max_rit = kHz(9.99), .max_xit = kHz(9.99), .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_FREQ, .vfo_ops = TS940_VFO_OPS, .scan_ops = TS940_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 89, RIG_MTYPE_MEM, {IC10_CHANNEL_CAPS} }, /* TBC */ { 90, 99, RIG_MTYPE_EDGE, {IC10_CHANNEL_CAPS} }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(500),MHz(30),TS940_ALL_MODES,-1,-1,TS940_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { FRQ_RNG_HF(1,TS940_OTHER_TX_MODES, W(5),W(250),TS940_VFO,TS940_ANTS), FRQ_RNG_HF(1,TS940_AM_TX_MODES, W(4),W(140),TS940_VFO,TS940_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30),TS940_ALL_MODES,-1,-1,TS940_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { FRQ_RNG_HF(2,TS940_OTHER_TX_MODES, W(5),W(250),TS940_VFO,TS940_ANTS), FRQ_RNG_HF(2,TS940_AM_TX_MODES, W(4),W(140),TS940_VFO,TS940_ANTS), /* AM class */ RIG_FRNG_END, }, /* tx range */ .tuning_steps = { /* FIXME: TBC */ {TS940_ALL_MODES,10}, {TS940_ALL_MODES,kHz(100)}, {TS940_ALL_MODES,MHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_CW, Hz(500)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .priv = (void *)&ts940_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = ic10_get_freq, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_xit = kenwood_set_xit, .get_xit = kenwood_get_xit, .set_mode = kenwood_set_mode, .get_mode = ic10_get_mode, .set_vfo = ic10_set_vfo, .get_vfo = ic10_get_vfo, .set_split_vfo = ic10_set_split_vfo, .get_split_vfo = ic10_get_split_vfo, .set_ptt = kenwood_set_ptt, .get_ptt = ic10_get_ptt, .set_func = kenwood_set_func, .vfo_op = kenwood_vfo_op, .set_mem = kenwood_set_mem, .get_mem = ic10_get_mem, .set_trn = kenwood_set_trn, .scan = kenwood_scan, .set_channel = ic10_set_channel, .get_channel = ic10_get_channel, .decode_event = ic10_decode_event, }; /* * Function definitions below */ hamlib-1.2.15.3/kenwood/ts850.c0000644000175000017500000003252612044564477012640 00000000000000/* * Hamlib Kenwood backend - TS850 description * Copyright (c) 2000-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include "kenwood.h" #define TS850_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define TS850_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define TS850_AM_TX_MODES (RIG_MODE_AM) #define TS850_FUNC_ALL (RIG_FUNC_AIP|RIG_FUNC_LOCK) #define TS850_LEVEL_GET (RIG_LEVEL_SWR|RIG_LEVEL_COMP|RIG_LEVEL_ALC|RIG_LEVEL_CWPITCH|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH|RIG_LEVEL_SLOPE_LOW|RIG_LEVEL_SLOPE_HIGH) #define TS850_LEVEL_SET (RIG_LEVEL_CWPITCH|RIG_LEVEL_SLOPE_LOW|RIG_LEVEL_SLOPE_HIGH) #define TS850_VFO (RIG_VFO_A|RIG_VFO_B) #define TS850_VFO_OPS (RIG_OP_UP|RIG_OP_DOWN) #define TS850_CHANNEL_CAPS \ .freq=1,\ .mode=1,\ .tx_freq=1,\ .tx_mode=1,\ .split=1,\ .flags=RIG_CHFLAG_SKIP, \ .ctcss_tone=1 #define TS850_STR_CAL { 4, \ { \ { 0, -54 }, \ { 15, 0 }, \ { 22,30 }, \ { 30, 66}, \ } } static struct kenwood_priv_caps ts850_priv_caps = { .cmdtrm = EOM_KEN, }; /* forward definitions */ static int ts850_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit); static int ts850_set_xit(RIG * rig, vfo_t vfo, shortfreq_t rit); static int ts850_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int ts850_set_channel (RIG * rig, const channel_t * chan); static const struct confparams ts850_ext_parms[] = { { TOK_FINE, "fine", "Fine", "Fine step mode", NULL, RIG_CONF_CHECKBUTTON, { } }, { TOK_VOICE, "voice", "Voice", "Voice recall", NULL, RIG_CONF_BUTTON, { } }, { TOK_XIT, "xit", "XIT", "XIT", NULL, RIG_CONF_CHECKBUTTON, { } }, { TOK_RIT, "rit", "RIT", "RIT", NULL, RIG_CONF_CHECKBUTTON, { } }, { RIG_CONF_END, NULL, } }; /* * ts850 rig capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! */ const struct rig_caps ts850_caps = { .rig_model = RIG_MODEL_TS850, .model_name = "TS-850", .mfg_name = "Kenwood", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 100, .timeout = 480000, // When you tune a Kenwood, the reply is delayed until you stop. .retry = 0, .has_get_func = TS850_FUNC_ALL, .has_set_func = TS850_FUNC_ALL, .has_get_level = TS850_LEVEL_GET, .has_set_level = TS850_LEVEL_SET, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .parm_gran = {}, .extparms = ts850_ext_parms, .ctcss_list = kenwood38_ctcss_list, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = kHz(1.27), .max_xit = kHz(1.27), .max_ifshift = Hz(0), .vfo_ops=TS850_VFO_OPS, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 3, .chan_list = { { 0, 89, RIG_MTYPE_MEM ,{TS850_CHANNEL_CAPS}}, { 90, 99, RIG_MTYPE_EDGE ,{TS850_CHANNEL_CAPS}}, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100),MHz(30),TS850_ALL_MODES,-1,-1,TS850_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { {kHz(1810),kHz(1850),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, /* 100W class */ {kHz(1810),kHz(1850),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, /* 40W class */ {kHz(3500),kHz(3800),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {kHz(3500),kHz(3800),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, {MHz(7),kHz(7100),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {MHz(7),kHz(7100),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, {kHz(10100),kHz(10150),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {kHz(10100),kHz(10150),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, {MHz(14),kHz(14350),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {MHz(14),kHz(14350),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, {kHz(18068),kHz(18168),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {kHz(18068),kHz(18168),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, {MHz(21),kHz(21450),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {MHz(21),kHz(21450),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, {kHz(24890),kHz(24990),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {kHz(24890),kHz(24990),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, {MHz(28),kHz(29700),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {MHz(28),kHz(29700),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(30),TS850_ALL_MODES,-1,-1,TS850_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {kHz(1800),MHz(2)-1,TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, /* 100W class */ {kHz(1800),MHz(2)-1,TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, /* 40W class */ {kHz(3500),MHz(4)-1,TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {kHz(3500),MHz(4)-1,TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, {MHz(7),kHz(7300),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {MHz(7),kHz(7300),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, {kHz(10100),kHz(10150),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {kHz(10100),kHz(10150),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, {MHz(14),kHz(14350),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {MHz(14),kHz(14350),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, {kHz(18068),kHz(18168),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {kHz(18068),kHz(18168),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, {MHz(21),kHz(21450),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {MHz(21),kHz(21450),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, {kHz(24890),kHz(24990),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {kHz(24890),kHz(24990),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, {MHz(28),kHz(29700),TS850_OTHER_TX_MODES,W(5),W(100),TS850_VFO}, {MHz(28),kHz(29700),TS850_AM_TX_MODES,W(2),W(40),TS850_VFO}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {TS850_ALL_MODES,0}, /* any tuning step */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {TS850_ALL_MODES, kHz(12)}, {TS850_ALL_MODES, kHz(6)}, {TS850_ALL_MODES, kHz(2.7)}, {TS850_ALL_MODES, Hz(500)}, {TS850_ALL_MODES, Hz(250)}, RIG_FLT_END, }, .str_cal = TS850_STR_CAL, .priv = (void *)&ts850_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_rit = ts850_set_rit, .get_rit = kenwood_get_rit, .set_xit = ts850_set_xit, .get_xit = kenwood_get_xit, .set_mode = kenwood_set_mode, .get_mode = kenwood_get_mode_if, .set_vfo = kenwood_set_vfo, .get_vfo = kenwood_get_vfo_if, .set_split_vfo = kenwood_set_split_vfo, .set_ctcss_tone = kenwood_set_ctcss_tone_tn, .get_ctcss_tone = kenwood_get_ctcss_tone, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt_safe, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .set_level = kenwood_set_level, .get_level = ts850_get_level, .vfo_op = kenwood_vfo_op, .set_mem = kenwood_set_mem, .get_mem = kenwood_get_mem_if, .get_channel = kenwood_get_channel, .set_channel = ts850_set_channel, .set_trn = kenwood_set_trn }; /* * Function definitions below */ int ts850_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit) { char buf[50], infobuf[50]; unsigned char c; int retval, len, i; size_t info_len; info_len = 0; if (rit == 0) { retval = kenwood_transaction(rig, "RT0", 3, infobuf, &info_len); if (retval != RIG_OK) return retval; } else { retval = kenwood_transaction(rig, "RT1", 3, infobuf, &info_len); if (retval != RIG_OK) return retval; } if (rit > 0) c = 'U'; else c = 'D'; len = sprintf(buf, "R%c", c); info_len = 0; retval = kenwood_transaction(rig, "RC", 2, infobuf, &info_len); if (retval != RIG_OK) return retval; for (i = 0; i < abs(rint(rit/20)); i++) { info_len = 0; retval = kenwood_transaction(rig, buf, len, infobuf, &info_len); if (retval != RIG_OK) return retval; } return RIG_OK; } int ts850_set_xit(RIG * rig, vfo_t vfo, shortfreq_t xit) { char buf[50], infobuf[50]; unsigned char c; int retval, len, i; size_t info_len; info_len = 0; if (xit == 0) { retval = kenwood_transaction(rig, "XT0", 3, infobuf, &info_len); if (retval != RIG_OK) return retval; } else { retval = kenwood_transaction(rig, "XT1", 3, infobuf, &info_len); if (retval != RIG_OK) return retval; } info_len = 0; retval = kenwood_transaction(rig, "RC", 2, infobuf, &info_len); if (retval != RIG_OK) return retval; if (xit > 0) c = 'U'; else c = 'D'; len = sprintf(buf, "R%c", c); for (i = 0; i < abs(rint(xit/20)); i++) { info_len = 0; retval = kenwood_transaction(rig, buf, len, infobuf, &info_len); if (retval != RIG_OK) return retval; } return RIG_OK; } static char mode_to_char(rmode_t mode) { switch (mode) { case RIG_MODE_CW: return(MD_CW); case RIG_MODE_CWR: return(MD_CWR); case RIG_MODE_USB: return(MD_USB); case RIG_MODE_LSB: return(MD_LSB); case RIG_MODE_FM: return(MD_FM); case RIG_MODE_AM: return(MD_AM); case RIG_MODE_RTTY: return(MD_FSK); case RIG_MODE_RTTYR: return(MD_FSKR); default: rig_debug(RIG_DEBUG_WARN,"%s: unsupported mode %d\n", __func__,mode); } return(RIG_MODE_NONE); } int ts850_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { char lvlbuf[50]; int i, retval; size_t lvl_len; if(vfo!=RIG_VFO_CURR) return -RIG_EINVAL; switch (level) { case RIG_LEVEL_RAWSTR: lvl_len = 50; retval = kenwood_transaction (rig, "SM", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; lvlbuf[6]='\0'; val->i=atoi(&lvlbuf[2]); break; case RIG_LEVEL_STRENGTH: lvl_len = 50; retval = kenwood_transaction (rig, "SM", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; lvlbuf[6]='\0'; val->i=atoi(&lvlbuf[2]); //val->i = (val->i * 4) - 54; Old approximate way of doing it. val->i = (int)rig_raw2val(val->i,&rig->caps->str_cal); break; case RIG_LEVEL_SWR: lvl_len = 0; retval = kenwood_transaction (rig, "RM1", 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; lvl_len = 50; retval = kenwood_transaction (rig, "RM", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; lvlbuf[7]='\0'; i=atoi(&lvlbuf[3]); if(i == 30) val->f = 150.0; /* infinity :-) */ else val->f = 60.0/(30.0-(float)i)-1.0; break; case RIG_LEVEL_COMP: lvl_len = 0; retval = kenwood_transaction (rig, "RM2", 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; lvl_len = 50; retval = kenwood_transaction (rig, "RM", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; lvlbuf[7]='\0'; val->f=(float)atoi(&lvlbuf[3])/30.0; break; case RIG_LEVEL_ALC: lvl_len = 0; retval = kenwood_transaction (rig, "RM3", 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; lvl_len = 50; retval = kenwood_transaction (rig, "RM", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; lvlbuf[7]='\0'; val->f=(float)atoi(&lvlbuf[3])/30.0; break; case RIG_LEVEL_CWPITCH: lvl_len = 25; retval = kenwood_transaction (rig, "PT", 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; lvlbuf[4]='\0'; val->i=atoi(&lvlbuf[2]); val->i=(val->i-8)*50+800; break; default: return kenwood_get_level (rig, vfo, level, val); } return retval; // Never gets here. } int ts850_set_channel (RIG * rig, const channel_t * chan) { char cmdbuf[30], membuf[30]; int retval, cmd_len; size_t mem_len; int num,freq,tx_freq,tone; char mode,tx_mode,tones; num=chan->channel_num; freq=(int)chan->freq; mode=mode_to_char(chan->mode); if(chan->split==RIG_SPLIT_ON) { tx_freq=(int)chan->tx_freq; tx_mode=mode_to_char(chan->tx_mode); } else { tx_freq=0; tx_mode='\0'; } for (tone = 1; rig->caps->ctcss_list[tone-1] != 0 && tone<39; tone++) { if (rig->caps->ctcss_list[tone-1] == chan->ctcss_tone) break; } if(chan->ctcss_tone!=0) { tones='1'; } else { tones='0'; tone=0; } cmd_len = sprintf(cmdbuf, "MW0 %02d%011d%c0%c%02d ", num,freq,mode,tones,tone); mem_len = 0; retval = kenwood_transaction (rig, cmdbuf, cmd_len, membuf, &mem_len); if (retval != RIG_OK) return retval; cmd_len = sprintf(cmdbuf, "MW1 %02d%011d%c0%c%02d ", num,tx_freq,tx_mode,tones,tone); mem_len = 0; retval = kenwood_transaction (rig, cmdbuf, cmd_len, membuf, &mem_len); if (retval != RIG_OK) return retval; return RIG_OK; } hamlib-1.2.15.3/kenwood/trc80.c0000644000175000017500000001157312044564477012714 00000000000000/* * Hamlib Kenwood backend - TRC-80 description * Copyright (c) 2000-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "bandplan.h" #include "kenwood.h" #define TRC80_ALL_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM|RIG_MODE_RTTY) #define TRC80_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY) #define TRC80_AM_TX_MODES RIG_MODE_AM /* TODO: make sure they are implemented by kenwood generic backend, and compatible */ #define TRC80_FUNC_ALL (RIG_FUNC_TUNER|RIG_FUNC_AIP|\ RIG_FUNC_TONE|RIG_FUNC_AIP|RIG_FUNC_NB|RIG_FUNC_VOX) #define TRC80_LEVEL_ALL (RIG_LEVEL_STRENGTH|RIG_LEVEL_AF|RIG_LEVEL_MICGAIN|\ RIG_LEVEL_RFPOWER|RIG_LEVEL_CWPITCH|RIG_LEVEL_BKIN_DLYMS|\ RIG_LEVEL_SQL|RIG_LEVEL_VOX) #define TRC80_PARMS (RIG_PARM_NONE) #define TRC80_VFO_OPS (RIG_OP_NONE) #define TRC80_SCAN_OPS (RIG_SCAN_VFO) #define TRC80_VFO (RIG_VFO_MEM) #define TRC80_ANTS (0) #define TRC80_CHANNEL_CAPS { \ .freq=1,\ .mode=1,\ .tx_freq=1,\ .tx_mode=1,\ .split=1,\ .flags=RIG_CHFLAG_SKIP \ } static struct kenwood_priv_caps trc80_priv_caps = { .cmdtrm = EOM_KEN, }; /* * TRC-80/TK-80 rig capabilities. */ const struct rig_caps trc80_caps = { .rig_model = RIG_MODEL_TRC80, .model_name = "TRC-80", .mfg_name = "Kenwood", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .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_HARDWARE, .write_delay = 0, .post_write_delay = 100, .timeout = 1000, .retry = 3, .has_get_func = TRC80_FUNC_ALL, .has_set_func = TRC80_FUNC_ALL, .has_get_level = TRC80_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(TRC80_LEVEL_ALL), .has_get_parm = TRC80_PARMS, .has_set_parm = RIG_LEVEL_SET(TRC80_PARMS), /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = kHz(1.1), .max_xit = 0, .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .vfo_ops = TRC80_VFO_OPS, .scan_ops = TRC80_SCAN_OPS, .chan_list = { { 1, 80, RIG_MTYPE_MEM, TRC80_CHANNEL_CAPS }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(500),MHz(30),TRC80_ALL_MODES,-1,-1,TRC80_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { {MHz(1.8),MHz(30),TRC80_OTHER_TX_MODES,W(15),W(100),TRC80_VFO,TRC80_ANTS}, {MHz(1.8),MHz(30),TRC80_AM_TX_MODES,W(5),W(25),TRC80_VFO,TRC80_ANTS}, /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30),TRC80_ALL_MODES,-1,-1,TRC80_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {MHz(1.8),MHz(30),TRC80_OTHER_TX_MODES,W(15),W(100),TRC80_VFO,TRC80_ANTS}, {MHz(1.8),MHz(30),TRC80_AM_TX_MODES,W(5),W(25),TRC80_VFO,TRC80_ANTS}, /* AM class */ RIG_FRNG_END, }, /* tx range */ .tuning_steps = { /* FIXME: TBC */ {TRC80_ALL_MODES,1}, {TRC80_ALL_MODES,10}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.2)}, {RIG_MODE_AM, kHz(5)}, RIG_FLT_END, }, .priv = (void *)&trc80_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, #if 0 .set_freq = kenwood_set_freq, #endif .get_freq = kenwood_get_freq_if, .get_split_vfo = kenwood_get_split_vfo_if, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_mode = kenwood_set_mode, .get_mode = kenwood_get_mode, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt, .get_dcd = kenwood_get_dcd, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .set_level = kenwood_set_level, .get_level = kenwood_get_level, .set_mem = kenwood_set_mem, .get_mem = kenwood_get_mem, .get_channel = kenwood_get_channel, .scan = kenwood_scan, .set_powerstat = kenwood_set_powerstat, .get_powerstat = kenwood_get_powerstat, .get_info = kenwood_get_info, }; /* * Function definitions below */ hamlib-1.2.15.3/kenwood/r5000.c0000644000175000017500000001036012044564477012513 00000000000000/* * Hamlib Kenwood backend - R5000 description * Copyright (c) 2000-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "kenwood.h" #include "ic10.h" #define R5000_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define R5000_FUNC_ALL (RIG_FUNC_LOCK) #define R5000_LEVEL_ALL RIG_LEVEL_NONE #define R5000_PARM_ALL (RIG_PARM_TIME) #define R5000_VFO (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define R5000_VFO_OPS (RIG_OP_UP|RIG_OP_DOWN) #define R5000_SCAN_OPS (RIG_SCAN_VFO) #define R5000_ANTS (RIG_ANT_1|RIG_ANT_2) static struct kenwood_priv_caps r5000_priv_caps = { .cmdtrm = EOM_KEN, .if_len = 33, }; /* * R5000 rig capabilities, with IF-10 interface (like TS440). * * TODO: scan, get/set_channel, RIT */ const struct rig_caps r5000_caps = { .rig_model = RIG_MODEL_R5000, .model_name = "R-5000", .mfg_name = "Kenwood", .version = IC10_VER, .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 2, .timeout = 400, .retry = 3, .has_get_func = R5000_FUNC_ALL, .has_set_func = R5000_FUNC_ALL, .has_get_level = R5000_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(R5000_LEVEL_ALL), .has_get_parm = R5000_PARM_ALL, .has_set_parm = RIG_PARM_SET(R5000_PARM_ALL), .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 = RIG_TARGETABLE_FREQ, .vfo_ops = R5000_VFO_OPS, .scan_ops = R5000_SCAN_OPS, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 99, RIG_MTYPE_MEM, {IC10_CHANNEL_CAPS} }, /* TBC */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100),MHz(30),R5000_ALL_MODES,-1,-1,R5000_VFO}, {MHz(108),MHz(174),R5000_ALL_MODES,-1,-1,R5000_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(30),R5000_ALL_MODES,-1,-1,R5000_VFO}, {MHz(108),MHz(174),R5000_ALL_MODES,-1,-1,R5000_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {R5000_ALL_MODES,10}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.4)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .priv = (void *)&r5000_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = ic10_set_freq, .get_freq = ic10_get_freq, .set_mode = ic10_set_mode, .get_mode = ic10_get_mode, .set_vfo = ic10_set_vfo, .get_vfo = ic10_get_vfo, .set_func = ic10_set_func, .get_func = ic10_get_func, .set_parm = ic10_set_parm, .get_parm = ic10_get_parm, .set_ant = ic10_set_ant, .get_ant = ic10_get_ant, .set_mem = ic10_set_mem, .get_mem = ic10_get_mem, .vfo_op = ic10_vfo_op, .set_trn = ic10_set_trn, .get_trn = ic10_get_trn, .scan = ic10_scan, .set_channel = ic10_set_channel, .get_channel = ic10_get_channel, .set_powerstat = ic10_set_powerstat, .get_powerstat = ic10_get_powerstat, .get_info = ic10_get_info, .decode_event = ic10_decode_event, }; /* * Function definitions below */ hamlib-1.2.15.3/kenwood/ts711.c0000644000175000017500000001150512044564477012626 00000000000000/* * Hamlib Kenwood backend - TS-711 description * Copyright (c) 2000-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "kenwood.h" #include "ic10.h" #define TS711_ALL_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) /* func and levels to be checked */ #define TS711_FUNC_ALL (RIG_FUNC_TSQL|RIG_FUNC_LOCK|RIG_FUNC_MUTE) #define TS711_LEVEL_ALL (RIG_LEVEL_STRENGTH) #define TS711_VFO (RIG_VFO_A|RIG_VFO_B) #define TS711_VFO_OP (RIG_OP_UP|RIG_OP_DOWN) #define TS711_SCAN_OP (RIG_SCAN_VFO) static struct kenwood_priv_caps ts711_priv_caps = { .cmdtrm = EOM_KEN, .if_len = 29, }; /* * ts711 rig capabilities. * * specs: http://www.qsl.net/sm7vhs/radio/kenwood/ts711/specs.htm * * TODO: protocol to be check with manual! */ const struct rig_caps ts711_caps = { .rig_model = RIG_MODEL_TS711, .model_name = "TS-711", .mfg_name = "Kenwood", .version = BACKEND_VER "." IC10_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 0, .timeout = 1000, .retry = 3, .has_get_func = TS711_FUNC_ALL, .has_set_func = TS711_FUNC_ALL, .has_get_level = TS711_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(TS711_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .vfo_ops = TS711_VFO_OP, .scan_ops = TS711_SCAN_OP, .ctcss_list = kenwood38_ctcss_list, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = kHz(9.9), .max_xit = 0, .max_ifshift = 0, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, /* FIXME: split memories, call channel, etc. */ .chan_list = { { 1, 59, RIG_MTYPE_MEM, {IC10_CHANNEL_CAPS} }, RIG_CHAN_END, }, .rx_range_list1 = { {MHz(144),MHz(146),TS711_ALL_MODES,-1,-1,TS711_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { {MHz(144),MHz(146),TS711_ALL_MODES,W(5),W(25),TS711_VFO}, RIG_FRNG_END, }, /* tx range */ .rx_range_list2 = { {MHz(144),MHz(148),TS711_ALL_MODES,-1,-1,TS711_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {MHz(144),MHz(148),TS711_ALL_MODES,W(5),W(25),TS711_VFO}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {TS711_ALL_MODES,50}, {TS711_ALL_MODES,100}, {TS711_ALL_MODES,kHz(1)}, {TS711_ALL_MODES,kHz(5)}, {TS711_ALL_MODES,kHz(9)}, {TS711_ALL_MODES,kHz(10)}, {TS711_ALL_MODES,12500}, {TS711_ALL_MODES,kHz(20)}, {TS711_ALL_MODES,kHz(25)}, {TS711_ALL_MODES,kHz(100)}, {TS711_ALL_MODES,MHz(1)}, {TS711_ALL_MODES,0}, /* any tuning step */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.2)}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .priv = (void *)&ts711_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = ic10_get_freq, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_xit = kenwood_set_xit, .get_xit = kenwood_get_xit, .set_mode = kenwood_set_mode, .get_mode = ic10_get_mode, .set_vfo = ic10_set_vfo, .get_vfo = ic10_get_vfo, .set_split_vfo = ic10_set_split_vfo, .get_split_vfo = ic10_get_split_vfo, .set_ptt = kenwood_set_ptt, .get_ptt = ic10_get_ptt, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .vfo_op = kenwood_vfo_op, .set_mem = kenwood_set_mem, .get_mem = ic10_get_mem, .set_trn = kenwood_set_trn, .scan = kenwood_scan, .set_ctcss_tone = kenwood_set_ctcss_tone, .get_ctcss_tone = kenwood_get_ctcss_tone, .set_level = kenwood_set_level, .get_level = kenwood_get_level, .set_channel = ic10_set_channel, .get_channel = ic10_get_channel, .decode_event = ic10_decode_event, }; /* * Function definitions below */ hamlib-1.2.15.3/kenwood/Makefile.am0000644000175000017500000000125612044564477013641 00000000000000 TSSRCLIST = ts850.c ts870s.c ts570.c ts450s.c ts950.c ts50s.c \ ts790.c ts2000.c k2.c k3.c ts930.c \ ts680.c ts690.c ts140.c ts480.c trc80.c ts590.c IC10SRCLIST = ts440.c ts940.c ts711.c ts811.c r5000.c THSRCLIST = thd7.c thf7.c thg71.c tmd700.c tmv7.c thf6a.c thd72.c tmd710.c pkglib_LTLIBRARIES = hamlib-kenwood.la hamlib_kenwood_la_SOURCES = $(TSSRCLIST) $(THSRCLIST) $(IC10SRCLIST) \ kenwood.c th.c ic10.c elecraft.c transfox.c hamlib_kenwood_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_kenwood_la_LIBADD = $(top_builddir)/src/libhamlib.la @MATH_LIBS@ EXTRA_DIST = README.kenwood README.k2 README.k3 noinst_HEADERS = kenwood.h th.h ic10.h elecraft.h hamlib-1.2.15.3/kenwood/ts930.c0000644000175000017500000001202412044564477012626 00000000000000/* * Hamlib Kenwood backend - TS930 description * Copyright (c) 2000-2003 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "kenwood.h" #define TS930_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY) #define TS930_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY) #define TS930_AM_TX_MODES RIG_MODE_AM /* FIXME: TBC */ #define TS930_FUNC_ALL (RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_NR|RIG_FUNC_ANF|RIG_FUNC_LOCK) #define TS930_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_SQL|RIG_LEVEL_STRENGTH|RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_AGC) #define TS930_VFO (RIG_VFO_A|RIG_VFO_B) #define TS930_ANTS (0) static struct kenwood_priv_caps ts930_priv_caps = { .cmdtrm = EOM_KEN, }; /* * ts930 rig capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! * * part of infos comes from .http = //www.kenwood.net/ */ const struct rig_caps ts930_caps = { .rig_model = RIG_MODEL_TS930, .model_name = "TS-930", .mfg_name = "Kenwood", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 57600, .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 = TS930_FUNC_ALL, .has_set_func = TS930_FUNC_ALL, .has_get_level = TS930_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(TS930_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .preamp = { RIG_DBLST_END, }, /* FIXME: preamp list */ .attenuator = { 6, 12, 18, RIG_DBLST_END, }, /* TBC */ .max_rit = kHz(9.99), .max_xit = kHz(9.99), .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 89, RIG_MTYPE_MEM }, /* TBC */ { 90, 99, RIG_MTYPE_EDGE }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(150),MHz(30),TS930_ALL_MODES,-1,-1,TS930_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { FRQ_RNG_HF(1,TS930_OTHER_TX_MODES, W(5),W(250),TS930_VFO,TS930_ANTS), FRQ_RNG_HF(1,TS930_AM_TX_MODES, W(4),W(80),TS930_VFO,TS930_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(150),MHz(30),TS930_ALL_MODES,-1,-1,TS930_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { FRQ_RNG_HF(1,TS930_OTHER_TX_MODES, W(5),W(250),TS930_VFO,TS930_ANTS), FRQ_RNG_HF(1,TS930_AM_TX_MODES, W(4),W(80),TS930_VFO,TS930_ANTS), /* AM class */ RIG_FRNG_END, }, /* tx range */ .tuning_steps = { /* FIXME: TBC */ {TS930_ALL_MODES,50}, {TS930_ALL_MODES,100}, {TS930_ALL_MODES,kHz(1)}, {TS930_ALL_MODES,kHz(5)}, {TS930_ALL_MODES,kHz(9)}, {TS930_ALL_MODES,kHz(10)}, {TS930_ALL_MODES,12500}, {TS930_ALL_MODES,kHz(20)}, {TS930_ALL_MODES,kHz(25)}, {TS930_ALL_MODES,kHz(100)}, {TS930_ALL_MODES,MHz(1)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_AM, kHz(6)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_AM, kHz(2.7)}, RIG_FLT_END, }, .priv = (void *)&ts930_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_rit = kenwood_set_rit, .get_rit = kenwood_get_rit, .set_xit = kenwood_set_xit, .get_xit = kenwood_get_xit, .set_mode = kenwood_set_mode, .get_mode = kenwood_get_mode, .set_vfo = kenwood_set_vfo, .get_vfo = kenwood_get_vfo_if, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt, .get_dcd = kenwood_get_dcd, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .set_level = kenwood_set_level, .get_level = kenwood_get_level, .vfo_op = kenwood_vfo_op, .set_mem = kenwood_set_mem, .get_mem = kenwood_get_mem, .set_trn = kenwood_set_trn, .get_trn = kenwood_get_trn, .set_powerstat = kenwood_set_powerstat, .get_powerstat = kenwood_get_powerstat, .reset = kenwood_reset, }; /* * Function definitions below */ hamlib-1.2.15.3/kenwood/thd72.c0000644000175000017500000002066212044564477012703 00000000000000/* * Hamlib Kenwood backend - TH-D72 description * cloned after TH-D7 * Copyright (c) 2000-2011 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "hamlib/rig.h" #include "kenwood.h" #include "th.h" #include "num_stdio.h" #include "iofunc.h" #include "serial.h" #define THD72_MODES (RIG_MODE_FM|RIG_MODE_AM) #define THD72_MODES_TX (RIG_MODE_FM) #define THD72_FUNC_ALL (RIG_FUNC_TSQL| \ RIG_FUNC_AIP| \ RIG_FUNC_MON| \ RIG_FUNC_SQL| \ RIG_FUNC_TONE| \ RIG_FUNC_REV| \ RIG_FUNC_LOCK| \ RIG_FUNC_ARO) #define THD72_LEVEL_ALL (RIG_LEVEL_STRENGTH| \ RIG_LEVEL_SQL| \ RIG_LEVEL_AF| \ RIG_LEVEL_RF|\ RIG_LEVEL_MICGAIN) #define THD72_PARMS (RIG_PARM_BACKLIGHT) #define THD72_VFO_OP (RIG_OP_NONE) /* * TODO: Band A & B */ #define THD72_VFO (RIG_VFO_A|RIG_VFO_B) static rmode_t td72_mode_table[KENWOOD_MODE_TABLE_MAX] = { [0] = RIG_MODE_FM, [1] = RIG_MODE_AM, }; static struct kenwood_priv_caps thd72_priv_caps = { .cmdtrm = EOM_TH, /* Command termination character */ .mode_table = td72_mode_table, }; static int thd72_open(RIG *rig); static int thd72_get_chan_all_cb (RIG * rig, chan_cb_t chan_cb, rig_ptr_t arg); /* * th-d72a rig capabilities. */ const struct rig_caps thd72a_caps = { .rig_model = RIG_MODEL_THD72A, .model_name = "TH-D72A", .mfg_name = "Kenwood", .version = TH_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_HANDHELD|RIG_FLAG_APRS|RIG_FLAG_TNC|RIG_FLAG_DXCLUSTER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .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_XONXOFF, .write_delay = 0, .post_write_delay = 0, .timeout = 250, .retry = 3, .has_get_func = THD72_FUNC_ALL, .has_set_func = THD72_FUNC_ALL, .has_get_level = THD72_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(THD72_LEVEL_ALL), .has_get_parm = THD72_PARMS, .has_set_parm = THD72_PARMS, /* FIXME: parms */ .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 5 } }, [LVL_SQL] = { .min = { .i = 0 }, .max = { .i = 5 } }, [LVL_RFPOWER] = { .min = { .i = 3 }, .max = { .i = 0 } }, }, .parm_gran = {}, .ctcss_list = kenwood38_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), .vfo_ops = THD72_VFO_OP, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 6, /* TBC */ .chan_list = { { 0, 999, RIG_MTYPE_MEM , {TH_CHANNEL_CAPS}}, /* TBC MEM */ RIG_CHAN_END, }, .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {MHz(118),MHz(174),THD72_MODES,-1,-1,THD72_VFO}, {MHz(320),MHz(524),THD72_MODES,-1,-1,THD72_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {MHz(144),MHz(148),THD72_MODES_TX,W(0.05),W(5),THD72_VFO}, {MHz(430),MHz(440),THD72_MODES_TX,W(0.05),W(5),THD72_VFO}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {THD72_MODES,kHz(5)}, {THD72_MODES,kHz(6.25)}, /* kHz(8.33) ?? */ {THD72_MODES,kHz(10)}, {THD72_MODES,kHz(12.5)}, {THD72_MODES,kHz(15)}, {THD72_MODES,kHz(20)}, {THD72_MODES,kHz(25)}, {THD72_MODES,kHz(30)}, {THD72_MODES,kHz(50)}, {THD72_MODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_FM, kHz(14)}, {RIG_MODE_AM, kHz(9)}, RIG_FLT_END, }, .priv = (void *)&thd72_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .rig_open = thd72_open, .set_vfo = th_set_vfo, .get_vfo = th_get_vfo, .get_chan_all_cb = thd72_get_chan_all_cb, .get_info = th_get_info, }; int thd72_open(RIG *rig) { int ret; kenwood_simple_cmd(rig, ""); ret = kenwood_simple_cmd(rig, "TC1"); if (ret != RIG_OK) return ret; return RIG_OK; } #define CMD_SZ 5 #define BLOCK_SZ 256 #define BLOCK_COUNT 256 static int thd72_get_block (RIG *rig, int block_num, char *block) { hamlib_port_t *rp = &rig->state.rigport; char cmd[CMD_SZ] = "R\0\0\0\0"; char resp[CMD_SZ]; int ret; /* fetching block i */ cmd[2] = block_num & 0xff; ret = write_block(rp, cmd, CMD_SZ); if (ret != RIG_OK) return ret; /* read response first */ ret = read_block(rp, resp, CMD_SZ); if (ret != RIG_OK) return ret; if (resp[0] != 'W' || memcmp(cmd+1, resp+1, CMD_SZ-1)) return -RIG_EPROTO; /* read block */ ret = read_block(rp, block, BLOCK_SZ); if (ret != BLOCK_SZ) return ret; ret = write_block(rp, "\006", 1); if (ret != RIG_OK) return ret; ret = read_block(rp, resp, 1); if (ret != 1) return ret; if (resp[0] != 0x06) return -RIG_EPROTO; return RIG_OK; } int thd72_get_chan_all_cb (RIG * rig, chan_cb_t chan_cb, rig_ptr_t arg) { int i, j, ret; hamlib_port_t *rp = &rig->state.rigport; channel_t *chan; chan_t *chan_list = rig->state.chan_list; int chan_next = chan_list[0].start; char block[BLOCK_SZ]; char resp[CMD_SZ]; ret = kenwood_simple_cmd(rig, "0M PROGRAM"); if (ret != RIG_OK) return ret; rp->parm.serial.rate = 57600; serial_setup(rp); /* let the pcr settle and flush any remaining data*/ usleep(100*1000); serial_flush(rp); /* setRTS or Hardware flow control? */ ret = ser_set_rts(rp, 1); if (ret != RIG_OK) return ret; /* * setting chan to NULL means the application * has to provide a struct where to store data * future data for channel channel_num */ chan = NULL; ret = chan_cb(rig, &chan, chan_next, chan_list, arg); if (ret != RIG_OK) return ret; if (chan == NULL) return -RIG_ENOMEM; for (i=0; ivfo = RIG_VFO_MEM; chan->channel_num = i*CHAN_PER_BLOCK + j; /* What are the extra 64 channels ? */ if (chan->channel_num >= 1000) break; /* non-empty channel ? */ if (block_chan[0] != 0xff) { memcpy(chan->channel_desc, block_chan, 8); /* TODO: chop off trailing chars */ chan->channel_desc[8] = '\0'; /* TODO: parse block and fill in chan */ } /* notify the end? */ chan_next = chan_next < chan_list[i].end ? chan_next+1 : chan_next; /* * provide application with channel data, * and ask for a new channel structure */ chan_cb(rig, &chan, chan_next, chan_list, arg); } } ret = write_block(rp, "E", 1); if (ret != RIG_OK) return ret; ret = read_block(rp, resp, 1); if (ret != 1) return ret; if (resp[0] != 0x06) { return -RIG_EPROTO; } /* setRTS?? getCTS needed? */ ret = ser_set_rts(rp, 1); if (ret != RIG_OK) return ret; return RIG_OK; } hamlib-1.2.15.3/kenwood/thf6a.c0000644000175000017500000002236612044564477012766 00000000000000/* * Hamlib Kenwood backend - TH-F6A Cloned from TH-F7E description * Copyright (c) 2001-2009 by Stephane Fillod * Copyright (c) 2010 by Scott Martin * * 10-03-2010 * Ported from Stephane Fillod's thf7.c * Changed TH-F7E perameters to reflect TH-F6A * Changed RIG_ITU_REGION from 1 to 2 * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "tones.h" #include "kenwood.h" #include "th.h" #define THF6_MODES_TX (RIG_MODE_FM) #define THF6_HIGH_MODES (RIG_MODE_FM|RIG_MODE_AM|RIG_MODE_WFM) #define THF6_ALL_MODES (THF6_HIGH_MODES|RIG_MODE_SSB|RIG_MODE_CW) #define THF6_FUNC_ALL (RIG_FUNC_ARO|RIG_FUNC_LOCK|RIG_FUNC_BC) /* * How incredible, there's no RIG_LEVEL_STRENGTH! */ #define THF6_LEVEL_ALL (RIG_LEVEL_SQL|RIG_LEVEL_RFPOWER|RIG_LEVEL_ATT|\ RIG_LEVEL_BALANCE|RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY) #define THF6_PARMS (RIG_PARM_APO|RIG_PARM_BEEP|RIG_PARM_BACKLIGHT) #define THF6_VFO_OP (RIG_OP_UP|RIG_OP_DOWN) #define THF6_ANTS (RIG_ANT_1|RIG_ANT_2) /* * TODO: * scan_group can only be get. scan_group=channel_num%50; */ #define THF6_CHANNEL_CAPS \ TH_CHANNEL_CAPS,\ .flags=1, \ .dcs_code=1, \ .dcs_sql=1, #define THF6_CHANNEL_CAPS_WO_LO \ TH_CHANNEL_CAPS,\ .dcs_code=1, \ .dcs_sql=1, /* CTCSS 01..42 */ static const tone_t thf6_ctcss_list[] = { 670, 693, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, 1365, 1413, 1462, 1514, 1567, 1622, 1679, 1738, 1799, 1862, 1928, 2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541, 0 }; static rmode_t thf6_mode_table[KENWOOD_MODE_TABLE_MAX] = { [0] = RIG_MODE_FM, [1] = RIG_MODE_WFM, [2] = RIG_MODE_AM, [3] = RIG_MODE_LSB, [4] = RIG_MODE_USB, [5] = RIG_MODE_CW }; /* * Band A & B */ #define THF6_VFO (RIG_VFO_A|RIG_VFO_B) static struct kenwood_priv_caps thf6_priv_caps = { .cmdtrm = EOM_TH, /* Command termination character */ .mode_table = thf6_mode_table, }; static int thf6a_init(RIG *rig); static int thf6a_open(RIG *rig); static int thf6a_get_vfo (RIG *rig, vfo_t *vfo); static int thf6a_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); /* * TH-F6A rig capabilities. * * Manual, thanks to K6MAY: http://www.k6may.com/KenwoodTHF6Tip1.shtml * * TODO: * - set/get_ctcss_tone/sql through set/get_channel() and VR/VW * - emulate RIG_FUNC_TONE|RIG_FUNC_TSQL by setting ctcss_tone/sql to 0/non zero? */ const struct rig_caps thf6a_caps = { .rig_model = RIG_MODEL_THF6A, .model_name = "TH-F6A", .mfg_name = "Kenwood", .version = TH_VER, .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_HANDHELD, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .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 = 500, .retry = 3, .has_get_func = THF6_FUNC_ALL, .has_set_func = THF6_FUNC_ALL|RIG_FUNC_TBURST, .has_get_level = THF6_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(THF6_LEVEL_ALL), .has_get_parm = THF6_PARMS, .has_set_parm = THF6_PARMS, .level_gran = { [LVL_SQL] = { .min = { .i = 0 }, .max = { .i = 5 } }, [LVL_RFPOWER] = { .min = { .i = 2 }, .max = { .i = 0 } }, }, .parm_gran = {}, .ctcss_list = thf6_ctcss_list, .dcs_list = common_dcs_list, .preamp = { RIG_DBLST_END, }, .attenuator = { 20, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .vfo_ops = THF6_VFO_OP, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, /* TBC */ .bank_qty = 0, .chan_desc_sz = 8, .chan_list = { { 0, 399, RIG_MTYPE_MEM , {THF6_CHANNEL_CAPS}}, /* normal MEM */ { 400,409, RIG_MTYPE_EDGE, {THF6_CHANNEL_CAPS}}, /* L0-L9 lower scan limit */ { 410,419, RIG_MTYPE_EDGE, {THF6_CHANNEL_CAPS}}, /* U0-U9 upper scan limit */ { 420,429, RIG_MTYPE_MEM, {THF6_CHANNEL_CAPS}}, /* I0-I9 info */ { 430,431, RIG_MTYPE_PRIO, {THF6_CHANNEL_CAPS}}, /* PR0,PR1 priority */ { 432,434, RIG_MTYPE_CALL, {THF6_CHANNEL_CAPS_WO_LO}}, /* Call (for each ham band) */ { 435,449, RIG_MTYPE_BAND, {THF6_CHANNEL_CAPS_WO_LO}}, /* VFO */ /* 3 A-band VFO */ /* 11 B-band VFO */ /* TODO: 10 DTMF */ RIG_CHAN_END, }, .rx_range_list1 = { /* RIG_ANT_2 is internal bar antenna */ {MHz(144),MHz(146),THF6_MODES_TX,-1,-1,RIG_VFO_A,RIG_ANT_1}, {MHz(430),MHz(440),THF6_MODES_TX,-1,-1,RIG_VFO_A,RIG_ANT_1}, {kHz(100),MHz(470),THF6_ALL_MODES,-1,-1,RIG_VFO_B, RIG_ANT_1|RIG_ANT_2}, {MHz(470),GHz(1.3),THF6_HIGH_MODES,-1,-1,RIG_VFO_B,RIG_ANT_1}, RIG_FRNG_END }, .tx_range_list1 = { /* power actually depends on DC power supply */ {MHz(144),MHz(146),THF6_MODES_TX,W(0.05),W(5),RIG_VFO_A,RIG_ANT_1}, {MHz(430),MHz(440),THF6_MODES_TX,W(0.05),W(5),RIG_VFO_A,RIG_ANT_1}, RIG_FRNG_END }, /* region 2 is model TH-F6A in fact */ .rx_range_list2 = { /* RIG_ANT_2 is internal bar antenna */ {MHz(144),MHz(148),THF6_MODES_TX,-1,-1,RIG_VFO_A,RIG_ANT_1}, {MHz(222),MHz(225),THF6_MODES_TX,-1,-1,RIG_VFO_A,RIG_ANT_1}, {MHz(430),MHz(450),THF6_MODES_TX,-1,-1,RIG_VFO_A,RIG_ANT_1}, {kHz(100),MHz(470),THF6_ALL_MODES,-1,-1,RIG_VFO_B, RIG_ANT_1|RIG_ANT_2}, {MHz(470),GHz(1.3),THF6_HIGH_MODES,-1,-1,RIG_VFO_B,RIG_ANT_1}, RIG_FRNG_END }, .tx_range_list2 = { /* power actually depends on DC power supply */ {MHz(144),MHz(148),THF6_MODES_TX,W(0.05),W(5),RIG_VFO_A,RIG_ANT_1}, {MHz(222),MHz(225),THF6_MODES_TX,W(0.05),W(5),RIG_VFO_A,RIG_ANT_1}, {MHz(430),MHz(450),THF6_MODES_TX,W(0.05),W(5),RIG_VFO_A,RIG_ANT_1}, RIG_FRNG_END }, .tuning_steps = { /* This table is ordered according to protocol, from '0' to 'b' */ /* The steps are not available on every band/frequency limit 470MHz */ {THF6_ALL_MODES,kHz(5)}, {THF6_ALL_MODES,kHz(6.25)}, {THF6_ALL_MODES,kHz(8.33)}, {THF6_ALL_MODES,kHz(9)}, {THF6_ALL_MODES,kHz(10)}, {THF6_ALL_MODES,kHz(12.5)}, {THF6_ALL_MODES,kHz(15)}, {THF6_ALL_MODES,kHz(20)}, {THF6_ALL_MODES,kHz(25)}, {THF6_ALL_MODES,kHz(30)}, {THF6_ALL_MODES,kHz(50)}, {THF6_ALL_MODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { /* real width to be checked (missing specs) */ {RIG_MODE_FM, kHz(12)}, {RIG_MODE_FM, kHz(6)}, /* narrow FM */ {RIG_MODE_AM, kHz(9)}, {RIG_MODE_WFM, kHz(150)}, /* or 230? */ {RIG_MODE_SSB|RIG_MODE_CW, kHz(3)}, RIG_FLT_END, }, .priv = (void *)&thf6_priv_caps, .rig_init = thf6a_init, .rig_cleanup = kenwood_cleanup, .rig_open = thf6a_open, .set_freq = th_set_freq, .get_freq = th_get_freq, .set_mode = th_set_mode, .get_mode = th_get_mode, .set_vfo = th_set_vfo, .get_vfo = thf6a_get_vfo, .set_ptt = th_set_ptt, .get_dcd = th_get_dcd, .vfo_op = thf6a_vfo_op, .set_mem = th_set_mem, .get_mem = th_get_mem, .set_func = th_set_func, .get_func = th_get_func, .set_level = th_set_level, .get_level = th_get_level, .get_parm = th_get_parm, .set_parm = th_set_parm, .get_info = th_get_info, .set_channel = th_set_channel, .get_channel = th_get_channel, .set_ant = th_set_ant, .get_ant = th_get_ant, .reset = th_reset, }; int thf6a_init(RIG *rig) { rig->state.itu_region = RIG_ITU_REGION2; return kenwood_init(rig); } int thf6a_open(RIG *rig) { /* TH-F7E is Region 1 only. * Region 2 is supported by TH-F6A */ if (rig->state.itu_region != RIG_ITU_REGION2) return -RIG_ECONF; return kenwood_open(rig); } /* * th_get_vfo * Assumes rig!=NULL */ int thf6a_get_vfo(RIG *rig, vfo_t *vfo) { char vfoch; int retval; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); retval = th_get_vfo_char(rig, vfo, &vfoch); if (retval != RIG_OK) return retval; switch (vfoch) { case '0' : case '3' : /* Fine Step Enable */ break; case '1' : /* MR */ case '2' : /* CALL */ case '4' : /* INFO */ *vfo = RIG_VFO_MEM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unexpected VFO value '%c'\n", __func__, vfoch); return -RIG_EVFO; } return RIG_OK; } /* * thf6a_vfo_op */ int thf6a_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; switch(op) { case RIG_OP_UP: return kenwood_simple_cmd(rig, "UP"); case RIG_OP_DOWN: return kenwood_simple_cmd(rig, "DW"); /* Not implemented! case RIG_OP_BAND_UP: return kenwood_simple_cmd(rig, "BU"); case RIG_OP_BAND_DOWN: return kenwood_simple_cmd(rig, "BD"); */ default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported op %#x\n", __func__, op); return -RIG_EINVAL; } } hamlib-1.2.15.3/kenwood/tmv7.c0000644000175000017500000004561712044564477012657 00000000000000/* * Hamlib Kenwood backend - TM-V7 description * Copyright (c) 2004-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "kenwood.h" #include "th.h" #include "misc.h" #include "num_stdio.h" #if 1 #define RIG_ASSERT(x) if (!(x)) { rig_debug(RIG_DEBUG_ERR, "Assertion failed on line %i\n",__LINE__); abort(); } #else #define RIG_ASSERT(x) #endif #define TMV7_FUNC_ALL (\ RIG_FUNC_TBURST \ ) #define TMV7_LEVEL_ALL (\ RIG_LEVEL_RAWSTR| \ RIG_LEVEL_SQL| \ RIG_LEVEL_AF| \ RIG_LEVEL_RFPOWER\ ) #define TMV7_CHANNEL_CAPS \ .freq=1,\ .tx_freq=1,\ .mode=1,\ .tuning_step=1,\ .rptr_shift=1,\ .ctcss_tone=1,\ .ctcss_sql=1,\ .channel_desc=1 #ifndef RIG_TONEMAX #define RIG_TONEMAX 38 #endif #define RIG_VFO_A_OP (RIG_OP_UP|RIG_OP_DOWN|RIG_OP_TO_VFO) #define ACKBUF_LEN 128 static rmode_t tmv7_mode_table[KENWOOD_MODE_TABLE_MAX] = { [0] = RIG_MODE_FM, [1] = RIG_MODE_AM, }; static struct kenwood_priv_caps tmv7_priv_caps = { .cmdtrm = EOM_TH, /* Command termination character */ .mode_table = tmv7_mode_table, }; /* tmv7 procs */ static int tmv7_decode_event (RIG *rig); static int tmv7_set_vfo (RIG *rig, vfo_t vfo); static int tmv7_get_mode (RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int tmv7_get_powerstat (RIG *rig, powerstat_t *status); static int tmv7_get_channel(RIG *rig, channel_t *chan); static int tmv7_set_channel(RIG *rig, const channel_t *chan); /* * tm-v7 rig capabilities. */ const struct rig_caps tmv7_caps = { .rig_model = RIG_MODEL_TMV7, .model_name = "TM-V7", .mfg_name = "Kenwood", .version = TH_VER, .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_MOBILE, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .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 = 1, .post_write_delay = 0, .timeout = 500, .retry = 3, .has_set_func = TMV7_FUNC_ALL, .has_get_level = TMV7_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(TMV7_LEVEL_ALL), .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 7 } }, [LVL_SQL] = { .min = { .i = 0 }, .max = { .i = 32 } }, [LVL_AF] = { .min = { .i = 0 }, .max = { .i = 32 } }, [LVL_RFPOWER] = { .min = { .i = 0 }, .max = { .i = 2 } }, }, .parm_gran = {}, .ctcss_list = kenwood38_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), .vfo_ops = RIG_VFO_A_OP, .targetable_vfo = RIG_TARGETABLE_NONE, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 6, .chan_list = { { 1, 90 , RIG_MTYPE_MEM , {TMV7_CHANNEL_CAPS}}, /* normal MEM VHF */ { 101, 190, RIG_MTYPE_MEM , {TMV7_CHANNEL_CAPS}}, /* normal MEM UHF */ { 201,206, RIG_MTYPE_EDGE , {TMV7_CHANNEL_CAPS}}, /* L MEM */ { 211,216, RIG_MTYPE_EDGE , {TMV7_CHANNEL_CAPS}}, /* U MEM */ { 221,222, RIG_MTYPE_CALL , {TMV7_CHANNEL_CAPS}}, /* Call V/U */ RIG_CHAN_END, }, .rx_range_list1 = { {MHz(118),MHz(174),RIG_MODE_AM | RIG_MODE_FM,-1,-1,RIG_VFO_A}, {MHz(300),MHz(470),RIG_MODE_FM,-1,-1,RIG_VFO_B}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { {MHz(118),MHz(174), RIG_MODE_FM,W(5),W(50),RIG_VFO_A}, {MHz(300),MHz(470),RIG_MODE_FM,W(5),W(35),RIG_VFO_B}, RIG_FRNG_END, }, /* tx range */ .rx_range_list2 = { {MHz(118),MHz(174),RIG_MODE_AM | RIG_MODE_FM,-1,-1,RIG_VFO_A}, {MHz(300),MHz(470),RIG_MODE_FM,-1,-1,RIG_VFO_B}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {MHz(118),MHz(174), RIG_MODE_FM,W(5),W(50),RIG_VFO_A}, {MHz(300),MHz(470),RIG_MODE_FM,W(5),W(35),RIG_VFO_B}, RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {RIG_MODE_FM,kHz(5)}, {RIG_MODE_FM,kHz(6.25)}, {RIG_MODE_FM,kHz(10)}, {RIG_MODE_FM,kHz(12.5)}, {RIG_MODE_FM,kHz(15)}, {RIG_MODE_FM,kHz(25)}, {RIG_MODE_FM,kHz(50)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { RIG_FLT_END, }, .str_cal ={ 4, { {0, -60 }, {1, -30,}, {5,0}, {7,20}}}, /* rought guess */ .priv = (void *)&tmv7_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .rig_open = kenwood_open, .rig_close = NULL, .set_freq = th_set_freq, .get_freq = th_get_freq, .get_mode = tmv7_get_mode, .set_vfo = tmv7_set_vfo, .get_vfo = th_get_vfo, .set_mem = th_set_mem, .get_mem = th_get_mem, .set_channel = tmv7_set_channel, .get_channel = tmv7_get_channel, .set_trn = th_set_trn, .get_trn = th_get_trn, .set_func = th_set_func, .get_func = th_get_func, .get_level = th_get_level, .set_level = th_set_level, .get_info = th_get_info, .get_powerstat = tmv7_get_powerstat, .vfo_op = th_vfo_op, .set_ptt = th_set_ptt, .get_dcd=th_get_dcd, .decode_event = tmv7_decode_event, }; /* --------------------------------------------------------------------- */ int tmv7_decode_event (RIG *rig) { char asyncbuf[ACKBUF_LEN]; int retval; size_t asyncbuf_len = ACKBUF_LEN; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); retval = kenwood_transaction(rig, NULL, 0, asyncbuf, &asyncbuf_len); if (retval != RIG_OK) return retval; rig_debug(RIG_DEBUG_TRACE, "%s: Decoding message\n", __func__); if (asyncbuf[0] == 'B' && asyncbuf[1] == 'U' && asyncbuf[2] == 'F') { freq_t freq, offset; int step, shift, rev, tone, ctcss, tonefq, ctcssfq; retval = num_sscanf(asyncbuf, "BUF 0,%"SCNfreq",%d,%d,%d,%d,%d,,%d,,%d,%"SCNfreq, &freq, &step, &shift, &rev, &tone, &ctcss, &tonefq, &ctcssfq, &offset); if (retval != 11) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected BUF message '%s'\n", __func__, asyncbuf); return -RIG_ERJCTED; } rig_debug(RIG_DEBUG_TRACE, "%s: Buffer (freq %"PRIfreq" Hz, mode %d)\n", __func__, freq); /* Callback execution */ if (rig->callbacks.vfo_event) { rig->callbacks.vfo_event(rig, RIG_VFO_A, rig->callbacks.vfo_arg); } if (rig->callbacks.freq_event) { rig->callbacks.freq_event(rig, RIG_VFO_A, freq, rig->callbacks.freq_arg); } /* if (rig->callbacks.mode_event) { rig->callbacks.mode_event(rig, RIG_VFO_A, mode, RIG_PASSBAND_NORMAL, rig->callbacks.mode_arg); } */ /* --------------------------------------------------------------------- */ } else if (asyncbuf[0] == 'S' && asyncbuf[1] == 'M') { int lev; retval = sscanf(asyncbuf, "SM 0,%d", &lev); if (retval != 2) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected SM message '%s'\n", __func__, asyncbuf); return -RIG_ERJCTED; } rig_debug(RIG_DEBUG_TRACE, "%s: Signal strength event - signal = %.3f\n", __func__, (float)(lev / 5.0)); /* Callback execution */ #if STILLHAVETOADDCALLBACK if (rig->callbacks.strength_event) rig->callbacks.strength_event(rig, RIG_VFO_0,(float)(lev / 5.0), rig->callbacks.strength_arg); #endif /* --------------------------------------------------------------------- */ } else if (asyncbuf[0] == 'B' && asyncbuf[1] == 'Y') { int busy; retval = sscanf(asyncbuf, "BY 0,%d", &busy); if (retval != 2) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected BY message '%s'\n", __func__, asyncbuf); return -RIG_ERJCTED; } rig_debug(RIG_DEBUG_TRACE, "%s: Busy event - status = '%s'\n", __func__, (busy == 0) ? "OFF" : "ON" ); return -RIG_ENIMPL; /* This event does not have a callback. */ /* --------------------------------------------------------------------- */ } else if (asyncbuf[0] == 'V' && asyncbuf[1] == 'M' && asyncbuf[2] == 'C') { vfo_t bandmode; retval = sscanf(asyncbuf, "VMC 0,%d", &bandmode); if (retval != 1) { rig_debug(RIG_DEBUG_ERR, "%s: Unexpected VMC message '%s'\n", __func__, asyncbuf); return -RIG_ERJCTED; } switch (bandmode) { case 0: bandmode = RIG_VFO_VFO; break; case 2: bandmode = RIG_VFO_MEM; break; /* case 3: bandmode = RIG_VFO_CALL; break; */ default: bandmode = RIG_VFO_CURR; break; } rig_debug(RIG_DEBUG_TRACE, "%s: Mode of Band event - %d\n", __func__, bandmode); /* TODO: This event does not have a callback! */ return -RIG_ENIMPL; /* --------------------------------------------------------------------- */ } else { rig_debug(RIG_DEBUG_ERR, "%s: Unsupported transceive cmd '%s'\n", __func__, asyncbuf); return -RIG_ENIMPL; } return RIG_OK; } /* --------------------------------------------------------------------- */ int tmv7_set_vfo (RIG *rig, vfo_t vfo) { char vfobuf[16], ackbuf[ACKBUF_LEN]; int retval; size_t ack_len; rig_debug(RIG_DEBUG_TRACE, "%s: called %d\n", __func__,vfo); switch (vfo) { case RIG_VFO_A: case RIG_VFO_VFO: sprintf(vfobuf, "VMC 0,0"); break; case RIG_VFO_B: sprintf(vfobuf, "VMC 1,0"); break; case RIG_VFO_MEM: sprintf(vfobuf, "BC"); ack_len=ACKBUF_LEN; retval = kenwood_transaction(rig, vfobuf, strlen(vfobuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; sprintf(vfobuf, "VMC %c,2",ackbuf[3]); break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported VFO %d\n", __func__, vfo); return -RIG_EVFO; } ack_len=0; retval = kenwood_transaction(rig, vfobuf, strlen(vfobuf), ackbuf, &ack_len); if (retval != RIG_OK) { rig_debug(RIG_DEBUG_ERR, "%s: bad return \n", __func__); return retval; } rig_debug(RIG_DEBUG_TRACE, "%s: next %d\n", __func__,vfo); switch (vfo) { case RIG_VFO_A: case RIG_VFO_VFO: sprintf(vfobuf, "BC 0,0"); break; case RIG_VFO_B: sprintf(vfobuf, "BC 1,1"); break; case RIG_VFO_MEM: return RIG_OK; default: return RIG_OK; } rig_debug(RIG_DEBUG_TRACE, "%s: next2\n", __func__); ack_len=0; retval = kenwood_transaction(rig, vfobuf, strlen(vfobuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; return RIG_OK; } /* --------------------------------------------------------------------- */ int tmv7_get_mode (RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char ackbuf[ACKBUF_LEN]; int retval; size_t ack_len=ACKBUF_LEN; int step; freq_t freq; rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); switch (vfo) { case RIG_VFO_CURR: break; case RIG_VFO_A: break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported VFO %d\n", __func__, vfo); return -RIG_EVFO; } /* try to guess from frequency */ retval = kenwood_transaction(rig, "FQ", 3, ackbuf, &ack_len); if (retval != RIG_OK) return retval; num_sscanf(ackbuf,"FQ %"SCNfreq",%d",&freq,&step); if(freq channel_num<100) sprintf(req,"MR 0,0,%03d",chan->channel_num); else if(chan->channel_num<200) sprintf(req,"MR 1,0,%03d",chan->channel_num-100); else if(chan->channel_num<204) { sprintf(req,"MR 0,0,L%01d",chan->channel_num-200); sprintf(chan->channel_desc,"L%01d/V",chan->channel_num-200); } else if(chan->channel_num<211) { sprintf(req,"MR 1,0,L%01d",chan->channel_num-203); sprintf(chan->channel_desc,"L%01d/U",chan->channel_num-203); } else if(chan->channel_num<214) { sprintf(req,"MR 0,0,U%01d",chan->channel_num-210); sprintf(chan->channel_desc,"U%01d/V",chan->channel_num-210); } else if(chan->channel_num<220) { sprintf(req,"MR 1,0,U%01d",chan->channel_num-213); sprintf(chan->channel_desc,"U%01d/U",chan->channel_num-213); } else if(chan->channel_num<223) { if(chan->channel_num==221) { sprintf(req,"CR 0,0"); sprintf(chan->channel_desc,"Call V"); } if(chan->channel_num==222) { sprintf(req,"CR 1,0"); sprintf(chan->channel_desc,"Call U"); } } else return -RIG_EINVAL; sprintf(membuf,"%s",req); ack_len=ACKBUF_LEN; retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; strcpy(scf,req); strcat(scf,",%"SCNfreq",%d,%d,%d,%d,0,%d,%d,000,%d,,0"); retval = num_sscanf(ackbuf, scf, &freq, &step, &shift, &rev, &tone, &ctcss, &tonefq, &ctcssfq); chan->freq=freq; chan->vfo=RIG_VFO_MEM; chan->tuning_step=rig->state.tuning_steps[step].ts; if(freq mode=RIG_MODE_AM; } else { chan->mode=RIG_MODE_FM; } switch(shift) { case 0 : chan->rptr_shift=RIG_RPT_SHIFT_NONE; break; case 1 : chan->rptr_shift=RIG_RPT_SHIFT_PLUS; break; case 2 : chan->rptr_shift=RIG_RPT_SHIFT_MINUS; break; } if(tone) chan->ctcss_tone=rig->caps->ctcss_list[tonefq==1?0:tonefq-2]; else chan->ctcss_tone=0; if(ctcss) chan->ctcss_sql=rig->caps->ctcss_list[ctcssfq==1?0:ctcssfq-2]; else chan->ctcss_sql=0; chan->tx_freq=RIG_FREQ_NONE; if(chan->channel_num<223 && shift==0) { req[5]='1'; sprintf(membuf,"%s",req); ack_len=ACKBUF_LEN; retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len); if (retval == RIG_OK) { strcpy(scf,req); strcat(scf,",%"SCNfreq",%d"); retval = num_sscanf(ackbuf, scf, &freq, &step); chan->tx_freq=freq; } } if(chan->channel_num<200) { if(chan->channel_num<100) sprintf(membuf,"MNA 0,%03d",chan->channel_num); else sprintf(membuf,"MNA 1,%03d",chan->channel_num-100); ack_len=ACKBUF_LEN; retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; memcpy(chan->channel_desc,&ackbuf[10],7); } return RIG_OK; } /* --------------------------------------------------------------------- */ int tmv7_set_channel(RIG *rig, const channel_t *chan) { char membuf[ACKBUF_LEN],ackbuf[ACKBUF_LEN]; int retval; size_t ack_len; char req[64]; long freq; int step, shift, tone, ctcss, tonefq, ctcssfq; freq=(long)chan->freq; for(step=0; rig->state.tuning_steps[step].ts!=0;step++) if(chan->tuning_step==rig->state.tuning_steps[step].ts) break; switch(chan->rptr_shift) { case RIG_RPT_SHIFT_NONE : shift=0; break; case RIG_RPT_SHIFT_PLUS: shift=1; break; case RIG_RPT_SHIFT_MINUS: shift=2; break; default: rig_debug(RIG_DEBUG_ERR, "%s: not supported shift\n", __func__); return -RIG_EINVAL; } if(chan->ctcss_tone==0) { tone=0;tonefq=9; } else { tone=1; for (tonefq = 0; rig->caps->ctcss_list[tonefq] != 0 && tonefq < RIG_TONEMAX; tonefq++) { if (rig->caps->ctcss_list[tonefq] == chan->ctcss_tone) break; } tonefq=tonefq==0?1:tonefq+2; } if(chan->ctcss_sql==0) { ctcss=0;ctcssfq=9; } else { ctcss=1; for (ctcssfq = 0; rig->caps->ctcss_list[ctcssfq] != 0 && ctcssfq < RIG_TONEMAX; ctcssfq++) { if (rig->caps->ctcss_list[ctcssfq] == chan->ctcss_sql) break; } ctcssfq=ctcssfq==0?1:ctcssfq+2; } if(chan->channel_num<100) sprintf(req,"MW 0,0,%03d",chan->channel_num); else if(chan->channel_num<200) sprintf(req,"MW 1,0,%03d",chan->channel_num-100); else if(chan->channel_num<204) { sprintf(req,"MW 0,0,L%01d",chan->channel_num-200); } else if(chan->channel_num<211) { sprintf(req,"MW 1,0,L%01d",chan->channel_num-203); } else if(chan->channel_num<214) { sprintf(req,"MW 0,0,U%01d",chan->channel_num-210); } else if(chan->channel_num<220) { sprintf(req,"MW 1,0,U%01d",chan->channel_num-213); } else if(chan->channel_num<223) { if(chan->channel_num==221) { sprintf(req,"CW 0,0"); } if(chan->channel_num==222) { sprintf(req,"CW 1,0"); } } else return -RIG_EINVAL; if(chan->channel_num<221) sprintf(membuf, "%s,%011ld,%01d,%01d,0,%01d,%01d,0,%02d,000,%02d,0,0", req,(long)freq, step, shift, tone, ctcss, tonefq, ctcssfq); else sprintf(membuf, "%s,%011ld,%01d,%01d,0,%01d,%01d,0,%02d,000,%02d,", req, (long)freq, step, shift, tone, ctcss, tonefq, ctcssfq); ack_len=0; retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; if(chan->tx_freq!=RIG_FREQ_NONE) { req[5]='1'; sprintf(membuf, "%s,%011"PRIll",%01d", req, (int64_t)chan->tx_freq, step); ack_len=0; retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; } if(chan->channel_num<200) { if(chan->channel_num<100) sprintf(membuf,"MNA 0,%03d,%s",chan->channel_num,chan->channel_desc); else sprintf(membuf,"MNA 1,%03d,%s",chan->channel_num-100,chan->channel_desc); ack_len=0; retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len); if (retval != RIG_OK) return retval; } return RIG_OK; } hamlib-1.2.15.3/kenwood/README.kenwood0000644000175000017500000000146712044564477014136 00000000000000hamlib - Copyright (C) 2000 Frank Singleton libkenwood.so - Copyright (C) 2000 Stephane Fillod This shared library provides an API for communicating via serial interface to a Kenwood rig. Reference Documentation ----------------------- Kenwood CAT protocol (manual). Status ------ All primitives are written from spec. Some testing has been done with a TS-870S. At least reading and setting of frequency, mode, VFO, audio- and RF level should work. Patches and contributions are welcome! I'm also looking for a real maintainer :) --SF This lib should/will support other Kenwood models as well. Warnings -------- 1. This library should be tested with more kenwood rigs. 2. Error codes returned by the rig are not yet handled. Contributors ------------ Joop Stakenborg, PA4TU for TS-870S. hamlib-1.2.15.3/kenwood/k3.c0000644000175000017500000004506412044564477012273 00000000000000/* * Hamlib Kenwood backend - Elecraft K3 description * Copyright (c) 2002-2009 by Stephane Fillod * Copyright (C) 2010,2011 by Nate Bargmann, n0nb@arrl.net * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * See the file 'COPYING.LIB' in the main Hamlib distribution directory for * the complete text of the GNU Lesser Public License version 2.1. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "kenwood.h" #include "bandplan.h" #include "elecraft.h" #include "token.h" #include "cal.h" #define K3_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|\ RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM|RIG_MODE_AM|RIG_MODE_PKTUSB|\ RIG_MODE_PKTLSB) #define K3_FUNC_ALL (RIG_FUNC_NB|RIG_FUNC_LOCK) #define K3_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_PREAMP|RIG_LEVEL_AGC|RIG_LEVEL_SQL|\ RIG_LEVEL_STRENGTH|RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD|\ RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_MICGAIN|RIG_LEVEL_RAWSTR) #define K3_VFO (RIG_VFO_A|RIG_VFO_B) #define K3_VFO_OP (RIG_OP_UP|RIG_OP_DOWN) #define K3_ANTS (RIG_ANT_1|RIG_ANT_2) /* kenwood_transaction() will add this to command strings * sent to the rig and remove it from strings returned from * the rig, so no need to append ';' manually to command strings. */ static struct kenwood_priv_caps k3_priv_caps = { .cmdtrm = EOM_KEN, }; /* K3 specific function declarations */ int k3_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int k3_set_vfo(RIG *rig, vfo_t vfo); int k3_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val); int k3_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val); int k3_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit); int k3_set_xit(RIG * rig, vfo_t vfo, shortfreq_t rit); int k3_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width); int k3_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width); int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); /* Private helper functions */ int set_rit_xit(RIG * rig, char *func, shortfreq_t rit); /* * K3 rig capabilities. * This kit can recognize a large subset of TS-570/K2 commands and has many * extensions of its own. Extension backend functions to standard Kenwood * command are defined in elecraft.c (shared with K2) and in this file. * * Part of info comes from http://www.elecraft.com/K2_Manual_Download_Page.htm#K3 * look for K3 Programmer's Reference PDF * * Wayne Burdick, N6KR, advises that the forthcoming KX3 (prototype shown at * Dayton Hamvention 2011) will have an identical command set to the K3. */ const struct rig_caps k3_caps = { .rig_model = RIG_MODEL_K3, .model_name = "K3/KX3", .mfg_name = "Elecraft", .version = "20120615", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 38400, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, /* Timing between bytes */ .post_write_delay = 100, /* Timing between command strings */ .timeout = 600, /* FA and FB make take up to 500 ms on band change */ .retry = 3, .has_get_func = K3_FUNC_ALL, .has_set_func = K3_FUNC_ALL, .has_get_level = K3_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(K3_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .extlevels = elecraft_ext_levels, .extparms = kenwood_cfg_params, .preamp = { 14, RIG_DBLST_END, }, .attenuator = { 10, RIG_DBLST_END, }, .max_rit = Hz(9990), .max_xit = Hz(9990), .max_ifshift = Hz(0), .vfo_ops = K3_VFO_OP, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END }, .rx_range_list1 = { {kHz(500), MHz(30), K3_MODES, -1, -1, K3_VFO, K3_ANTS}, { MHz(48), MHz(54), K3_MODES, -1,- 1, K3_VFO, K3_ANTS}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { FRQ_RNG_HF(1, K3_MODES, mW(10), W(10), K3_VFO, K3_ANTS), FRQ_RNG_6m(1, K3_MODES, mW(10), W(10), K3_VFO, K3_ANTS), RIG_FRNG_END, }, /* tx range */ .rx_range_list2 = { {kHz(500), MHz(30), K3_MODES, -1, -1, K3_VFO, K3_ANTS}, { MHz(48), MHz(54), K3_MODES, -1, -1, K3_VFO, K3_ANTS}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { FRQ_RNG_HF(2, K3_MODES, mW(10), W(10), K3_VFO, K3_ANTS), FRQ_RNG_6m(2, K3_MODES, mW(10), W(10), K3_VFO, K3_ANTS), RIG_FRNG_END, }, /* tx range */ .tuning_steps = { {K3_MODES, 1}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ /* Values are arbitrary based on common K3 filter options. */ .filters = { {RIG_MODE_SSB, kHz(2.7)}, {RIG_MODE_SSB, kHz(2.8)}, {RIG_MODE_SSB, kHz(1.8)}, {RIG_MODE_SSB, RIG_FLT_ANY}, {RIG_MODE_CW|RIG_MODE_CWR, kHz(1)}, {RIG_MODE_CW|RIG_MODE_CWR, kHz(2.8)}, {RIG_MODE_CW|RIG_MODE_CWR, Hz(50)}, {RIG_MODE_CW|RIG_MODE_CWR, RIG_FLT_ANY}, {RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(2)}, {RIG_MODE_RTTY|RIG_MODE_RTTYR, kHz(2.7)}, {RIG_MODE_RTTY|RIG_MODE_RTTYR, Hz(500)}, {RIG_MODE_RTTY|RIG_MODE_RTTYR, RIG_FLT_ANY}, {RIG_MODE_PKTUSB|RIG_MODE_PKTLSB, kHz(2.7)}, {RIG_MODE_PKTUSB|RIG_MODE_PKTLSB, kHz(2.8)}, {RIG_MODE_PKTUSB|RIG_MODE_PKTLSB, Hz(50)}, {RIG_MODE_PKTUSB|RIG_MODE_PKTLSB, RIG_FLT_ANY}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_AM, kHz(13)}, {RIG_MODE_AM, kHz(2.7)}, {RIG_MODE_AM, RIG_FLT_ANY}, {RIG_MODE_FM, kHz(13)}, /* TBC */ RIG_FLT_END, }, .priv = (void *)&k3_priv_caps, .rig_init = kenwood_init, .rig_cleanup = kenwood_cleanup, .rig_open = elecraft_open, .set_freq = kenwood_set_freq, .get_freq = kenwood_get_freq, .set_mode = k3_set_mode, .get_mode = k3_get_mode, .set_vfo = k3_set_vfo, .get_vfo = kenwood_get_vfo_if, .set_split_mode = k3_set_split_mode, .get_split_mode = k3_get_split_mode, .set_split_vfo = kenwood_set_split_vfo, .get_split_vfo = kenwood_get_split_vfo_if, .set_rit = k3_set_rit, .get_rit = kenwood_get_rit, .set_xit = k3_set_xit, .get_xit = kenwood_get_xit, .get_ptt = kenwood_get_ptt, .set_ptt = kenwood_set_ptt, .get_dcd = kenwood_get_dcd, .set_func = kenwood_set_func, .get_func = kenwood_get_func, .set_ext_parm = kenwood_set_ext_parm, .get_ext_parm = kenwood_get_ext_parm, .set_level = kenwood_set_level, .get_level = k3_get_level, .set_ext_level = k3_set_ext_level, .get_ext_level = k3_get_ext_level, .vfo_op = kenwood_vfo_op, .set_trn = kenwood_set_trn, .get_trn = kenwood_get_trn, .set_powerstat = kenwood_set_powerstat, .get_powerstat = kenwood_get_powerstat, .set_ant = kenwood_set_ant_no_ack, .get_ant = kenwood_get_ant, .send_morse = kenwood_send_morse, }; /* * K3 extension function definitions follow */ /* k3_get_mode() * * The K3 supports a new command, DT, to query the data submode so * RIG_MODE_PKTUSB and RIG_MODE_PKTLSB can be supported. */ int k3_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !mode || !width) return -RIG_EINVAL; char buf[KENWOOD_MAX_BUF_LEN]; int err; rmode_t temp_m; pbwidth_t temp_w; err = kenwood_get_mode(rig, vfo, &temp_m, &temp_w); if (err != RIG_OK) return err; if (temp_m == RIG_MODE_RTTY) { err = kenwood_safe_transaction(rig, "DT", buf, KENWOOD_MAX_BUF_LEN, 4); if (err != RIG_OK) { rig_debug(RIG_DEBUG_VERBOSE, "%s: Cannot read K3 DT value\n", __func__); return err; } switch(atoi(&buf[2])) { case K3_MODE_DATA_A: *mode = RIG_MODE_PKTUSB; break; case K3_MODE_AFSK_A: *mode = RIG_MODE_RTTY; break; default: rig_debug(RIG_DEBUG_VERBOSE, "%s: unsupported data sub-mode %c\n", __func__, buf[2]); return -RIG_EINVAL; } } else if (temp_m == RIG_MODE_RTTYR) { err = kenwood_safe_transaction(rig, "DT", buf, KENWOOD_MAX_BUF_LEN, 4); if (err != RIG_OK) { rig_debug(RIG_DEBUG_VERBOSE, "%s: Cannot read K3 DT value\n", __func__); return err; } switch(atoi(&buf[2])) { case K3_MODE_DATA_A: *mode = RIG_MODE_PKTLSB; break; case K3_MODE_AFSK_A: *mode = RIG_MODE_RTTYR; break; default: rig_debug(RIG_DEBUG_VERBOSE, "%s: unsupported data sub-mode %c\n", __func__, buf[2]); return -RIG_EINVAL; } } else { *mode = temp_m; } /* The K3 is not limited to specific filter widths so we can query * the actual bandwidth using the BW command */ err = kenwood_safe_transaction(rig, "BW", buf, KENWOOD_MAX_BUF_LEN, 7); if (err != RIG_OK) { rig_debug(RIG_DEBUG_VERBOSE, "%s: Cannot read K3 BW value\n", __func__); return err; } *width = atoi(&buf[2]) * 10; return RIG_OK; } /* k3_set_mode() * * As with k3_get_mode(), the K3 can also set the data submodes which allows * use of RIG_MODE_PKTUSB and RIG_MODE_PKLSB. */ int k3_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; int err; char cmd_s[16]; switch (mode) { case RIG_MODE_PKTLSB: mode = RIG_MODE_RTTYR; strncpy(cmd_s, "DT0", 5); break; case RIG_MODE_PKTUSB: mode = RIG_MODE_RTTY; strncpy(cmd_s, "DT0", 5); break; case RIG_MODE_RTTY: case RIG_MODE_RTTYR: strncpy(cmd_s, "DT1", 5); break; default: break; } /* kenwood_set_mode() ignores width value for K2/K3/TS-570 */ err = kenwood_set_mode(rig, vfo, mode, width); if (err != RIG_OK) return err; /* Now set data sub-mode. K3 needs to be in a DATA mode before setting * the sub-mode. */ if (mode == RIG_MODE_PKTLSB || mode == RIG_MODE_PKTUSB || mode == RIG_MODE_RTTY || mode == RIG_MODE_RTTYR) { err = kenwood_simple_cmd(rig, cmd_s); if (err != RIG_OK) return err; } /* and set the requested bandwidth. On my K3, the bandwidth is rounded * down to the nearest 50 Hz, i.e. sending BW0239; will cause the bandwidth * to be set to 2.350 kHz. As the width must be divided by 10, 10 Hz values * between 0 and 4 round down to the nearest 100 Hz and values between 5 * and 9 round down to the nearest 50 Hz. * * width string value must be padded with leading '0' to equal four * characters. */ /* passband widths vary by mode so gather lower and upper limits */ pbwidth_t pb_nar = rig_passband_narrow(rig, mode); pbwidth_t pb_wid = rig_passband_wide(rig, mode); if (width < 0) width = labs(width); if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); else if (width < pb_nar) width = pb_nar; else if (width > pb_wid) width = pb_wid; sprintf(cmd_s, "BW%04ld", width / 10); err = kenwood_simple_cmd(rig, cmd_s); if (err != RIG_OK) return err; return RIG_OK; } /* The K3 changes "VFOs" by swapping the contents of * the upper display with the lower display. This function * accomplishes this by sending the emulation command, SWT11; * to the K3 to emulate a tap of the A/B button. */ int k3_set_vfo(RIG *rig, vfo_t vfo) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; int err; switch (vfo) { case RIG_VFO_B: err = kenwood_simple_cmd(rig, "SWT11"); if (err != RIG_OK) return err; break; default: break; } return RIG_OK; } /* Support the RC command for clearing RIT/XIT, * * token Defined in elecraft.h or this file * val Type depends on token type from confparams structure: * NUMERIC: val.f * COMBO: val.i, starting from 0 Index to a string table. * STRING: val.cs for set, val.s for get * CHECKBUTTON: val.i 0/1 * * See Private Elecraft extra levels definitions in elecraft.c and * private token #define in elecraft.h */ int k3_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; int err; switch(token) { case TOK_RIT_CLR: /* Clear offset */ err = kenwood_simple_cmd(rig, "RC"); if (err != RIG_OK) return err; /* val is ignored for RC command */ break; default: rig_debug(RIG_DEBUG_WARN, "%s: Unsupported set_ext_level %d\n", __func__, token); return -RIG_EINVAL; } return RIG_OK; } /* Support the FI command for reading the IF center frequency, * useful for panadapters and such that need to know the IF center. * TQ command is a quick transmit status query--K2/K3 only. * * token Defined in elecraft.h or this file * val Type depends on token type from confparams structure: * NUMERIC: val.f * COMBO: val.i, starting from 0 Index to a string table. * STRING: val.cs for set, val.s for get * CHECKBUTTON: val.i 0/1 */ int k3_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !val) return -RIG_EINVAL; char buf[KENWOOD_MAX_BUF_LEN]; int err; const struct confparams *cfp; cfp = rig_ext_lookup_tok(rig, token); switch(token) { case TOK_IF_FREQ: err = kenwood_safe_transaction(rig, "FI", buf, KENWOOD_MAX_BUF_LEN, 7); if (err != RIG_OK) return err; if (cfp->type == RIG_CONF_NUMERIC) { val->f = 8210000.0 + (float)atoi(&buf[2]); } else { rig_debug(RIG_DEBUG_ERR, "%s: protocol error, invalid token type\n", __func__); return -RIG_EPROTO; } break; case TOK_TX_STAT: err = kenwood_safe_transaction(rig, "TQ", buf, KENWOOD_MAX_BUF_LEN, 4); if (err != RIG_OK) return err; if (cfp->type == RIG_CONF_CHECKBUTTON) { val->i = atoi(&buf[2]); } else { rig_debug(RIG_DEBUG_ERR, "%s: protocol error, invalid token type\n", __func__); return -RIG_EPROTO; } break; default: rig_debug(RIG_DEBUG_WARN, "%s: Unsupported get_ext_level %d\n", __func__, token); return -RIG_EINVAL; } return RIG_OK; } /* * k3_set_rit() -- Differs from from generic Kenwood function as K3 can set * RIT to an arbitrary offset. When rit == 0, the RIT offset is cleared and * the RIT is turned on when given a value other than 0. */ int k3_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); int err; char func[16]; if (!rig) return -RIG_EINVAL; if (rit == 0) snprintf(func, 4, "RT0"); else snprintf(func, 4, "RT1"); err = set_rit_xit(rig, func, rit); if (err != RIG_OK) return err; return RIG_OK; } /* * k3_set_xit() -- Differs from from generic Kenwood function as K3 can set * XIT to an arbitrary offset. When rit == 0, the XIT offset is cleared and * the XIT is turned on when given a value other than 0. */ int k3_set_xit(RIG * rig, vfo_t vfo, shortfreq_t rit) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); int err; char func[16]; if (!rig) return -RIG_EINVAL; if (rit == 0) snprintf(func, 4, "XT0"); else snprintf(func, 4, "XT1"); err = set_rit_xit(rig, func, rit); if (err != RIG_OK) return err; return RIG_OK; } /* The K3 *always* uses VFOB for TX. Do we continually switch VFOs and * possibly irritate the user? Better just to return -RIG_ENAVAIL * until this is resolved. */ int k3_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } /* The K3 *always* uses VFOB for TX. Do we continually switch VFOs and * possibly irritate the user? Better just to return -RIG_ENAVAIL * until this is resolved. */ int k3_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } /* * Handle S-meter (SM, SMH) level locally and pass rest to kenwood_get_level() */ int k3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig || !val) return -RIG_EINVAL; char lvlbuf[50]; int retval; struct kenwood_priv_data *priv = rig->state.priv; switch (level) { case RIG_LEVEL_STRENGTH: /* As of FW rev 4.37 the K3 supports an 'SMH' command that * offers a higher resolution, 0-100 (mine went to 106), * rawstr value for more precise S-meter reporting. */ retval = strncmp(priv->k3_fw_rev, "4.37", 4); if (retval < 0) { cal_table_t str_cal = K3_SM_CAL; retval = kenwood_safe_transaction(rig, "SM", lvlbuf, 10, 7); if (retval != RIG_OK) return retval; sscanf(lvlbuf+2, "%d", &val->i); /* rawstr */ val->i = (int) rig_raw2val(val->i, &str_cal); } else if (retval >= 0) { cal_table_t str_cal = K3_SMH_CAL; retval = kenwood_safe_transaction(rig, "SMH", lvlbuf, 10, 7); if (retval != RIG_OK) return retval; sscanf(lvlbuf+3, "%d", &val->i); /* rawstr */ val->i = (int) rig_raw2val(val->i, &str_cal); } else { rig_debug(RIG_DEBUG_ERR, "%s: Firmware version comparison failed!\n", __func__); return -RIG_EINVAL; } break; default: retval = kenwood_get_level(rig, vfo, level, val); if (retval != RIG_OK) return retval; break; } return RIG_OK; } /* Private K3 helper functions */ /* * set_rit_xit() -- Differs from from generic Kenwood function as K3 can set * RIT/XIT to an arbitrary offset. When rit == 0, the RIT/XIT offset is * cleared and the RIT/XIT is turned on when given a value other than 0. */ int set_rit_xit(RIG * rig, char *func, shortfreq_t rit) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); int err; char offs; char cmd[16]; if (!rig) return -RIG_EINVAL; if (rit == 0) { /* Clear offset first */ err = kenwood_simple_cmd(rig, "RC"); if (err != RIG_OK) return err; /* K3 RIT|XIT Off command */ err = kenwood_simple_cmd(rig, func); if (err != RIG_OK) return err; return RIG_OK; } /* Set offset and turn on RIT|XIT */ if (rit <= 9999 && rit >= -9999) { offs = (rit < 0) ? '-' : '+'; snprintf(cmd, 8, "RO%c%04d", offs, abs((int)rit)); err = kenwood_simple_cmd(rig, cmd); if (err != RIG_OK) return err; /* K3 RIT ON command */ err = kenwood_simple_cmd(rig, func); if (err != RIG_OK) return err; } else { return -RIG_EINVAL; } return RIG_OK; } hamlib-1.2.15.3/dummy/0000755000175000017500000000000012044565016011334 500000000000000hamlib-1.2.15.3/dummy/rot_dummy.c0000644000175000017500000001444412044564477013460 00000000000000/* * Hamlib Dummy backend - main file * Copyright (c) 2001-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include #include "hamlib/rotator.h" #include "serial.h" #include "misc.h" #include "register.h" #include "rot_dummy.h" struct dummy_rot_priv_data { azimuth_t az; elevation_t el; struct timeval tv; /* time last az/el update */ azimuth_t target_az; elevation_t target_el; }; static int dummy_rot_init(ROT *rot) { struct dummy_rot_priv_data *priv; priv = (struct dummy_rot_priv_data*) malloc(sizeof(struct dummy_rot_priv_data)); if (!priv) return -RIG_ENOMEM; rot->state.priv = (void*)priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rot->state.rotport.type.rig = RIG_PORT_NONE; priv->az = priv->el = 0; priv->target_az = priv->target_el = 0; return RIG_OK; } static int dummy_rot_cleanup(ROT *rot) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (rot->state.priv) free(rot->state.priv); rot->state.priv = NULL; return RIG_OK; } static int dummy_rot_open(ROT *rot) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return RIG_OK; } static int dummy_rot_close(ROT *rot) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return RIG_OK; } static int dummy_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) { struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %.2f %.2f\n", __func__, az, el); priv->target_az = az; priv->target_el = el; gettimeofday(&priv->tv, NULL); return RIG_OK; } /* * Get position of rotor, simulating slow rotation */ static int dummy_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; struct timeval tv; unsigned elapsed; /* ms */ rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (priv->az == priv->target_az && priv->el == priv->target_el) { *az = priv->az; *el = priv->el; return RIG_OK; } gettimeofday(&tv, NULL); elapsed = (tv.tv_sec - priv->tv.tv_sec) * 1000 + (tv.tv_usec - priv->tv.tv_usec) / 1000; /* * Simulate rotation speed of 360 deg per minute */ #define DEG_PER_MS (360./60/1000) if (fabs(priv->target_az - priv->az)/DEG_PER_MS <= elapsed) { /* target reached */ priv->az = priv->target_az; } else { if (priv->az < priv->target_az) priv->az += (azimuth_t)elapsed*DEG_PER_MS; else priv->az -= (azimuth_t)elapsed*DEG_PER_MS; } if (fabs(priv->target_el - priv->el)/DEG_PER_MS <= elapsed) { /* target reached */ priv->el = priv->target_el; } else { if (priv->el < priv->target_el) priv->el += (elevation_t)elapsed*DEG_PER_MS; else priv->el -= (elevation_t)elapsed*DEG_PER_MS; } *az = priv->az; *el = priv->el; priv->tv = tv; return RIG_OK; } static int dummy_rot_stop(ROT *rot) { struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; azimuth_t az; elevation_t el; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); dummy_rot_get_position(rot, &az, &el); priv->target_az = priv->az = az; priv->target_el = priv->el = el; return RIG_OK; } static int dummy_rot_park(ROT *rot) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); /* Assume home is 0,0 */ dummy_rot_set_position(rot, 0, 0); return RIG_OK; } static int dummy_rot_reset(ROT *rot, rot_reset_t reset) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return RIG_OK; } static int dummy_rot_move(ROT *rot, int direction, int speed) { struct dummy_rot_priv_data *priv = (struct dummy_rot_priv_data *)rot->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: Direction = %d, Speed = %d\n", __func__, direction, speed); switch(direction) { case ROT_MOVE_UP: return dummy_rot_set_position(rot, priv->target_az, 90); case ROT_MOVE_DOWN: return dummy_rot_set_position(rot, priv->target_az, 0); case ROT_MOVE_CCW: return dummy_rot_set_position(rot, -180, priv->target_el); case ROT_MOVE_CW: return dummy_rot_set_position(rot, 180, priv->target_el); default: return -RIG_EINVAL; } return RIG_OK; } static const char *dummy_rot_get_info(ROT *rot) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return "Dummy rotator"; } /* * Dummy rotator capabilities. */ const struct rot_caps dummy_rot_caps = { .rot_model = ROT_MODEL_DUMMY, .model_name = "Dummy", .mfg_name = "Hamlib", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_AZEL, .port_type = RIG_PORT_NONE, .min_az = -180., .max_az = 180., .min_el = 0., .max_el = 90., .priv = NULL, /* priv */ .rot_init = dummy_rot_init, .rot_cleanup = dummy_rot_cleanup, .rot_open = dummy_rot_open, .rot_close = dummy_rot_close, .set_position = dummy_rot_set_position, .get_position = dummy_rot_get_position, .park = dummy_rot_park, .stop = dummy_rot_stop, .reset = dummy_rot_reset, .move = dummy_rot_move, .get_info = dummy_rot_get_info, }; DECLARE_INITROT_BACKEND(dummy) { rig_debug(RIG_DEBUG_VERBOSE, "dummy: _init called\n"); rot_register(&dummy_rot_caps); rot_register(&netrotctl_caps); return RIG_OK; } hamlib-1.2.15.3/dummy/netrigctl.c0000644000175000017500000007577212044564477013447 00000000000000/* * Hamlib Netrigctl backend - main file * Copyright (c) 2001-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include #include "hamlib/rig.h" #include "iofunc.h" #include "misc.h" #include "num_stdio.h" #include "dummy.h" #define CMD_MAX 32 #define BUF_MAX 96 #define CHKSCN1ARG(a) if ((a) != 1) return -RIG_EPROTO; else do {} while(0) /* * Helper function with protocol return code parsing */ static int netrigctl_transaction(RIG *rig, char *cmd, int len, char *buf) { int ret; ret = write_block(&rig->state.rigport, cmd, len); if (ret != RIG_OK) return ret; ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret < 0) return ret; if (!memcmp(buf, NETRIGCTL_RET, strlen(NETRIGCTL_RET))) return atoi(buf+strlen(NETRIGCTL_RET)); return ret; } /* * mimics rpcrig_open() from rpcrig/rpcrig_backend.c */ static int netrigctl_open(RIG *rig) { int ret, len, i; struct rig_state *rs = &rig->state; int prot_ver; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "\\dump_state\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; prot_ver = atoi(buf); #define RIGCTLD_PROT_VER 0 if (prot_ver < RIGCTLD_PROT_VER) return -RIG_EPROTO; ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; rs->itu_region = atoi(buf); for (i=0; istate.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; ret = num_sscanf(buf, "%"SCNfreq"%"SCNfreq"%x%d%d%x%x", &rs->rx_range_list[i].start, &rs->rx_range_list[i].end, &rs->rx_range_list[i].modes, &rs->rx_range_list[i].low_power, &rs->rx_range_list[i].high_power, &rs->rx_range_list[i].vfo, &rs->rx_range_list[i].ant ); if (ret != 7) return -RIG_EPROTO; if (RIG_IS_FRNG_END(rs->rx_range_list[i])) break; } for (i=0; istate.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; ret = num_sscanf(buf, "%"SCNfreq"%"SCNfreq"%x%d%d%x%x", &rs->tx_range_list[i].start, &rs->tx_range_list[i].end, &rs->tx_range_list[i].modes, &rs->tx_range_list[i].low_power, &rs->tx_range_list[i].high_power, &rs->tx_range_list[i].vfo, &rs->tx_range_list[i].ant ); if (ret != 7) return -RIG_EPROTO; if (RIG_IS_FRNG_END(rs->tx_range_list[i])) break; } for (i=0; istate.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; ret = sscanf(buf, "%x%ld", &rs->tuning_steps[i].modes, &rs->tuning_steps[i].ts); if (ret != 2) return -RIG_EPROTO; if (RIG_IS_TS_END(rs->tuning_steps[i])) break; } for (i=0; istate.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; ret = sscanf(buf, "%x%ld", &rs->filters[i].modes, &rs->filters[i].width); if (ret != 2) return -RIG_EPROTO; if (RIG_IS_FLT_END(rs->filters[i])) break; } #if 0 /* TODO */ chan_t chan_list[CHANLSTSIZ]; /*!< Channel list, zero ended */ #endif ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; rs->max_rit = atol(buf); ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; rs->max_xit = atol(buf); ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; rs->max_ifshift = atol(buf); ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; rs->announces = atoi(buf); ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; ret = sscanf (buf, "%d%d%d%d%d%d%d", &rs->preamp[0], &rs->preamp[1], &rs->preamp[2], &rs->preamp[3], &rs->preamp[4], &rs->preamp[5], &rs->preamp[6]); if (ret < 0 || ret >= MAXDBLSTSIZ) ret = 0; rs->preamp[ret] = RIG_DBLST_END; ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; ret = sscanf (buf, "%d%d%d%d%d%d%d", &rs->attenuator[0], &rs->attenuator[1], &rs->attenuator[2], &rs->attenuator[3], &rs->attenuator[4], &rs->attenuator[5], &rs->attenuator[6]); if (ret < 0 || ret >= MAXDBLSTSIZ) ret = 0; rs->attenuator[ret] = RIG_DBLST_END; ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; rs->has_get_func = strtol(buf, NULL, 0); ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; rs->has_set_func = strtol(buf, NULL, 0); ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; rs->has_get_level = strtol(buf, NULL, 0); ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; rs->has_set_level = strtol(buf, NULL, 0); ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; rs->has_get_parm = strtol(buf, NULL, 0); ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; rs->has_set_parm = strtol(buf, NULL, 0); #if 0 gran_t level_gran[RIG_SETTING_MAX]; /*!< level granularity */ gran_t parm_gran[RIG_SETTING_MAX]; /*!< parm granularity */ #endif for (i=0; irx_range_list[i]); i++) { rs->vfo_list |= rs->rx_range_list[i].vfo; } for (i=0; itx_range_list[i]); i++) { rs->vfo_list |= rs->tx_range_list[i].vfo; } return RIG_OK; } static int netrigctl_close(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); /* clean signoff, no read back */ write_block(&rig->state.rigport, "q\n", 2); return RIG_OK; } static int netrigctl_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "F %"FREQFMT"\n", freq); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "f\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; CHKSCN1ARG(num_sscanf(buf, "%"SCNfreq, freq)); return RIG_OK; } static int netrigctl_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "M %s %li\n", rig_strrmode(mode), width); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "m\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; if (ret > 0 && buf[ret-1]=='\n') buf[ret-1] = '\0'; /* chomp */ *mode = rig_parse_mode(buf); ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *width = atoi(buf); return RIG_OK; } static int netrigctl_set_vfo(RIG *rig, vfo_t vfo) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "V %s\n", rig_strvfo(vfo)); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_vfo(RIG *rig, vfo_t *vfo) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "v\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; if (ret > 0 && buf[ret-1]=='\n') buf[ret-1] = '\0'; /* chomp */ *vfo = rig_parse_vfo(buf); return RIG_OK; } static int netrigctl_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "T %d\n", ptt); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "t\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *ptt = atoi(buf); return RIG_OK; } static int netrigctl_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "\\get_dcd\n"); /* FIXME */ ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *dcd = atoi(buf); return RIG_OK; } static int netrigctl_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "R %s\n", rig_strptrshift(rptr_shift)); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "r\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; if (ret > 0 && buf[ret-1]=='\n') buf[ret-1] = '\0'; /* chomp */ *rptr_shift = rig_parse_rptr_shift(buf); return RIG_OK; } static int netrigctl_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "O %ld\n", rptr_offs); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "o\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *rptr_offs = atoi(buf); return RIG_OK; } static int netrigctl_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "C %d\n", tone); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "c\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *tone = atoi(buf); return RIG_OK; } static int netrigctl_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "D %d\n", code); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "d\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *code = atoi(buf); return RIG_OK; } static int netrigctl_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "\\set_ctcss_sql %d\n", tone); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "\\get_ctcss_sql\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *tone = atoi(buf); return RIG_OK; } static int netrigctl_set_dcs_sql(RIG *rig, vfo_t vfo, unsigned int code) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "\\set_dcs_sql %d\n", code); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_dcs_sql(RIG *rig, vfo_t vfo, unsigned int *code) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "\\get_dcs_sql\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *code = atoi(buf); return RIG_OK; } static int netrigctl_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "I %"FREQFMT"\n", tx_freq); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "i\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; CHKSCN1ARG(num_sscanf(buf, "%"SCNfreq, tx_freq)); return RIG_OK; } static int netrigctl_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "X %s %li\n", rig_strrmode(tx_mode), tx_width); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "x\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; if (ret > 0 && buf[ret-1]=='\n') buf[ret-1] = '\0'; /* chomp */ *tx_mode = rig_parse_mode(buf); ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *tx_width = atoi(buf); return RIG_OK; } static int netrigctl_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "S %d %s\n", split, rig_strvfo(tx_vfo)); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "s\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *split = atoi(buf); ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; if (ret > 0 && buf[ret-1]=='\n') buf[ret-1] = '\0'; /* chomp */ *tx_vfo = rig_parse_vfo(buf); return RIG_OK; } static int netrigctl_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "J %ld\n", rit); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "j\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *rit = atoi(buf); return RIG_OK; } static int netrigctl_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "Z %ld\n", xit); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "z\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *xit = atoi(buf); return RIG_OK; } static int netrigctl_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "N %ld\n", ts); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "n\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *ts = atoi(buf); return RIG_OK; } static int netrigctl_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "U %s %i\n", rig_strfunc(func), status); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "u %s\n", rig_strfunc(func)); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *status = atoi(buf); return RIG_OK; } static int netrigctl_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; char lstr[32]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); if (RIG_LEVEL_IS_FLOAT(level)) sprintf(lstr, "%f", val.f); else sprintf(lstr, "%d", val.i); len = sprintf(cmd, "L %s %s\n", rig_strlevel(level), lstr); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "l %s\n", rig_strlevel(level)); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; if (RIG_LEVEL_IS_FLOAT(level)) val->f = atof(buf); else val->i = atoi(buf); return RIG_OK; } static int netrigctl_set_powerstat(RIG *rig, powerstat_t status) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "\\set_powerstat %d\n", status); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_powerstat(RIG *rig, powerstat_t *status) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "\\get_powerstat\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *status = atoi(buf); return RIG_OK; } static int netrigctl_set_parm(RIG *rig, setting_t parm, value_t val) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; char pstr[32]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); if (RIG_PARM_IS_FLOAT(parm)) sprintf(pstr, "%f", val.f); else sprintf(pstr, "%d", val.i); len = sprintf(cmd, "P %s %s\n", rig_strparm(parm), pstr); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_parm(RIG *rig, setting_t parm, value_t *val) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "p %s\n", rig_strparm(parm)); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; if (RIG_PARM_IS_FLOAT(parm)) val->f = atoi(buf); else val->i = atoi(buf); return RIG_OK; } static int netrigctl_set_ant(RIG *rig, vfo_t vfo, ant_t ant) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "Y %d\n", ant); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_ant(RIG *rig, vfo_t vfo, ant_t *ant) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "y\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *ant = atoi(buf); return RIG_OK; } static int netrigctl_set_bank(RIG *rig, vfo_t vfo, int bank) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "B %d\n", bank); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_set_mem(RIG *rig, vfo_t vfo, int ch) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "E %d\n", ch); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_get_mem(RIG *rig, vfo_t vfo, int *ch) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "e\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *ch = atoi(buf); return RIG_OK; } static int netrigctl_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "g %s %d\n", rig_strscan(scan), ch); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "J %s\n", rig_strvfop(op)); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_set_channel(RIG *rig, const channel_t *chan) { return -RIG_ENIMPL; } static int netrigctl_get_channel(RIG *rig, channel_t *chan) { return -RIG_ENIMPL; } static const char *netrigctl_get_info(RIG *rig) { int ret, len; char cmd[CMD_MAX]; static char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "_\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret < 0) return NULL; buf [ret] = '\0'; return buf; } static int netrigctl_send_dtmf(RIG *rig, vfo_t vfo, const char *digits) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "\\send_dtmf %s\n", digits); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrigctl_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length) { int ret, len; char cmd[CMD_MAX]; static char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "\\recv_dtmf\n"); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; if (ret > *length) ret = *length; strncpy(digits, buf, ret); *length = ret; digits [ret] = '\0'; return RIG_OK; } static int netrigctl_send_morse(RIG *rig, vfo_t vfo, const char *msg) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); len = sprintf(cmd, "\\send_morse %s\n", msg); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } /* * Netrigctl rig capabilities. */ const struct rig_caps netrigctl_caps = { .rig_model = RIG_MODEL_NETRIGCTL, .model_name = "NET rigctl", .mfg_name = "Hamlib", .version = "0.3", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_OTHER, .targetable_vfo = 0, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_NETWORK, .timeout = 2000, /* enough for a network */ .retry = 3, /* following fields updated in rig_state at openning time */ .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { }, .ctcss_list = NULL, .dcs_list = NULL, .chan_list = { }, .transceive = RIG_TRN_OFF, .attenuator = { }, .preamp = { }, .rx_range_list2 = { RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { }, .filters = { RIG_FLT_END, }, .max_rit = 0, .max_xit = 0, .max_ifshift = 0, .priv = NULL, .rig_init = NULL, .rig_cleanup = NULL, .rig_open = netrigctl_open, .rig_close = netrigctl_close, .set_freq = netrigctl_set_freq, .get_freq = netrigctl_get_freq, .set_mode = netrigctl_set_mode, .get_mode = netrigctl_get_mode, .set_vfo = netrigctl_set_vfo, .get_vfo = netrigctl_get_vfo, .set_powerstat = netrigctl_set_powerstat, .get_powerstat = netrigctl_get_powerstat, .set_level = netrigctl_set_level, .get_level = netrigctl_get_level, .set_func = netrigctl_set_func, .get_func = netrigctl_get_func, .set_parm = netrigctl_set_parm, .get_parm = netrigctl_get_parm, .get_info = netrigctl_get_info, .set_ptt = netrigctl_set_ptt, .get_ptt = netrigctl_get_ptt, .get_dcd = netrigctl_get_dcd, .set_rptr_shift = netrigctl_set_rptr_shift, .get_rptr_shift = netrigctl_get_rptr_shift, .set_rptr_offs = netrigctl_set_rptr_offs, .get_rptr_offs = netrigctl_get_rptr_offs, .set_ctcss_tone = netrigctl_set_ctcss_tone, .get_ctcss_tone = netrigctl_get_ctcss_tone, .set_dcs_code = netrigctl_set_dcs_code, .get_dcs_code = netrigctl_get_dcs_code, .set_ctcss_sql = netrigctl_set_ctcss_sql, .get_ctcss_sql = netrigctl_get_ctcss_sql, .set_dcs_sql = netrigctl_set_dcs_sql, .get_dcs_sql = netrigctl_get_dcs_sql, .set_split_freq = netrigctl_set_split_freq, .get_split_freq = netrigctl_get_split_freq, .set_split_mode = netrigctl_set_split_mode, .get_split_mode = netrigctl_get_split_mode, .set_split_vfo = netrigctl_set_split_vfo, .get_split_vfo = netrigctl_get_split_vfo, .set_rit = netrigctl_set_rit, .get_rit = netrigctl_get_rit, .set_xit = netrigctl_set_xit, .get_xit = netrigctl_get_xit, .set_ts = netrigctl_set_ts, .get_ts = netrigctl_get_ts, .set_ant = netrigctl_set_ant, .get_ant = netrigctl_get_ant, .set_bank = netrigctl_set_bank, .set_mem = netrigctl_set_mem, .get_mem = netrigctl_get_mem, .vfo_op = netrigctl_vfo_op, .scan = netrigctl_scan, .send_dtmf = netrigctl_send_dtmf, .recv_dtmf = netrigctl_recv_dtmf, .send_morse = netrigctl_send_morse, .set_channel = netrigctl_set_channel, .get_channel = netrigctl_get_channel, }; hamlib-1.2.15.3/dummy/dummy.c0000644000175000017500000011503212044564477012567 00000000000000/* * Hamlib Dummy backend - main file * Copyright (c) 2001-2010 by Stephane Fillod * Copyright (c) 2010 by Nate Bargmann * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "tones.h" #include "idx_builtin.h" #include "register.h" #include "dummy.h" #define NB_CHAN 22 /* see caps->chan_list */ struct dummy_priv_data { /* current vfo already in rig_state ? */ vfo_t curr_vfo; vfo_t last_vfo; /* VFO A or VFO B, when in MEM mode */ ptt_t ptt; powerstat_t powerstat; int bank; value_t parms[RIG_SETTING_MAX]; channel_t *curr; /* points to vfo_a, vfo_b or mem[] */ channel_t vfo_a; channel_t vfo_b; channel_t mem[NB_CHAN]; struct ext_list *ext_parms; char *magic_conf; }; /* levels pertain to each VFO */ static const struct confparams dummy_ext_levels[] = { { TOK_EL_MAGICLEVEL, "MGL", "Magic level", "Magic level, as an example", NULL, RIG_CONF_NUMERIC, { .n = { 0, 1, .001 } } }, { TOK_EL_MAGICFUNC, "MGF", "Magic func", "Magic function, as an example", NULL, RIG_CONF_CHECKBUTTON }, { TOK_EL_MAGICOP, "MGO", "Magic Op", "Magic Op, as an example", NULL, RIG_CONF_BUTTON }, { RIG_CONF_END, NULL, } }; /* parms pertain to the whole rig */ static const struct confparams dummy_ext_parms[] = { { TOK_EP_MAGICPARM, "MGP", "Magic parm", "Magic parameter, as an example", NULL, RIG_CONF_NUMERIC, { .n = { 0, 1, .001 } } }, { RIG_CONF_END, NULL, } }; /* cfgparams are configuration item generally used by the backend's open() method */ static const struct confparams dummy_cfg_params[] = { { TOK_CFG_MAGICCONF, "mcfg", "Magic conf", "Magic parameter, as an example", "DX", RIG_CONF_STRING, { } }, { RIG_CONF_END, NULL, } }; /********************************************************************/ static void init_chan(RIG *rig, vfo_t vfo, channel_t *chan) { chan->channel_num = 0; chan->vfo = vfo; strcpy(chan->channel_desc, rig_strvfo(vfo)); chan->freq = MHz(145); chan->mode = RIG_MODE_FM; chan->width = rig_passband_normal(rig, RIG_MODE_FM); chan->tx_freq = chan->freq; chan->tx_mode = chan->mode; chan->tx_width = chan->width; chan->split = RIG_SPLIT_OFF; chan->rptr_shift = RIG_RPT_SHIFT_NONE; chan->rptr_offs = 0; chan->ctcss_tone = 0; chan->dcs_code = 0; chan->ctcss_sql = 0; chan->dcs_sql = 0; chan->rit = 0; chan->xit = 0; chan->tuning_step = 0; chan->ant = 0; chan->funcs = (setting_t)0; memset(chan->levels, 0, RIG_SETTING_MAX*sizeof(value_t)); } static void copy_chan(channel_t *dest, const channel_t *src) { struct ext_list *saved_ext_levels; int i; /* TODO: ext_levels[] of different sizes */ for (i=0; !RIG_IS_EXT_END(src->ext_levels[i]) && !RIG_IS_EXT_END(dest->ext_levels[i]); i++) { dest->ext_levels[i] = src->ext_levels[i]; } saved_ext_levels = dest->ext_levels; memcpy(dest, src, sizeof(channel_t)); dest->ext_levels = saved_ext_levels; } static struct ext_list * alloc_init_ext(const struct confparams *cfp) { struct ext_list *elp; int i, nb_ext; for (nb_ext=0; !RIG_IS_EXT_END(cfp[nb_ext]); nb_ext++) ; elp = calloc((nb_ext+1), sizeof(struct ext_list)); if (!elp) return NULL; for (i=0; !RIG_IS_EXT_END(cfp[i]); i++) { elp[i].token = cfp[i].token; /* value reset already by calloc */ } /* last token in array is set to 0 by calloc */ return elp; } static struct ext_list * find_ext(struct ext_list *elp, token_t token) { int i; for (i=0; elp[i].token != 0; i++) { if (elp[i].token == token) return &elp[i]; } return NULL; } static int dummy_init(RIG *rig) { struct dummy_priv_data *priv; int i; priv = (struct dummy_priv_data*)malloc(sizeof(struct dummy_priv_data)); if (!priv) return -RIG_ENOMEM; rig->state.priv = (void*)priv; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); rig->state.rigport.type.rig = RIG_PORT_NONE; priv->ptt = RIG_PTT_OFF; priv->powerstat = RIG_POWER_ON; priv->bank = 0; memset(priv->parms, 0, RIG_SETTING_MAX*sizeof(value_t)); memset(priv->mem, 0, sizeof(priv->mem)); for (i=0; imem[i].channel_num = i; priv->mem[i].vfo = RIG_VFO_MEM; priv->mem[i].ext_levels = alloc_init_ext(dummy_ext_levels); if (!priv->mem[i].ext_levels) return -RIG_ENOMEM; } priv->vfo_a.ext_levels = alloc_init_ext(dummy_ext_levels); if (!priv->vfo_a.ext_levels) return -RIG_ENOMEM; priv->vfo_b.ext_levels = alloc_init_ext(dummy_ext_levels); if (!priv->vfo_b.ext_levels) return -RIG_ENOMEM; priv->ext_parms = alloc_init_ext(dummy_ext_parms); if (!priv->ext_parms) return -RIG_ENOMEM; init_chan(rig, RIG_VFO_A, &priv->vfo_a); init_chan(rig, RIG_VFO_B, &priv->vfo_b); priv->curr = &priv->vfo_a; priv->curr_vfo = priv->last_vfo = RIG_VFO_A; priv->magic_conf = strdup("DX"); return RIG_OK; } static int dummy_cleanup(RIG *rig) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; int i; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); for (i=0; imem[i].ext_levels); } free(priv->vfo_a.ext_levels); free(priv->vfo_b.ext_levels); free(priv->ext_parms); free(priv->magic_conf); if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } static int dummy_open(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_close(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_set_conf(RIG *rig, token_t token, const char *val) { struct dummy_priv_data *priv; priv = (struct dummy_priv_data*)rig->state.priv; switch(token) { case TOK_CFG_MAGICCONF: if (val) { free(priv->magic_conf); priv->magic_conf = strdup(val); } break; default: return -RIG_EINVAL; } return RIG_OK; } static int dummy_get_conf(RIG *rig, token_t token, char *val) { struct dummy_priv_data *priv; priv = (struct dummy_priv_data*)rig->state.priv; switch(token) { case TOK_CFG_MAGICCONF: strcpy(val, priv->magic_conf); break; default: return -RIG_EINVAL; } return RIG_OK; } static int dummy_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; char fstr[20]; sprintf_freq(fstr, freq); rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s %s\n", __FUNCTION__, rig_strvfo(vfo), fstr); curr->freq = freq; return RIG_OK; } static int dummy_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s\n", __FUNCTION__, rig_strvfo(vfo)); *freq = curr->freq; return RIG_OK; } static int dummy_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; char buf[16]; sprintf_freq(buf, width); rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s %s %s\n", __FUNCTION__, rig_strvfo(vfo), rig_strrmode(mode), buf); curr->mode = mode; curr->width = width; return RIG_OK; } static int dummy_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s\n", __FUNCTION__, rig_strvfo(vfo)); *mode = curr->mode; *width = curr->width; return RIG_OK; } static int dummy_set_vfo(RIG *rig, vfo_t vfo) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s\n", __FUNCTION__, rig_strvfo(vfo)); priv->last_vfo = priv->curr_vfo; priv->curr_vfo = vfo; switch (vfo) { case RIG_VFO_VFO: /* FIXME */ case RIG_VFO_A: priv->curr = &priv->vfo_a; break; case RIG_VFO_B: priv->curr = &priv->vfo_b; break; case RIG_VFO_MEM: if (curr->channel_num >= 0 && curr->channel_num < NB_CHAN) { priv->curr = &priv->mem[curr->channel_num]; break; } default: rig_debug(RIG_DEBUG_VERBOSE,"%s unknown vfo: %s\n", __FUNCTION__, rig_strvfo(vfo)); } return RIG_OK; } static int dummy_get_vfo(RIG *rig, vfo_t *vfo) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; *vfo = priv->curr_vfo; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s\n", __FUNCTION__, rig_strvfo(*vfo)); return RIG_OK; } static int dummy_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); priv->ptt = ptt; return RIG_OK; } static int dummy_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); *ptt = priv->ptt; return RIG_OK; } static int dummy_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { static int twiddle = 0; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); *dcd = twiddle++ & 1 ? RIG_DCD_ON : RIG_DCD_OFF; return RIG_OK; } static int dummy_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); curr->rptr_shift = rptr_shift; return RIG_OK; } static int dummy_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; *rptr_shift = curr->rptr_shift; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); curr->rptr_offs = rptr_offs; return RIG_OK; } static int dummy_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; *rptr_offs = curr->rptr_offs; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); curr->ctcss_tone = tone; return RIG_OK; } static int dummy_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; *tone = curr->ctcss_tone; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); curr->dcs_code = code; return RIG_OK; } static int dummy_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; *code = curr->dcs_code; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); curr->ctcss_sql = tone; return RIG_OK; } static int dummy_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; *tone = curr->ctcss_sql; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_set_dcs_sql(RIG *rig, vfo_t vfo, unsigned int code) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); curr->dcs_sql = code; return RIG_OK; } static int dummy_get_dcs_sql(RIG *rig, vfo_t vfo, unsigned int *code) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; *code = curr->dcs_sql; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; char fstr[20]; sprintf_freq(fstr, tx_freq); rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s %s\n", __FUNCTION__, rig_strvfo(vfo), fstr); curr->tx_freq = tx_freq; return RIG_OK; } static int dummy_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s\n", __FUNCTION__,rig_strvfo(vfo)); *tx_freq = curr->tx_freq; return RIG_OK; } static int dummy_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; char buf[16]; sprintf_freq(buf, tx_width); rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s %s %s\n", __FUNCTION__, rig_strvfo(vfo), rig_strrmode(tx_mode), buf); curr->tx_mode = tx_mode; curr->tx_width = tx_width; return RIG_OK; } static int dummy_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s\n", __FUNCTION__, rig_strvfo(vfo)); *tx_mode = curr->tx_mode; *tx_width = curr->tx_width; return RIG_OK; } static int dummy_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); curr->split = split; return RIG_OK; } static int dummy_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; *split = curr->split; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); curr->rit = rit; return RIG_OK; } static int dummy_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; *rit = curr->rit; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); curr->xit = xit; return RIG_OK; } static int dummy_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; *xit = curr->xit; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); curr->tuning_step = ts; return RIG_OK; } static int dummy_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; *ts = curr->tuning_step; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s %d\n",__FUNCTION__, rig_strfunc(func), status); if (status) curr->funcs |= func; else curr->funcs &= ~func; return RIG_OK; } static int dummy_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; *status = curr->funcs & func ? 1 : 0; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s\n",__FUNCTION__, rig_strfunc(func)); return RIG_OK; } static int dummy_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; int idx; char lstr[32]; idx = rig_setting2idx(level); if (idx >= RIG_SETTING_MAX) return -RIG_EINVAL; curr->levels[idx] = val; if (RIG_LEVEL_IS_FLOAT(level)) sprintf(lstr, "%f", val.f); else sprintf(lstr, "%d", val.i); rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s %s\n",__FUNCTION__, rig_strlevel(level), lstr); return RIG_OK; } static int dummy_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; int idx; idx = rig_setting2idx(level); if (idx >= RIG_SETTING_MAX) return -RIG_EINVAL; /* make S-Meter jiggle */ if (level == RIG_LEVEL_STRENGTH || level == RIG_LEVEL_RAWSTR) { int qrm = -56; if (curr->freq < MHz(7)) qrm = -20; else if (curr->freq < MHz(21)) qrm = -30; else if (curr->freq < MHz(50)) qrm = -50; curr->levels[idx].i = qrm + time(NULL)%32 + rand()%4 - curr->levels[LVL_ATT].i + curr->levels[LVL_PREAMP].i; } *val = curr->levels[idx]; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s\n",__FUNCTION__, rig_strlevel(level)); return RIG_OK; } static int dummy_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; char lstr[64]; const struct confparams *cfp; struct ext_list *elp; cfp = rig_ext_lookup_tok(rig, token); if (!cfp) return -RIG_EINVAL; switch (token) { case TOK_EL_MAGICLEVEL: case TOK_EL_MAGICFUNC: case TOK_EL_MAGICOP: break; default: return -RIG_EINVAL; } switch (cfp->type) { case RIG_CONF_STRING: strcpy(lstr, val.s); break; case RIG_CONF_COMBO: sprintf(lstr, "%d", val.i); break; case RIG_CONF_NUMERIC: sprintf(lstr, "%f", val.f); break; case RIG_CONF_CHECKBUTTON: sprintf(lstr, "%s", val.i ? "ON" : "OFF"); break; case RIG_CONF_BUTTON: lstr[0] = '\0'; break; default: return -RIG_EINTERNAL; } elp = find_ext(curr->ext_levels, token); if (!elp) return -RIG_EINTERNAL; /* store value */ elp->val = val; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s %s\n",__FUNCTION__, cfp->name, lstr); return RIG_OK; } static int dummy_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; const struct confparams *cfp; struct ext_list *elp; cfp = rig_ext_lookup_tok(rig, token); if (!cfp) return -RIG_EINVAL; switch (token) { case TOK_EL_MAGICLEVEL: case TOK_EL_MAGICFUNC: case TOK_EL_MAGICOP: break; default: return -RIG_EINVAL; } elp = find_ext(curr->ext_levels, token); if (!elp) return -RIG_EINTERNAL; /* load value */ *val = elp->val; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s\n",__FUNCTION__, cfp->name); return RIG_OK; } static int dummy_set_powerstat(RIG *rig, powerstat_t status) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); priv->powerstat = status; return RIG_OK; } static int dummy_get_powerstat(RIG *rig, powerstat_t *status) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; *status = priv->powerstat; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_set_parm(RIG *rig, setting_t parm, value_t val) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; int idx; char pstr[32]; idx = rig_setting2idx(parm); if (idx >= RIG_SETTING_MAX) return -RIG_EINVAL; if (RIG_PARM_IS_FLOAT(parm)) sprintf(pstr, "%f", val.f); else sprintf(pstr, "%d", val.i); rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s %s\n", __FUNCTION__, rig_strparm(parm), pstr); priv->parms[idx] = val; return RIG_OK; } static int dummy_get_parm(RIG *rig, setting_t parm, value_t *val) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; int idx; idx = rig_setting2idx(parm); if (idx >= RIG_SETTING_MAX) return -RIG_EINVAL; *val = priv->parms[idx]; rig_debug(RIG_DEBUG_VERBOSE,"%s called %s\n",__FUNCTION__, rig_strparm(parm)); return RIG_OK; } static int dummy_set_ext_parm(RIG *rig, token_t token, value_t val) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; char lstr[64]; const struct confparams *cfp; struct ext_list *epp; cfp = rig_ext_lookup_tok(rig, token); if (!cfp) return -RIG_EINVAL; switch (token) { case TOK_EP_MAGICPARM: break; default: return -RIG_EINVAL; } switch (cfp->type) { case RIG_CONF_STRING: strcpy(lstr, val.s); break; case RIG_CONF_COMBO: sprintf(lstr, "%d", val.i); break; case RIG_CONF_NUMERIC: sprintf(lstr, "%f", val.f); break; case RIG_CONF_CHECKBUTTON: sprintf(lstr, "%s", val.i ? "ON" : "OFF"); break; case RIG_CONF_BUTTON: lstr[0] = '\0'; break; default: return -RIG_EINTERNAL; } epp = find_ext(priv->ext_parms, token); if (!epp) return -RIG_EINTERNAL; /* store value */ epp->val = val; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s %s\n",__FUNCTION__, cfp->name, lstr); return RIG_OK; } static int dummy_get_ext_parm(RIG *rig, token_t token, value_t *val) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; const struct confparams *cfp; struct ext_list *epp; /* TODO: load value from priv->ext_parms */ cfp = rig_ext_lookup_tok(rig, token); if (!cfp) return -RIG_EINVAL; switch (token) { case TOK_EP_MAGICPARM: break; default: return -RIG_EINVAL; } epp = find_ext(priv->ext_parms, token); if (!epp) return -RIG_EINTERNAL; /* load value */ *val = epp->val; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s\n",__FUNCTION__, cfp->name); return RIG_OK; } static int dummy_set_ant(RIG *rig, vfo_t vfo, ant_t ant) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; curr->ant = ant; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_get_ant(RIG *rig, vfo_t vfo, ant_t *ant) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); *ant = curr->ant; return RIG_OK; } static int dummy_set_bank(RIG *rig, vfo_t vfo, int bank) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; priv->bank = bank; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_set_mem(RIG *rig, vfo_t vfo, int ch) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); if (ch < 0 || ch >= NB_CHAN) return -RIG_EINVAL; if (priv->curr_vfo == RIG_VFO_MEM) priv->curr = &priv->mem[ch]; else priv->curr->channel_num = ch; return RIG_OK; } static int dummy_get_mem(RIG *rig, vfo_t vfo, int *ch) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; *ch = curr->channel_num; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) { rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s %d\n",__FUNCTION__, rig_strscan(scan), ch); /* TODO: change freq, etc. */ return RIG_OK; } static void chan_vfo(channel_t *chan, vfo_t vfo) { chan->vfo = vfo; strcpy(chan->channel_desc, rig_strvfo(vfo)); } static int dummy_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; channel_t *curr = priv->curr; int ret; freq_t freq; shortfreq_t ts; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s\n",__FUNCTION__, rig_strvfop(op)); switch (op) { case RIG_OP_FROM_VFO: /* VFO->MEM */ if (priv->curr_vfo == RIG_VFO_MEM) { int ch = curr->channel_num; copy_chan(curr, priv->last_vfo == RIG_VFO_A ? &priv->vfo_a : &priv->vfo_b); curr->channel_num = ch; curr->channel_desc[0] = '\0'; curr->vfo = RIG_VFO_MEM; } else { channel_t *mem_chan = &priv->mem[curr->channel_num]; copy_chan(mem_chan, curr); mem_chan->channel_num = curr->channel_num; mem_chan->channel_desc[0] = '\0'; mem_chan->vfo = RIG_VFO_MEM; } break; case RIG_OP_TO_VFO: /* MEM->VFO */ if (priv->curr_vfo == RIG_VFO_MEM) { channel_t *vfo_chan = (priv->last_vfo == RIG_VFO_A) ? &priv->vfo_a : &priv->vfo_b; copy_chan(vfo_chan, curr); chan_vfo(vfo_chan, priv->last_vfo); } else { copy_chan(&priv->mem[curr->channel_num], curr); chan_vfo(curr, priv->curr_vfo); } break; case RIG_OP_CPY: /* VFO A = VFO B or VFO B = VFO A */ if (priv->curr_vfo == RIG_VFO_A) { copy_chan(&priv->vfo_b, &priv->vfo_a); chan_vfo(&priv->vfo_b, RIG_VFO_B); break; } else if (priv->curr_vfo == RIG_VFO_B) { copy_chan(&priv->vfo_a, &priv->vfo_b); chan_vfo(&priv->vfo_a, RIG_VFO_A); break; } rig_debug(RIG_DEBUG_VERBOSE,"%s beep!\n", __FUNCTION__ ); break; case RIG_OP_XCHG: /* Exchange VFO A/B */ { channel_t chan; chan.ext_levels = alloc_init_ext(dummy_ext_levels); if (!chan.ext_levels) return -RIG_ENOMEM; copy_chan(&chan, &priv->vfo_b); copy_chan(&priv->vfo_b, &priv->vfo_a); copy_chan(&priv->vfo_a, &chan); chan_vfo(&priv->vfo_a, RIG_VFO_A); chan_vfo(&priv->vfo_b, RIG_VFO_B); free(chan.ext_levels); break; } case RIG_OP_MCL: /* Memory clear */ if (priv->curr_vfo == RIG_VFO_MEM) { struct ext_list *saved_ext_levels = curr->ext_levels; int saved_ch = curr->channel_num; int i; for (i=0; !RIG_IS_EXT_END(curr->ext_levels[i]); i++) { curr->ext_levels[i].val.i = 0; } memset(curr, 0, sizeof(channel_t)); curr->ext_levels = saved_ext_levels; curr->channel_num = saved_ch; curr->vfo = RIG_VFO_MEM; } else { struct ext_list *saved_ext_levels = curr->ext_levels; channel_t *mem_chan = &priv->mem[curr->channel_num]; int i; for (i=0; !RIG_IS_EXT_END(mem_chan->ext_levels[i]); i++) { mem_chan->ext_levels[i].val.i = 0; } memset(mem_chan, 0, sizeof(channel_t)); mem_chan->ext_levels = saved_ext_levels; mem_chan->channel_num = curr->channel_num; mem_chan->vfo = RIG_VFO_MEM; } break; case RIG_OP_TOGGLE: if (priv->curr_vfo == RIG_VFO_A) return dummy_set_vfo(rig, RIG_VFO_B); else if (priv->curr_vfo == RIG_VFO_B) return dummy_set_vfo(rig, RIG_VFO_A); else return -RIG_EVFO; case RIG_OP_RIGHT: case RIG_OP_LEFT: case RIG_OP_TUNE: /* NOP */ break; case RIG_OP_BAND_UP: case RIG_OP_BAND_DOWN: return -RIG_ENIMPL; case RIG_OP_UP: ret = dummy_get_freq(rig, vfo, &freq); if (!ret) break; ret = dummy_get_ts(rig, vfo, &ts); if (!ret) break; ret = dummy_set_freq(rig, vfo, freq+ts); /* up */ break; case RIG_OP_DOWN: ret = dummy_get_freq(rig, vfo, &freq); if (!ret) break; ret = dummy_get_ts(rig, vfo, &ts); if (!ret) break; ret = dummy_set_freq(rig, vfo, freq-ts); /* down */ break; default: break; } return RIG_OK; } static int dummy_set_channel(RIG *rig, const channel_t *chan) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); if (!chan->ext_levels) return -RIG_EINVAL; if (chan->channel_num < 0 || chan->channel_num >= NB_CHAN) return -RIG_EINVAL; /* TODO: * - check ext_levels is the right length */ switch (chan->vfo) { case RIG_VFO_MEM: copy_chan(&priv->mem[chan->channel_num], chan); break; case RIG_VFO_A: copy_chan(&priv->vfo_a, chan); break; case RIG_VFO_B: copy_chan(&priv->vfo_b, chan); break; case RIG_VFO_CURR: copy_chan(priv->curr, chan); break; default: return -RIG_EINVAL; } return RIG_OK; } static int dummy_get_channel(RIG *rig, channel_t *chan) { struct dummy_priv_data *priv = (struct dummy_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); if (chan->channel_num < 0 || chan->channel_num >= NB_CHAN) return -RIG_EINVAL; if (!chan->ext_levels) { chan->ext_levels = alloc_init_ext(dummy_ext_levels); if (!chan->ext_levels) return -RIG_ENOMEM; } /* TODO: * - check ext_levels is the right length */ switch (chan->vfo) { case RIG_VFO_MEM: copy_chan(chan, &priv->mem[chan->channel_num]); break; case RIG_VFO_A: copy_chan(chan, &priv->vfo_a); break; case RIG_VFO_B: copy_chan(chan, &priv->vfo_b); break; case RIG_VFO_CURR: copy_chan(chan, priv->curr); break; default: return -RIG_EINVAL; } return RIG_OK; } static int dummy_set_trn(RIG *rig, int trn) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static int dummy_get_trn(RIG *rig, int *trn) { *trn = RIG_TRN_OFF; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return RIG_OK; } static const char *dummy_get_info(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return "Nothing much (dummy)"; } static int dummy_send_dtmf(RIG *rig, vfo_t vfo, const char *digits) { rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s\n", __FUNCTION__, digits); return RIG_OK; } static int dummy_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); strcpy(digits, "0123456789ABCDEF"); *length = 16; return RIG_OK; } static int dummy_send_morse(RIG *rig, vfo_t vfo, const char *msg) { rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s\n", __FUNCTION__, msg); return RIG_OK; } static int dummy_power2mW(RIG * rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode) { rig_debug(RIG_DEBUG_TRACE, "%s: passed power = %f\n", __func__, power); rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq); rig_debug(RIG_DEBUG_TRACE, "%s: passed mode = %i\n", __func__, mode); /* Pretend this is a 100W radio */ *mwpower = (power * 100000); return RIG_OK; } static int dummy_mW2power(RIG * rig, float *power, unsigned int mwpower, freq_t freq, rmode_t mode) { rig_debug(RIG_DEBUG_TRACE, "%s: passed mwpower = %i\n", __func__, mwpower); rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq); rig_debug(RIG_DEBUG_TRACE, "%s: passed mode = %i\n", __func__, mode); /* Pretend this is a 100W radio */ if (mwpower > 100000) return -RIG_EINVAL; *power = ((float)mwpower / 100000); return RIG_OK; } /* * Dummy rig capabilities. */ #define DUMMY_FUNC (((setting_t)-1)&~(0xc1000000U)) /* has it all */ #define DUMMY_LEVEL (((setting_t)-1)&~(1<<27)) #define DUMMY_PARM ((setting_t)-1) #define DUMMY_VFO_OP 0x7ffffffL #define DUMMY_SCAN 0x7ffffffL #define DUMMY_VFOS (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) #define DUMMY_MODES (RIG_MODE_AM | RIG_MODE_CW | RIG_MODE_RTTY | \ RIG_MODE_SSB | RIG_MODE_FM | RIG_MODE_WFM | \ RIG_MODE_CWR | RIG_MODE_RTTYR) #define DUMMY_MEM_CAP { \ .bank_num = 1, \ .vfo = 1, \ .ant = 1, \ .freq = 1, \ .mode = 1, \ .width = 1, \ .tx_freq = 1, \ .tx_mode = 1, \ .tx_width = 1, \ .split = 1, \ .rptr_shift = 1, \ .rptr_offs = 1, \ .tuning_step = 1, \ .rit = 1, \ .xit = 1, \ .funcs = DUMMY_FUNC, \ .levels = RIG_LEVEL_SET(DUMMY_LEVEL), \ .ctcss_tone = 1, \ .ctcss_sql = 1, \ .dcs_code = 1, \ .dcs_sql = 1, \ .scan_group = 1, \ .flags = 1, \ .channel_desc = 1, \ .ext_levels = 1, \ } const struct rig_caps dummy_caps = { .rig_model = RIG_MODEL_DUMMY, .model_name = "Dummy", .mfg_name = "Hamlib", .version = "0.5", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_OTHER, .targetable_vfo = 0, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_NONE, .has_get_func = DUMMY_FUNC, .has_set_func = DUMMY_FUNC, .has_get_level = DUMMY_LEVEL, .has_set_level = RIG_LEVEL_SET(DUMMY_LEVEL), .has_get_parm = DUMMY_PARM, .has_set_parm = RIG_PARM_SET(DUMMY_PARM), .level_gran = { [LVL_CWPITCH] = { .step = { .i = 10 } } }, .ctcss_list = common_ctcss_list, .dcs_list = full_dcs_list, .chan_list = { { 0, 18, RIG_MTYPE_MEM, DUMMY_MEM_CAP }, { 19, 19, RIG_MTYPE_CALL }, { 20, NB_CHAN-1, RIG_MTYPE_EDGE }, RIG_CHAN_END, }, .scan_ops = DUMMY_SCAN, .vfo_ops = DUMMY_VFO_OP, .transceive = RIG_TRN_OFF, .attenuator = { 10, 20, 30, RIG_DBLST_END, }, .preamp = { 10, RIG_DBLST_END, }, .rx_range_list1 = { {.start=kHz(150),.end=MHz(1500),.modes=DUMMY_MODES, .low_power=-1,.high_power=-1,DUMMY_VFOS, RIG_ANT_1|RIG_ANT_2}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {.start=kHz(150),.end=MHz(1500),.modes=DUMMY_MODES, .low_power=-1,.high_power=-1,DUMMY_VFOS, RIG_ANT_1|RIG_ANT_2}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {DUMMY_MODES,1}, {DUMMY_MODES,RIG_TS_ANY}, RIG_TS_END, }, .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.4)}, {RIG_MODE_CW, Hz(500)}, {RIG_MODE_AM, kHz(8)}, {RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_FM, kHz(8)}, {RIG_MODE_WFM, kHz(230)}, RIG_FLT_END, }, .max_rit = 9990, .max_xit = 9990, .max_ifshift = 10000, .priv = NULL, /* priv */ .extlevels = dummy_ext_levels, .extparms = dummy_ext_parms, .cfgparams = dummy_cfg_params, .rig_init = dummy_init, .rig_cleanup = dummy_cleanup, .rig_open = dummy_open, .rig_close = dummy_close, .set_conf = dummy_set_conf, .get_conf = dummy_get_conf, .set_freq = dummy_set_freq, .get_freq = dummy_get_freq, .set_mode = dummy_set_mode, .get_mode = dummy_get_mode, .set_vfo = dummy_set_vfo, .get_vfo = dummy_get_vfo, .set_powerstat = dummy_set_powerstat, .get_powerstat = dummy_get_powerstat, .set_level = dummy_set_level, .get_level = dummy_get_level, .set_func = dummy_set_func, .get_func = dummy_get_func, .set_parm = dummy_set_parm, .get_parm = dummy_get_parm, .set_ext_level = dummy_set_ext_level, .get_ext_level = dummy_get_ext_level, .set_ext_parm = dummy_set_ext_parm, .get_ext_parm = dummy_get_ext_parm, .get_info = dummy_get_info, .set_ptt = dummy_set_ptt, .get_ptt = dummy_get_ptt, .get_dcd = dummy_get_dcd, .set_rptr_shift = dummy_set_rptr_shift, .get_rptr_shift = dummy_get_rptr_shift, .set_rptr_offs = dummy_set_rptr_offs, .get_rptr_offs = dummy_get_rptr_offs, .set_ctcss_tone = dummy_set_ctcss_tone, .get_ctcss_tone = dummy_get_ctcss_tone, .set_dcs_code = dummy_set_dcs_code, .get_dcs_code = dummy_get_dcs_code, .set_ctcss_sql = dummy_set_ctcss_sql, .get_ctcss_sql = dummy_get_ctcss_sql, .set_dcs_sql = dummy_set_dcs_sql, .get_dcs_sql = dummy_get_dcs_sql, .set_split_freq = dummy_set_split_freq, .get_split_freq = dummy_get_split_freq, .set_split_mode = dummy_set_split_mode, .get_split_mode = dummy_get_split_mode, .set_split_vfo = dummy_set_split_vfo, .get_split_vfo = dummy_get_split_vfo, .set_rit = dummy_set_rit, .get_rit = dummy_get_rit, .set_xit = dummy_set_xit, .get_xit = dummy_get_xit, .set_ts = dummy_set_ts, .get_ts = dummy_get_ts, .set_ant = dummy_set_ant, .get_ant = dummy_get_ant, .set_bank = dummy_set_bank, .set_mem = dummy_set_mem, .get_mem = dummy_get_mem, .vfo_op = dummy_vfo_op, .scan = dummy_scan, .send_dtmf = dummy_send_dtmf, .recv_dtmf = dummy_recv_dtmf, .send_morse = dummy_send_morse, .set_channel = dummy_set_channel, .get_channel = dummy_get_channel, .set_trn = dummy_set_trn, .get_trn = dummy_get_trn, .power2mW = dummy_power2mW, .mW2power = dummy_mW2power, }; DECLARE_INITRIG_BACKEND(dummy) { rig_debug(RIG_DEBUG_VERBOSE, "dummy: _init called\n"); rig_register(&dummy_caps); rig_register(&netrigctl_caps); return RIG_OK; } hamlib-1.2.15.3/dummy/Makefile.in0000644000175000017500000005005712044564551013333 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = dummy DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_dummy_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am_hamlib_dummy_la_OBJECTS = dummy.lo rot_dummy.lo netrigctl.lo \ netrotctl.lo hamlib_dummy_la_OBJECTS = $(am_hamlib_dummy_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_dummy_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_dummy_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_dummy_la_SOURCES) DIST_SOURCES = $(hamlib_dummy_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = hamlib-dummy.la hamlib_dummy_la_SOURCES = dummy.c rot_dummy.c netrigctl.c netrotctl.c hamlib_dummy_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_dummy_la_LIBADD = $(top_builddir)/src/libhamlib.la \ @MATH_LIBS@ noinst_HEADERS = dummy.h rot_dummy.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu dummy/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu dummy/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-dummy.la: $(hamlib_dummy_la_OBJECTS) $(hamlib_dummy_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_dummy_la_LINK) -rpath $(pkglibdir) $(hamlib_dummy_la_OBJECTS) $(hamlib_dummy_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netrigctl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netrotctl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rot_dummy.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/dummy/dummy.h0000644000175000017500000000247312044564477012600 00000000000000/* * Hamlib Dummy backend - main header * Copyright (c) 2001-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _DUMMY_H #define _DUMMY_H 1 #include "hamlib/rig.h" #include "token.h" /* backend conf */ #define TOK_CFG_MAGICCONF TOKEN_BACKEND(1) /* ext_level's and ext_parm's tokens */ #define TOK_EL_MAGICLEVEL TOKEN_BACKEND(1) #define TOK_EL_MAGICFUNC TOKEN_BACKEND(2) #define TOK_EL_MAGICOP TOKEN_BACKEND(3) #define TOK_EP_MAGICPARM TOKEN_BACKEND(4) extern const struct rig_caps dummy_caps; extern const struct rig_caps netrigctl_caps; #endif /* _DUMMY_H */ hamlib-1.2.15.3/dummy/rot_dummy.h0000644000175000017500000000200512044564477013453 00000000000000/* * Hamlib Dummy backend - main header * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROT_DUMMY_H #define _ROT_DUMMY_H 1 extern const struct rot_caps dummy_rot_caps; extern const struct rot_caps netrotctl_caps; #endif /* _ROT_DUMMY_H */ hamlib-1.2.15.3/dummy/netrotctl.c0000644000175000017500000001463712044564477013463 00000000000000/* * Hamlib Netrotctl backend - main file * Copyright (c) 2001-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include "hamlib/rotator.h" #include "iofunc.h" #include "misc.h" #include "rot_dummy.h" #define CMD_MAX 32 #define BUF_MAX 64 /* * Helper function with protocol return code parsing */ static int netrotctl_transaction(ROT *rot, char *cmd, int len, char *buf) { int ret; ret = write_block(&rot->state.rotport, cmd, len); if (ret != RIG_OK) return ret; ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret < 0) return ret; if (!memcmp(buf, NETROTCTL_RET, strlen(NETROTCTL_RET))) return atoi(buf+strlen(NETROTCTL_RET)); return ret; } static int netrotctl_open(ROT *rot) { int ret, len; struct rot_state *rs = &rot->state; int prot_ver; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "\\dump_state\n"); ret = netrotctl_transaction(rot, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; prot_ver = atoi(buf); #define ROTCTLD_PROT_VER 0 if (prot_ver < ROTCTLD_PROT_VER) return -RIG_EPROTO; ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; rs->min_az = atof(buf); ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; rs->max_az = atof(buf); ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; rs->min_el = atof(buf); ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; rs->max_el = atof(buf); return RIG_OK; } static int netrotctl_close(ROT *rot) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); /* clean signoff, no read back */ write_block(&rot->state.rotport, "q\n", 2); return RIG_OK; } static int netrotctl_set_position(ROT *rot, azimuth_t az, elevation_t el) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %f %f\n", __FUNCTION__, az, el); len = sprintf(cmd, "P %f %f\n", az, el); ret = netrotctl_transaction(rot, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrotctl_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "p\n"); ret = netrotctl_transaction(rot, cmd, len, buf); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *az = atof(buf); ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n")); if (ret <= 0) return (ret < 0) ? ret : -RIG_EPROTO; *el = atof(buf); return RIG_OK; } static int netrotctl_stop(ROT *rot) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "S\n"); ret = netrotctl_transaction(rot, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrotctl_park(ROT *rot) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "K\n"); ret = netrotctl_transaction(rot, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrotctl_reset(ROT *rot, rot_reset_t reset) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "R %d\n", reset); ret = netrotctl_transaction(rot, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static int netrotctl_move(ROT *rot, int direction, int speed) { int ret, len; char cmd[CMD_MAX]; char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "M %d %d\n", direction, speed); ret = netrotctl_transaction(rot, cmd, len, buf); if (ret > 0) return -RIG_EPROTO; else return ret; } static const char *netrotctl_get_info(ROT *rot) { int ret, len; char cmd[CMD_MAX]; static char buf[BUF_MAX]; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); len = sprintf(cmd, "_\n"); ret = netrotctl_transaction(rot, cmd, len, buf); if (ret < 0) return NULL; buf [ret] = '\0'; return buf; } /* * NET rotctl capabilities. */ const struct rot_caps netrotctl_caps = { .rot_model = ROT_MODEL_NETROTCTL, .model_name = "NET rotctl", .mfg_name = "Hamlib", .version = "0.3", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_OTHER, .port_type = RIG_PORT_NETWORK, .timeout = 2000, .retry = 3, .min_az = -180., .max_az = 180., .min_el = 0., .max_el = 90., .priv = NULL, /* priv */ /* .rot_init = netrotctl_init, */ /* .rot_cleanup = netrotctl_cleanup, */ .rot_open = netrotctl_open, .rot_close = netrotctl_close, .set_position = netrotctl_set_position, .get_position = netrotctl_get_position, .park = netrotctl_park, .stop = netrotctl_stop, .reset = netrotctl_reset, .move = netrotctl_move, .get_info = netrotctl_get_info, }; hamlib-1.2.15.3/dummy/Makefile.am0000644000175000017500000000043512044564477013324 00000000000000 pkglib_LTLIBRARIES = hamlib-dummy.la hamlib_dummy_la_SOURCES = dummy.c rot_dummy.c netrigctl.c netrotctl.c hamlib_dummy_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_dummy_la_LIBADD = $(top_builddir)/src/libhamlib.la \ @MATH_LIBS@ noinst_HEADERS = dummy.h rot_dummy.h hamlib-1.2.15.3/tests/0000755000175000017500000000000012044565010011335 500000000000000hamlib-1.2.15.3/tests/testctld.pl0000755000175000017500000005642312044564477013475 00000000000000#! /usr/bin/perl # testctld.pl - (C) 2008,2010 Nate Bargmann, n0nb@arrl.net # A Perl test script for the rigctld program. # # # It connects to the rigctld TCP port (default 4532) and queries the daemon # for some common rig information and sets some values. It also aims to # provide a bit of example code for Perl scripting. # # This program utilizes the Extended Response protocol of rigctld in line # response mode. See the rigctld(8) man page for details. ############################################################################# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # See the file 'COPYING' in the main Hamlib distribution directory for the # complete text of the GNU Public License version 2. # ############################################################################# # Perl modules this script uses use warnings; use strict; use IO::Socket; use Getopt::Long; use Pod::Usage; # Global variables my $socket; my $host = 'localhost'; my $port = 4532; my $vfo = ''; my %rig_state = (); # State of the rig--freq, mode, passband, ptt, etc. my %rig_caps = (); # Rig capabilities from \dump_caps my $man = 0; my $help = 0; my $debug = 0; my $user_in; my $ret_val; # Error values returned from rigctld by Hamlib name my %errstr = ( RIG_OK => "0", # No error, operation completed successfully RIG_EINVAL => "-1", # invalid parameter RIG_ECONF => "-2", # invalid configuration (serial,..) RIG_ENOMEM => "-3", # memory shortage RIG_ENIMPL => "-4", # function not implemented, but will be RIG_ETIMEOUT => "-5", # communication timed out RIG_EIO => "-6", # IO error, including open failed RIG_EINTERNAL => "-7", # Internal Hamlib error, huh?! RIG_EPROTO => "-8", # Protocol error RIG_ERJCTED => "-9", # Command rejected by the rig RIG_ETRUNC => "-10", # Command performed, but arg truncated RIG_ENAVAIL => "-11", # function not available RIG_ENTARGET => "-12", # VFO not targetable RIG_BUSERROR => "-13", # Error talking on the bus RIG_BUSBUSY => "-14", # Collision on the bus RIG_EARG => "-15", # NULL RIG handle or any invalid pointer parameter in get arg RIG_EVFO => "-16", # Invalid VFO RIG_EDOM => "-17", # Argument out of domain of func # testctld specific error values from -100 onward CTLD_OK => "-100", # testctld -- No error CTLD_ENIMPL => "-103", # testctld -- %rig_caps reports backend function not implemented CTLD_EPROTO => "-108", # testctld -- Echoed command mismatch or other error ); # Error values returned from rigctld by Hamlib value my %errval = reverse %errstr; ############################################################################# # Main program # ############################################################################# # Parse command line options argv_opts(); # Create the new socket. # 'localhost' may be replaced by any hostname or IP address where a # rigctld instance is running. # Timeout is set to 5 seconds. $socket = new IO::Socket::INET (PeerAddr => $host, PeerPort => $port, Proto => 'tcp', Type => SOCK_STREAM, Timeout => 5 ) or die $@; print "Welcome to testctld.pl a program to test `rigctld'\n"; print "Type '?' or 'help' for commands help.\n\n"; # Populate %rig_caps from \dump_caps $ret_val = dump_caps(); # Tell user what radio rigctld is working with if ($ret_val eq $errstr{'RIG_OK'}) { print "Hamlib Model: " . $rig_caps{'Caps dump for model'} . "\t"; print "Common Name: " . $rig_caps{'Mfg name'} . ' ' . $rig_caps{'Model name'} . "\n\n\n"; } else { errmsg ($ret_val); } # Check rigctld's response to the \chk_vfo command to see if it was # invoked with the -o|--vfo option. If true, all commands must include VFO as # first parameter after the command if (chk_opt($socket, 'CHKVFO')) { $vfo = 'currVFO'; # KISS--One could use the VFO key from %rig_state after calling the \get_vfo command... } # Interactive loop do { print "rigctld command: "; chomp($user_in = <>); # F, \set_freq if ($user_in =~ /^(F|\\set_freq)\s+(\d+)\b$/) { if ($rig_caps{'Can set Frequency'} eq 'Y') { # Get the entered frequency value print "Freq = $2\n" if $debug; $ret_val = rig_cmd('set_freq', $vfo, $2); unless ($ret_val eq $errstr{'RIG_OK'}) { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # f, \get_freq elsif ($user_in =~ /^(f|\\get_freq)\b$/) { if ($rig_caps{'Can get Frequency'} eq 'Y') { # Query rig and process result $ret_val = rig_cmd('get_freq', $vfo); if ($ret_val eq $errstr{'RIG_OK'}) { print "Frequency: " . $rig_state{Frequency} . "\n\n"; } else { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # M, \set_mode elsif ($user_in =~ /^(M|\\set_mode)\s+([A-Z]+)\s+(\d+)\b$/) { if ($rig_caps{'Can set Mode'} eq 'Y') { # Get the entered mode and passband values print "Mode = $2, Passband = $3\n" if $debug; $ret_val = rig_cmd('set_mode', $vfo, $2, $3); unless ($ret_val eq $errstr{'RIG_OK'}) { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # m, \get_mode elsif ($user_in =~ /^(m|\\get_mode)\b$/) { if ($rig_caps{'Can get Mode'} eq 'Y') { # Do the same for the mode (reading the mode also returns the bandwidth) $ret_val = rig_cmd('get_mode', $vfo); if ($ret_val eq $errstr{'RIG_OK'}) { print "Mode: " . $rig_state{Mode} . "\n"; print "Passband: " . $rig_state{Passband} . "\n\n"; } else { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # V, \set_vfo elsif ($user_in =~ /^(V|\\set_vfo)\s+([A-Za-z]+)\b$/) { if ($rig_caps{'Can set VFO'} eq 'Y') { print "VFO = $2\n" if $debug; $ret_val = rig_cmd('set_vfo', $2); # $vfo not used! unless ($ret_val eq $errstr{'RIG_OK'}) { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # v, \get_vfo elsif ($user_in =~ /^(v|\\get_vfo)\b$/) { if ($rig_caps{'Can get VFO'} eq 'Y') { $ret_val = rig_cmd('get_vfo', $vfo); if ($ret_val eq $errstr{'RIG_OK'}) { print "VFO: " . $rig_state{VFO} . "\n\n"; } else { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # J, \set_rit elsif ($user_in =~ /^(J|\\set_rit)\s+([+-]?\d+)\b$/) { if ($rig_caps{'Can set RIT'} eq 'Y') { print "RIT freq = $2\n" if $debug; $ret_val = rig_cmd('set_rit', $vfo, $2); unless ($ret_val eq $errstr{'RIG_OK'}) { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # j, \get_rit elsif ($user_in =~ /^(j|\\get_rit)\b$/) { if ($rig_caps{'Can get RIT'} eq 'Y') { $ret_val = rig_cmd('get_rit', $vfo); if ($ret_val eq $errstr{'RIG_OK'}) { print "RIT: " . $rig_state{RIT} . "\n\n"; } else { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # Z, \set_xit elsif ($user_in =~ /^(Z|\\set_xit)\s+([+-]?\d+)\b$/) { if ($rig_caps{'Can set XIT'} eq 'Y') { print "XIT freq = $2\n" if $debug; $ret_val = rig_cmd('set_xit', $vfo, $2); unless ($ret_val eq $errstr{'RIG_OK'}) { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # z, \get_xit elsif ($user_in =~ /^(z|\\get_xit)\b$/) { if ($rig_caps{'Can get XIT'} eq 'Y') { $ret_val = rig_cmd('get_xit', $vfo); if ($ret_val eq $errstr{'RIG_OK'}) { print "XIT: " . $rig_state{XIT} . "\n\n"; } else { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # T, \set_ptt elsif ($user_in =~ /^(T|\\set_ptt)\s+(\d)\b$/) { if ($rig_caps{'Can set PTT'} eq 'Y') { print "PTT = $2\n" if $debug; $ret_val = rig_cmd('set_ptt', $vfo, $2); unless ($ret_val eq $errstr{'RIG_OK'}) { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # t, \get_ptt elsif ($user_in =~ /^(t|\\get_ptt)\b$/) { if ($rig_caps{'Can get PTT'} eq 'Y') { $ret_val = rig_cmd('get_ptt', $vfo); if ($ret_val eq $errstr{'RIG_OK'}) { print "PTT: " . $rig_state{PTT} . "\n\n"; } else { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # S, \set_split_vfo elsif ($user_in =~ /^(S|\\set_split_vfo)\s+(\d)\s+([A-Za-z]+)\b$/) { if ($rig_caps{'Can set Split VFO'} eq 'Y') { print "split = $2, VFO = $3\n" if $debug; $ret_val = rig_cmd('set_split_vfo', $vfo, $2, $3); unless ($ret_val eq $errstr{'RIG_OK'}) { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # s, \get_split_vfo elsif ($user_in =~ /^(s|\\get_split_vfo)\b$/) { if ($rig_caps{'Can get Split VFO'} eq 'Y') { $ret_val = rig_cmd('get_split_vfo', $vfo); if ($ret_val eq $errstr{'RIG_OK'}) { print "Split: " . $rig_state{Split} . "\n"; print "TX VFO: " . $rig_state{'TX VFO'} . "\n\n"; } else { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # I, \set_split_freq elsif ($user_in =~ /^(I|\\set_split_freq)\s+(\d+)\b$/) { if ($rig_caps{'Can set Split Freq'} eq 'Y') { print "TX VFO freq = $2\n" if $debug; $ret_val = rig_cmd('set_split_freq', $vfo, $2); unless ($ret_val eq $errstr{'RIG_OK'}) { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # i, \get_split_freq elsif ($user_in =~ /^(i|\\get_split_freq)\b$/) { if ($rig_caps{'Can get Split Freq'} eq 'Y') { $ret_val = rig_cmd('get_split_freq', $vfo); if ($ret_val eq $errstr{'RIG_OK'}) { print "TX Frequency: " . $rig_state{'TX Frequency'} . "\n\n"; } else { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # X, \set_split_mode elsif ($user_in =~ /^(X|\\set_split_mode)\s+([A-Z]+)\s+(\d+)\b$/) { if ($rig_caps{'Can set Split Mode'} eq 'Y') { # Get the entered mode and passband values print "TX Mode = $2, TX Passband = $3\n" if $debug; $ret_val = rig_cmd('set_split_mode', $vfo, $2, $3); unless ($ret_val eq $errstr{'RIG_OK'}) { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # x, \get_split_mode elsif ($user_in =~ /^(x|\\get_split_mode)\b$/) { if ($rig_caps{'Can get Split Mode'} eq 'Y') { # Do the same for the mode (reading the mode also returns the bandwidth) $ret_val = rig_cmd('get_split_mode', $vfo); if ($ret_val eq $errstr{'RIG_OK'}) { print "TX Mode: " . $rig_state{'TX Mode'} . "\n"; print "TX Passband: " . $rig_state{'TX Passband'} . "\n\n"; } else { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # 2, \power2mW elsif ($user_in =~ /^(2|\\power2mW)\s+(\d\.\d+)\s+(\d+)\s+([A-Za-z]+)\b$/) { if ($rig_caps{'Can get power2mW'} eq 'Y') { print "Power = $2, freq = $3, VFO = $4\n" if $debug; $ret_val = rig_cmd('power2mW', $2, $3, $4); if ($ret_val eq $errstr{'RIG_OK'}) { print "Power mW: " . $rig_state{'Power mW'} . "\n"; } else { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # 4, \mW2power elsif ($user_in =~ /^(4|\\mW2power)\s+(\d+)\s+(\d+)\s+([A-Za-z]+)\b$/) { if ($rig_caps{'Can get mW2power'} eq 'Y') { print "mW = $2, freq = $3, VFO = $4\n" if $debug; $ret_val = rig_cmd('mW2power', $2, $3, $4); if ($ret_val eq $errstr{'RIG_OK'}) { print "Power [0.0..1.0]: " . $rig_state{'Power [0.0..1.0]'} . "\n"; } else { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # 1, \dump_caps elsif ($user_in =~ /^(1|\\dump_caps)\b$/) { $ret_val = dump_caps(); if ($ret_val eq $errstr{'RIG_OK'}) { print "Model: " . $rig_caps{'Caps dump for model'} . "\n"; print "Manufacturer: " . $rig_caps{'Mfg name'} . "\n"; print "Name: " . $rig_caps{'Model name'} . "\n\n"; } else { errmsg ($ret_val); } } # ?, help elsif ($user_in =~ /^\?|^help\b$/) { print <) { # rigctld terminates each line with '\n' chomp; push @lines, $_; return @lines if $_ =~ /^RPRT/; } } # Builds the %rig_state hash from the lines returned by rigctld which are of the # form "Frequency: 14250000", "Mode: USB", "Passband: 2400", etc. sub get_state { my ($key, $val); foreach (@_) { ($key, $val) = split(/: /, $_); $rig_state{$key} = $val; } } # Parse the (large) \dump_caps command response into %rig_caps. # TODO: process all lines of output sub get_caps { my ($key, $val); foreach (@_) { if (($_ =~ /^Caps .*:/) or ($_ =~ /^Model .*:/) or ($_ =~ /^Mfg .*:/) or ($_ =~ /^Can .*:/) ) { ($key, $val) = split(/:\s+/, $_); $rig_caps{$key} = $val; } } } # Extract the Hamlib error value returned with the last line from rigctld sub get_errno { chomp @_; my @errno = split(/ /, $_[0]); return $errno[1]; } # check for VFO mode from rigctld sub chk_opt { my $sock = shift @_; my @lines; if ($_[0] =~ /^CHKVFO/) { print $sock "\\chk_vfo\n"; } while (<$sock>) { # rigctld terminates each line with '\n' chomp; push @lines, $_; # Should only be one line, but be sure last if $_ =~ /^$_[0]/; } # The CHK* line will have a space separated interger of 0 or 1 # for `rigctld' invocation without and with -b|--block or # -o|--vfo options respectively foreach (@lines) { if ($_ =~ /^$_[0]\s(\d)/) { return $1; } } } # FIXME: Better argument handling sub errmsg { unless (($_[0] eq $errstr{'CTLD_EPROTO'}) or ($_[0] eq $errstr{'CTLD_ENIMPL'})) { print "rigctld returned Hamlib $errval{$_[0]}\n\n"; } elsif ($_[0] eq $errstr{'CTLD_EPROTO'}) { print "Echoed command mismatch\n\n"; } elsif ($_[0] eq $errstr{'CTLD_ENIMPL'}) { print "Function not yet implemented in Hamlib rig backend\n\n"; } } # Parse the command line for supported options. Print help text as needed. sub argv_opts { # Parse options and print usage if there is a syntax error, # or if usage was explicitly requested. GetOptions('help|?' => \$help, man => \$man, "port=i" => \$port, "host=s" => \$host, debug => \$debug ) or pod2usage(2); pod2usage(1) if $help; pod2usage(-verbose => 2) if $man; } # POD for pod2usage __END__ =head1 NAME testctld.pl - A test and example program for `rigctld' written in Perl. =head1 SYNOPSIS testctld.pl [options] Options: --host Hostname or IP address of target `rigctld' process --port TCP Port of target `rigctld' process --help Brief help message --man Full documentation --debug Enable debugging output =head1 DESCRIPTION B provides a set of functions to interactively test the Hamlib I TCP/IP network daemon. It also aims to be an example of programming code to control a radio via TCP/IP in Hamlib. =head1 OPTIONS =over 8 =item B<--host> Hostname or IP address of the target I process. Default is I which should resolve to 127.0.0.1 if I is configured correctly. =item B<--port> TCP port of the target I process. Default is 4532. Mutliple instances of I will require unique port numbers. =item B<--help> Prints a brief help message and exits. =item B<--man> Prints this manual page and exits. =item B<--debug> Enables debugging output to the console. =back =head1 COMMANDS Commands are the same as described in the rigctld(8) man page. This is only a brief summary. F, \set_freq Set frequency in Hz f, \get_freq Get frequency in Hz M, \set_mode Set mode including passband in Hz m, \get_mode Get mode including passband in Hz V, \set_vfo Set VFO (VFOA, VFOB, etc.) v, \get_vfo Get VFO (VFOA, VFOB, etc.) J, \set_rit Set RIT in +/-Hz, '0' to clear j, \get_rit Get RIT in +/-Hz, '0' indicates Off Z, \set_xit Set XIT in +/-Hz, '0' to clear z, \get_rit Get XIT in +/-Hz, '0' indicates Off T, \set_ptt Set PTT, '1' On, '0' Off t, \get_ptt Get PTT, '1' indicates On, '0' indicates Off S, \set_split_vfo Set rig into "split" VFO mode, '1' On, '0' Off s, \get_split_vfo Get status of :split" VFO mode, '1' On, '0' Off I, \set_split_freq Set TX VFO frequency in Hz i, \get_split_freq Get TX VFO frequency in Hz X, \set_split_mode Set TX VFO mode including passband in Hz x, \get_split_mode Get TX VFO mode including passband in Hz 2, \power2mW Translate a power value [0.0..1.0] to milliWatts 4, \mW2power Translate milliWatts to a power value [0.0..1.0] 1, \dump_caps Get the rig capabilities and display select values. =cut hamlib-1.2.15.3/tests/testbcd.c0000644000175000017500000000220112044564477013064 00000000000000 /* * Very simple test program to check BCD convertion against some other --SF * This is mainly to test freq2bcd and bcd2freq functions. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "misc.h" #define MAXDIGITS 32 int main (int argc, char *argv[]) { unsigned char b[(MAXDIGITS+1)/2]; freq_t f=0; int digits = 10; int i; if (argc != 2 && argc != 3) { fprintf(stderr,"Usage: %s [digits]\n",argv[0]); exit(1); } f = (freq_t)atoll(argv[1]); if (argc > 2) { digits = atoi(argv[2]); if (digits > MAXDIGITS) exit(1); } printf("Little Endian mode\n"); printf("Frequency: %"PRIfreq"\n",f); to_bcd(b, f, digits); printf("BCD: %2.2x",b[0]); for (i = 1; i < (digits+1)/2; i++) printf(",%2.2x",b[i]); printf("\nResult after recoding: %"SCNll"\n", from_bcd(b, digits)); printf("\nBig Endian mode\n"); printf("Frequency: %"PRIfreq"\n",f); to_bcd_be(b, f, digits); printf("BCD: %2.2x",b[0]); for (i = 1; i < (digits+1)/2; i++) printf(",%2.2x",b[i]); printf("\nResult after recoding: %"SCNll"\n", from_bcd_be(b, digits)); return 0; } hamlib-1.2.15.3/tests/rotctl.c0000644000175000017500000001505712044564477012760 00000000000000/* * rotctl.c - (C) Stephane Fillod 2000-2010 * * This program test/control a rotator using Hamlib. * It takes commands in interactive mode as well as * from command line options. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include "misc.h" #include "rotctl_parse.h" /* * Prototypes */ void usage(); /* * Reminder: when adding long options, * keep up to date SHORT_OPTIONS, usage()'s output and man page. thanks. * NB: do NOT use -W since it's reserved by POSIX. * TODO: add an option to read from a file */ #define SHORT_OPTIONS "m:r:s:C:t:LvhVlu" static struct option long_options[] = { {"model", 1, 0, 'm'}, {"rot-file", 1, 0, 'r'}, {"serial-speed", 1, 0, 's'}, {"send-cmd-term", 1, 0, 't'}, {"list", 0, 0, 'l'}, {"set-conf", 1, 0, 'C'}, {"show-conf",0, 0, 'L'}, {"dump-caps",0, 0, 'u'}, {"verbose", 0, 0, 'v'}, {"help", 0, 0, 'h'}, {"version", 0, 0, 'V'}, {0, 0, 0, 0} }; #define MAXCONFLEN 128 int interactive = 1; /* if no cmd on command line, switch to interactive */ int prompt = 1; /* Print prompt in rotctl */ int opt_end= 0 ; /* only used by rotctld */ char send_cmd_term = '\r'; /* send_cmd termination char */ int main (int argc, char *argv[]) { ROT *my_rot; /* handle to rot (instance) */ rot_model_t my_model = ROT_MODEL_DUMMY; int retcode; /* generic return code from functions */ int exitcode; int verbose = 0; int show_conf = 0; int dump_caps_opt = 0; const char *rot_file=NULL; int serial_rate = 0; char conf_parms[MAXCONFLEN] = ""; while(1) { int c; int option_index = 0; c = getopt_long (argc, argv, SHORT_OPTIONS, long_options, &option_index); if (c == -1) break; switch(c) { case 'h': usage(); exit(0); case 'V': version(); exit(0); case 'm': if (!optarg) { usage(); /* wrong arg count */ exit(1); } my_model = atoi(optarg); break; case 'r': if (!optarg) { usage(); /* wrong arg count */ exit(1); } rot_file = optarg; break; case 's': if (!optarg) { usage(); /* wrong arg count */ exit(1); } serial_rate = atoi(optarg); break; case 'C': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (*conf_parms != '\0') strcat(conf_parms, ","); strncat(conf_parms, optarg, MAXCONFLEN-strlen(conf_parms)); break; case 't': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (strlen(optarg) > 1) send_cmd_term = strtol(optarg, NULL, 0); else send_cmd_term = optarg[0]; break; case 'v': verbose++; break; case 'L': show_conf++; break; case 'l': rig_set_debug(0); list_models(); exit(0); case 'u': dump_caps_opt++; break; default: usage(); /* unknown option? */ exit(1); } } rig_set_debug(verbose); rig_debug(RIG_DEBUG_VERBOSE, "rotctl, %s\n", hamlib_version); rig_debug(RIG_DEBUG_VERBOSE, "Report bugs to " "\n\n"); /* * at least one command on command line, * disable interactive mode */ if (optind < argc) interactive = 0; my_rot = rot_init(my_model); if (!my_rot) { fprintf(stderr, "Unknown rot num %d, or initialization error.\n", my_model); fprintf(stderr, "Please check with --list option.\n"); exit(2); } retcode = set_conf(my_rot, conf_parms); if (retcode != RIG_OK) { fprintf(stderr, "Config parameter error: %s\n", rigerror(retcode)); exit(2); } if (rot_file) strncpy(my_rot->state.rotport.pathname, rot_file, FILPATHLEN - 1); /* FIXME: bound checking and port type == serial */ if (serial_rate != 0) my_rot->state.rotport.parm.serial.rate = serial_rate; /* * print out conf parameters */ if (show_conf) { rot_token_foreach(my_rot, print_conf_list, (rig_ptr_t)my_rot); } /* * print out capabilities, and exists immediately * We may be interested only in caps, and rig_open may fail. */ if (dump_caps_opt) { dumpcaps_rot(my_rot, stdout); rot_cleanup(my_rot); /* if you care about memory */ exit(0); } retcode = rot_open(my_rot); if (retcode != RIG_OK) { fprintf(stderr,"rot_open: error = %s \n", rigerror(retcode)); exit(2); } if (verbose > 0) printf("Opened rot model %d, '%s'\n", my_rot->caps->rot_model, my_rot->caps->model_name); rig_debug(RIG_DEBUG_VERBOSE, "Backend version: %s, Status: %s\n", my_rot->caps->version, rig_strstatus(my_rot->caps->status)); exitcode = 0; do { retcode = rotctl_parse(my_rot, stdin, stdout, argv, argc); if (retcode == 2) exitcode = 2; } while (retcode == 0 || retcode == 2); rot_close(my_rot); /* close port */ rot_cleanup(my_rot); /* if you care about memory */ return exitcode; } void usage() { printf("Usage: rotctl [OPTION]... [COMMAND]...\n" "Send COMMANDs to a connected antenna rotator.\n\n"); printf( " -m, --model=ID select rotator model number. See model list\n" " -r, --rot-file=DEVICE set device of the rotator to operate on\n" " -s, --serial-speed=BAUD set serial speed of the serial port\n" " -t, --send-cmd-term=CHAR set send_cmd command termination char\n" " -C, --set-conf=PARM=VAL set config parameters\n" " -L, --show-conf list all config parameters\n" " -l, --list list all model numbers and exit\n" " -u, --dump-caps dump capabilities and exit\n" " -v, --verbose set verbose mode, cumulative\n" " -h, --help display this help and exit\n" " -V, --version output version information and exit\n\n" ); usage_rot(stdout); printf("\nReport bugs to .\n"); } hamlib-1.2.15.3/tests/testtrn.c0000644000175000017500000000356412044564477013154 00000000000000/* * Hamlib sample program to test transceive mode (async event) */ #include #include #include #include #include #define SERIAL_PORT "/dev/ttyS0" int myfreq_event(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg) { int *count_ptr = (int *) arg; printf("Rig changed freq to %"PRIfreq"Hz\n", freq); *count_ptr += 1; return 0; } int main (int argc, char *argv[]) { RIG *my_rig; /* handle to rig (nstance) */ int retcode; /* generic return code from functions */ int i, count = 0; if (argc != 2) { fprintf(stderr,"%s \n", argv[0]); exit(1); } printf("testrig:hello, I am your main() !\n"); /* * allocate memory, setup & open port */ my_rig = rig_init(atoi(argv[1])); if (!my_rig) { fprintf(stderr,"Unknown rig num: %d\n",atoi(argv[1])); fprintf(stderr,"Please check riglist.h\n"); exit(1); /* whoops! something went wrong (mem alloc?) */ } strncpy(my_rig->state.rigport.pathname, SERIAL_PORT, FILPATHLEN - 1); if (rig_open(my_rig)) exit(2); printf("Port %s opened ok\n", SERIAL_PORT); /* * Below are examples of set/get routines. * Must add checking of functionality map prior to command execution -- FS * */ retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 439700000); if (retcode != RIG_OK ) { printf("rig_set_freq: error = %s \n", rigerror(retcode)); } rig_set_freq_callback(my_rig, myfreq_event, (rig_ptr_t)&count); retcode = rig_set_trn(my_rig, RIG_TRN_RIG); if (retcode != RIG_OK ) { printf("rig_set_trn: error = %s \n", rigerror(retcode)); } for (i=0;i<12;i++) { printf("Loop count: %d\n", i); sleep(10); /* or anything smarter */ } printf("Frequency changed %d times\n", count); rig_close(my_rig); /* close port */ rig_cleanup(my_rig); /* if you care about memory */ printf("port %s closed ok \n",SERIAL_PORT); return 0; } hamlib-1.2.15.3/tests/rigctl_parse.c0000644000175000017500000015726512044564477014137 00000000000000/* * rigctl_parse.c - (C) Stephane Fillod 2000-2011 * (C) Terry Embry 2008-2009 * (C) The Hamlib Group 2010 * * This program tests/controls a radio using Hamlib. * It takes commands in interactive mode as well as * from command line options. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include "misc.h" #include "iofunc.h" #include "serial.h" #include "sprintflst.h" #include "rigctl_parse.h" /* Hash table implementation See: http://uthash.sourceforge.net/ */ #include "uthash.h" #ifdef HAVE_PTHREAD #include static pthread_mutex_t rig_mutex = PTHREAD_MUTEX_INITIALIZER; #endif #define MAXNAMSIZ 32 #define MAXNBOPT 100 /* max number of different options */ #define ARG_IN1 0x01 #define ARG_OUT1 0x02 #define ARG_IN2 0x04 #define ARG_OUT2 0x08 #define ARG_IN3 0x10 #define ARG_OUT3 0x20 #define ARG_IN4 0x40 #define ARG_OUT4 0x80 #define ARG_IN_LINE 0x4000 #define ARG_NOVFO 0x8000 #define ARG_IN (ARG_IN1|ARG_IN2|ARG_IN3|ARG_IN4) #define ARG_OUT (ARG_OUT1|ARG_OUT2|ARG_OUT3|ARG_OUT4) struct test_table { unsigned char cmd; const char *name; int (*rig_routine)(RIG*, FILE*, FILE*, int, const struct test_table*, vfo_t, const char*, const char*, const char*); int flags; const char *arg1; const char *arg2; const char *arg3; const char *arg4; }; #define CHKSCN1ARG(a) if ((a) != 1) return -RIG_EINVAL; else do {} while(0) #define declare_proto_rig(f) static int (f)(RIG *rig, FILE *fout, FILE *fin, int interactive, \ const struct test_table *cmd, vfo_t vfo, const char *arg1, \ const char *arg2, const char *arg3) declare_proto_rig(set_freq); declare_proto_rig(get_freq); declare_proto_rig(set_rit); declare_proto_rig(get_rit); declare_proto_rig(set_xit); declare_proto_rig(get_xit); declare_proto_rig(set_mode); declare_proto_rig(get_mode); declare_proto_rig(set_vfo); declare_proto_rig(get_vfo); declare_proto_rig(set_ptt); declare_proto_rig(get_ptt); declare_proto_rig(get_ptt); declare_proto_rig(get_dcd); declare_proto_rig(set_rptr_shift); declare_proto_rig(get_rptr_shift); declare_proto_rig(set_rptr_offs); declare_proto_rig(get_rptr_offs); declare_proto_rig(set_ctcss_tone); declare_proto_rig(get_ctcss_tone); declare_proto_rig(set_dcs_code); declare_proto_rig(get_dcs_code); declare_proto_rig(set_ctcss_sql); declare_proto_rig(get_ctcss_sql); declare_proto_rig(set_dcs_sql); declare_proto_rig(get_dcs_sql); declare_proto_rig(set_split_freq); declare_proto_rig(get_split_freq); declare_proto_rig(set_split_mode); declare_proto_rig(get_split_mode); declare_proto_rig(set_split_vfo); declare_proto_rig(get_split_vfo); declare_proto_rig(set_ts); declare_proto_rig(get_ts); declare_proto_rig(power2mW); declare_proto_rig(mW2power); declare_proto_rig(set_level); declare_proto_rig(get_level); declare_proto_rig(set_func); declare_proto_rig(get_func); declare_proto_rig(set_parm); declare_proto_rig(get_parm); declare_proto_rig(set_bank); declare_proto_rig(set_mem); declare_proto_rig(get_mem); declare_proto_rig(vfo_op); declare_proto_rig(scan); declare_proto_rig(set_channel); declare_proto_rig(get_channel); declare_proto_rig(set_trn); declare_proto_rig(get_trn); declare_proto_rig(get_info); declare_proto_rig(dump_caps); declare_proto_rig(dump_conf); declare_proto_rig(dump_state); declare_proto_rig(set_ant); declare_proto_rig(get_ant); declare_proto_rig(reset); declare_proto_rig(send_morse); declare_proto_rig(send_cmd); declare_proto_rig(set_powerstat); declare_proto_rig(get_powerstat); declare_proto_rig(send_dtmf); declare_proto_rig(recv_dtmf); declare_proto_rig(chk_vfo); declare_proto_rig(halt); /* * convention: upper case cmd is set, lowercase is get * * TODO: add missing rig_set_/rig_get_: sql, dcd, etc. * NB: 'q' 'Q' '?' are reserved by interactive mode interface * do NOT use -W since it's reserved by POSIX. * * Available alphabetic letters: -.--------K-----*-----W-Y- */ static struct test_table test_list[] = { { 'F', "set_freq", set_freq, ARG_IN, "Frequency" }, { 'f', "get_freq", get_freq, ARG_OUT, "Frequency" }, { 'M', "set_mode", set_mode, ARG_IN, "Mode", "Passband" }, { 'm', "get_mode", get_mode, ARG_OUT, "Mode", "Passband" }, { 'I', "set_split_freq", set_split_freq, ARG_IN, "TX Frequency" }, { 'i', "get_split_freq", get_split_freq, ARG_OUT, "TX Frequency" }, { 'X', "set_split_mode", set_split_mode, ARG_IN, "TX Mode", "TX Passband" }, { 'x', "get_split_mode", get_split_mode, ARG_OUT, "TX Mode", "TX Passband" }, { 'S', "set_split_vfo", set_split_vfo, ARG_IN, "Split", "TX VFO" }, { 's', "get_split_vfo", get_split_vfo, ARG_OUT, "Split", "TX VFO" }, { 'N', "set_ts", set_ts, ARG_IN, "Tuning Step" }, { 'n', "get_ts", get_ts, ARG_OUT, "Tuning Step" }, { 'L', "set_level", set_level, ARG_IN, "Level", "Level Value" }, { 'l', "get_level", get_level, ARG_IN1|ARG_OUT2, "Level", "Level Value" }, { 'U', "set_func", set_func, ARG_IN, "Func", "Func Status" }, { 'u', "get_func", get_func, ARG_IN1|ARG_OUT2, "Func", "Func Status" }, { 'P', "set_parm", set_parm, ARG_IN|ARG_NOVFO, "Parm", "Parm Value" }, { 'p', "get_parm", get_parm, ARG_IN1|ARG_OUT2|ARG_NOVFO, "Parm", "Parm Value" }, { 'G', "vfo_op", vfo_op, ARG_IN, "Mem/VFO Op" }, { 'g', "scan", scan, ARG_IN, "Scan Fct", "Scan Channel" }, { 'A', "set_trn", set_trn, ARG_IN|ARG_NOVFO, "Transceive" }, { 'a', "get_trn", get_trn, ARG_OUT|ARG_NOVFO, "Transceive" }, { 'R', "set_rptr_shift", set_rptr_shift, ARG_IN, "Rptr Shift" }, { 'r', "get_rptr_shift", get_rptr_shift, ARG_OUT, "Rptr Shift" }, { 'O', "set_rptr_offs", set_rptr_offs, ARG_IN, "Rptr Offset" }, { 'o', "get_rptr_offs", get_rptr_offs, ARG_OUT, "Rptr Offset" }, { 'C', "set_ctcss_tone", set_ctcss_tone, ARG_IN, "CTCSS Tone" }, { 'c', "get_ctcss_tone", get_ctcss_tone, ARG_OUT, "CTCSS Tone" }, { 'D', "set_dcs_code", set_dcs_code, ARG_IN, "DCS Code" }, { 'd', "get_dcs_code", get_dcs_code, ARG_OUT, "DCS Code" }, { 0x90, "set_ctcss_sql", set_ctcss_sql, ARG_IN, "CTCSS Sql" }, { 0x91, "get_ctcss_sql", get_ctcss_sql, ARG_OUT, "CTCSS Sql" }, { 0x92, "set_dcs_sql", set_dcs_sql, ARG_IN, "DCS Sql" }, { 0x93, "get_dcs_sql", get_dcs_sql, ARG_OUT, "DCS Sql" }, { 'V', "set_vfo", set_vfo, ARG_IN|ARG_NOVFO, "VFO" }, { 'v', "get_vfo", get_vfo, ARG_OUT, "VFO" }, { 'T', "set_ptt", set_ptt, ARG_IN, "PTT" }, { 't', "get_ptt", get_ptt, ARG_OUT, "PTT" }, { 'E', "set_mem", set_mem, ARG_IN, "Memory#" }, { 'e', "get_mem", get_mem, ARG_OUT, "Memory#" }, { 'H', "set_channel", set_channel, ARG_IN|ARG_NOVFO, "Channel" }, { 'h', "get_channel", get_channel, ARG_IN|ARG_NOVFO, "Channel" }, { 'B', "set_bank", set_bank, ARG_IN, "Bank" }, { '_', "get_info", get_info, ARG_OUT|ARG_NOVFO, "Info" }, { 'J', "set_rit", set_rit, ARG_IN, "RIT" }, { 'j', "get_rit", get_rit, ARG_OUT, "RIT" }, { 'Z', "set_xit", set_xit, ARG_IN, "XIT" }, { 'z', "get_xit", get_xit, ARG_OUT, "XIT" }, { 'Y', "set_ant", set_ant, ARG_IN, "Antenna" }, { 'y', "get_ant", get_ant, ARG_OUT, "Antenna" }, { 0x87, "set_powerstat", set_powerstat, ARG_IN|ARG_NOVFO, "Power Status" }, { 0x88, "get_powerstat", get_powerstat, ARG_OUT|ARG_NOVFO, "Power Status" }, { 0x89, "send_dtmf", send_dtmf, ARG_IN, "Digits" }, { 0x8a, "recv_dtmf", recv_dtmf, ARG_OUT, "Digits" }, { '*', "reset", reset, ARG_IN, "Reset" }, { 'w', "send_cmd", send_cmd, ARG_IN1|ARG_IN_LINE|ARG_OUT2|ARG_NOVFO, "Cmd", "Reply" }, { 'b', "send_morse", send_morse, ARG_IN|ARG_IN_LINE, "Morse" }, { 0x8b, "get_dcd", get_dcd, ARG_OUT, "DCD" }, { '2', "power2mW", power2mW, ARG_IN1|ARG_IN2|ARG_IN3|ARG_OUT1|ARG_NOVFO, "Power [0.0..1.0]", "Frequency", "Mode", "Power mW" }, { '4', "mW2power", mW2power, ARG_IN1|ARG_IN2|ARG_IN3|ARG_OUT1|ARG_NOVFO, "Power mW", "Frequency", "Mode", "Power [0.0..1.0]" }, { '1', "dump_caps", dump_caps, ARG_NOVFO }, { '3', "dump_conf", dump_conf, ARG_NOVFO }, { 0x8f,"dump_state", dump_state, ARG_OUT|ARG_NOVFO }, { 0xf0,"chk_vfo", chk_vfo, ARG_NOVFO }, /* rigctld only--check for VFO mode */ { 0xf1,"halt", halt, ARG_NOVFO }, /* rigctld only--halt the daemon */ { 0x00, "", NULL }, }; static struct test_table *find_cmd_entry(int cmd) { int i; for (i = 0; i < MAXNBOPT && test_list[i].cmd != 0x00; i++) if (test_list[i].cmd == cmd) break; if (i >= MAXNBOPT || test_list[i].cmd == 0x00) return NULL; return &test_list[i]; } /* Structure for hash table provided by uthash.h * * Structure and hash funtions patterned after/copied from example.c * distributed with the uthash package. See: http://uthash.sourceforge.net/ */ struct mod_lst { int id; /* caps->rig_model This is the hash key */ char mfg_name[32]; /* caps->mfg_name */ char model_name[32]; /* caps->model_name */ char version[32]; /* caps->version */ char status[32]; /* caps->status */ UT_hash_handle hh; /* makes this structure hashable */ }; /* Hash declaration. Must be initialized to NULL */ struct mod_lst *models = NULL; /* Add model information to the hash */ void hash_add_model(int id, const char *mfg_name, const char *model_name, const char *version, const char *status) { struct mod_lst *s; s = (struct mod_lst*)malloc(sizeof(struct mod_lst)); s->id = id; snprintf(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name); snprintf(s->model_name, sizeof(s->model_name), "%s", model_name); snprintf(s->version, sizeof(s->version), "%s", version); snprintf(s->status, sizeof(s->status), "%s", status); HASH_ADD_INT(models, id, s); /* id: name of key field */ } /* Hash sorting functions */ int hash_model_id_sort(struct mod_lst *a, struct mod_lst *b) { return (a->id - b->id); } void hash_sort_by_model_id() { HASH_SORT(models, hash_model_id_sort); } /* Delete hash */ void hash_delete_all() { struct mod_lst *current_model, *tmp; HASH_ITER(hh, models, current_model, tmp) { HASH_DEL(models, current_model); /* delete it (models advances to next) */ free(current_model); /* free it */ } } /* * TODO: use Lex? */ static char parse_arg(const char *arg) { int i; for (i = 0; i < MAXNBOPT && test_list[i].cmd != 0; i++) if (!strncmp(arg, test_list[i].name, MAXNAMSIZ)) return test_list[i].cmd; return 0; } /* * This scanf works even in presence of signals (timer, SIGIO, ..) */ static int scanfc(FILE *fin, const char *format, void *p) { int ret; do { ret = fscanf(fin, format, p); if (ret < 0) { if (errno == EINTR) continue; rig_debug(RIG_DEBUG_ERR, "fscanf: %s\n", strerror(errno)); } return ret; } while(1); } #define fprintf_flush(f, a...) \ ({ int __ret; \ __ret = fprintf((f), a); \ fflush((f)); \ __ret; \ }) #define MAXARGSZ 127 extern int interactive; extern int prompt; extern int opt_end; extern int vfo_mode; extern char send_cmd_term; int ext_resp = 0; unsigned char resp_sep = '\n'; /* Default response separator */ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc) { int retcode; /* generic return code from functions */ unsigned char cmd; struct test_table *cmd_entry; char arg1[MAXARGSZ+1], *p1; char arg2[MAXARGSZ+1], *p2; char arg3[MAXARGSZ+1], *p3; static int last_was_ret = 1; vfo_t vfo = RIG_VFO_CURR; if (interactive) { if (prompt) fprintf_flush(fout, "\nRig command: "); do { if (scanfc(fin, "%c", &cmd) < 1) return -1; /* Extended response protocol requested with leading '+' on command * string--rigctld only! */ if (cmd == '+' && !prompt) { ext_resp = 1; if (scanfc(fin, "%c", &cmd) < 1) return -1; } else if (cmd == '+' && prompt) { return 0; } if (cmd != '\\' && cmd != '_' && cmd != '#' && ispunct(cmd) && !prompt) { ext_resp = 1; resp_sep = cmd; if (scanfc(fin, "%c", &cmd) < 1) return -1; } else if (cmd != '\\' && cmd != '?' && cmd != '_' && cmd != '#' && ispunct(cmd) && prompt) { return 0; } /* command by name */ if (cmd == '\\') { unsigned char cmd_name[MAXNAMSIZ], *pcmd = cmd_name; int c_len = MAXNAMSIZ; if (scanfc(fin, "%c", pcmd) < 1) return -1; while(c_len-- && (isalnum(*pcmd) || *pcmd == '_' )) if (scanfc(fin, "%c", ++pcmd) < 1) return -1; *pcmd = '\0'; cmd = parse_arg((char *)cmd_name); break; } if (cmd == 0x0a || cmd == 0x0d) { if (last_was_ret) { if (prompt) { fprintf(fout, "? for help, q to quit.\n"); fprintf_flush(fout, "\nRig command: "); } return 0; } last_was_ret = 1; } } while (cmd == 0x0a || cmd == 0x0d); last_was_ret = 0; /* comment line */ if (cmd == '#') { while( cmd != '\n' && cmd != '\r') if (scanfc(fin, "%c", &cmd) < 1) return -1; return 0; } if (cmd == 'Q' || cmd == 'q') return 1; if (cmd == '?') { usage_rig(fout); fflush(fout); return 0; } } else { /* parse rest of command line */ if (optind >= argc) return 1; if (argv[optind][1] == '\0') cmd = argv[optind][0]; else cmd = parse_arg(argv[optind]); optind++; } cmd_entry = find_cmd_entry(cmd); if (!cmd_entry) { fprintf(stderr, "Command '%c' not found!\n", cmd); return 0; } p1 = p2 = p3 = NULL; if (!(cmd_entry->flags & ARG_NOVFO) && vfo_mode) { if (interactive) { if (prompt) fprintf_flush(fout, "VFO: "); if (scanfc(fin, "%s", arg1) < 1) return -1; vfo = rig_parse_vfo(arg1); } else { if (!argv[optind]) { fprintf(stderr, "Invalid arg for command '%s'\n", cmd_entry->name); exit(1); } vfo = rig_parse_vfo(argv[optind++]); } } if ((cmd_entry->flags & ARG_IN_LINE) && (cmd_entry->flags & ARG_IN1) && cmd_entry->arg1) { if (interactive) { char *nl; if (prompt) fprintf_flush(fout, "%s: ", cmd_entry->arg1); if (fgets(arg1, MAXARGSZ, fin) == NULL) return -1; if (arg1[0] == 0xa) if (fgets(arg1, MAXARGSZ, fin) == NULL) return -1; nl = strchr(arg1, 0xa); if (nl) *nl = '\0'; /* chomp */ p1 = arg1[0] == ' ' ? arg1 + 1 : arg1; } else { if (!argv[optind]) { fprintf(stderr, "Invalid arg for command '%s'\n", cmd_entry->name); exit(1); } p1 = argv[optind++]; } } else if ((cmd_entry->flags & ARG_IN1) && cmd_entry->arg1) { if (interactive) { if (prompt) fprintf_flush(fout, "%s: ", cmd_entry->arg1); if (scanfc(fin, "%s", arg1) < 1) return -1; p1 = arg1; } else { if (!argv[optind]) { fprintf(stderr, "Invalid arg for command '%s'\n", cmd_entry->name); exit(1); } p1 = argv[optind++]; } } if (p1 && p1[0] != '?' && (cmd_entry->flags & ARG_IN2) && cmd_entry->arg2) { if (interactive) { if (prompt) fprintf_flush(fout, "%s: ", cmd_entry->arg2); if (scanfc(fin, "%s", arg2) < 1) return -1; p2 = arg2; } else { if (!argv[optind]) { fprintf(stderr, "Invalid arg for command '%s'\n", cmd_entry->name); exit(1); } p2 = argv[optind++]; } } if (p1 && p1[0] != '?' && (cmd_entry->flags & ARG_IN3) && cmd_entry->arg3) { if (interactive) { if (prompt) fprintf_flush(fout, "%s: ", cmd_entry->arg3); if (scanfc(fin, "%s", arg3) < 1) return -1; p3 = arg3; } else { if (!argv[optind]) { fprintf(stderr, "Invalid arg for command '%s'\n", cmd_entry->name); exit(1); } p3 = argv[optind++]; } } /* * mutex locking needed because rigctld is multithreaded * and hamlib is not MT-safe */ #ifdef HAVE_PTHREAD pthread_mutex_lock(&rig_mutex); #endif if (!prompt) rig_debug(RIG_DEBUG_TRACE, "rigctl(d): %c '%s' '%s' '%s' '%s'\n", cmd, rig_strvfo(vfo), p1?p1:"", p2?p2:"", p3?p3:""); /* * Extended Response protocol: output received command name and arguments * response. Don't send command header on '\chk_vfo' command. */ if (interactive && ext_resp && !prompt && cmd != 0xf0) { char a1[MAXARGSZ + 1]; char a2[MAXARGSZ + 1]; char a3[MAXARGSZ + 1]; char vfo_str[MAXARGSZ + 1]; vfo_mode == 0 ? vfo_str[0] = '\0' : snprintf(vfo_str, sizeof(vfo_str), " %s", rig_strvfo(vfo)); p1 == NULL ? a1[0] = '\0' : snprintf(a1, sizeof(a1), " %s", p1); p2 == NULL ? a2[0] = '\0' : snprintf(a2, sizeof(a2), " %s", p2); p3 == NULL ? a3[0] = '\0' : snprintf(a3, sizeof(a3), " %s", p3); fprintf(fout, "%s:%s%s%s%s%c", cmd_entry->name, vfo_str, a1, a2, a3, resp_sep); } retcode = (*cmd_entry->rig_routine)(my_rig, fout, fin, interactive, cmd_entry, vfo, p1, p2 ? p2 : "", p3 ? p3 : ""); #ifdef HAVE_PTHREAD pthread_mutex_unlock(&rig_mutex); #endif if (retcode != RIG_OK) { /* only for rigctld */ if (interactive && !prompt) { fprintf(fout, NETRIGCTL_RET "%d\n", retcode); ext_resp = 0; resp_sep = '\n'; } else fprintf(fout, "%s: error = %s\n", cmd_entry->name, rigerror(retcode)); } else { /* only for rigctld */ if (interactive && !prompt) { /* netrigctl RIG_OK */ if (!(cmd_entry->flags & ARG_OUT) && !opt_end && !ext_resp && cmd != 0xf0) fprintf(fout, NETRIGCTL_RET "0\n"); /* Extended Response protocol */ else if (ext_resp && cmd != 0xf0) { fprintf(fout, NETRIGCTL_RET "0\n"); ext_resp = 0; resp_sep = '\n'; } /* Nate's protocol (obsolete) */ else if ((cmd_entry->flags & ARG_OUT) && opt_end) fprintf(fout, "END\n"); } } fflush(fout); return retcode != RIG_OK ? 2 : 0; } void version() { printf("rigctl, %s\n\n", hamlib_version); printf("%s\n", hamlib_copyright); } void usage_rig(FILE *fout) { int i, nbspaces; fprintf(fout, "Commands (some may not be available for this rig):\n"); for (i = 0; test_list[i].cmd != 0; i++) { fprintf(fout, "%c: %-16s(", isprint(test_list[i].cmd) ? test_list[i].cmd:'?', test_list[i].name); nbspaces = 18; if (test_list[i].arg1 && (test_list[i].flags&ARG_IN1)) nbspaces -= fprintf(fout, "%s", test_list[i].arg1); if (test_list[i].arg2 && (test_list[i].flags&ARG_IN2)) nbspaces -= fprintf(fout, ",%s", test_list[i].arg2); if (test_list[i].arg3 && (test_list[i].flags&ARG_IN3)) nbspaces -= fprintf(fout, ",%s", test_list[i].arg3); if (i % 2) fprintf(fout, ")\n"); else fprintf(fout, ")%*s", nbspaces, " "); } } int print_conf_list(const struct confparams *cfp, rig_ptr_t data) { RIG *rig = (RIG*) data; int i; char buf[128] = ""; rig_get_conf(rig, cfp->token, buf); printf("%s: \"%s\"\n" "\t" "Default: %s, Value: %s\n", cfp->name, cfp->tooltip, cfp->dflt, buf ); switch (cfp->type) { case RIG_CONF_NUMERIC: printf("\tRange: %.1f..%.1f, step %.1f\n", cfp->u.n.min, cfp->u.n.max, cfp->u.n.step); break; case RIG_CONF_COMBO: if (!cfp->u.c.combostr) break; printf("\tCombo: %s", cfp->u.c.combostr[0]); for (i=1 ; iu.c.combostr[i]; i++) printf(", %s", cfp->u.c.combostr[i]); printf("\n"); break; case RIG_CONF_STRING: printf("\tString.\n"); break; case RIG_CONF_CHECKBUTTON: printf("\tCheck button.\n"); break; case RIG_CONF_BUTTON: printf("\tButton.\n"); break; default: printf("\tUnknown conf\n"); } return 1; /* !=0, we want them all ! */ } static int hash_model_list(const struct rig_caps *caps, void *data) { hash_add_model(caps->rig_model, caps->mfg_name, caps->model_name, caps->version, rig_strstatus(caps->status)); return 1; /* !=0, we want them all ! */ } void print_model_list() { struct mod_lst *s; for (s = models; s != NULL; s = (struct mod_lst *)(s->hh.next)) { printf("%6d %-23s%-24s%-16s%s\n", s->id, s->mfg_name, s->model_name, s->version, s->status); } } void list_models() { int status; rig_load_all_backends(); printf(" Rig # Mfg Model Version Status\n"); status = rig_list_foreach(hash_model_list, NULL); if (status != RIG_OK ) { printf("rig_list_foreach: error = %s \n", rigerror(status)); exit(2); } hash_sort_by_model_id(); print_model_list(); hash_delete_all(); } int set_conf(RIG *my_rig, char *conf_parms) { char *p, *q, *n; int ret; p = conf_parms; while (p && *p != '\0') { /* FIXME: left hand value of = cannot be null */ q = strchr(p, '='); if ( !q ) return -RIG_EINVAL; *q++ = '\0'; n = strchr(q, ','); if (n) *n++ = '\0'; ret = rig_set_conf(my_rig, rig_token_lookup(my_rig, p), q); if (ret != RIG_OK) return ret; p = n; } return RIG_OK; } /* * static int (f)(RIG *rig, FILE *fout, int interactive, const struct test_table *cmd, * vfo_t vfo, const void *arg1, const void *arg2, const void *arg3) */ /* 'F' */ declare_proto_rig(set_freq) { freq_t freq; CHKSCN1ARG(sscanf(arg1, "%"SCNfreq, &freq)); return rig_set_freq(rig, vfo, freq); } /* 'f' */ declare_proto_rig(get_freq) { int status; freq_t freq; status = rig_get_freq(rig, vfo, &freq); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); /* i.e. "Frequency" */ fprintf(fout, "%"PRIll"%c", (int64_t)freq, resp_sep); return status; } /* 'J' */ declare_proto_rig(set_rit) { shortfreq_t rit; CHKSCN1ARG(sscanf(arg1, "%ld", &rit)); return rig_set_rit(rig, vfo, rit); } /* 'j' */ declare_proto_rig(get_rit) { int status; shortfreq_t rit; status = rig_get_rit(rig, vfo, &rit); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%ld%c", rit, resp_sep); return status; } /* 'Z' */ declare_proto_rig(set_xit) { shortfreq_t xit; CHKSCN1ARG(sscanf(arg1, "%ld", &xit)); return rig_set_xit(rig, vfo, xit); } /* 'z' */ declare_proto_rig(get_xit) { int status; shortfreq_t xit; status = rig_get_xit(rig, vfo, &xit); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%ld%c", xit, resp_sep); return status; } /* 'M' */ declare_proto_rig(set_mode) { rmode_t mode; pbwidth_t width; if (!strcmp(arg1, "?")) { char s[SPRINTF_MAX_SIZE]; sprintf_mode(s, rig->state.mode_list); fprintf(fout, "%s\n", s); return RIG_OK; } mode = rig_parse_mode(arg1); CHKSCN1ARG(sscanf(arg2, "%ld", &width)); return rig_set_mode(rig, vfo, mode, width); } /* 'm' */ declare_proto_rig(get_mode) { int status; rmode_t mode; pbwidth_t width; status = rig_get_mode(rig, vfo, &mode, &width); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%s%c", rig_strrmode(mode), resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg2); fprintf(fout, "%ld%c", width, resp_sep); return status; } /* 'V' */ declare_proto_rig(set_vfo) { return rig_set_vfo(rig, rig_parse_vfo(arg1)); } /* 'v' */ declare_proto_rig(get_vfo) { int status; status = rig_get_vfo(rig, &vfo); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%s%c", rig_strvfo(vfo), resp_sep); return status; } /* 'T' */ declare_proto_rig(set_ptt) { int ptt; /* TODO MICDATA */ CHKSCN1ARG(sscanf(arg1, "%d", &ptt)); return rig_set_ptt(rig, vfo, (ptt_t) ptt); } /* 't' */ declare_proto_rig(get_ptt) { int status; ptt_t ptt; status = rig_get_ptt(rig, vfo, &ptt); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); /* TODO MICDATA */ fprintf(fout, "%d%c", ptt, resp_sep); return status; } /* '0x8b' */ declare_proto_rig(get_dcd) { int status; dcd_t dcd; status = rig_get_dcd(rig, vfo, &dcd); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%d%c", dcd, resp_sep); return status; } /* 'R' */ declare_proto_rig(set_rptr_shift) { rptr_shift_t rptr_shift; rptr_shift = rig_parse_rptr_shift(arg1); return rig_set_rptr_shift(rig, vfo, rptr_shift); } /* 'r' */ declare_proto_rig(get_rptr_shift) { int status; rptr_shift_t rptr_shift; status = rig_get_rptr_shift(rig, vfo, &rptr_shift); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%s%c", rig_strptrshift(rptr_shift), resp_sep); return status; } /* 'O' */ declare_proto_rig(set_rptr_offs) { unsigned long rptr_offs; CHKSCN1ARG(sscanf(arg1, "%ld", &rptr_offs)); return rig_set_rptr_offs(rig, vfo, rptr_offs); } /* 'o' */ declare_proto_rig(get_rptr_offs) { int status; shortfreq_t rptr_offs; status = rig_get_rptr_offs(rig, vfo, &rptr_offs); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%ld%c", rptr_offs, resp_sep); return status; } /* 'C' */ declare_proto_rig(set_ctcss_tone) { tone_t tone; CHKSCN1ARG(sscanf(arg1, "%d", &tone)); return rig_set_ctcss_tone(rig, vfo, tone); } /* 'c' */ declare_proto_rig(get_ctcss_tone) { int status; tone_t tone; status = rig_get_ctcss_tone(rig, vfo, &tone); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%d%c", tone, resp_sep); return status; } /* 'D' */ declare_proto_rig(set_dcs_code) { tone_t code; CHKSCN1ARG(sscanf(arg1, "%d", &code)); return rig_set_dcs_code(rig, vfo, code); } /* 'd' */ declare_proto_rig(get_dcs_code) { int status; tone_t code; status = rig_get_dcs_code(rig, vfo, &code); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%d%c", code, resp_sep); return status; } /* '0x90' */ declare_proto_rig(set_ctcss_sql) { tone_t tone; CHKSCN1ARG(sscanf(arg1, "%d", &tone)); return rig_set_ctcss_sql(rig, vfo, tone); } /* '0x91' */ declare_proto_rig(get_ctcss_sql) { int status; tone_t tone; status = rig_get_ctcss_sql(rig, vfo, &tone); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%d%c", tone, resp_sep); return status; } /* '0x92' */ declare_proto_rig(set_dcs_sql) { tone_t code; CHKSCN1ARG(sscanf(arg1, "%d", &code)); return rig_set_dcs_sql(rig, vfo, code); } /* '0x93' */ declare_proto_rig(get_dcs_sql) { int status; tone_t code; status = rig_get_dcs_sql(rig, vfo, &code); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%d%c", code, resp_sep); return status; } /* 'I' */ declare_proto_rig(set_split_freq) { freq_t txfreq; vfo_t txvfo = RIG_VFO_TX; CHKSCN1ARG(sscanf(arg1, "%"SCNfreq, &txfreq)); return rig_set_split_freq(rig, txvfo, txfreq); } /* 'i' */ declare_proto_rig(get_split_freq) { int status; freq_t txfreq; vfo_t txvfo = RIG_VFO_TX; status = rig_get_split_freq(rig, txvfo, &txfreq); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%"PRIll"%c", (int64_t)txfreq, resp_sep); return status; } /* 'X' */ declare_proto_rig(set_split_mode) { rmode_t mode; int width; vfo_t txvfo = RIG_VFO_TX; if (!strcmp(arg1, "?")) { char s[SPRINTF_MAX_SIZE]; sprintf_mode(s, rig->state.mode_list); fprintf(fout, "%s\n", s); return RIG_OK; } mode = rig_parse_mode(arg1); CHKSCN1ARG(sscanf(arg2, "%d", &width)); return rig_set_split_mode(rig, txvfo, mode, (pbwidth_t) width); } /* 'x' */ declare_proto_rig(get_split_mode) { int status; rmode_t mode; pbwidth_t width; vfo_t txvfo = RIG_VFO_TX; status = rig_get_split_mode(rig, txvfo, &mode, &width); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%s%c", rig_strrmode(mode), resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg2); fprintf(fout, "%ld%c", width, resp_sep); return status; } /* 'S' */ declare_proto_rig(set_split_vfo) { int split; vfo_t tx_vfo; CHKSCN1ARG(sscanf(arg1, "%d", &split)); tx_vfo = rig_parse_vfo(arg2); if (tx_vfo == RIG_VFO_NONE) return -RIG_EINVAL; return rig_set_split_vfo(rig, vfo, (split_t) split, tx_vfo); } /* 's' */ declare_proto_rig(get_split_vfo) { int status; split_t split; vfo_t tx_vfo; status = rig_get_split_vfo(rig, vfo, &split, &tx_vfo); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%d%c", split, resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg2); fprintf(fout, "%s%c", rig_strvfo(tx_vfo), resp_sep); return status; } /* 'N' */ declare_proto_rig(set_ts) { unsigned long ts; CHKSCN1ARG(sscanf(arg1, "%ld", &ts)); return rig_set_ts(rig, vfo, ts); } /* 'n' */ declare_proto_rig(get_ts) { int status; shortfreq_t ts; status = rig_get_ts(rig, vfo, &ts); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%ld%c", ts, resp_sep); return status; } /* '2' */ declare_proto_rig(power2mW) { int status; float power; freq_t freq; rmode_t mode; unsigned int mwp; CHKSCN1ARG(sscanf(arg1, "%f", &power)); CHKSCN1ARG(sscanf(arg2, "%"SCNfreq, &freq)); mode = rig_parse_mode(arg3); status = rig_power2mW(rig, &mwp, power, freq, mode); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg4); fprintf(fout, "%i%c", mwp, resp_sep); return status; } /* '4' */ declare_proto_rig(mW2power) { int status; float power; freq_t freq; rmode_t mode; unsigned int mwp; CHKSCN1ARG(sscanf(arg1, "%i", &mwp)); CHKSCN1ARG(sscanf(arg2, "%"SCNfreq, &freq)); mode = rig_parse_mode(arg3); status = rig_mW2power(rig, &power, mwp, freq, mode); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg4); fprintf(fout, "%f%c", power, resp_sep); return status; } /* * RIG_CONF_ extparm's type: * NUMERIC: val.f * COMBO: val.i, starting from 0 * STRING: val.s * CHECKBUTTON: val.i 0/1 * * 'L' */ declare_proto_rig(set_level) { setting_t level; value_t val; if (!strcmp(arg1, "?")) { char s[SPRINTF_MAX_SIZE]; sprintf_level(s, rig->state.has_set_level); fputs(s, fout); if (rig->caps->set_ext_level) { sprintf_level_ext(s, rig->caps->extlevels); fputs(s, fout); } fputc('\n', fout); return RIG_OK; } level = rig_parse_level(arg1); if (!rig_has_set_level(rig, level)) { const struct confparams *cfp; cfp = rig_ext_lookup(rig, arg1); if (!cfp) return -RIG_ENAVAIL; /* no such parameter */ switch (cfp->type) { case RIG_CONF_BUTTON: /* arg is ignored */ break; case RIG_CONF_CHECKBUTTON: case RIG_CONF_COMBO: CHKSCN1ARG(sscanf(arg2, "%d", &val.i)); break; case RIG_CONF_NUMERIC: CHKSCN1ARG(sscanf(arg2, "%f", &val.f)); break; case RIG_CONF_STRING: val.cs = arg2; break; default: return -RIG_ECONF; } return rig_set_ext_level(rig, vfo, cfp->token, val); } if (RIG_LEVEL_IS_FLOAT(level)) CHKSCN1ARG(sscanf(arg2, "%f", &val.f)); else CHKSCN1ARG(sscanf(arg2, "%d", &val.i)); return rig_set_level(rig, vfo, level, val); } /* 'l' */ declare_proto_rig(get_level) { int status; setting_t level; value_t val; if (!strcmp(arg1, "?")) { char s[SPRINTF_MAX_SIZE]; sprintf_level(s, rig->state.has_get_level); fputs(s, fout); if (rig->caps->get_ext_level) { sprintf_level_ext(s, rig->caps->extlevels); fputs(s, fout); } fputc('\n', fout); return RIG_OK; } level = rig_parse_level(arg1); if (!rig_has_get_level(rig, level)) { const struct confparams *cfp; cfp = rig_ext_lookup(rig, arg1); if (!cfp) return -RIG_EINVAL; /* no such parameter */ status = rig_get_ext_level(rig, vfo, cfp->token, &val); if (status != RIG_OK) return status; if (interactive && prompt) fprintf(fout, "%s: ", cmd->arg2); switch (cfp->type) { case RIG_CONF_BUTTON: /* there's no sense in retrieving value of stateless button */ return -RIG_EINVAL; case RIG_CONF_CHECKBUTTON: case RIG_CONF_COMBO: fprintf(fout, "%d\n", val.i); break; case RIG_CONF_NUMERIC: fprintf(fout, "%f\n", val.f); break; case RIG_CONF_STRING: fprintf(fout, "%s\n", val.s); break; default: return -RIG_ECONF; } return status; } status = rig_get_level(rig, vfo, level, &val); if (status != RIG_OK) return status; if (interactive && prompt) fprintf(fout, "%s: ", cmd->arg2); if (RIG_LEVEL_IS_FLOAT(level)) fprintf(fout, "%f\n", val.f); else fprintf(fout, "%d\n", val.i); return status; } /* 'U' */ declare_proto_rig(set_func) { setting_t func; int func_stat; if (!strcmp(arg1, "?")) { char s[SPRINTF_MAX_SIZE]; sprintf_func(s, rig->state.has_set_func); fprintf(fout, "%s\n", s); return RIG_OK; } func = rig_parse_func(arg1); if (RIG_FUNC_NONE == func) return -RIG_EINVAL; CHKSCN1ARG(sscanf(arg2, "%d", &func_stat)); return rig_set_func(rig, vfo, func, func_stat); } /* 'u' */ declare_proto_rig(get_func) { int status; setting_t func; int func_stat; if (!strcmp(arg1, "?")) { char s[SPRINTF_MAX_SIZE]; sprintf_func(s, rig->state.has_get_func); fprintf(fout, "%s\n", s); return RIG_OK; } func = rig_parse_func(arg1); if (RIG_FUNC_NONE == func) return -RIG_EINVAL; status = rig_get_func(rig, vfo, func, &func_stat); if (status != RIG_OK) return status; if (interactive && prompt) fprintf(fout, "%s: ", cmd->arg2); fprintf(fout, "%d\n", func_stat); return status; } /* 'P' */ declare_proto_rig(set_parm) { setting_t parm; value_t val; if (!strcmp(arg1, "?")) { char s[SPRINTF_MAX_SIZE]; sprintf_parm(s, rig->state.has_set_parm); fprintf(fout, "%s\n", s); return RIG_OK; } parm = rig_parse_parm(arg1); if (!rig_has_set_parm(rig, parm)) { const struct confparams *cfp; cfp = rig_ext_lookup(rig, arg1); if (!cfp) return -RIG_EINVAL; /* no such parameter */ switch (cfp->type) { case RIG_CONF_BUTTON: /* arg is ignored */ break; case RIG_CONF_CHECKBUTTON: case RIG_CONF_COMBO: CHKSCN1ARG(sscanf(arg2, "%d", &val.i)); break; case RIG_CONF_NUMERIC: CHKSCN1ARG(sscanf(arg2, "%f", &val.f)); break; case RIG_CONF_STRING: val.cs = arg2; break; default: return -RIG_ECONF; } return rig_set_ext_parm(rig, cfp->token, val); } if (RIG_PARM_IS_FLOAT(parm)) CHKSCN1ARG(sscanf(arg2, "%f", &val.f)); else CHKSCN1ARG(sscanf(arg2, "%d", &val.i)); return rig_set_parm(rig, parm, val); } /* 'p' */ declare_proto_rig(get_parm) { int status; setting_t parm; value_t val; if (!strcmp(arg1, "?")) { char s[SPRINTF_MAX_SIZE]; sprintf_parm(s, rig->state.has_get_parm); fprintf(fout, "%s\n", s); return RIG_OK; } parm = rig_parse_parm(arg1); if (!rig_has_get_parm(rig, parm)) { const struct confparams *cfp; cfp = rig_ext_lookup(rig, arg1); if (!cfp) return -RIG_EINVAL; /* no such parameter */ status = rig_get_ext_parm(rig, cfp->token, &val); if (status != RIG_OK) return status; if (interactive && prompt) fprintf(fout, "%s: ", cmd->arg2); switch (cfp->type) { case RIG_CONF_BUTTON: /* there's not sense in retrieving value of stateless button */ return -RIG_EINVAL; case RIG_CONF_CHECKBUTTON: case RIG_CONF_COMBO: fprintf(fout, "%d\n", val.i); break; case RIG_CONF_NUMERIC: fprintf(fout, "%f\n", val.f); break; case RIG_CONF_STRING: fprintf(fout, "%s\n", val.s); break; default: return -RIG_ECONF; } return status; } status = rig_get_parm(rig, parm, &val); if (status != RIG_OK) return status; if (interactive && prompt) fprintf(fout, "%s: ", cmd->arg2); if (RIG_PARM_IS_FLOAT(parm)) fprintf(fout, "%f\n", val.f); else fprintf(fout, "%d\n", val.i); return status; } /* 'B' */ declare_proto_rig(set_bank) { int bank; CHKSCN1ARG(sscanf(arg1, "%d", &bank)); return rig_set_bank(rig, vfo, bank); } /* 'E' */ declare_proto_rig(set_mem) { int ch; CHKSCN1ARG(sscanf(arg1, "%d", &ch)); return rig_set_mem(rig, vfo, ch); } /* 'e' */ declare_proto_rig(get_mem) { int status; int ch; status = rig_get_mem(rig, vfo, &ch); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%d%c", ch, resp_sep); return status; } /* 'G' */ declare_proto_rig(vfo_op) { vfo_op_t op; if (!strcmp(arg1, "?")) { char s[SPRINTF_MAX_SIZE]; sprintf_vfop(s, rig->caps->vfo_ops); fprintf(fout, "%s\n", s); return RIG_OK; } op = rig_parse_vfo_op(arg1); if (RIG_OP_NONE == op) return -RIG_EINVAL; return rig_vfo_op(rig, vfo, op); } /* 'g' */ declare_proto_rig(scan) { scan_t op; int ch; if (!strcmp(arg1, "?")) { char s[SPRINTF_MAX_SIZE]; sprintf_scan(s, rig->caps->scan_ops); fprintf(fout, "%s\n", s); return RIG_OK; } op = rig_parse_scan(arg1); CHKSCN1ARG(sscanf(arg2, "%d", &ch)); return rig_scan(rig, vfo, op, ch); } /* 'H' */ declare_proto_rig(set_channel) { const channel_cap_t *mem_caps = NULL; const chan_t *chan_list; channel_t chan; int status; char s[16]; memset(&chan, 0, sizeof(channel_t)); if (isdigit(arg1[0])) { chan.vfo = RIG_VFO_MEM; CHKSCN1ARG(sscanf(arg1, "%d", &chan.channel_num)); /* * find mem_caps in caps, we'll need it later */ chan_list = rig_lookup_mem_caps(rig, chan.channel_num); if (chan_list) mem_caps = &chan_list->mem_caps; } else { chan.vfo = rig_parse_vfo(arg1); chan.channel_num = 0; /* TODO: mem_caps for VFO! */ /* either from mem, or reverse computed from caps */ } if (!mem_caps) return -RIG_ECONF; if (mem_caps->bank_num) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "Bank Num: "); CHKSCN1ARG(scanfc(fin, "%d", &chan.bank_num)); } #if 0 if (mem_caps->vfo) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "vfo (VFOA,MEM,etc...): "); CHKSCN1ARG(scanfc(fin, "%s", s)); chan.vfo = rig_parse_vfo(s); } #endif if (mem_caps->ant) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "ant: "); CHKSCN1ARG(scanfc(fin, "%d", &chan.ant)); } if (mem_caps->freq) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "Frequency: "); CHKSCN1ARG(scanfc(fin, "%"SCNfreq, &chan.freq)); } if (mem_caps->mode) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "mode (FM,LSB,etc...): "); CHKSCN1ARG(scanfc(fin, "%s", s)); chan.mode = rig_parse_mode(s); } if (mem_caps->width) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "width: "); CHKSCN1ARG(scanfc(fin, "%ld", &chan.width)); } if (mem_caps->tx_freq) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "tx freq: "); CHKSCN1ARG(scanfc(fin, "%"SCNfreq, &chan.tx_freq)); } if (mem_caps->tx_mode) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "tx mode (FM,LSB,etc...): "); CHKSCN1ARG(scanfc(fin, "%s", s)); chan.tx_mode = rig_parse_mode(s); } if (mem_caps->tx_width) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "tx width: "); CHKSCN1ARG(scanfc(fin, "%ld", &chan.tx_width)); } if (mem_caps->split) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "split (0,1): "); CHKSCN1ARG(scanfc(fin, "%d", &status)); chan.split = status; } if (mem_caps->tx_vfo) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "tx vfo (VFOA,MEM,etc...): "); CHKSCN1ARG(scanfc(fin, "%s", s)); chan.tx_vfo = rig_parse_vfo(s); } if (mem_caps->rptr_shift) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "rptr shift (+-0): "); CHKSCN1ARG(scanfc(fin, "%s", s)); chan.rptr_shift = rig_parse_rptr_shift(s); } if (mem_caps->rptr_offs) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "rptr offset: "); CHKSCN1ARG(scanfc(fin, "%ld", &chan.rptr_offs)); } if (mem_caps->tuning_step) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "tuning step: "); CHKSCN1ARG(scanfc(fin, "%ld", &chan.tuning_step)); } if (mem_caps->rit) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "rit (Hz,0=off): "); CHKSCN1ARG(scanfc(fin, "%ld", &chan.rit)); } if (mem_caps->xit) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "xit (Hz,0=off): "); CHKSCN1ARG(scanfc(fin, "%ld", &chan.xit)); } if (mem_caps->funcs) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "funcs: "); CHKSCN1ARG(scanfc(fin, "%lx", &chan.funcs)); } #if 0 /* for all levels (except READONLY), ask */ if (mem_caps->levels) sscanf(arg1, "%d", &chan.levels); #endif if (mem_caps->ctcss_tone) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "ctcss tone freq in tenth of Hz (0=off): "); CHKSCN1ARG(scanfc(fin, "%d", &chan.ctcss_tone)); } if (mem_caps->ctcss_sql) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "ctcss sql freq in tenth of Hz (0=off): "); CHKSCN1ARG(scanfc(fin, "%d", &chan.ctcss_sql)); } if (mem_caps->dcs_code) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "dcs code: "); CHKSCN1ARG(scanfc(fin, "%d", &chan.dcs_code)); } if (mem_caps->dcs_sql) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "dcs sql: "); CHKSCN1ARG(scanfc(fin, "%d", &chan.dcs_sql)); } if (mem_caps->scan_group) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "scan group: "); CHKSCN1ARG(scanfc(fin, "%d", &chan.scan_group)); } if (mem_caps->flags) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "flags: "); CHKSCN1ARG(scanfc(fin, "%d", &chan.flags)); } if (mem_caps->channel_desc) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf_flush(fout, "channel desc: "); CHKSCN1ARG(scanfc(fin, "%s", s)); strcpy(chan.channel_desc, s); } #if 0 /* TODO: same as levels, allocate/free the array */ if (mem_caps->ext_levels) sscanf(arg1, "%d", &chan.ext_levels[i].val.i); #endif status = rig_set_channel(rig, &chan); return status; } /* 'h' */ declare_proto_rig(get_channel) { int status; channel_t chan; memset(&chan, 0, sizeof(channel_t)); if (isdigit(arg1[0])) { chan.vfo = RIG_VFO_MEM; CHKSCN1ARG(sscanf(arg1, "%d", &chan.channel_num)); } else { chan.vfo = rig_parse_vfo(arg1); chan.channel_num = 0; } status = rig_get_channel(rig, &chan); if (status != RIG_OK) return status; status = dump_chan(fout, rig, &chan); if (chan.ext_levels) free(chan.ext_levels); return status; } static int myfreq_event(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg) { printf("Event: freq changed to %"PRIll"Hz on %s\n", (int64_t)freq, rig_strvfo(vfo)); return 0; } static int mymode_event(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, rig_ptr_t arg) { printf("Event: mode changed to %s, width %liHz on %s\n", rig_strrmode(mode), width, rig_strvfo(vfo)); return 0; } static int myvfo_event(RIG *rig, vfo_t vfo, rig_ptr_t arg) { printf("Event: vfo changed to %s\n", rig_strvfo(vfo)); return 0; } static int myptt_event(RIG *rig, vfo_t vfo, ptt_t ptt, rig_ptr_t arg) { printf("Event: PTT changed to %i on %s\n", ptt, rig_strvfo(vfo)); return 0; } static int mydcd_event(RIG *rig, vfo_t vfo, dcd_t dcd, rig_ptr_t arg) { printf("Event: DCD changed to %i on %s\n", dcd, rig_strvfo(vfo)); return 0; } /* 'A' */ declare_proto_rig(set_trn) { int trn; if (!strcmp(arg1, "?")) { fprintf(fout, "OFF RIG POLL\n"); return RIG_OK; } if (!strcmp(arg1, "OFF")) trn = RIG_TRN_OFF; else if (!strcmp(arg1, "RIG") || !strcmp(arg1, "ON")) trn = RIG_TRN_RIG; else if (!strcmp(arg1, "POLL")) trn = RIG_TRN_POLL; else return -RIG_EINVAL; if (trn != RIG_TRN_OFF) { rig_set_freq_callback(rig, myfreq_event, NULL); rig_set_mode_callback(rig, mymode_event, NULL); rig_set_vfo_callback (rig, myvfo_event, NULL); rig_set_ptt_callback (rig, myptt_event, NULL); rig_set_dcd_callback (rig, mydcd_event, NULL); } return rig_set_trn(rig, trn); } /* 'a' */ declare_proto_rig(get_trn) { int status; int trn; static const char* trn_txt[] = { "OFF", "RIG", "POLL"}; status = rig_get_trn(rig, &trn); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); if (trn>=0 && trn<=2) fprintf(fout, "%s%c", trn_txt[trn], resp_sep); return status; } /* '_' */ declare_proto_rig(get_info) { const char *s; s = rig_get_info(rig); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%s%c", s ? s : "None", resp_sep); return RIG_OK; } int dump_chan(FILE *fout, RIG *rig, channel_t *chan) { int idx, firstloop=1; char freqbuf[16]; char widthbuf[16]; char prntbuf[256]; fprintf(fout, "Channel: %d, Name: '%s'\n", chan->channel_num, chan->channel_desc); fprintf(fout, "VFO: %s, Antenna: %d, Split: %s\n", rig_strvfo(chan->vfo), chan->ant, chan->split==RIG_SPLIT_ON?"ON":"OFF"); sprintf_freq(freqbuf, chan->freq); sprintf_freq(widthbuf, chan->width); fprintf(fout, "Freq: %s\tMode: %s\tWidth: %s\n", freqbuf, rig_strrmode(chan->mode), widthbuf); sprintf_freq(freqbuf, chan->tx_freq); sprintf_freq(widthbuf, chan->tx_width); fprintf(fout, "txFreq: %s\ttxMode: %s\ttxWidth: %s\n", freqbuf, rig_strrmode(chan->tx_mode), widthbuf); sprintf_freq(freqbuf,chan->rptr_offs); fprintf(fout, "Shift: %s, Offset: %s%s, ", rig_strptrshift(chan->rptr_shift), chan->rptr_offs>0?"+":"", freqbuf); sprintf_freq(freqbuf,chan->tuning_step); fprintf(fout, "Step: %s, ", freqbuf); sprintf_freq(freqbuf,chan->rit); fprintf(fout, "RIT: %s%s, ", chan->rit>0?"+":"", freqbuf); sprintf_freq(freqbuf,chan->xit); fprintf(fout, "XIT: %s%s\n", chan->xit>0?"+":"", freqbuf); fprintf(fout, "CTCSS: %d.%dHz, ", chan->ctcss_tone/10, chan->ctcss_tone%10); fprintf(fout, "CTCSSsql: %d.%dHz, ", chan->ctcss_sql/10, chan->ctcss_sql%10); fprintf(fout, "DCS: %d.%d, ", chan->dcs_code/10, chan->dcs_code%10); fprintf(fout, "DCSsql: %d.%d\n", chan->dcs_sql/10, chan->dcs_sql%10); sprintf_func(prntbuf, chan->funcs); fprintf(fout, "Functions: %s\n", prntbuf); fprintf(fout, "Levels:"); for (idx=0; idxlevels[idx].f); else fprintf(fout, " %s: %d", level_s, chan->levels[idx].i); } /* ext_levels */ for (idx=0; chan->ext_levels && !RIG_IS_EXT_END(chan->ext_levels[idx]); idx++) { const struct confparams *cfp; char lstr[32]; cfp = rig_ext_lookup_tok(rig, chan->ext_levels[idx].token); if (!cfp) return -RIG_EINVAL; switch (cfp->type) { case RIG_CONF_STRING: strcpy(lstr, chan->ext_levels[idx].val.s); break; case RIG_CONF_COMBO: sprintf(lstr, "%d", chan->ext_levels[idx].val.i); break; case RIG_CONF_NUMERIC: sprintf(lstr, "%f", chan->ext_levels[idx].val.f); break; case RIG_CONF_CHECKBUTTON: sprintf(lstr, "%s", chan->ext_levels[idx].val.i ? "ON" : "OFF"); break; case RIG_CONF_BUTTON: continue; default: return -RIG_EINTERNAL; } fprintf(fout, ",\t %s: %s", cfp->name, lstr); } fprintf(fout, "\n"); return RIG_OK; } /* '1' */ declare_proto_rig(dump_caps) { dumpcaps(rig, fout); return RIG_OK; } /* For rigctld internal use */ declare_proto_rig(dump_state) { int i; struct rig_state *rs = &rig->state; /* * - Protocol version */ #define RIGCTLD_PROT_VER 0 fprintf(fout, "%d\n", RIGCTLD_PROT_VER); fprintf(fout, "%d\n", rig->caps->rig_model); fprintf(fout, "%d\n", rs->itu_region); for (i=0; irx_range_list[i]); i++) fprintf(fout, "%"FREQFMT" %"FREQFMT" 0x%x %d %d 0x%x 0x%x\n", rs->rx_range_list[i].start, rs->rx_range_list[i].end, rs->rx_range_list[i].modes, rs->rx_range_list[i].low_power, rs->rx_range_list[i].high_power, rs->rx_range_list[i].vfo, rs->rx_range_list[i].ant ); fprintf(fout, "0 0 0 0 0 0 0\n"); for (i=0; itx_range_list[i]); i++) fprintf(fout, "%"FREQFMT" %"FREQFMT" 0x%x %d %d 0x%x 0x%x\n", rs->tx_range_list[i].start, rs->tx_range_list[i].end, rs->tx_range_list[i].modes, rs->tx_range_list[i].low_power, rs->tx_range_list[i].high_power, rs->tx_range_list[i].vfo, rs->tx_range_list[i].ant ); fprintf(fout, "0 0 0 0 0 0 0\n"); for (i=0; ituning_steps[i]); i++) fprintf(fout, "0x%x %ld\n", rs->tuning_steps[i].modes, rs->tuning_steps[i].ts); fprintf(fout, "0 0\n"); for (i=0; ifilters[i]); i++) fprintf(fout, "0x%x %ld\n", rs->filters[i].modes, rs->filters[i].width); fprintf(fout, "0 0\n"); #if 0 chan_t chan_list[CHANLSTSIZ]; /*!< Channel list, zero ended */ #endif fprintf(fout, "%ld\n", rs->max_rit); fprintf(fout, "%ld\n", rs->max_xit); fprintf(fout, "%ld\n", rs->max_ifshift); fprintf(fout, "%d\n", rs->announces); for (i=0; ipreamp[i]; i++) fprintf(fout, "%d ", rs->preamp[i]); fprintf(fout, "\n"); for (i=0; iattenuator[i]; i++) fprintf(fout, "%d ", rs->attenuator[i]); fprintf(fout, "\n"); fprintf(fout, "0x%lx\n", rs->has_get_func); fprintf(fout, "0x%lx\n", rs->has_set_func); fprintf(fout, "0x%lx\n", rs->has_get_level); fprintf(fout, "0x%lx\n", rs->has_set_level); fprintf(fout, "0x%lx\n", rs->has_get_parm); fprintf(fout, "0x%lx\n", rs->has_set_parm); #if 0 gran_t level_gran[RIG_SETTING_MAX]; /*!< level granularity */ gran_t parm_gran[RIG_SETTING_MAX]; /*!< parm granularity */ #endif return RIG_OK; } /* '3' */ declare_proto_rig(dump_conf) { dumpconf(rig, fout); return RIG_OK; } /* 'Y' */ declare_proto_rig(set_ant) { ant_t ant; CHKSCN1ARG(sscanf(arg1, "%d", &ant)); return rig_set_ant(rig, vfo, rig_idx2setting(ant)); } /* 'y' */ declare_proto_rig(get_ant) { int status; ant_t ant; status = rig_get_ant(rig, vfo, &ant); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%d%c", rig_setting2idx(ant), resp_sep); return status; } /* '*' */ declare_proto_rig(reset) { int reset; CHKSCN1ARG(sscanf(arg1, "%d", &reset)); return rig_reset(rig, (reset_t) reset); } /* 'b' */ declare_proto_rig(send_morse) { return rig_send_morse(rig, vfo, arg1); } declare_proto_rig(send_dtmf) { return rig_send_dtmf(rig, vfo, arg1); } declare_proto_rig(recv_dtmf) { int status; int len; char digits[MAXARGSZ]; len = MAXARGSZ-1; status = rig_recv_dtmf(rig, vfo, digits, &len); if (status != RIG_OK) return status; if (interactive && prompt) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%s\n", digits); return status; } /* '0x87' */ declare_proto_rig(set_powerstat) { int stat; CHKSCN1ARG(sscanf(arg1, "%d", &stat)); return rig_set_powerstat(rig, (powerstat_t) stat); } /* '0x88' */ declare_proto_rig(get_powerstat) { int status; powerstat_t stat; status = rig_get_powerstat(rig, &stat); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%d\n", stat); return status; } /* * special debugging purpose send command * display reply until there's a timeout * * 'w' */ declare_proto_rig(send_cmd) { int retval; struct rig_state *rs; int backend_num, cmd_len; #define BUFSZ 128 char bufcmd[BUFSZ]; char buf[BUFSZ]; char eom_buf[4] = { 0xa, 0xd, 0, 0 }; /* * binary protocols enter values as \0xZZ\0xYY.. */ backend_num = RIG_BACKEND_NUM(rig->caps->rig_model); if (send_cmd_term == -1 || backend_num == RIG_YAESU || backend_num == RIG_ICOM || backend_num == RIG_KACHINA || backend_num == RIG_MICROTUNE) { const char *p = arg1, *pp = NULL; int i; for (i=0; i < BUFSZ-1 && p != pp; i++) { pp = p+1; bufcmd[i] = strtol(p+1, (char **) &p, 0); } /* must save length to allow 0x00 to be sent as part of a command */ cmd_len = i-1; /* no End Of Message chars */ eom_buf[0] = '\0'; } else { /* text protocol */ strncpy(bufcmd,arg1,BUFSZ); bufcmd[BUFSZ-2] = '\0'; cmd_len = strlen(bufcmd); /* Automatic termination char */ if (send_cmd_term != 0) bufcmd[cmd_len++] = send_cmd_term; eom_buf[2] = send_cmd_term; } rs = &rig->state; serial_flush(&rs->rigport); retval = write_block(&rs->rigport, bufcmd, cmd_len); if (retval != RIG_OK) return retval; if (interactive && prompt) fprintf(fout, "%s: ", cmd->arg2); do { /* * assumes CR or LF is end of line char * for all ascii protocols */ retval = read_string(&rs->rigport, buf, BUFSZ, eom_buf, strlen(eom_buf)); if (retval < 0) break; if (retval < BUFSZ) buf[retval] = '\0'; else buf[BUFSZ-1] = '\0'; fprintf(fout, "%s\n", buf); } while (retval > 0); if (retval > 0 || retval == -RIG_ETIMEOUT) retval = RIG_OK; return retval; } /* '0xf0'--test if rigctld called with -o|--vfo option */ declare_proto_rig(chk_vfo) { fprintf(fout, "CHKVFO %d\n", vfo_mode); return RIG_OK; } /* '0xf1'--halt rigctld daemon */ declare_proto_rig(halt) { /* a bit rough, TODO: clean daemon shutdown */ exit(0); return RIG_OK; } hamlib-1.2.15.3/tests/rotctld.80000644000175000017500000004325112044564477013046 00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH ROTCTLD "8" "September 27, 2012" "Hamlib" "Rotator Control Daemon" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME rotctld \- Hamlib TCP rotator control daemon .SH SYNOPSIS .B rotctld [\fIOPTION\fR]... .SH DESCRIPTION The \fBrotctld\fP program is an NEW \fBHamlib\fP rotator control daemon ready for testing that handles client requests via TCP sockets. This allows multiple user programs to share one rotator (this needs testing), except on Win32 where pthreads are not available. Multiple rotators can be controlled on different TCP ports by use of multiple \fBrotctld\fP processes. The syntax of the commands are the same as \fBrotctl\fP. It is hoped that \fBrotctld\fP will be especially useful for client authors using languages such as Perl, Python, PHP, and others. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invoke bold face and italics, .\" respectively. \fBrotctld\fP communicates to a client through a TCP socket using text commands shared with \fBrotctl\fP. The protocol is simple, commands are sent to \fBrotctld\fP on one line and \fBrotctld\fP responds to "get" commands with the requested values, one per line, when successful, otherwise, it responds with one line "RPRT x", where x is a negative number indicating the error code. Commands that do not return values respond with the line "RPRT x", where x is zero when successful, otherwise is a regative number indicating the error code. Each line is terminated with a newline '\\n' character. This protocol is primarily for use by the \fINET rotctl\fP (rot model 2) backend. .PP A separate \fBExtended Response\fP protocol extends the above behavior by echoing the received command string as a header, any returned values as a key: value pair, and the "RPRT x" string as the end of response marker which includes the \fBHamlib\fP success or failure value. See the \fIPROTOCOL\fP section for details. Consider using this protocol for clients that will interact with \fBrotctld\fP directly through a TCP socket. .PP Keep in mind that \fBHamlib\fP is BETA level software. While a lot of backend libraries lack complete rotator support, the basic functions are usually well supported. The API may change without publicized notice, while an advancement of the minor version (e.g. 1.1.x to 1.2.x) indicates such a change. .PP Please report bugs and provide feedback at the e-mail address given in the REPORTING BUGS section. Patches and code enhancements are also welcome. .SH OPTIONS This program follows the usual GNU command line syntax, with long options starting with two dashes ('-'). .PP Here is a summary of the supported options: .TP .B \-m, --model=id Select rotator model number. See -l, "list" option below. .TP .B \-r, --rot-file=device Use \fIdevice\fP as the file name of the port the rotator is connected. Often a serial port, but could be a USB to serial adapter or USB port device. Typically /dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0, etc. on Linux or COM1, COM2, etc. on Win32. .TP .B \-s, --serial-speed=baud Set serial speed to \fIbaud\fP rate. Uses maximum serial speed from rotor backend capabilities (set by -m above) as the default. .TP .B \-T, --listen-addr=IPADDR Use \fIIPADDR\fP as the listening IP address. The default is ANY. .sp N.B.: This option seems mandatory on Win32, eg: -T 127.0.0.1 .TP .B \-t, --port=number Use \fInumber\fP as the TCP listening port. The default is 4533. .sp \fBN.B.\fP: As \fBrigctld\fP's default port is 4532, it is advisable to use odd numbered ports for \fBrotctld\fP, e.g. 4533, 4535, 4537, etc. .sp N.B.: This option seems mandatory on Win32, eg: -t 4533 .TP .B \-L, --show-conf List all config parameters for the rotator defined with -m above. .TP .B \-C, --set-conf=parm=val[,parm=val]* Set config parameter. e.g. --set-conf=stop_bits=2 .sp Use -L option for a list. .TP .B \-l, --list List all model numbers defined in \fBHamlib\fP and exit. As of 1.2.15.1 the list is sorted by model number. .sp \fBN.B.\fP In Linux the list can be scrolled back using Shift-PageUp/ Shift-PageDown, or using the scrollbars of a virtual terminal in X or the cmd window in Windows. The output can be piped to 'more' or 'less', e.g. 'rotctld -l | more'. .TP .B \-u, --dump-caps Dump capabilities for the radio defined with -m above and exit. .TP .B \-e, --end-marker Use END marker in rotctld protocol. .sp N.B.: This option should be considered obsolete. Please consider using the Extended Response protocol instead (see \fIPROTOCOL\fP below). This option will be removed in a future Hamlib release. .TP .B \-v, --verbose Set verbose mode, cumulative (see DIAGNOSTICS below). .TP .B \-h, --help Show a summary of these options and exit. .TP .B \-V, --version Show the version of \fBrotctld\fP and exit. .PP \fBN.B.\fP Some options may not be implemented by a given backend and will return an error. This is most likely to occur with the \fI\-\-set-conf\fP and \fI\-\-show-conf\fP options. .PP Please note that the backend for the rotator to be controlled, or the rotator itself may not support some commands. In that case, the operation will fail with a \fBHamlib\fP error code. .SH COMMANDS Commands can be sent over the TCP socket either as a single char, or as a long command name plus the value(s) space separated on one '\\n' terminated line. See \fIPROTOCOL\fP. .PP Since most of the \fBHamlib\fP operations have a \fIset\fP and a \fIget\fP method, an upper case letter will be used for \fIset\fP methods whereas the corresponding lower case letter refers to the \fIget\fP method. Each operation also has a long name; prepend a backslash to send a long command name. .PP Example (Perl): `print $socket "\\\\dump_caps\\n";' to see what the rotor's backend can do (NOTE: In Perl and many other languages a '\\' will need to be escaped with a preceding '\\' so that even though two backslash characters appear in the code, only one will be passed to \fBrotctld\fP. This is a possible bug, beware!). .PP Please note that the backend for the rotator to be controlled, or the rotator itself may not support some commands. In that case, the operation will fail with a \fBHamlib\fP error message. .PP Here is a summary of the supported commands (In the case of "set" commands the quoted string is replaced by the value in the description. In the case of "get" commands the quoted string is the key name of the value returned.): .TP .B P, set_pos 'Azimuth' 'Elevation' Set position: Azimuth and Elevation as double precision floating point values. .TP .B p, get_pos Get position: 'Azimuth' and 'Elevation' as double precision floating point values. .TP .B M, move 'Direction' 'Speed' Move the rotator in a specific direction at the given rate. .sp Values are integers where Direction is defined as 2 = Up, 4 = Down, 8 = Left, and 16 = Right. Speed is an integer between 1 and 100. Not all backends that implement the move command use the Speed value. At this time only the gs232a utilizes the Speed parameter. .TP .B S, stop Stop the rotator. .TP .B K, park Park the antenna. .TP .B C, set_conf 'Token' 'Value' Set Token to Value. .sp Backend dependent. Needs testing. .TP .B R, reset 'Reset' Reset the rotator. .sp Integer value of '1' for Reset All. .TP .B _, get_info Get misc information about the rotator. .sp At the moment returns 'Model Name'. .TP .B w, send_cmd 'Cmd' Send raw command string to rotator. .sp For binary protocols enter values as \\0xAA\\0xBB. Expect a 'Reply' from the rotator which will likely be a binary block or an ASCII string. .PP \fBLocator Commands\fP .PP These commands offer conversions of Degrees Minutes Seconds to other formats, Maidenhead square locator conversions and distance and azimuth conversions. .TP .B L, lonlat2loc 'Longitude' 'Latitude' 'Loc Len [2-12]' Returns the Maidenhead locator for the given 'Longitude' and 'Latitude'. .sp Both are floating point values. The precision of the returned square is controlled by 'Loc Len' which should be an even numbered integer value between 2 and 12. .sp For example, "+L -170.000000 -85.000000 12\\n" returns "Locator: AA55AA00AA00\\n". .TP .B l, loc2lonlat 'Locator' Returns 'Longitude' and 'Latitude' in decimal degrees at the approximate center of the requested grid square (despite the use of double precision variables internally, some rounding error occurs). West longitude is expressed as a negative value. South latitude is expressed as a negative value. Locator can be from 2 to 12 characters in length. .sp For example, "+l AA55AA00AA00\\n" returns "Longitude: -169.999983\\nLatitude: -84.999991\\n". .TP .B D, dms2dec 'Degrees' 'Minutes' 'Seconds' 'S/W' Returns 'Dec Degrees', a signed floating point value. .sp Degrees and Minutes are integer values and Seconds is a floating point value. S/W is a flag with '1' indicating South latitude or West longitude and '0' North or East (the flag is needed as computers don't recognize a signed zero even though only the Degrees value only is typically signed in DMS notation). .TP .B d, dec2dms 'Dec Degrees' Returns 'Degrees' 'Minutes' 'Seconds' 'S/W'. .sp Values are as in dms2dec above. .TP .B E, dmmm2dec 'Degrees' 'Dec Minutes' 'S/W' Returns 'Dec Degrees', a signed floating point value. .sp Degrees is an integer value and Minutes is a floating point value. S/W is a flag with '1' indicating South latitude or West longitude and '0' North or East (the flag is needed as computers don't recognize a signed zero even though only the Degrees value only is typically signed in DMS notation). .TP .B e, dec2dmmm 'Dec Deg' Returns 'Degrees' 'Minutes' 'S/W'. .sp Values are as in dmmm2dec above. .TP .B B, qrb 'Lon 1' 'Lat 1' 'Lon 2' 'Lat 2' Returns 'Distance' 'Azimuth' where Distance is in km and Azimuth is in degrees. .sp All Lon/Lat values are signed floating point numbers. .TP .B A, a_sp2a_lp 'Short Path Deg' Returns 'Long Path Deg' or -RIG_EINVAL upon input error.. .sp Both are floating point values within the range 0.00 to 360.00. .TP .B a, d_sp2d_lp 'Short Path km' Returns 'Long Path km'. .sp Both are floating point values. .SH PROTOCOL \fBDefault Protocol\fP .PP The \fBrotctld\fP protocol is intentionally simple. Commands are entered on a single line with any needed values. In Perl, reliable results are obtained by terminating each command string with a newline character, '\\n'. .sp Example \fIset\fP (Perl code): .sp print $socket "P 135 10\\n"; .sp print $socket "\\\\set_pos 135 10\\n"; # escape leading '\\' .PP A one line response will be sent as a reply to \fIset\fP commands, "RPRT \fIx\fP\\n" where \fIx\fP is the Hamlib error code with '0' indicating success of the command. .PP Responses from \fBrotctld\fP \fIget\fP commands are text values and match the same tokens used in the \fIset\fP commands. Each value is returned on its own line. On error the string "RPRT \fIx\fP\\n" is returned where \fIx\fP is the Hamlib error code. .sp Example \fIget\fP (Perl code): .sp print $socket "p\\n"; .br "135" .br "10" .PP Most \fIget\fP functions return one to three values. A notable exception is the \fI\\dump_caps\fP function which returns many lines of key:value pairs. .PP This protocol is primarily used by the \fINET rotctl\fP (rotctl model 2) backend which allows applications already written for Hamlib's C API to take advantage of \fBrotctld\fP without the need of rewriting application code. An application's user can select rotor model 2 ("NET rotctl") and then set rot_pathname to "localhost:4533" or other network host:port (set by the \fI-t\fP option above). .PP \fBExtended Response Protocol\fP .PP An \fIEXPERIMENTAL\fP Extended Response protocol has been introduced into \fBrotctld\fP as of February 10, 2010. This protocol adds several rules to the strings returned by \fBrotctld\fP and adds a rule for the command syntax. .PP 1. The command received by \fBrotctld\fP is echoed with its long command name followed by the value(s) (if any) received from the client terminated by the specified response separator as the first record of the response. .PP 2. The last record of each block is the string "RPRT \fIx\fP\\n" where \fIx\fP is the numeric return value of the Hamlib backend function that was called by the command. .PP 3. Any records consisting of data values returned by the rotor backend are prepended by a string immediately followed by a colon then a space and then the value terminated by the response separator. e.g. "Azimuth: 90.000000\\n" when the command was prepended by '+'. .PP 4. All commands received will be acknowledged by \fBrotctld\fP with records from rules 1 and 2. Records from rule 3 are only returned when data values must be returned to the client. .PP An example response to a \fI+P\fP command command sent from the shell prompt (note the prepended '+'): .sp $ echo "+P 90 45" | nc -w 1 localhost 4533 .br set_pos: 90 45 .br RPRT 0 .PP In this case the long command name and values are returned on the first line and the second line contains the end of block marker and the numeric rig backend return value indicating success. .PP An example response to a \fI+\\get_pos\fP query: .sp $ echo "+\\get_pos" | nc -w 1 localhost 4533 .br get_pos: .br Azimuth: 90.000000 .br Elevation: 45.000000 .br RPRT 0 .PP In this case, as no value is passed to \fBrotctld\fP, the first line consists only of the long command name. The final line shows that the command was processed successfully by the rotor backend. .PP Invoking the Extended Response protocol requires prepending a command with a punctuation character. As shown in the examples above, prepending a '+' character to the command results in the responses being separated by a newline character ('\\n'). Any other punctuation character recognized by the C \fIispunct()\fP function except '\\', '?', or '_' will cause that character to become the response separator and the entire response will be on one line. .PP Separator character summary: .TP .B '+' .br Each record of the response is appended with a newline ('\\n'). .TP .B ';', '|', or ',' .br Each record of the response is appended by the given character resulting in entire response on one line. .sp Common record separators for text representations of spreadsheet data, etc. .TP .B '?' .br Reserved for 'help' in rotctl short command .TP .B '_' .br Reserved for \\get_info short command .TP .B '#' .br Reserved for comments when reading a command file script .sp Other punctuation characters have not been tested! Use at your own risk. .PP For example, invoking a \fI;\\get_pos\fP query with a leading ';' returns: .sp get_pos:;Azimuth: 90.000000;Elevation: 45.000000;RPRT 0 .sp Or, using the pipe character '|' returns: .sp get_pos:|Azimuth: 90.000000|Elevation: 45.000000|RPRT 0 .sp And a \\set_pos command prepended with a '|' returns: .sp set_pos: 135 22.5|RPRT 0 .PP Such a format will allow reading a response as a single event using a preferred response separator. Other punctuation characters have not been tested! .PP All commands with the exception of \fI\\set_conf\fP have been tested with the Extended Response protocol and the included \fBtestrotctld.pl\fP script. .PP .SH EXAMPLES Start \fBrotctld\fP for a Ham IV rotor with the RotorEZ installed using a USB-to-serial adapter and backgrounding on Linux: .sp $ rotctld -m 401 -r /dev/ttyUSB1 & .sp Start \fBrotctld\fP for RotorEZ using COM3 on Win32: .sp C:\\> rotctld -m 401 -r COM3 -T 127.0.0.1 -t 4533 .sp Connect to the already running \fBrotctld\fP, and set position to 135.0 degrees azimuth and 30.0 degrees elevation with a 1 second read timeout from the shell prompt: .sp $ echo "\\set_pos 135.0 30.0" | nc -w 1 localhost 4533 .sp Connect to a running \fBrotctld\fP with \fBrotctl\fP on the local host on POSIX: .sp $ rotctl -m2 .sp and on Win32: .sp C:\\> rotctl -m 2 -r 127.0.0.1:4533 .SH DIAGNOSTICS The \fB-v\fP, \fB--version\fP option allows different levels of diagnostics to be output to \fBstderr\fP and correspond to -v for BUG, -vv for ERR, -vvv for WARN, -vvvv for VERBOSE, or -vvvvv for TRACE. .PP A given verbose level is useful for providing needed debugging information to the email address below. For example, TRACE output shows all of the values sent to and received from the rotator which is very useful for rotator backend library development and may be requested by the developers. See the \fBREADME.betatester\fP and \fBREADME.developer\fP files for more information. .SH SECURITY No authentication whatsoever; DO NOT leave this TCP port open wide to the Internet. Please ask if stronger security is needed or consider using an SSH tunnel. .PP As \fBrotctld\fP does not need any greater permissions than \fBrotctl\fP, it is advisable to not start \fBrotctld\fP as \fIroot\fP or another system user account in order to limit any vulnerability. .SH BUGS The daemon is not detaching and backgrounding itself. .PP Much testing needs to be done. .SH REPORTING BUGS Report bugs to . .PP We are already aware of the bugs in the previous section :-) .SH AUTHORS Written by Stephane Fillod, Nate Bargmann, and the Hamlib Group .PP . .SH COPYRIGHT Copyright \(co 2000-2009 Stephane Fillod .br Copyright \(co 2011-2012 Nate Bargmann .br Copyright \(co 2000-2009 the Hamlib Group. .PP This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .SH SEE ALSO .BR rotctl (1), .BR hamlib (3) hamlib-1.2.15.3/tests/rigctl.10000644000175000017500000004144312044564477012651 00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH RIGCTL "1" "September 27, 2012" "Hamlib" "Radio Control Program" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME rigctl \- control radio transceivers and receivers .SH SYNOPSIS .B rigctl [\fIOPTION\fR]... [\fICOMMAND\fR]... .SH DESCRIPTION Control radio transceivers and receivers. \fBrigctl\fP accepts \fBcommands\fP from the command line as well as in interactive mode if none are provided on the command line. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invoke bold face and italics, .\" respectively. Keep in mind that \fBHamlib\fP is BETA level software. While a lot of backend libraries lack complete rig support, the basic functions are usually well supported. The API may change without publicized notice, while an advancement of the minor version (e.g. 1.1.x to 1.2.x) indicates such a change. .PP Please report bugs and provide feedback at the e-mail address given in the REPORTING BUGS section. Patches and code enhancements are also welcome. .SH OPTIONS This program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). .PP Here is a summary of the supported options: .TP .B \-m, --model=id Select radio model number. See model list (use 'rigctl -l'). .sp NB: \fBrigctl\fP (or third party software) will use rig model 1901 when using \fBrpc.rigd\fP or rig model 2 for NET rigctl (rigctld). .TP .B \-r, --rig-file=device Use \fIdevice\fP as the file name of the port the radio is connected. Often a serial port, but could be a USB to serial adapter. Typically /dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0, etc. on Linux or COM1, COM2, etc. on Win32. .sp Also used to specify the host and port to connect to a listening rotctld daemon on POSIX: .sp -r localhost:4532 .sp and on Win32: .sp -r 127.0.0.1:4532 .TP .B \-p, --ptt-file=device Use \fIdevice\fP as the file name of the Push-To-Talk device using a device file as described above. .TP .B \-d, --dcd-file=device Use \fIdevice\fP as the file name of the Data Carrier Detect device using a device file as described above. .TP .B \-P, --ptt-type=type Use \fItype\fP of Push-To-Talk device. Supported types are RIG, DTR, RTS, PARALLEL, NONE, overriding PTT type defined in the rig's backend. .sp Some side effects of this command are that when type is set to DTR, read PTT state comes from Hamlib frontend, not read from the radio. When set to NONE, PTT state cannot be read or set even if rig backend supports reading/setting PTT status from the rig. .TP .B \-D, --dcd-type=type Use \fItype\fP of Data Carrier Detect device. Supported types are RIG, DSR, CTS, CD, PARALLEL, NONE. .TP .B \-s, --serial-speed=baud Set serial speed to \fIbaud\fP rate. Uses maximum serial speed from rig backend capabilities as the default. .TP .B \-c, --civaddr=id Use \fIid\fP as the CI-V address to communicate with the rig. Only useful for Icom rigs. .sp NB: the \fIid\fP is in decimal notation, unless prefixed by \fI0x\fP, in which case it is hexadecimal. .TP .B \-t, --send-cmd-term=char Change the termination \fIchar\fP for text protocol when using the \fIsend_cmd\fP command. The default value is (0x0d). Non ASCII printable characters can be specified as an ASCII number, in hexadecimal format, prepended with 0x. You may pass an empty string for no termination char. The string '-1' tells rigctl to switch to binary protocol. See the \fIsend_cmd\fP command for further explanation. .sp For example, to specify a command terminator for Kenwood style text commands pass "-t ';'" to rigctl. See EXAMPLES below. .TP .B \-L, --show-conf List all config parameters for the radio defined with -m above. .TP .B \-C, --set-conf=parm=val[,parm=val]* Set config parameter. e.g. stop_bits=2 .sp Use -L option for a list. .TP .B \-l, --list List all model numbers defined in \fBHamlib\fP and exit. As of 1.2.15.1 the list is sorted by model number. .sp \fBN.B.\fP In Linux the list can be scrolled back using Shift-PageUp/ Shift-PageDown, or using the scrollbars of a virtual terminal in X or the cmd window in Windows. The output can be piped to 'more' or 'less', e.g. 'rigctl -l | more'. .TP .B \-u, --dump-caps Dump capabilities for the radio defined with -m above and exit. .TP .B \-o, --vfo Set vfo mode, requiring an extra VFO argument in front of each appropriate command. Otherwise, VFO_CURR is assumed when this option is not set. .TP .B \-v, --verbose Set verbose mode, cumulative (see DIAGNOSTICS below). .TP .B \-h, --help Show summary of these options and exit. .TP .B \-V, --version Show version of \fBrigctl\fP and exit. .PP \fBN.B.\fP Some options may not be implemented by a given backend and will return an error. This is most likely to occur with the \fI\-\-set-conf\fP and \fI\-\-show-conf\fP options. .PP Please note that the backend for the radio to be controlled, or the radio itself may not support some commands. In that case, the operation will fail with a \fBHamlib\fP error code. .SH COMMANDS Commands can be entered either as a single char, or as a long command name. Basically, the commands do not take a dash in front of them on the command line, as the options do. They may be typed in when in interactive mode or provided as argument(s) in command line interface mode. .PP Since most of the \fBHamlib\fP operations have a \fIset\fP and a \fIget\fP method, an upper case letter will be used for \fIset\fP method whereas the corresponding lower case letter refers to the \fIget\fP method. Each operation also has a long name; in interactive mode, prepend a backslash to enter a long command name. .sp Example: Use "\\dump_caps" to see what this radio can do. .PP Please note that the backend for the radio to be controlled, or the radio itself may not support some commands. In that case, the operation will fail with a \fBHamlib\fP error message. .PP Here is a summary of the supported commands (In the case of "set" commands the quoted string is replaced by the value in the description. In the case of "get" commands the quoted string is the key name of the value returned.): .TP .B Q|q, exit rigctl Exit rigctl in interactive mode. .sp When rigctl is controlling the rig directly, will close the rig backend and port. When rigctl is connected to rigctld (rig model 2), the TCP/IP connection to rigctld is closed and rigctld remains running, available for another TCP/IP network connection. .TP .B F, set_freq 'Frequency' Set 'Frequency', in Hz. .TP .B f, get_freq Get 'Frequency', in Hz. .TP .B M, set_mode 'Mode' 'Passband' Set 'Mode': USB, LSB, CW, CWR, RTTY, RTTYR, AM, FM, WFM, AMS, PKTLSB, PKTUSB, PKTFM, ECSSUSB, ECSSLSB, FAX, SAM, SAL, SAH, DSB. .sp Set 'Passband' in Hz, or '0' for the Hamlib backend default. .TP .B m, get_mode Get 'Mode' 'Passband'. .sp Returns Mode as a string from \fIset_mode\fP above and Passband in Hz. .TP .B V, set_vfo 'VFO' Set 'VFO': VFOA, VFOB, VFOC, currVFO, VFO, MEM, Main, Sub, TX, RX. .sp In VFO mode only a single VFO parameter is required. .TP .B v, get_vfo Get current 'VFO'. .sp Returns VFO as a string from \fIset_vfo\fP above. .TP .B J, set_rit 'RIT' Set 'RIT', in Hz, can be + or -. .sp A value of '0' resets RIT and *should* turn RIT off. If not, file a bug report against the Hamlib backend. .TP .B j, get_rit Get 'RIT', in Hz. .TP .B Z, set_xit 'XIT' Set 'XIT', in Hz can be + or -. .sp A value of '0' resets RIT and *should* turn RIT off. If not, file a bug report against the Hamlib backend. .TP .B z, get_xit Get 'XIT', in Hz. .TP .B T, set_ptt 'PTT' Set 'PTT', 0 (RX), 1 (TX), 2 (TX mic), 3 (TX data). .TP .B t, get_ptt Get 'PTT' status. .TP .B 0x8b, get_dcd Get 'DCD' (squelch) status, 0 (Closed) or 1 (Open) .TP .B R, set_rptr_shift 'Rptr Shift' Set 'Rptr Shift': "+", "-" or something else for none. .TP .B r, get_rptr_shift Get 'Rptr Shift'. Returns "+", "-" or "None". .TP .B O, set_rptr_offs 'Rptr Offset' Set 'Rptr Offset', in Hz. .TP .B o, get_rptr_offs Get 'Rptr Offset', in Hz. .TP .B C, set_ctcss_tone 'CTCSS Tone' Set 'CTCSS Tone', in tenths of Hz. .TP .B c, get_ctcss_tone Get 'CTCSS Tone', in tenths of Hz. .TP .B D, set_dcs_code 'DCS Code' Set 'DCS Code'. .TP .B d, get_dcs_code Get 'DCS Code'. .TP .B 0x90, set_ctcss_sql 'CTCSS Sql' Set 'CTCSS Sql' tone, in tenths of Hz. .TP .B 0x91, get_ctcss_sql Get 'CTCSS Sql' tone, in tenths of Hz. .TP .B 0x92, set_dcs_sql 'DCS Sql' Set 'DCS Sql' code. .TP .B 0x93, get_dcs_sql Get 'DCS Sql' code. .TP .B I, set_split_freq 'Tx Frequency' Set 'TX Frequency', in Hz. .TP .B i, get_split_freq Get 'TX Frequency', in Hz. .TP .B X, set_split_mode 'TX Mode' 'TX Passband' Set 'TX Mode': AM, FM, CW, CWR, USB, LSB, RTTY, RTTYR, WFM, AMS, PKTLSB, PKTUSB, PKTFM, ECSSUSB, ECSSLSB, FAX, SAM, SAL, SAH, DSB. .sp The 'TX Passband' is the exact passband in Hz, or '0' for the Hamlib backend default. .TP .B x, get_split_mode Get 'TX Mode' and 'TX Passband'. .sp Returns TX mode as a string from \fIset_split_mode\fP above and TX passband in Hz. .TP .B S, set_split_vfo 'Split' 'TX VFO' Set 'Split' mode, '0' or '1', and 'TX VFO' from \fIset_vfo\fP above. .TP .B s, get_split_vfo Get 'Split' mode, '0' or '1', and 'TX VFO'. .TP .B N, set_ts 'Tuning Step' Set 'Tuning Step', in Hz. .TP .B n, get_ts Get 'Tuning Step', in Hz. .TP .B U, set_func 'Func' 'Func Status' Set 'Func' 'Func Status'. .sp Func is one of: FAGC, NB, COMP, VOX, TONE, TSQL, SBKIN, FBKIN, ANF, NR, AIP, APF, MON, MN, RF, ARO, LOCK, MUTE, VSC, REV, SQL, ABM, BC, MBC, AFC, SATMODE, SCOPE, RESUME, TBURST, TUNER. .sp Func Status argument is a non null value for "activate", "de-activate" otherwise, much as TRUE/FALSE definitions in C language. .TP .B u, get_func Get 'Func' 'Func Status'. .sp Returns Func as a string from \fIset_func\fP above and Func status as a non null value. .TP .B L, set_level 'Level' 'Level Value' Set 'Level' and 'Level Value'. .sp Level is one of: PREAMP, ATT, VOX, AF, RF, SQL, IF, APF, NR, PBT_IN, PBT_OUT, CWPITCH, RFPOWER, MICGAIN, KEYSPD, NOTCHF, COMP, AGC (0:OFF, 1:SUPERFAST, 2:FAST, 3:SLOW, 4:USER, 5:MEDIUM, 6:AUTO), BKINDL, BAL, METER, VOXGAIN, ANTIVOX, SLOPE_LOW, SLOPE_HIGH, RAWSTR, SWR, ALC, STRENGTH. .sp The Level Value can be a float or an integer. .TP .B l, get_level Get 'Level' 'Level Value'. .sp Returns Level as a string from \fIset_level\fP above and Level value as a float or integer. .TP .B P, set_parm 'Parm' 'Parm Value' Set 'Parm' 'Parm Value' .sp Parm is one of: ANN, APO, BACKLIGHT, BEEP, TIME, BAT, KEYLIGHT. .TP .B p, get_parm Get 'Parm' 'Parm Value'. .sp Returns Parm as a string from \fIset_parm\fP above and Parm Value as a float or integer. .TP .B B, set_bank 'Bank' Set 'Bank'. Sets the current memory bank number. .TP .B E, set_mem 'Memory#' Set 'Memory#' channel number. .TP .B e, get_mem Get 'Memory#' channel number. .TP .B G, vfo_op 'Mem/VFO Op' Perform 'Mem/VFO Op'. .sp Mem VFO operation is one of: CPY, XCHG, FROM_VFO, TO_VFO, MCL, UP, DOWN, BAND_UP, BAND_DOWN, LEFT, RIGHT, TUNE, TOGGLE. .TP .B g, scan 'Scan Fct' 'Scan Channel' Perform 'Scan Fct' 'Scan Channel'. .sp Scan function/channel is one of: STOP, MEM, SLCT, PRIO, PROG, DELTA, VFO, PLT. .TP .B H, set_channel 'Channel' Set memory 'Channel' data. Not implemented yet. .TP .B h, get_channel Get memory 'Channel' data. Not implemented yet. .TP .B A, set_trn 'Transceive' Set 'Transceive' mode (reporting event): OFF, RIG, POLL. .TP .B a, get_trn Get 'Transceive' mode (reporting event) as in \fIset_trn\fP above. .TP .B Y, set_ant 'Antenna' Set 'Antenna' number (0, 1, 2, ..). .TP .B y, get_ant Get 'Antenna' number (0, 1, 2, ..). .TP .B *, reset 'Reset' Perform rig 'Reset'. .sp 0 = None, 1 = Software reset, 2 = VFO reset, 4 = Memory Clear reset, 8 = Master reset. Since these values are defined as a bitmask in rig.h, it should be possible to AND these values together to do multiple resets at once, if the backend supports it or supports a reset action via rig control at all. .TP .B b, send_morse 'Morse' Send 'Morse' symbols. .TP .B 0x87, set_powerstat 'Power Status' Set power On/Off/Standby 'Power Status'. .sp 0 = Power Off, 1 = Power On, 2 = Power Standby. Defined as a bitmask in rig.h. .TP .B 0x88, get_powerstat Get power On/Off/Standby 'Power Status' as in \fIset_powerstat\fP above. .TP .B 0x89, send_dtmf 'Digits' Set DTMF 'Digits'. .TP .B 0x8a, recv_dtmf Get DTMF 'Digits'. .TP .B _, get_info Get misc information about the rig (no VFO in 'VFO mode' or value is passed). .TP .B 1, dump_caps Not a real rig remote command, it just dumps capabilities, i.e. what the backend knows about this model, and what it can do. .sp TODO: Ensure this is in a consistent format so it can be read into a hash, dictionary, etc. Bug reports requested. .sp \fBN.B.\fP: This command will produce many lines of output so be very careful if using a fixed length array! For example, running this command against the Dummy backend results in over 5kB of text output. .sp VFO parameter not used in 'VFO mode'. .TP .B 2, power2mW 'Power [0.0..1.0]' 'Frequency' 'Mode' Returns 'Power mW' .sp Converts a Power value in a range of \fI0.0 ... 1.0\fP to the real transmit power in milli-Watts (integer). The \fIfrequency\fP and \fImode\fP also need to be provided as output power may vary according to these values. .sp VFO parameter not used in 'VFO mode'. .TP .B 4, mW2power 'Power mW' 'Frequency' 'Mode' Returns 'Power [0.0..1.0]' .sp Converts the real transmit power in milli-Watts (integer) to a Power value in a range of \fI0.0 ... 1.0\fP. The \fIfrequency\fP and \fImode\fP also need to be provided as output power may vary according to these values. .sp VFO parameter not used in 'VFO mode'. .TP .B w, send_cmd 'Cmd' Send raw command string to rig. This is useful for testing and troubleshooting rig commands and responses when developing a backend. .sp For binary protocols enter values as \\0xAA\\0xBB. Expect a 'Reply' from the rig which will likely be a binary block or an ASCII string depending on the rig's protocol (see your radio's computer control documentation). .sp The command terminator, set by the \fIsend-cmd-term\fP option above, will terminate each command string sent to the radio. This character should not be a part of the input string. .SH EXAMPLES Start \fBrigctl\fP for a Yaesu FT-920 using a USB to serial adapter on Linux in interactive mode: .sp $ rigctl -m 114 -r /dev/ttyUSB1 .sp Start \fBrigctl\fP for a Yaesu FT-920 using COM1 on Win32 while generating TRACE output to \fBstderr\fP: .sp C:\\> rigctl -m 114 -r COM1 -vvvvv .sp Start \fBrigctl\fP for a Yaesu FT-920 using a USB to serial adapter while setting baud rate and stop bits: .sp $ rigctl -m 114 -r /dev/ttyUSB1 -s 4800 -C stop_bits=2 .sp Start \fBrigctl\fP for an Elecraft K3 using a USB to serial adapter while specifying a command terminator for the 'w' command: .sp $ rigctl -m 229 -r /dev/ttyUSB0 -t';' .sp Start \fBrigctl\fP using \fBrpc.rigd\fP and setting the frequency and mode: .sp $ rigctl -m 1901 -r localhost F 7253500 M LSB 0 .sp Connect to a running \fBrigctld\fP with rig model 2 ("NET rigctl") on the local host and specifying the TCP port on POSIX: .sp $ rigctl -m 2 -r localhost:4532 .sp and on Win32: .sp C:\\> rigctl -m 2 -r 127.0.0.1:4532 .SH DIAGNOSTICS The \fB-v\fP, \fB--verbose\fP option allows different levels of diagnostics to be output to \fBstderr\fP and correspond to -v for BUG, -vv for ERR, -vvv for WARN, -vvvv for VERBOSE, or -vvvvv for TRACE. A given verbose level is useful for providing needed debugging information to the email address below. For example, TRACE output shows all of the values sent to and received from the radio which is very useful for radio backend library development and may be requested by the developers. .SH EXIT STATUS \fBrigctl\fP exits with: .br 0 if all operations completed normally; .br 1 if there was an invalid command line option or argument; .br 2 if an error was returned by \fBHamlib\fP. .SH BUGS set_chan has no entry method as of yet, hence left unimplemented. This almost empty section... .SH REPORTING BUGS Report bugs to . .PP We are already aware of the bugs in the previous section :-) .SH AUTHORS Written by Stephane Fillod, Nate Bargmann, and the Hamlib Group .PP . .SH COPYRIGHT Copyright \(co 2000-2010 Stephane Fillod .br Copyright \(co 2010-2012 Nate Bargmann .br Copyright \(co 2000-2010 the Hamlib Group. .sp This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .SH SEE ALSO .BR hamlib (3), .BR rpc.rigd (8) .BR rigctld(8) hamlib-1.2.15.3/tests/memsave.c0000644000175000017500000001554412044564477013107 00000000000000/* * memsave.c - Copyright (C) 2003-2005 Thierry Leconte * Copyright (C) 2008-2010 Stephane Fillod * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include "misc.h" #ifdef HAVE_XML2 #include #include static int dump_xml_chan(RIG *rig, channel_t **chan, int channel_num, const chan_t *chan_list, rig_ptr_t arg); #endif int xml_save (RIG *rig, const char *outfilename) { #ifdef HAVE_XML2 int retval; xmlDocPtr Doc; xmlNodePtr root; /* create xlm Doc */ Doc=xmlNewDoc((unsigned char *) "1.0"); root=xmlNewNode(NULL,(unsigned char *) "hamlib"); xmlDocSetRootElement(Doc, root); root=xmlNewChild(root,NULL,(unsigned char *) "channels",NULL); if (rig->caps->clone_combo_get) printf("About to save data, enter cloning mode: %s\n", rig->caps->clone_combo_get); retval = rig_get_chan_all_cb (rig, dump_xml_chan, root); if (retval != RIG_OK) return retval; /* write xml File */ xmlSaveFormatFileEnc(outfilename, Doc, "UTF-8", 1); xmlFreeDoc(Doc); xmlCleanupParser(); return 0; #else return -RIG_ENAVAIL; #endif } int xml_parm_save (RIG *rig, const char *outfilename) { return -RIG_ENIMPL; } #ifdef HAVE_XML2 int dump_xml_chan(RIG *rig, channel_t **chan_pp, int chan_num, const chan_t *chan_list, rig_ptr_t arg) { char attrbuf[20]; xmlNodePtr root = arg; xmlNodePtr node = NULL; int i; const char *mtype; static channel_t chan; const channel_cap_t *mem_caps = &chan_list->mem_caps; if (*chan_pp == NULL) { /* * Hamlib frontend demand application an allocated * channel_t pointer for next round. */ *chan_pp = &chan; return RIG_OK; } if (chan_list->type == RIG_MTYPE_NONE) return RIG_OK; mtype = rig_strmtype(chan_list->type); for (i=0; ibank_num) { sprintf(attrbuf,"%d",chan.bank_num); xmlNewProp(node, (unsigned char *) "bank_num", (unsigned char *) attrbuf); } sprintf(attrbuf,"%d",chan.channel_num); xmlNewProp(node, (unsigned char *) "num", (unsigned char *) attrbuf); if (mem_caps->channel_desc && chan.channel_desc[0]!='\0') { xmlNewProp(node, (unsigned char *) "channel_desc", (unsigned char *) chan.channel_desc); } if (mem_caps->vfo) { sprintf(attrbuf,"%d",chan.vfo); xmlNewProp(node, (unsigned char *) "vfo", (unsigned char *) attrbuf); } if (mem_caps->ant && chan.ant != RIG_ANT_NONE) { sprintf(attrbuf,"%d",chan.ant); xmlNewProp(node, (unsigned char *) "ant", (unsigned char *) attrbuf); } if (mem_caps->freq && chan.freq != RIG_FREQ_NONE) { sprintf(attrbuf,"%"PRIll,(int64_t)chan.freq); xmlNewProp(node, (unsigned char *) "freq", (unsigned char *) attrbuf); } if (mem_caps->mode && chan.mode != RIG_MODE_NONE) { xmlNewProp(node, (unsigned char *) "mode", (unsigned char *) rig_strrmode(chan.mode)); } if (mem_caps->width && chan.width != 0) { sprintf(attrbuf,"%d",(int)chan.width); xmlNewProp(node, (unsigned char *) "width", (unsigned char *) attrbuf); } if (mem_caps->tx_freq && chan.tx_freq != RIG_FREQ_NONE) { sprintf(attrbuf,"%"PRIll,(int64_t)chan.tx_freq); xmlNewProp(node, (unsigned char *) "tx_freq", (unsigned char *) attrbuf); } if (mem_caps->tx_mode && chan.tx_mode != RIG_MODE_NONE) { xmlNewProp(node, (unsigned char *) "tx_mode", (unsigned char *) rig_strrmode(chan.tx_mode)); } if (mem_caps->tx_width && chan.tx_width!=0) { sprintf(attrbuf,"%d",(int)chan.tx_width); xmlNewProp(node, (unsigned char *) "tx_width", (unsigned char *) attrbuf); } if (mem_caps->split && chan.split!=RIG_SPLIT_OFF) { xmlNewProp(node, (unsigned char *) "split", (unsigned char *) "on"); if (mem_caps->tx_vfo) { sprintf(attrbuf,"%x",chan.tx_vfo); xmlNewProp(node, (unsigned char *) "tx_vfo", (unsigned char *) attrbuf); } } if (mem_caps->rptr_shift && chan.rptr_shift!=RIG_RPT_SHIFT_NONE) { xmlNewProp(node, (unsigned char *) "rptr_shift", (unsigned char *) rig_strptrshift(chan.rptr_shift)); if (mem_caps->rptr_offs && (int)chan.rptr_offs!=0) { sprintf(attrbuf,"%d",(int)chan.rptr_offs); xmlNewProp(node, (unsigned char *) "rptr_offs", (unsigned char *) attrbuf); } } if (mem_caps->tuning_step && chan.tuning_step !=0) { sprintf(attrbuf,"%d",(int)chan.tuning_step); xmlNewProp(node, (unsigned char *) "tuning_step", (unsigned char *) attrbuf); } if (mem_caps->rit && chan.rit!=0) { sprintf(attrbuf,"%d",(int)chan.rit); xmlNewProp(node, (unsigned char *) "rit", (unsigned char *) attrbuf); } if (mem_caps->xit && chan.xit !=0) { sprintf(attrbuf,"%d",(int)chan.xit); xmlNewProp(node, (unsigned char *) "xit", (unsigned char *) attrbuf); } if (mem_caps->funcs) { sprintf(attrbuf,"%lx",chan.funcs); xmlNewProp(node, (unsigned char *) "funcs", (unsigned char *) attrbuf); } if (mem_caps->ctcss_tone && chan.ctcss_tone !=0) { sprintf(attrbuf,"%d",chan.ctcss_tone); xmlNewProp(node, (unsigned char *) "ctcss_tone", (unsigned char *) attrbuf); } if (mem_caps->ctcss_sql && chan.ctcss_sql !=0) { sprintf(attrbuf,"%d",chan.ctcss_sql); xmlNewProp(node, (unsigned char *) "ctcss_sql", (unsigned char *) attrbuf); } if (mem_caps->dcs_code && chan.dcs_code !=0) { sprintf(attrbuf,"%d",chan.dcs_code); xmlNewProp(node, (unsigned char *) "dcs_code", (unsigned char *) attrbuf); } if (mem_caps->dcs_sql && chan.dcs_sql !=0) { sprintf(attrbuf,"%d",chan.dcs_sql); xmlNewProp(node, (unsigned char *) "dcs_sql", (unsigned char *) attrbuf); } if (mem_caps->scan_group) { sprintf(attrbuf,"%d",chan.scan_group); xmlNewProp(node, (unsigned char *) "scan_group", (unsigned char *) attrbuf); } if (mem_caps->flags) { sprintf(attrbuf,"%x",chan.flags); xmlNewProp(node, (unsigned char *) "flags", (unsigned char *) attrbuf); } return 0; } #endif hamlib-1.2.15.3/tests/memcsv.c0000644000175000017500000004607212044564477012744 00000000000000/* * memcsv.c - (C) Stephane Fillod 2003-2005 * * This program exercises the backup and restore of a radio * using Hamlib. CSV primitives * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include "misc.h" #include "sprintflst.h" /* * external prototype */ extern int all; char csv_sep = ','; /* CSV separator */ /* * Prototypes */ static int dump_csv_chan(RIG *rig, channel_t **chan, int channel_num, const chan_t *chan_list, rig_ptr_t arg); static void dump_csv_name(const channel_cap_t *mem_caps, FILE *f); static int set_channel_data(RIG *rig, channel_t *chan, char **line_key, char **line_data); static char* mystrtok( char *s, char delim ); static int tokenize_line( char *line, char **token_list, size_t siz, char delim ); static int find_on_list( char **list, char *what ); int csv_save (RIG *rig, const char *outfilename); int csv_load (RIG *rig, const char *infilename); int csv_parm_save (RIG *rig, const char *outfilename); int csv_parm_load (RIG *rig, const char *infilename); int csv_save (RIG *rig, const char *outfilename) { int status; FILE *f; f = fopen(outfilename, "w"); if (!f) return -1; if (rig->caps->clone_combo_get) printf("About to save data, enter cloning mode: %s\n", rig->caps->clone_combo_get); status = rig_get_chan_all_cb (rig, dump_csv_chan, f); fclose(f); return status; } /** csv_load assumes the first line in a csv file is a key line, defining entries and their number. First line should not contain 'empty column', i.e. two adjacent commas. Each next line should contain the same number of entries. However, empty columns (two adjacent commas) are allowed. \param rig - a pointer to the rig \param infilename - a string with a file name to write to */ int csv_load (RIG *rig, const char *infilename) { int status = RIG_OK; FILE *f; char *key_list[ 64 ]; char *value_list[ 64 ]; char keys[ 256 ]; char line[ 256 ]; channel_t chan; f = fopen(infilename, "r"); if (!f) return -1; /* First read the first line, containing the key */ if( fgets( keys, sizeof( keys ), f ) != NULL ){ /* fgets stores '\n' in a buffer, get rid of it */ keys[ strlen( keys )-1 ] = '\0'; printf("Read the key: %s\n", keys ); /* Tokenize the key list */ if( !tokenize_line( keys, key_list, sizeof(key_list)/sizeof(char*), ',' ) ){ fprintf( stderr, "Invalid (possibly too long or empty) key line, cannot continue.\n" ); fclose(f); return -1; } }else{ /* File exists, but is empty */ fclose(f); return -1; } /* Next, read the file line by line */ while ( fgets ( line, sizeof line, f ) != NULL ){ /* Tokenize the line */ if( !tokenize_line( line, value_list, sizeof(value_list)/sizeof(char*), ',' ) ){ fprintf( stderr, "Invalid (possibly too long or empty) line ignored\n" ); continue; } /* Parse a line, write channel data into chan */ set_channel_data( rig, &chan, key_list, value_list ); /* Write a rig memory */ status=rig_set_channel(rig, &chan); if (status != RIG_OK ) { fprintf( stderr, "rig_get_channel: error = %s \n", rigerror(status)); fclose(f); return status; } } fclose( f ); return status; } /** Function to break a line into a list of tokens. Delimiters are replaced by end-of-string characters ('\0'), and a list of pointers to thus created substrings is created. \param line (input) - a line to be tokenized, the line will be modified! \param token_list (output) - a resulting table containing pointers to tokens, or NULLs (the table will be initially nulled ) all the pointers schould point to addresses within the line \param siz (input) - size of the table \param delim (input) - delimiter character \return number of tokens on success, 0 if \param token_list is too small to contain all the tokens, or if line was empty. */ static int tokenize_line( char *line, char **token_list, size_t siz, char delim ){ size_t i; char *tok; // printf("Starting tokenizer, line pointer %x, list pointer %x, list size = %d...", line, token_list, siz); /* Erase the table */ for( i = 0; i < siz; i++ ){ token_list[i] = NULL; } // printf(", list emptied!\n"); /* Empty line passed? */ if( line == NULL ) return 0; /* Reinitialize, find the first token */ i = 0; tok = mystrtok( line, delim ); /* Line contains no delim */ if( tok == NULL ) return 0; token_list[ i++ ] = tok; // printf("First token is: %s\n", tok); /* Find the remaining tokens */ while( i < siz ){ tok = mystrtok( NULL, delim ); // printf("Next token: %s\n", tok ); /* If NULL, no more tokens left */ if( (tok == NULL) ) break; /* Add token to the list */ token_list[ i++ ] = tok; } // printf("Finished tokenizing, i = %d, siz = %d\n", i, siz); /* Any tokens left? */ if( i == siz ){ return 0; }else{ return i; } } /** Tokenizer that handles two delimiters by returning an empty string. First param (input) is a string to be tokenized, second is a delimiter (input) This tokenizer accepts only one delimiter! \param s - string to divide on first run, NULL on each next \param delim - delimiter \return pointer to token, or NULL if there are no more tokens \sa "man strtok" */ static char* mystrtok( char *s, char delim ){ static size_t pos = 0, length = 0; static char *str = 0; if( s != NULL ){ str = s; pos = 0; length = strlen( str ); }else{ } if( str[ pos+1 ] == '\0' ) return NULL; size_t i,ent_pos = pos; for( i = pos; i < length; ){ if( str[i] == delim ){ str[i] = '\0'; pos = i+1; return str+ent_pos; }else{ i++; } } return str + ent_pos; } static int print_parm_name(RIG *rig, const struct confparams *cfp, rig_ptr_t ptr) { fprintf((FILE*)ptr, "%s%c", cfp->name, csv_sep); return 1; /* process them all */ } static int print_parm_val(RIG *rig, const struct confparams *cfp, rig_ptr_t ptr) { value_t val; FILE *f=(FILE*)ptr; rig_get_ext_parm(rig, cfp->token, &val); switch (cfp->type) { case RIG_CONF_CHECKBUTTON: case RIG_CONF_COMBO: fprintf(f,"%d%c", val.i, csv_sep); break; case RIG_CONF_NUMERIC: fprintf(f,"%f%c", val.f, csv_sep); break; case RIG_CONF_STRING: fprintf(f,"%s%c", val.s, csv_sep); break; default: fprintf(f,"unknown%c", csv_sep); } return 1; /* process them all */ } int csv_parm_save (RIG *rig, const char *outfilename) { int i, ret; FILE *f; setting_t parm, get_parm = all ? 0x7fffffff : rig->state.has_get_parm; f = fopen(outfilename, "w"); if (!f) return -1; for (i = 0; i < RIG_SETTING_MAX; i++) { const char *ms = rig_strparm(get_parm & rig_idx2setting(i)); if (!ms || !ms[0]) continue; fprintf(f, "%s%c", ms, csv_sep); } rig_ext_parm_foreach(rig, print_parm_name, f); fprintf(f, "\n"); for (i = 0; i < RIG_SETTING_MAX; i++) { const char *ms; value_t val; parm = get_parm & rig_idx2setting(i); ms = rig_strparm(parm); if (!ms || !ms[0]) continue; ret = rig_get_parm(rig, parm, &val); if (ret != RIG_OK) return ret; if (RIG_PARM_IS_FLOAT(parm)) fprintf(f, "%f%c", val.f, csv_sep); else fprintf(f, "%d%c", val.i, csv_sep); } rig_ext_parm_foreach(rig, print_parm_val, f); fprintf(f, "\n"); fclose(f); return 0; } int csv_parm_load (RIG *rig, const char *infilename) { return -RIG_ENIMPL; /* for every parm/ext_parm, fscanf, parse, set_parm's */ } /* *********************** */ /* Caution! Keep the function consistent with dump_csv_chan and set_channel_data! */ void dump_csv_name(const channel_cap_t *mem_caps, FILE *f) { fprintf(f, "num%c", csv_sep); if (mem_caps->bank_num) { fprintf(f, "bank_num%c", csv_sep); } if (mem_caps->channel_desc) { fprintf(f, "channel_desc%c", csv_sep); } if (mem_caps->vfo) { fprintf(f, "vfo%c", csv_sep); } if (mem_caps->ant) { fprintf(f, "ant%c", csv_sep); } if (mem_caps->freq) { fprintf(f, "freq%c", csv_sep); } if (mem_caps->mode) { fprintf(f, "mode%c", csv_sep); } if (mem_caps->width) { fprintf(f, "width%c", csv_sep); } if (mem_caps->tx_freq) { fprintf(f, "tx_freq%c", csv_sep); } if (mem_caps->tx_mode) { fprintf(f, "tx_mode%c", csv_sep); } if (mem_caps->tx_width) { fprintf(f, "tx_width%c", csv_sep); } if (mem_caps->split) { fprintf(f, "split%c", csv_sep); } if (mem_caps->tx_vfo) { fprintf(f, "tx_vfo%c", csv_sep); } if (mem_caps->rptr_shift) { fprintf(f, "rptr_shift%c", csv_sep); } if (mem_caps->rptr_offs) { fprintf(f, "rptr_offs%c", csv_sep); } if (mem_caps->tuning_step) { fprintf(f, "tuning_step%c", csv_sep); } if (mem_caps->rit) { fprintf(f, "rit%c", csv_sep); } if (mem_caps->xit) { fprintf(f, "xit%c", csv_sep); } if (mem_caps->funcs) { fprintf(f, "funcs%c", csv_sep); } if (mem_caps->ctcss_tone) { fprintf(f, "ctcss_tone%c", csv_sep); } if (mem_caps->ctcss_sql) { fprintf(f, "ctcss_sql%c", csv_sep); } if (mem_caps->dcs_code) { fprintf(f, "dcs_code%c", csv_sep); } if (mem_caps->dcs_sql) { fprintf(f, "dcs_sql%c", csv_sep); } if (mem_caps->scan_group) { fprintf(f, "scan_group%c", csv_sep); } if (mem_caps->flags) { fprintf(f, "flags%c", csv_sep); } fprintf(f, "\n"); } /* Caution! Keep the function consistent with dump_csv_name and set_channel_data! */ int dump_csv_chan(RIG *rig, channel_t **chan_pp, int channel_num, const chan_t *chan_list, rig_ptr_t arg) { FILE *f = arg; static channel_t chan; static int first_time = 1; const channel_cap_t *mem_caps = &chan_list->mem_caps; if (first_time) { dump_csv_name(mem_caps, f); first_time = 0; } if (*chan_pp == NULL) { /* * Hamlib frontend demand application an allocated * channel_t pointer for next round. */ *chan_pp = &chan; return RIG_OK; } fprintf(f,"%d%c",chan.channel_num, csv_sep); if (mem_caps->bank_num) { fprintf(f,"%d%c",chan.bank_num, csv_sep); } if (mem_caps->channel_desc) { fprintf(f, "%s%c", chan.channel_desc, csv_sep); } if (mem_caps->vfo) { fprintf(f,"%s%c",rig_strvfo(chan.vfo), csv_sep); } if (mem_caps->ant) { fprintf(f,"%d%c",chan.ant, csv_sep); } if (mem_caps->freq) { fprintf(f,"%.0"PRIfreq"%c",chan.freq, csv_sep); } if (mem_caps->mode) { fprintf(f, "%s%c", rig_strrmode(chan.mode), csv_sep); } if (mem_caps->width) { fprintf(f,"%d%c",(int)chan.width, csv_sep); } if (mem_caps->tx_freq) { fprintf(f,"%.0"PRIfreq"%c",chan.tx_freq, csv_sep); } if (mem_caps->tx_mode) { fprintf(f, "%s%c", rig_strrmode(chan.tx_mode), csv_sep); } if (mem_caps->tx_width) { fprintf(f,"%d%c",(int)chan.tx_width, csv_sep); } if (mem_caps->split) { fprintf(f, "%s%c", chan.split==RIG_SPLIT_ON?"on":"off", csv_sep); } if (mem_caps->tx_vfo) { fprintf(f,"%s%c",rig_strvfo(chan.tx_vfo), csv_sep); } if (mem_caps->rptr_shift) { fprintf(f, "%s%c", rig_strptrshift(chan.rptr_shift), csv_sep); } if (mem_caps->rptr_offs) { fprintf(f,"%d%c",(int)chan.rptr_offs, csv_sep); } if (mem_caps->tuning_step) { fprintf(f,"%d%c",(int)chan.tuning_step, csv_sep); } if (mem_caps->rit) { fprintf(f,"%d%c",(int)chan.rit, csv_sep); } if (mem_caps->xit) { fprintf(f,"%d%c",(int)chan.xit, csv_sep); } if (mem_caps->funcs) { fprintf(f,"%lx%c",chan.funcs, csv_sep); } if (mem_caps->ctcss_tone) { fprintf(f,"%d%c",chan.ctcss_tone, csv_sep); } if (mem_caps->ctcss_sql) { fprintf(f,"%d%c",chan.ctcss_sql, csv_sep); } if (mem_caps->dcs_code) { fprintf(f,"%d%c",chan.dcs_code, csv_sep); } if (mem_caps->dcs_sql) { fprintf(f,"%d%c",chan.dcs_sql, csv_sep); } if (mem_caps->scan_group) { fprintf(f,"%d%c",chan.scan_group, csv_sep); } if (mem_caps->flags) { fprintf(f,"%x%c",chan.flags, csv_sep); } fprintf(f,"\n"); /* * keep the same *chan_pp for next round, thanks * to chan being static */ return RIG_OK; } /** Function to parse a line read from csv file and store the data into appropriate fields of channel_t. The function must be consistent with dump_csv_name and dump_csv_chan. \param rig - a pointer to the rig \param chan - a pointer to channel_t structure with channel data \param line_key_list - a pointer to a table of strings with "keys" \param line_data_list - a pointer to a table of strings with values \return 0 on success, negative value on error */ int set_channel_data(RIG *rig, channel_t *chan, char **line_key_list, char **line_data_list){ int i,j,n; memset(chan,0,sizeof(channel_t)); chan->vfo = RIG_VFO_CURR; i = find_on_list( line_key_list, "num" ); if( i < 0 ){ fprintf(stderr,"No channel number\n"); return -1; } n = chan->channel_num = atoi( line_data_list[ i ] ); /* find chanel caps of appropriate memory group? */ for(j=0; j < CHANLSTSIZ; j++) if( rig->state.chan_list[j].start <= n && rig->state.chan_list[j].end >= n) break; printf("Requested channel number %d, list number %d\n",n,j); const channel_cap_t *mem_caps = &rig->state.chan_list[j].mem_caps; if (mem_caps->bank_num) { i = find_on_list( line_key_list, "bank_num" ); if( i >= 0 ){ chan->bank_num = atoi( line_data_list[ i ] ); } } if (mem_caps->channel_desc) { i = find_on_list( line_key_list, "channel_desc" ); if( i >= 0 ){ strncpy( chan->channel_desc, line_data_list[ i ], rig->caps->chan_desc_sz-1 ); chan->channel_desc[ rig->caps->chan_desc_sz ] = '\0'; } } if (mem_caps->ant) { i = find_on_list( line_key_list, "ant" ); if( i >= 0 ){ chan->ant = atoi( line_data_list[ i ] ); } } if (mem_caps->freq) { i = find_on_list( line_key_list, "freq" ); if( i >= 0 ){ chan->freq = atoi( line_data_list[ i ] ); } } if (mem_caps->mode) { i = find_on_list( line_key_list, "mode" ); if( i >= 0 ){ chan->mode = rig_parse_mode( line_data_list[ i ] ); } } if (mem_caps->width) { i = find_on_list( line_key_list, "width" ); if( i >= 0 ){ chan->width = atoi( line_data_list[ i ] ); } } if (mem_caps->tx_freq) { i = find_on_list( line_key_list, "tx_freq" ); if( i >= 0 ){ sscanf( line_data_list[i], "%"SCNfreq, &chan->tx_freq ); } } if (mem_caps->tx_mode) { i = find_on_list( line_key_list, "tx_mode" ); if( i >= 0 ){ chan->tx_mode = rig_parse_mode( line_data_list[ i ] ); } } if (mem_caps->tx_width) { i = find_on_list( line_key_list, "tx_width" ); if( i >= 0 ){ chan->tx_width = atoi( line_data_list[ i ] ); } } if (mem_caps->split) { chan->split=RIG_SPLIT_OFF; i = find_on_list( line_key_list, "split" ); if( i >= 0 ){ if( strcmp( line_data_list[i], "on" ) == 0 ) { chan->split=RIG_SPLIT_ON; if (mem_caps->tx_vfo) { i = find_on_list( line_key_list, "tx_vfo" ); if( i >= 0 ) sscanf( line_data_list[i],"%x",&chan->tx_vfo); } } } } if (mem_caps->rptr_shift) { i = find_on_list( line_key_list, "rptr_shift" ); if( i >= 0 ){ switch( line_data_list[i][0] ) { case '=': chan->rptr_shift=RIG_RPT_SHIFT_NONE; break; case '+': chan->rptr_shift=RIG_RPT_SHIFT_PLUS; break; case '-': chan->rptr_shift=RIG_RPT_SHIFT_MINUS; break; } if( mem_caps->rptr_offs && chan->rptr_shift != RIG_RPT_SHIFT_NONE ){ i = find_on_list( line_key_list, "rptr_offs" ); if( i >= 0 ) chan->rptr_offs = atoi( line_data_list[ i ] ); } } } if (mem_caps->tuning_step) { i = find_on_list( line_key_list, "tuning_step" ); if( i >= 0 ){ chan->tuning_step = atoi( line_data_list[ i ] ); } } if (mem_caps->rit) { i = find_on_list( line_key_list, "rit" ); if( i >= 0 ){ chan->rit = atoi( line_data_list[ i ] ); } } if (mem_caps->xit) { i = find_on_list( line_key_list, "xit" ); if( i >= 0 ){ chan->xit = atoi( line_data_list[ i ] ); } } if (mem_caps->funcs) { i = find_on_list( line_key_list, "funcs" ); if( i >= 0 ){ sscanf( line_data_list[i], "%lx", &chan->funcs ); } } if (mem_caps->ctcss_tone) { i = find_on_list( line_key_list, "ctcss_tone" ); if( i >= 0 ){ chan->ctcss_tone = atoi( line_data_list[ i ] ); } } if (mem_caps->ctcss_sql) { i = find_on_list( line_key_list, "ctcss_sql" ); if( i >= 0 ){ chan->ctcss_sql = atoi( line_data_list[ i ] ); } } if (mem_caps->dcs_code) { i = find_on_list( line_key_list, "dcs_code" ); if( i >= 0 ){ chan->dcs_code = atoi( line_data_list[ i ] ); } } if (mem_caps->dcs_sql) { i = find_on_list( line_key_list, "dcs_sql" ); if( i >= 0 ){ chan->dcs_sql = atoi( line_data_list[ i ] ); } } if (mem_caps->scan_group) { i = find_on_list( line_key_list, "scan_group" ); if( i >= 0 ){ chan->scan_group = atoi( line_data_list[ i ] ); } } if (mem_caps->flags) { i = find_on_list( line_key_list, "flags" ); if( i >= 0 ){ sscanf( line_data_list[i], "%x", &chan->flags ); } } return 0; } /** Find a string on the list. Assumes the last element on the list is NULL \param list - a list \param what - a string to find \return string position on the list on success, -1 if string not found or if string is empty */ int find_on_list( char **list, char *what ){ int i = 0; if( !what ) return -1; while( list[i] != NULL ){ if( strcmp( list[i], what ) == 0 ){ return i; }else{ i++; } } if( !list[i] ){ return -1; }else{ return i; } } hamlib-1.2.15.3/tests/rig_split_lst.awk0000755000175000017500000000500312044564477014660 00000000000000#!/usr/bin/awk -f # (c) 2007-2009 Stephane Fillod # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # This program is to be piped from: # tests/rigctl -l |sort -n | rig_split_lst.awk BEGIN { bkendlst[0]="dummy" bkendlst[1]="yaesu" bkendlst[2]="kenwood" bkendlst[3]="icom" bkendlst[4]="pcr" bkendlst[5]="aor" bkendlst[6]="jrc" bkendlst[7]="radioshack" bkendlst[8]="uniden" bkendlst[9]="drake" bkendlst[10]="lowe" bkendlst[11]="racal" bkendlst[12]="wj" bkendlst[13]="ek" bkendlst[14]="skanti" bkendlst[15]="winradio" bkendlst[16]="tentec" bkendlst[17]="alinco" bkendlst[18]="kachina" bkendlst[19]="rpcrig" bkendlst[20]="gnuradio" bkendlst[21]="microtune" bkendlst[22]="tapr" bkendlst[23]="flexradio" bkendlst[24]="rft" bkendlst[25]="kit" bkendlst[26]="tuner" bkendlst[27]="rs" bkendlst[28]="unknown" if (lst_dir == "") lst_dir="." else lst_dir=lst_dir for (bke in bkendlst) { print " " \ " Hamlib rig matrix

" \ "

" \ "" \ "" > lst_dir"/"bkendlst[bke]"_lst.html" } } # 0 1 2 3 4 5 # 012345678901234567890123456789012345678901234567890123456789 # 2004 GNU GNU Radio GrAudio I&Q 0.1.2 New $1 ~ /^[0-9]+$/ { num=$1 mfg=$2 sub("^[0-9]+\t","") model=substr($0,17,24) ver=substr($0,41,8) status=substr($0,49) printf "" \ "\n", num,num,mfg,model,ver,status >> lst_dir"/"bkendlst[int(num/100)]"_lst.html" } END { for (bke in bkendlst) { print "
Rig#MfgModelVers.Status
%d%s%s%s%s
" >> lst_dir"/"bkendlst[bke]"_lst.html" } } hamlib-1.2.15.3/tests/testrig.c0000644000175000017500000001271312044564477013126 00000000000000/* * Hamlib sample program */ #include #include #include #include #include #define SERIAL_PORT "/dev/ttyS0" int main (int argc, char *argv[]) { RIG *my_rig; /* handle to rig (nstance) */ freq_t freq; /* frequency */ rmode_t rmode; /* radio mode of operation */ pbwidth_t width; vfo_t vfo; /* vfo selection */ int strength; /* S-Meter level */ int retcode; /* generic return code from functions */ rig_model_t myrig_model; printf("testrig:hello, I am your main() !\n"); /* * allocate memory, setup & open port */ if (argc < 2) { hamlib_port_t myport; /* may be overriden by backend probe */ myport.type.rig = RIG_PORT_SERIAL; myport.parm.serial.rate = 9600; myport.parm.serial.data_bits = 8; myport.parm.serial.stop_bits = 1; myport.parm.serial.parity = RIG_PARITY_NONE; myport.parm.serial.handshake = RIG_HANDSHAKE_NONE; strncpy(myport.pathname, SERIAL_PORT, FILPATHLEN - 1); rig_load_all_backends(); myrig_model = rig_probe(&myport); } else { myrig_model = atoi(argv[1]); } my_rig = rig_init(myrig_model); if (!my_rig) { fprintf(stderr,"Unknown rig num: %d\n", myrig_model); fprintf(stderr,"Please check riglist.h\n"); exit(1); /* whoops! something went wrong (mem alloc?) */ } strncpy(my_rig->state.rigport.pathname,SERIAL_PORT,FILPATHLEN - 1); retcode = rig_open(my_rig); if (retcode != RIG_OK) { printf("rig_open: error = %s\n", rigerror(retcode)); exit(2); } printf("Port %s opened ok\n", SERIAL_PORT); /* * Below are examples of set/get routines. * Must add checking of functionality map prior to command execution -- FS * */ /* * Example of setting rig paameters * and some error checking on the return code. */ retcode = rig_set_vfo(my_rig, RIG_VFO_B); if (retcode != RIG_OK ) { printf("rig_set_vfo: error = %s \n", rigerror(retcode)); } /* * Lets try some frequencies and modes. Return code is not checked. * Examples of checking return code are further down. * */ /* 10m FM Narrow */ retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 28350125); /* 10m */ retcode = rig_set_mode(my_rig, RIG_VFO_CURR, RIG_MODE_FM, rig_passband_narrow(my_rig, RIG_MODE_FM)); sleep(3); /* so you can see it -- FS */ /* 15m USB */ retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 21235175); /* 15m */ retcode = rig_set_mode(my_rig, RIG_VFO_CURR, RIG_MODE_USB, RIG_PASSBAND_NORMAL); sleep(3); /* AM Broadcast band */ retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 770000); /* KAAM */ retcode = rig_set_mode(my_rig, RIG_VFO_CURR, RIG_MODE_AM, RIG_PASSBAND_NORMAL); sleep(3); /* 40m LSB */ retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 7250100); /* 40m */ retcode = rig_set_mode(my_rig, RIG_VFO_CURR, RIG_MODE_LSB, RIG_PASSBAND_NORMAL); sleep(3); /* 80m AM NArrow */ retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 3980000); /* 80m */ retcode = rig_set_mode(my_rig, RIG_VFO_CURR, RIG_MODE_AM, rig_passband_narrow(my_rig, RIG_MODE_FM)); sleep(3); /* 160m CW Normal */ retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 1875000); /* 160m */ retcode = rig_set_mode(my_rig, RIG_VFO_CURR, RIG_MODE_CW, RIG_PASSBAND_NORMAL); sleep(3); /* 160m CW Narrow -- The band is noisy tonight -- FS*/ retcode = rig_set_mode(my_rig, RIG_VFO_CURR, RIG_MODE_CW, rig_passband_narrow(my_rig, RIG_MODE_FM)); sleep(3); /* 20m USB on VFO_A */ retcode = rig_set_vfo(my_rig, RIG_VFO_A); retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 14250375); /* cq de vk3fcs */ sleep(3); /* 20m USB on VFO_A , with only 1 call */ retcode = rig_set_freq(my_rig, RIG_VFO_A, 14295125); /* cq de vk3fcs */ sleep(3); #if 0 retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 145100000); /* 2m */ sleep(2); retcode = rig_set_freq(my_rig, RIG_VFO_CURR, 435125000); /* 70cm */ sleep(2); #endif if (retcode != RIG_OK ) { printf("rig_set_freq: error = %s \n", rigerror(retcode)); } retcode = rig_set_mode(my_rig, RIG_VFO_CURR, RIG_MODE_LSB, RIG_PASSBAND_NORMAL); if (retcode != RIG_OK ) { printf("rig_set_mode: error = %s \n", rigerror(retcode)); } retcode = rig_set_ptt(my_rig, RIG_VFO_A, RIG_PTT_ON ); /* stand back ! */ if (retcode != RIG_OK ) { printf("rig_set_ptt: error = %s \n", rigerror(retcode)); } sleep(1); retcode = rig_set_ptt(my_rig, RIG_VFO_A, RIG_PTT_OFF ); /* phew ! */ if (retcode != RIG_OK ) { printf("rig_set_ptt: error = %s \n", rigerror(retcode)); } sleep(1); /* * Simple examples of getting rig information -- FS * */ retcode = rig_get_vfo(my_rig, &vfo); /* try to get vfo info */ if (retcode == RIG_OK ) { printf("rig_get_vfo: vfo = %i \n", vfo); } else { printf("rig_get_vfo: error = %s \n", rigerror(retcode)); } retcode = rig_get_freq(my_rig, RIG_VFO_CURR, &freq); if (retcode == RIG_OK ) { printf("rig_get_freq: freq = %"PRIfreq"\n", freq); } else { printf("rig_get_freq: error = %s \n", rigerror(retcode)); } retcode = rig_get_mode(my_rig, RIG_VFO_CURR, &rmode, &width); if (retcode == RIG_OK ) { printf("rig_get_mode: mode = %i \n", rmode); } else { printf("rig_get_mode: error = %s \n", rigerror(retcode)); } retcode = rig_get_strength(my_rig, RIG_VFO_CURR, &strength); if (retcode == RIG_OK ) { printf("rig_get_strength: strength = %i \n", strength); } else { printf("rig_get_strength: error = %s \n", rigerror(retcode)); } rig_close(my_rig); /* close port */ rig_cleanup(my_rig); /* if you care about memory */ printf("port %s closed ok \n",SERIAL_PORT); return 0; } hamlib-1.2.15.3/tests/rigswr.10000644000175000017500000001321012044564477012671 00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH RIGSWR "1" "February 24, 2007" "Hamlib" "Radio SWR Measurement Tool" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME rigswr \- measure VSWR vs frequency using \fBHamlib\fP. .SH SYNOPSIS .B rigswr [\fIOPTION\fR]... start_freq stop_freq [freq_step] .SH DESCRIPTION \fBrigswr\fP uses \fBHamlib\fP to control a rig to measure VSWR vs frequency: .br It scans frequencies from \fIstart_freq\fP to \fIstop_freq\fP with a step of \fIfreq_step\fP. For each frequency, it transmits at 25% of total POWER during 0.5 second in CW mode and reads VSWR. Frequency and the corresponding VSWR are then printed on \fBstdout\fP. To work correctly, \fBrigswr\fP needs a rig that can measure VSWR and a \fBHamlib\fP backend that supports reading VSWR from the rig. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. Keep in mind that \fBHamlib\fP is BETA level software. While a lot of backend libraries lack complete rig support, the basic functions are usually well supported. The API may change without publicized notice, while an advancement of the minor version (e.g. 1.1.x to 1.2.x) indicates such a change. .PP Please report bugs and provide feedback at the e-mail address given in the REPORTING BUGS section. Patches and code enhancements are also welcome. .SH OPTIONS This program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). Here is a summary of the supported options: .TP .B \-m, --model=id Select radio model number. See model list (use 'rigctl -l'). .br NB: \fBrigswr\fP (or third party software) will use rig model 1901 when using \fBrpc.rigd\fP. .TP .B \-r, --rig-file=device Use \fIdevice\fP as the file name of the port the radio is connected. Often a serial port, but could be a USB to serial adapter. Typically /dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0, etc. .TP .B \-s, --serial-speed=baud Set serial speed to \fIbaud\fP rate. Uses maximum serial speed from rig backend capabilities as the default. .TP .B \-c, --civaddr=id Use \fIid\fP as the CI-V address to communicate with the rig. Only useful for Icom rigs. .br NB: the \fIid\fP is in decimal notation, unless prefixed by \fI0x\fP, in which case it is hexadecimal. .TP .B \-p, --ptt-file=device Use \fIdevice\fP as the file name of the Push-To-Talk device using a device file as described above. .br This is only needed if the radio doesn't have legacy PTT control. .TP .B \-p, --ptt-type=type Use \fItype\fP of Push-To-Talk device. Supported types are RIG, DTR, RTS, PARALLEL, NONE. .br This is only needed if the radio doesn't have legacy PTT control. .TP .B \-C, --set-conf=parm=val[,parm=val]* Set config parameter. e.g. stop_bits=2 .br Use -L option of \fBrigctl\fP for a list. .TP .B \-v, --verbose Set verbose mode, cumulative (see DIAGNOSTICS below). .TP .B \-h, --help Show summary of these options and exit. .TP .B \-V, --version Show version of \fBrigswr\fP and exit. .PP \fBNOTE!\fP Some options may not be implemented by a given backend and will return an error. This is most likely to occur with the \fI\-\-set-conf\fP option. .SH EXAMPLE rigswr -m 209 -r /dev/ttyS1 14000000 14290000 50000 > cswr .PP Scans frequencies between 14.000 MHz and 14.200 MHz with 50 kHz step on a TS-850 and records VSWR measurements in file cswr. .PP After completion, cswr file contains the following lines: .br 14000000 1.50 .br 14050000 1.31 .br 14100000 1.22 .br 14150000 1.07 .br 14200000 1.07 .TP Result could then be plotted with \fBgnuplot\fP: .br gnuplot .br set data style linespoints .br set grid .br plot "cswr" .SH DIAGNOSTICS The \fB-v\fP, \fB--version\fP option allows different levels of diagnostics to be output to \fBstderr\fP and correspond to -v for BUG, -vv for ERR, -vvv for WARN, -vvvv for VERBOSE, or -vvvvv for TRACE. A given verbose level is useful for providing needed debugging information to the email address below. For example, TRACE output shows all of the values sent to and received from the radio which is very useful for radio backend library development and may be requested by the developers. .SH EXIT STATUS \fBrigswr\fP exits with: .br 0 if all operations completed normally; .br 1 if there was an invalid command line option or argument; .br 2 if an error was returned by \fBHamlib\fP; .br 3 if the rig doesn't have the required capabilities. .SH BUGS Depending on keyer/QSK setup, transmissions in CW mode may not be modulated thus possibly giving a wrong result. Please report this situation if it happens. .SH REPORTING BUGS Report bugs to . .br We are already aware of the bug in the previous section :-) .SH AUTHORS Written by Thierry Leconte, Stephane Fillod, and the Hamlib Group .br . .SH COPYRIGHT Copyright \(co 2004-2009 Thierry Leconte, Stephane Fillod, and the Hamlib Group. .br This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .SH SEE ALSO .BR rigctl (1), .BR gnuplot (1), .BR hamlib (3) hamlib-1.2.15.3/tests/rig_bench.c0000644000175000017500000000523412044564477013365 00000000000000/* * Hamlib rig_bench program */ #include #include #include #include #include #include #include "misc.h" #define LOOP_COUNT 100 #define SERIAL_PORT "/dev/ttyS0" int main (int argc, char *argv[]) { RIG *my_rig; /* handle to rig (nstance) */ int retcode; /* generic return code from functions */ rig_model_t myrig_model; unsigned i; struct timeval tv1, tv2; float elapsed; rig_set_debug(RIG_DEBUG_ERR); /* * allocate memory, setup & open port */ if (argc < 2) { hamlib_port_t myport; /* may be overriden by backend probe */ myport.type.rig = RIG_PORT_SERIAL; myport.parm.serial.rate = 9600; myport.parm.serial.data_bits = 8; myport.parm.serial.stop_bits = 1; myport.parm.serial.parity = RIG_PARITY_NONE; myport.parm.serial.handshake = RIG_HANDSHAKE_NONE; strncpy(myport.pathname, SERIAL_PORT, FILPATHLEN - 1); rig_load_all_backends(); myrig_model = rig_probe(&myport); } else { myrig_model = atoi(argv[1]); } my_rig = rig_init(myrig_model); if (!my_rig) { fprintf(stderr,"Unknown rig num: %d\n", myrig_model); fprintf(stderr,"Please check riglist.h\n"); exit(1); /* whoops! something went wrong (mem alloc?) */ } printf("Opened rig model %d, '%s'\n", my_rig->caps->rig_model, my_rig->caps->model_name); printf("Backend version: %s, Status: %s\n", my_rig->caps->version, rig_strstatus(my_rig->caps->status)); printf("Serial speed: %d bauds\n", my_rig->state.rigport.parm.serial.rate); strncpy(my_rig->state.rigport.pathname,SERIAL_PORT,FILPATHLEN - 1); retcode = rig_open(my_rig); if (retcode != RIG_OK) { printf("rig_open: error = %s\n", rigerror(retcode)); exit(2); } printf("Port %s opened ok\n", SERIAL_PORT); printf("Perform %d loops...\n", LOOP_COUNT); /* * we're not using getrusage here because we want effective time */ gettimeofday(&tv1, NULL); for (i=0; i= 1 or <= 6. If two locators are given, then the qrb is also * calculated. * * */ #include #include #include #include int main (int argc, char *argv[]) { char recodedloc[13], *loc1, *loc2, sign; double lon1, lat1, lon2, lat2; double distance, az, mmm, sec; int deg, min, retcode, loc_len, nesw = 0; if (argc < 2) { fprintf(stderr, "Usage: %s []\n", argv[0]); exit(1); } loc1 = argv[1]; loc_len = argc > 2 ? atoi(argv[2]) : strlen(loc1)/2; loc2 = argc > 3 ? argv[3] : NULL; printf("Locator1:\t%s\n", loc1); /* hamlib function to convert maidenhead to decimal degrees */ retcode = locator2longlat(&lon1, &lat1, loc1); if (retcode != RIG_OK) { fprintf(stderr, "locator2longlat() failed with malformed input.\n"); exit(2); } /* hamlib function to convert decimal degrees to deg, min, sec */ retcode = dec2dms(lon1, °, &min, &sec, &nesw); if (retcode != RIG_OK) { fprintf(stderr, "dec2dms() failed, invalid paramter address.\n"); exit(2); } if (nesw == 1) sign = '-'; else sign = '\0'; printf(" Longitude:\t%f\t%c%d %d' %.2f\"\n", lon1, sign, deg, min, sec); /* hamlib function to convert deg, min, sec to decimal degrees */ lon1 = dms2dec(deg, min, sec, nesw); printf(" Recoded lon:\t%f\n", lon1); /* hamlib function to convert decimal degrees to deg decimal minutes */ retcode = dec2dmmm(lon1, °, &mmm, &nesw); if (retcode != RIG_OK) { fprintf(stderr, "dec2dmmm() failed, invalid paramter address.\n"); exit(2); } if (nesw == 1) sign = '-'; else sign = '\0'; printf(" GPS lon:\t%f\t%c%d %.3f'\n", lon1, sign, deg, mmm); /* hamlib function to convert deg, decimal min to decimal degrees */ lon1 = dmmm2dec(deg, mmm, nesw); printf(" Recoded GPS:\t%f\n", lon1); /* hamlib function to convert decimal degrees to deg, min, sec */ retcode = dec2dms(lat1, °, &min, &sec, &nesw); if (retcode != RIG_OK) { fprintf(stderr, "dec2dms() failed, invalid paramter address.\n"); exit(2); } if (nesw == 1) sign = '-'; else sign = '\0'; printf(" Latitude:\t%f\t%c%d %d' %.2f\"\n", lat1, sign, deg, min, sec); /* hamlib function to convert deg, min, sec to decimal degrees */ lat1 = dms2dec(deg, min, sec, nesw); printf(" Recoded lat:\t%f\n", lat1); /* hamlib function to convert decimal degrees to deg decimal minutes */ retcode = dec2dmmm(lat1, °, &mmm, &nesw); if (retcode != RIG_OK) { fprintf(stderr, "dec2dmmm() failed, invalid paramter address.\n"); exit(2); } if (nesw == 1) sign = '-'; else sign = '\0'; printf(" GPS lat:\t%f\t%c%d %.3f'\n", lat1, sign, deg, mmm); /* hamlib function to convert deg, decimal min to decimal degrees */ lat1 = dmmm2dec(deg, mmm, nesw); printf(" Recoded GPS:\t%f\n", lat1); /* hamlib function to convert decimal degrees to maidenhead */ retcode = longlat2locator(lon1, lat1, recodedloc, loc_len); if (retcode != RIG_OK) { fprintf(stderr, "longlat2locator() failed, precision out of range.\n"); exit(2); } printf(" Recoded:\t%s\n", recodedloc); if (loc2 == NULL) exit(0); /* Now work on the second locator */ printf("\nLocator2:\t%s\n", loc2); retcode = locator2longlat(&lon2, &lat2, loc2); if (retcode != RIG_OK) { fprintf(stderr, "locator2longlat() failed with malformed input.\n"); exit(2); } /* hamlib function to convert decimal degrees to deg, min, sec */ retcode = dec2dms(lon2, °, &min, &sec, &nesw); if (retcode != RIG_OK) { fprintf(stderr, "dec2dms() failed, invalid paramter address.\n"); exit(2); } if (nesw == 1) sign = '-'; else sign = '\0'; printf(" Longitude:\t%f\t%c%d %d' %.2f\"\n", lon2, sign, deg, min, sec); /* hamlib function to convert deg, min, sec to decimal degrees */ lon2 = dms2dec(deg, min, sec, nesw); printf(" Recoded lon:\t%f\n", lon2); /* hamlib function to convert decimal degrees to deg decimal minutes */ retcode = dec2dmmm(lon2, °, &mmm, &nesw); if (retcode != RIG_OK) { fprintf(stderr, "dec2dmmm() failed, invalid paramter address.\n"); exit(2); } if (nesw == 1) sign = '-'; else sign = '\0'; printf(" GPS lon:\t%f\t%c%d %.3f'\n", lon2, sign, deg, mmm); /* hamlib function to convert deg, decimal min to decimal degrees */ lon2 = dmmm2dec(deg, mmm, nesw); printf(" Recoded GPS:\t%f\n", lon2); /* hamlib function to convert decimal degrees to deg, min, sec */ retcode = dec2dms(lat2, °, &min, &sec, &nesw); if (retcode != RIG_OK) { fprintf(stderr, "dec2dms() failed, invalid paramter address.\n"); exit(2); } if (nesw == 1) sign = '-'; else sign = '\0'; printf(" Latitude:\t%f\t%c%d %d' %.2f\"\n", lat2, sign, deg, min, sec); /* hamlib function to convert deg, min, sec to decimal degrees */ lat2 = dms2dec(deg, min, sec, nesw); printf(" Recoded lat:\t%f\n", lat2); /* hamlib function to convert decimal degrees to deg decimal minutes */ retcode = dec2dmmm(lat2, °, &mmm, &nesw); if (retcode != RIG_OK) { fprintf(stderr, "dec2dmmm() failed, invalid paramter address.\n"); exit(2); } if (nesw == 1) sign = '-'; else sign = '\0'; printf(" GPS lat:\t%f\t%c%d %.3f'\n", lat2, sign, deg, mmm); /* hamlib function to convert deg, decimal min to decimal degrees */ lat2 = dmmm2dec(deg, mmm, nesw); printf(" Recoded GPS:\t%f\n", lat2); /* hamlib function to convert decimal degrees to maidenhead */ retcode = longlat2locator(lon2, lat2, recodedloc, loc_len); if (retcode != RIG_OK) { fprintf(stderr, "longlat2locator() failed, precision out of range.\n"); exit(2); } printf(" Recoded:\t%s\n", recodedloc); retcode = qrb(lon1, lat1, lon2, lat2, &distance, &az); if (retcode != RIG_OK) { fprintf(stderr, "QRB error: %d\n", retcode); exit(2); } dec2dms(az, °, &min, &sec, &nesw); printf("\nDistance: %.6fkm\n", distance); if (nesw == 1) sign = '-'; else sign = '\0'; /* Beware printf() rounding error! */ printf("Bearing: %.2f, %c%d %d' %.2f\"\n", az, sign, deg, min, sec); exit(0); } hamlib-1.2.15.3/tests/rigsmtr.c0000644000175000017500000002231512044564477013133 00000000000000/* * rigsmtr.c - (C) Stephane Fillod 2007 * * This program output S-meter vs. Azimuth curve using Hamlib. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include "misc.h" /* * Prototypes */ static void usage(); static void version(); static int set_conf_rig(RIG *rig, char *conf_parms); static int set_conf_rot(ROT *rot, char *conf_parms); /* * Reminder: when adding long options, * keep up to date SHORT_OPTIONS, usage()'s output and man page. thanks. * NB: do NOT use -W since it's reserved by POSIX. */ #define SHORT_OPTIONS "m:r:s:c:C:M:R:S:N:vhV" static struct option long_options[] = { {"model", 1, 0, 'm'}, {"rig-file", 1, 0, 'r'}, {"serial-speed", 1, 0, 's'}, {"civaddr", 1, 0, 'c'}, {"set-conf", 1, 0, 'C'}, {"rot-model", 1, 0, 'M'}, {"rot-file", 1, 0, 'R'}, {"rot-serial-speed", 1, 0, 'S'}, {"rot-set-conf", 1, 0, 'N'}, {"verbose", 0, 0, 'v'}, {"help", 0, 0, 'h'}, {"version", 0, 0, 'V'}, {0, 0, 0, 0} }; #define MAXCONFLEN 128 int main (int argc, char *argv[]) { RIG *rig; /* handle to rig (instance) */ ROT *rot; /* handle to rotator (instance) */ rig_model_t rig_model = RIG_MODEL_DUMMY; rot_model_t rot_model = ROT_MODEL_DUMMY; int retcode; /* generic return code from functions */ int verbose = 0; const char *rig_file=NULL, *rot_file=NULL; int serial_rate = 0; int rot_serial_rate = 0; char *civaddr = NULL; /* NULL means no need to set conf */ char rig_conf_parms[MAXCONFLEN] = ""; char rot_conf_parms[MAXCONFLEN] = ""; /* int with_rot = 1; */ azimuth_t azimuth; elevation_t elevation; unsigned step = 1000000; /* 1e6 us */ while(1) { int c; int option_index = 0; c = getopt_long (argc, argv, SHORT_OPTIONS, long_options, &option_index); if (c == -1) break; switch(c) { case 'h': usage(); exit(0); case 'V': version(); exit(0); case 'm': if (!optarg) { usage(); /* wrong arg count */ exit(1); } rig_model = atoi(optarg); break; case 'r': if (!optarg) { usage(); /* wrong arg count */ exit(1); } rig_file = optarg; break; case 'c': if (!optarg) { usage(); /* wrong arg count */ exit(1); } civaddr = optarg; break; case 's': if (!optarg) { usage(); /* wrong arg count */ exit(1); } serial_rate = atoi(optarg); break; case 'C': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (*rig_conf_parms != '\0') strcat(rig_conf_parms, ","); strncat(rig_conf_parms, optarg, MAXCONFLEN-strlen(rig_conf_parms)); break; case 'M': if (!optarg) { usage(); /* wrong arg count */ exit(1); } rot_model = atoi(optarg); break; case 'R': if (!optarg) { usage(); /* wrong arg count */ exit(1); } rot_file = optarg; break; case 'S': if (!optarg) { usage(); /* wrong arg count */ exit(1); } rot_serial_rate = atoi(optarg); break; case 'N': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (*rot_conf_parms != '\0') strcat(rot_conf_parms, ","); strncat(rot_conf_parms, optarg, MAXCONFLEN-strlen(rot_conf_parms)); break; case 'v': verbose++; break; default: usage(); /* unknown option? */ exit(1); } } rig_set_debug(verbose<2 ? RIG_DEBUG_WARN: verbose); rig_debug(RIG_DEBUG_VERBOSE, "rigsmtr, %s\n", hamlib_version); rig_debug(RIG_DEBUG_VERBOSE, "Report bugs to " "\n\n"); /* * The radio */ rig = rig_init(rig_model); if (!rig) { fprintf(stderr, "Unknown rig num %d, or initialization error.\n", rig_model); fprintf(stderr, "Please check with --list option.\n"); exit(2); } retcode = set_conf_rig(rig, rig_conf_parms); if (retcode != RIG_OK) { fprintf(stderr, "Config parameter error: %s\n", rigerror(retcode)); exit(2); } if (rig_file) strncpy(rig->state.rigport.pathname, rig_file, FILPATHLEN - 1); /* FIXME: bound checking and port type == serial */ if (serial_rate != 0) rig->state.rigport.parm.serial.rate = serial_rate; if (civaddr) rig_set_conf(rig, rig_token_lookup(rig, "civaddr"), civaddr); if(!rig_has_get_level(rig,RIG_LEVEL_STRENGTH)) { fprintf(stderr,"rig backend for %s could not get S-Meter" "or has unsufficient capability\nSorry\n", rig->caps->model_name); exit(3); } retcode = rig_open(rig); if (retcode != RIG_OK) { fprintf(stderr,"rig_open: error = %s \n", rigerror(retcode)); exit(2); } if (verbose > 0) printf("Opened rig model %d, '%s'\n", rig->caps->rig_model, rig->caps->model_name); /* * The rotator */ rot = rot_init(rot_model); if (!rot) { fprintf(stderr, "Unknown rot num %d, or initialization error.\n", rot_model); fprintf(stderr, "Please check with --list option.\n"); exit(2); } retcode = set_conf_rot(rot, rot_conf_parms); if (retcode != RIG_OK) { fprintf(stderr, "Config parameter error: %s\n", rigerror(retcode)); exit(2); } if (rot_file) strncpy(rot->state.rotport.pathname, rot_file, FILPATHLEN - 1); /* FIXME: bound checking and port type == serial */ if (rot_serial_rate != 0) rot->state.rotport.parm.serial.rate = rot_serial_rate; retcode = rot_open(rot); if (retcode != RIG_OK && rot_model != ROT_MODEL_DUMMY) { fprintf(stderr,"rot_open: error = %s \n", rigerror(retcode)); exit(2); } /* Commenting out to quell "set but not used" warning. * Enable when needed for further functionality. -N0NB */ /* if (rot_model == ROT_MODEL_DUMMY) */ /* with_rot = 1; */ if (verbose > 0) printf("Opened rotator model %d, '%s'\n", rot->caps->rot_model, rot->caps->model_name); /*******************************/ if (optind < argc) step = atof(argv[optind])*1e6; fprintf(stderr,"Setting rotator to azimuth %.1f°\n",rot->state.min_az); rot_set_position (rot, rot->state.min_az, 0); fprintf(stderr,"Wait for rotator to move...\n"); rot_get_position (rot, &azimuth, &elevation); while (fabs(azimuth - rot->state.min_az) > 1.) { rot_get_position (rot, &azimuth, &elevation); usleep(step); } fprintf(stderr,"Now initiating full 360° rotation...\n"); rot_set_position (rot, rot->state.max_az, 0); /* TODO: check CW or CCW */ /* disable AGC? */ while (fabs(rot->state.max_az - azimuth) > 1.) { value_t strength; rig_get_level(rig,RIG_VFO_CURR,RIG_LEVEL_STRENGTH,&strength); rot_get_position (rot, &azimuth, &elevation); printf("%.1f %d\n", azimuth, strength.i); } rig_close(rig); rot_close(rot); return 0; } void version() { printf("rigsmtr, %s\n\n", hamlib_version); printf("%s\n", hamlib_copyright); } void usage() { printf("Usage: rigsmtr [OPTION]... [time]\n" "Input S-Meter vs Azimuth.\n\n"); printf( " -m, --model=ID select radio model number. See model list\n" " -r, --rig-file=DEVICE set device of the radio to operate on\n" " -s, --serial-speed=BAUD set serial speed of the serial port\n" " -c, --civaddr=ID set CI-V address, decimal (for Icom rigs only)\n" " -C, --set-conf=PARM=VAL set config parameters\n" " -M, --rot-model=ID select rotator model number. See model list\n" " -R, --rot-file=DEVICE set device of the rotator to operate on\n" " -S, --rot-serial-speed=BAUD set serial speed of the serial port\n" " -N, --rot-set-conf=PARM=VAL set rotator config parameters\n" " -v, --verbose set verbose mode, cumulative\n" " -h, --help display this help and exit\n" " -V, --version output version information and exit\n\n" ); printf("\nReport bugs to .\n"); } int set_conf_rig(RIG *rig, char *conf_parms) { char *p, *q, *n; int ret; p = conf_parms; while (p && *p != '\0') { /* FIXME: left hand value of = cannot be null */ q = strchr(p, '='); if ( !q ) return RIG_EINVAL; *q++ = '\0'; n = strchr(q, ','); if (n) *n++ = '\0'; ret = rig_set_conf(rig, rig_token_lookup(rig, p), q); if (ret != RIG_OK) return ret; p = n; } return RIG_OK; } int set_conf_rot(ROT *rot, char *conf_parms) { char *p, *q, *n; int ret; p = conf_parms; while (p && *p != '\0') { /* FIXME: left hand value of = cannot be null */ q = strchr(p, '='); if (q) *q++ = '\0'; n = strchr(q, ','); if (n) *n++ = '\0'; ret = rot_set_conf(rot, rot_token_lookup(rot, p), q); if (ret != RIG_OK) return ret; p = n; } return RIG_OK; } hamlib-1.2.15.3/tests/uthash.h0000644000175000017500000016257112044564477012756 00000000000000/* Copyright (c) 2003-2011, Troy D. Hanson http://uthash.sourceforge.net All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef UTHASH_H #define UTHASH_H #include /* memcmp,strlen */ #include /* ptrdiff_t */ #include /* exit() */ /* These macros use decltype or the earlier __typeof GNU extension. As decltype is only available in newer compilers (VS2010 or gcc 4.3+ when compiling c++ source) this code uses whatever method is needed or, for VS2008 where neither is available, uses casting workarounds. */ #ifdef _MSC_VER /* MS compiler */ #if _MSC_VER >= 1600 && defined(__cplusplus) /* VS2010 or newer in C++ mode */ #define DECLTYPE(x) (decltype(x)) #else /* VS2008 or older (or VS2010 in C mode) */ #define NO_DECLTYPE #define DECLTYPE(x) #endif #else /* GNU, Sun and other compilers */ #define DECLTYPE(x) (__typeof(x)) #endif #ifdef NO_DECLTYPE #define DECLTYPE_ASSIGN(dst,src) \ do { \ char **_da_dst = (char**)(&(dst)); \ *_da_dst = (char*)(src); \ } while(0) #else #define DECLTYPE_ASSIGN(dst,src) \ do { \ (dst) = DECLTYPE(dst)(src); \ } while(0) #endif /* a number of the hash function use uint32_t which isn't defined on win32 */ #ifdef _MSC_VER typedef unsigned int uint32_t; typedef unsigned char uint8_t; #else #include /* uint32_t */ #endif #define UTHASH_VERSION 1.9.4 #define uthash_fatal(msg) exit(-1) /* fatal error (out of memory,etc) */ #define uthash_malloc(sz) malloc(sz) /* malloc fcn */ #define uthash_free(ptr,sz) free(ptr) /* free fcn */ #define uthash_noexpand_fyi(tbl) /* can be defined to log noexpand */ #define uthash_expand_fyi(tbl) /* can be defined to log expands */ /* initial number of buckets */ #define HASH_INITIAL_NUM_BUCKETS 32 /* initial number of buckets */ #define HASH_INITIAL_NUM_BUCKETS_LOG2 5 /* lg2 of initial number of buckets */ #define HASH_BKT_CAPACITY_THRESH 10 /* expand when bucket count reaches */ /* calculate the element whose hash handle address is hhe */ #define ELMT_FROM_HH(tbl,hhp) ((void*)(((char*)(hhp)) - ((tbl)->hho))) #define HASH_FIND(hh,head,keyptr,keylen,out) \ do { \ unsigned _hf_bkt,_hf_hashv; \ out=NULL; \ if (head) { \ HASH_FCN(keyptr,keylen, (head)->hh.tbl->num_buckets, _hf_hashv, _hf_bkt); \ if (HASH_BLOOM_TEST((head)->hh.tbl, _hf_hashv)) { \ HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[ _hf_bkt ], \ keyptr,keylen,out); \ } \ } \ } while (0) #ifdef HASH_BLOOM #define HASH_BLOOM_BITLEN (1ULL << HASH_BLOOM) #define HASH_BLOOM_BYTELEN (HASH_BLOOM_BITLEN/8) + ((HASH_BLOOM_BITLEN%8) ? 1:0) #define HASH_BLOOM_MAKE(tbl) \ do { \ (tbl)->bloom_nbits = HASH_BLOOM; \ (tbl)->bloom_bv = (uint8_t*)uthash_malloc(HASH_BLOOM_BYTELEN); \ if (!((tbl)->bloom_bv)) { uthash_fatal( "out of memory"); } \ memset((tbl)->bloom_bv, 0, HASH_BLOOM_BYTELEN); \ (tbl)->bloom_sig = HASH_BLOOM_SIGNATURE; \ } while (0); #define HASH_BLOOM_FREE(tbl) \ do { \ uthash_free((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \ } while (0); #define HASH_BLOOM_BITSET(bv,idx) (bv[(idx)/8] |= (1U << ((idx)%8))) #define HASH_BLOOM_BITTEST(bv,idx) (bv[(idx)/8] & (1U << ((idx)%8))) #define HASH_BLOOM_ADD(tbl,hashv) \ HASH_BLOOM_BITSET((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1))) #define HASH_BLOOM_TEST(tbl,hashv) \ HASH_BLOOM_BITTEST((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1))) #else #define HASH_BLOOM_MAKE(tbl) #define HASH_BLOOM_FREE(tbl) #define HASH_BLOOM_ADD(tbl,hashv) #define HASH_BLOOM_TEST(tbl,hashv) (1) #endif #define HASH_MAKE_TABLE(hh,head) \ do { \ (head)->hh.tbl = (UT_hash_table*)uthash_malloc( \ sizeof(UT_hash_table)); \ if (!((head)->hh.tbl)) { uthash_fatal( "out of memory"); } \ memset((head)->hh.tbl, 0, sizeof(UT_hash_table)); \ (head)->hh.tbl->tail = &((head)->hh); \ (head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \ (head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \ (head)->hh.tbl->hho = (char*)(&(head)->hh) - (char*)(head); \ (head)->hh.tbl->buckets = (UT_hash_bucket*)uthash_malloc( \ HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket)); \ if (! (head)->hh.tbl->buckets) { uthash_fatal( "out of memory"); } \ memset((head)->hh.tbl->buckets, 0, \ HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket)); \ HASH_BLOOM_MAKE((head)->hh.tbl); \ (head)->hh.tbl->signature = HASH_SIGNATURE; \ } while(0) #define HASH_ADD(hh,head,fieldname,keylen_in,add) \ HASH_ADD_KEYPTR(hh,head,&((add)->fieldname),keylen_in,add) #define HASH_ADD_KEYPTR(hh,head,keyptr,keylen_in,add) \ do { \ unsigned _ha_bkt; \ (add)->hh.next = NULL; \ (add)->hh.key = (char*)keyptr; \ (add)->hh.keylen = keylen_in; \ if (!(head)) { \ head = (add); \ (head)->hh.prev = NULL; \ HASH_MAKE_TABLE(hh,head); \ } else { \ (head)->hh.tbl->tail->next = (add); \ (add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \ (head)->hh.tbl->tail = &((add)->hh); \ } \ (head)->hh.tbl->num_items++; \ (add)->hh.tbl = (head)->hh.tbl; \ HASH_FCN(keyptr,keylen_in, (head)->hh.tbl->num_buckets, \ (add)->hh.hashv, _ha_bkt); \ HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt],&(add)->hh); \ HASH_BLOOM_ADD((head)->hh.tbl,(add)->hh.hashv); \ HASH_EMIT_KEY(hh,head,keyptr,keylen_in); \ HASH_FSCK(hh,head); \ } while(0) #define HASH_TO_BKT( hashv, num_bkts, bkt ) \ do { \ bkt = ((hashv) & ((num_bkts) - 1)); \ } while(0) /* delete "delptr" from the hash table. * "the usual" patch-up process for the app-order doubly-linked-list. * The use of _hd_hh_del below deserves special explanation. * These used to be expressed using (delptr) but that led to a bug * if someone used the same symbol for the head and deletee, like * HASH_DELETE(hh,users,users); * We want that to work, but by changing the head (users) below * we were forfeiting our ability to further refer to the deletee (users) * in the patch-up process. Solution: use scratch space to * copy the deletee pointer, then the latter references are via that * scratch pointer rather than through the repointed (users) symbol. */ #define HASH_DELETE(hh,head,delptr) \ do { \ unsigned _hd_bkt; \ struct UT_hash_handle *_hd_hh_del; \ if ( ((delptr)->hh.prev == NULL) && ((delptr)->hh.next == NULL) ) { \ uthash_free((head)->hh.tbl->buckets, \ (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket) ); \ HASH_BLOOM_FREE((head)->hh.tbl); \ uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ head = NULL; \ } else { \ _hd_hh_del = &((delptr)->hh); \ if ((delptr) == ELMT_FROM_HH((head)->hh.tbl,(head)->hh.tbl->tail)) { \ (head)->hh.tbl->tail = \ (UT_hash_handle*)((char*)((delptr)->hh.prev) + \ (head)->hh.tbl->hho); \ } \ if ((delptr)->hh.prev) { \ ((UT_hash_handle*)((char*)((delptr)->hh.prev) + \ (head)->hh.tbl->hho))->next = (delptr)->hh.next; \ } else { \ DECLTYPE_ASSIGN(head,(delptr)->hh.next); \ } \ if (_hd_hh_del->next) { \ ((UT_hash_handle*)((char*)_hd_hh_del->next + \ (head)->hh.tbl->hho))->prev = \ _hd_hh_del->prev; \ } \ HASH_TO_BKT( _hd_hh_del->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \ HASH_DEL_IN_BKT(hh,(head)->hh.tbl->buckets[_hd_bkt], _hd_hh_del); \ (head)->hh.tbl->num_items--; \ } \ HASH_FSCK(hh,head); \ } while (0) /* convenience forms of HASH_FIND/HASH_ADD/HASH_DEL */ #define HASH_FIND_STR(head,findstr,out) \ HASH_FIND(hh,head,findstr,strlen(findstr),out) #define HASH_ADD_STR(head,strfield,add) \ HASH_ADD(hh,head,strfield,strlen(add->strfield),add) #define HASH_FIND_INT(head,findint,out) \ HASH_FIND(hh,head,findint,sizeof(int),out) #define HASH_ADD_INT(head,intfield,add) \ HASH_ADD(hh,head,intfield,sizeof(int),add) #define HASH_FIND_PTR(head,findptr,out) \ HASH_FIND(hh,head,findptr,sizeof(void *),out) #define HASH_ADD_PTR(head,ptrfield,add) \ HASH_ADD(hh,head,ptrfield,sizeof(void *),add) #define HASH_DEL(head,delptr) \ HASH_DELETE(hh,head,delptr) /* HASH_FSCK checks hash integrity on every add/delete when HASH_DEBUG is defined. * This is for uthash developer only; it compiles away if HASH_DEBUG isn't defined. */ #ifdef HASH_DEBUG #define HASH_OOPS(...) do { fprintf(stderr,__VA_ARGS__); exit(-1); } while (0) #define HASH_FSCK(hh,head) \ do { \ unsigned _bkt_i; \ unsigned _count, _bkt_count; \ char *_prev; \ struct UT_hash_handle *_thh; \ if (head) { \ _count = 0; \ for( _bkt_i = 0; _bkt_i < (head)->hh.tbl->num_buckets; _bkt_i++) { \ _bkt_count = 0; \ _thh = (head)->hh.tbl->buckets[_bkt_i].hh_head; \ _prev = NULL; \ while (_thh) { \ if (_prev != (char*)(_thh->hh_prev)) { \ HASH_OOPS("invalid hh_prev %p, actual %p\n", \ _thh->hh_prev, _prev ); \ } \ _bkt_count++; \ _prev = (char*)(_thh); \ _thh = _thh->hh_next; \ } \ _count += _bkt_count; \ if ((head)->hh.tbl->buckets[_bkt_i].count != _bkt_count) { \ HASH_OOPS("invalid bucket count %d, actual %d\n", \ (head)->hh.tbl->buckets[_bkt_i].count, _bkt_count); \ } \ } \ if (_count != (head)->hh.tbl->num_items) { \ HASH_OOPS("invalid hh item count %d, actual %d\n", \ (head)->hh.tbl->num_items, _count ); \ } \ /* traverse hh in app order; check next/prev integrity, count */ \ _count = 0; \ _prev = NULL; \ _thh = &(head)->hh; \ while (_thh) { \ _count++; \ if (_prev !=(char*)(_thh->prev)) { \ HASH_OOPS("invalid prev %p, actual %p\n", \ _thh->prev, _prev ); \ } \ _prev = (char*)ELMT_FROM_HH((head)->hh.tbl, _thh); \ _thh = ( _thh->next ? (UT_hash_handle*)((char*)(_thh->next) + \ (head)->hh.tbl->hho) : NULL ); \ } \ if (_count != (head)->hh.tbl->num_items) { \ HASH_OOPS("invalid app item count %d, actual %d\n", \ (head)->hh.tbl->num_items, _count ); \ } \ } \ } while (0) #else #define HASH_FSCK(hh,head) #endif /* When compiled with -DHASH_EMIT_KEYS, length-prefixed keys are emitted to * the descriptor to which this macro is defined for tuning the hash function. * The app can #include to get the prototype for write(2). */ #ifdef HASH_EMIT_KEYS #define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) \ do { \ unsigned _klen = fieldlen; \ write(HASH_EMIT_KEYS, &_klen, sizeof(_klen)); \ write(HASH_EMIT_KEYS, keyptr, fieldlen); \ } while (0) #else #define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) #endif /* default to Jenkin's hash unless overridden e.g. DHASH_FUNCTION=HASH_SAX */ #ifdef HASH_FUNCTION #define HASH_FCN HASH_FUNCTION #else #define HASH_FCN HASH_JEN #endif /* The Bernstein hash function, used in Perl prior to v5.6 */ #define HASH_BER(key,keylen,num_bkts,hashv,bkt) \ do { \ unsigned _hb_keylen=keylen; \ char *_hb_key=(char*)(key); \ (hashv) = 0; \ while (_hb_keylen--) { (hashv) = ((hashv) * 33) + *_hb_key++; } \ bkt = (hashv) & (num_bkts-1); \ } while (0) /* SAX/FNV/OAT/JEN hash functions are macro variants of those listed at * http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx */ #define HASH_SAX(key,keylen,num_bkts,hashv,bkt) \ do { \ unsigned _sx_i; \ char *_hs_key=(char*)(key); \ hashv = 0; \ for(_sx_i=0; _sx_i < keylen; _sx_i++) \ hashv ^= (hashv << 5) + (hashv >> 2) + _hs_key[_sx_i]; \ bkt = hashv & (num_bkts-1); \ } while (0) #define HASH_FNV(key,keylen,num_bkts,hashv,bkt) \ do { \ unsigned _fn_i; \ char *_hf_key=(char*)(key); \ hashv = 2166136261UL; \ for(_fn_i=0; _fn_i < keylen; _fn_i++) \ hashv = (hashv * 16777619) ^ _hf_key[_fn_i]; \ bkt = hashv & (num_bkts-1); \ } while(0); #define HASH_OAT(key,keylen,num_bkts,hashv,bkt) \ do { \ unsigned _ho_i; \ char *_ho_key=(char*)(key); \ hashv = 0; \ for(_ho_i=0; _ho_i < keylen; _ho_i++) { \ hashv += _ho_key[_ho_i]; \ hashv += (hashv << 10); \ hashv ^= (hashv >> 6); \ } \ hashv += (hashv << 3); \ hashv ^= (hashv >> 11); \ hashv += (hashv << 15); \ bkt = hashv & (num_bkts-1); \ } while(0) #define HASH_JEN_MIX(a,b,c) \ do { \ a -= b; a -= c; a ^= ( c >> 13 ); \ b -= c; b -= a; b ^= ( a << 8 ); \ c -= a; c -= b; c ^= ( b >> 13 ); \ a -= b; a -= c; a ^= ( c >> 12 ); \ b -= c; b -= a; b ^= ( a << 16 ); \ c -= a; c -= b; c ^= ( b >> 5 ); \ a -= b; a -= c; a ^= ( c >> 3 ); \ b -= c; b -= a; b ^= ( a << 10 ); \ c -= a; c -= b; c ^= ( b >> 15 ); \ } while (0) #define HASH_JEN(key,keylen,num_bkts,hashv,bkt) \ do { \ unsigned _hj_i,_hj_j,_hj_k; \ char *_hj_key=(char*)(key); \ hashv = 0xfeedbeef; \ _hj_i = _hj_j = 0x9e3779b9; \ _hj_k = keylen; \ while (_hj_k >= 12) { \ _hj_i += (_hj_key[0] + ( (unsigned)_hj_key[1] << 8 ) \ + ( (unsigned)_hj_key[2] << 16 ) \ + ( (unsigned)_hj_key[3] << 24 ) ); \ _hj_j += (_hj_key[4] + ( (unsigned)_hj_key[5] << 8 ) \ + ( (unsigned)_hj_key[6] << 16 ) \ + ( (unsigned)_hj_key[7] << 24 ) ); \ hashv += (_hj_key[8] + ( (unsigned)_hj_key[9] << 8 ) \ + ( (unsigned)_hj_key[10] << 16 ) \ + ( (unsigned)_hj_key[11] << 24 ) ); \ \ HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ \ _hj_key += 12; \ _hj_k -= 12; \ } \ hashv += keylen; \ switch ( _hj_k ) { \ case 11: hashv += ( (unsigned)_hj_key[10] << 24 ); \ case 10: hashv += ( (unsigned)_hj_key[9] << 16 ); \ case 9: hashv += ( (unsigned)_hj_key[8] << 8 ); \ case 8: _hj_j += ( (unsigned)_hj_key[7] << 24 ); \ case 7: _hj_j += ( (unsigned)_hj_key[6] << 16 ); \ case 6: _hj_j += ( (unsigned)_hj_key[5] << 8 ); \ case 5: _hj_j += _hj_key[4]; \ case 4: _hj_i += ( (unsigned)_hj_key[3] << 24 ); \ case 3: _hj_i += ( (unsigned)_hj_key[2] << 16 ); \ case 2: _hj_i += ( (unsigned)_hj_key[1] << 8 ); \ case 1: _hj_i += _hj_key[0]; \ } \ HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ bkt = hashv & (num_bkts-1); \ } while(0) /* The Paul Hsieh hash function */ #undef get16bits #if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \ || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__) #define get16bits(d) (*((const uint16_t *) (d))) #endif #if !defined (get16bits) #define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8) \ +(uint32_t)(((const uint8_t *)(d))[0]) ) #endif #define HASH_SFH(key,keylen,num_bkts,hashv,bkt) \ do { \ char *_sfh_key=(char*)(key); \ uint32_t _sfh_tmp, _sfh_len = keylen; \ \ int _sfh_rem = _sfh_len & 3; \ _sfh_len >>= 2; \ hashv = 0xcafebabe; \ \ /* Main loop */ \ for (;_sfh_len > 0; _sfh_len--) { \ hashv += get16bits (_sfh_key); \ _sfh_tmp = (get16bits (_sfh_key+2) << 11) ^ hashv; \ hashv = (hashv << 16) ^ _sfh_tmp; \ _sfh_key += 2*sizeof (uint16_t); \ hashv += hashv >> 11; \ } \ \ /* Handle end cases */ \ switch (_sfh_rem) { \ case 3: hashv += get16bits (_sfh_key); \ hashv ^= hashv << 16; \ hashv ^= _sfh_key[sizeof (uint16_t)] << 18; \ hashv += hashv >> 11; \ break; \ case 2: hashv += get16bits (_sfh_key); \ hashv ^= hashv << 11; \ hashv += hashv >> 17; \ break; \ case 1: hashv += *_sfh_key; \ hashv ^= hashv << 10; \ hashv += hashv >> 1; \ } \ \ /* Force "avalanching" of final 127 bits */ \ hashv ^= hashv << 3; \ hashv += hashv >> 5; \ hashv ^= hashv << 4; \ hashv += hashv >> 17; \ hashv ^= hashv << 25; \ hashv += hashv >> 6; \ bkt = hashv & (num_bkts-1); \ } while(0); #ifdef HASH_USING_NO_STRICT_ALIASING /* The MurmurHash exploits some CPU's (x86,x86_64) tolerance for unaligned reads. * For other types of CPU's (e.g. Sparc) an unaligned read causes a bus error. * MurmurHash uses the faster approach only on CPU's where we know it's safe. * * Note the preprocessor built-in defines can be emitted using: * * gcc -m64 -dM -E - < /dev/null (on gcc) * cc -## a.c (where a.c is a simple test file) (Sun Studio) */ #if (defined(__i386__) || defined(__x86_64__)) #define MUR_GETBLOCK(p,i) p[i] #else /* non intel */ #define MUR_PLUS0_ALIGNED(p) (((unsigned long)p & 0x3) == 0) #define MUR_PLUS1_ALIGNED(p) (((unsigned long)p & 0x3) == 1) #define MUR_PLUS2_ALIGNED(p) (((unsigned long)p & 0x3) == 2) #define MUR_PLUS3_ALIGNED(p) (((unsigned long)p & 0x3) == 3) #define WP(p) ((uint32_t*)((unsigned long)(p) & ~3UL)) #if (defined(__BIG_ENDIAN__) || defined(SPARC) || defined(__ppc__) || defined(__ppc64__)) #define MUR_THREE_ONE(p) ((((*WP(p))&0x00ffffff) << 8) | (((*(WP(p)+1))&0xff000000) >> 24)) #define MUR_TWO_TWO(p) ((((*WP(p))&0x0000ffff) <<16) | (((*(WP(p)+1))&0xffff0000) >> 16)) #define MUR_ONE_THREE(p) ((((*WP(p))&0x000000ff) <<24) | (((*(WP(p)+1))&0xffffff00) >> 8)) #else /* assume little endian non-intel */ #define MUR_THREE_ONE(p) ((((*WP(p))&0xffffff00) >> 8) | (((*(WP(p)+1))&0x000000ff) << 24)) #define MUR_TWO_TWO(p) ((((*WP(p))&0xffff0000) >>16) | (((*(WP(p)+1))&0x0000ffff) << 16)) #define MUR_ONE_THREE(p) ((((*WP(p))&0xff000000) >>24) | (((*(WP(p)+1))&0x00ffffff) << 8)) #endif #define MUR_GETBLOCK(p,i) (MUR_PLUS0_ALIGNED(p) ? ((p)[i]) : \ (MUR_PLUS1_ALIGNED(p) ? MUR_THREE_ONE(p) : \ (MUR_PLUS2_ALIGNED(p) ? MUR_TWO_TWO(p) : \ MUR_ONE_THREE(p)))) #endif #define MUR_ROTL32(x,r) (((x) << (r)) | ((x) >> (32 - (r)))) #define MUR_FMIX(_h) \ do { \ _h ^= _h >> 16; \ _h *= 0x85ebca6b; \ _h ^= _h >> 13; \ _h *= 0xc2b2ae35l; \ _h ^= _h >> 16; \ } while(0) #define HASH_MUR(key,keylen,num_bkts,hashv,bkt) \ do { \ const uint8_t *_mur_data = (const uint8_t*)(key); \ const int _mur_nblocks = (keylen) / 4; \ uint32_t _mur_h1 = 0xf88D5353; \ uint32_t _mur_c1 = 0xcc9e2d51; \ uint32_t _mur_c2 = 0x1b873593; \ const uint32_t *_mur_blocks = (const uint32_t*)(_mur_data+_mur_nblocks*4); \ int _mur_i; \ for(_mur_i = -_mur_nblocks; _mur_i; _mur_i++) { \ uint32_t _mur_k1 = MUR_GETBLOCK(_mur_blocks,_mur_i); \ _mur_k1 *= _mur_c1; \ _mur_k1 = MUR_ROTL32(_mur_k1,15); \ _mur_k1 *= _mur_c2; \ \ _mur_h1 ^= _mur_k1; \ _mur_h1 = MUR_ROTL32(_mur_h1,13); \ _mur_h1 = _mur_h1*5+0xe6546b64; \ } \ const uint8_t *_mur_tail = (const uint8_t*)(_mur_data + _mur_nblocks*4); \ uint32_t _mur_k1=0; \ switch((keylen) & 3) { \ case 3: _mur_k1 ^= _mur_tail[2] << 16; \ case 2: _mur_k1 ^= _mur_tail[1] << 8; \ case 1: _mur_k1 ^= _mur_tail[0]; \ _mur_k1 *= _mur_c1; \ _mur_k1 = MUR_ROTL32(_mur_k1,15); \ _mur_k1 *= _mur_c2; \ _mur_h1 ^= _mur_k1; \ } \ _mur_h1 ^= (keylen); \ MUR_FMIX(_mur_h1); \ hashv = _mur_h1; \ bkt = hashv & (num_bkts-1); \ } while(0) #endif /* HASH_USING_NO_STRICT_ALIASING */ /* key comparison function; return 0 if keys equal */ #define HASH_KEYCMP(a,b,len) memcmp(a,b,len) /* iterate over items in a known bucket to find desired item */ #define HASH_FIND_IN_BKT(tbl,hh,head,keyptr,keylen_in,out) \ do { \ if (head.hh_head) DECLTYPE_ASSIGN(out,ELMT_FROM_HH(tbl,head.hh_head)); \ else out=NULL; \ while (out) { \ if (out->hh.keylen == keylen_in) { \ if ((HASH_KEYCMP(out->hh.key,keyptr,keylen_in)) == 0) break; \ } \ if (out->hh.hh_next) DECLTYPE_ASSIGN(out,ELMT_FROM_HH(tbl,out->hh.hh_next)); \ else out = NULL; \ } \ } while(0) /* add an item to a bucket */ #define HASH_ADD_TO_BKT(head,addhh) \ do { \ head.count++; \ (addhh)->hh_next = head.hh_head; \ (addhh)->hh_prev = NULL; \ if (head.hh_head) { (head).hh_head->hh_prev = (addhh); } \ (head).hh_head=addhh; \ if (head.count >= ((head.expand_mult+1) * HASH_BKT_CAPACITY_THRESH) \ && (addhh)->tbl->noexpand != 1) { \ HASH_EXPAND_BUCKETS((addhh)->tbl); \ } \ } while(0) /* remove an item from a given bucket */ #define HASH_DEL_IN_BKT(hh,head,hh_del) \ (head).count--; \ if ((head).hh_head == hh_del) { \ (head).hh_head = hh_del->hh_next; \ } \ if (hh_del->hh_prev) { \ hh_del->hh_prev->hh_next = hh_del->hh_next; \ } \ if (hh_del->hh_next) { \ hh_del->hh_next->hh_prev = hh_del->hh_prev; \ } /* Bucket expansion has the effect of doubling the number of buckets * and redistributing the items into the new buckets. Ideally the * items will distribute more or less evenly into the new buckets * (the extent to which this is true is a measure of the quality of * the hash function as it applies to the key domain). * * With the items distributed into more buckets, the chain length * (item count) in each bucket is reduced. Thus by expanding buckets * the hash keeps a bound on the chain length. This bounded chain * length is the essence of how a hash provides constant time lookup. * * The calculation of tbl->ideal_chain_maxlen below deserves some * explanation. First, keep in mind that we're calculating the ideal * maximum chain length based on the *new* (doubled) bucket count. * In fractions this is just n/b (n=number of items,b=new num buckets). * Since the ideal chain length is an integer, we want to calculate * ceil(n/b). We don't depend on floating point arithmetic in this * hash, so to calculate ceil(n/b) with integers we could write * * ceil(n/b) = (n/b) + ((n%b)?1:0) * * and in fact a previous version of this hash did just that. * But now we have improved things a bit by recognizing that b is * always a power of two. We keep its base 2 log handy (call it lb), * so now we can write this with a bit shift and logical AND: * * ceil(n/b) = (n>>lb) + ( (n & (b-1)) ? 1:0) * */ #define HASH_EXPAND_BUCKETS(tbl) \ do { \ unsigned _he_bkt; \ unsigned _he_bkt_i; \ struct UT_hash_handle *_he_thh, *_he_hh_nxt; \ UT_hash_bucket *_he_new_buckets, *_he_newbkt; \ _he_new_buckets = (UT_hash_bucket*)uthash_malloc( \ 2 * tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ if (!_he_new_buckets) { uthash_fatal( "out of memory"); } \ memset(_he_new_buckets, 0, \ 2 * tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ tbl->ideal_chain_maxlen = \ (tbl->num_items >> (tbl->log2_num_buckets+1)) + \ ((tbl->num_items & ((tbl->num_buckets*2)-1)) ? 1 : 0); \ tbl->nonideal_items = 0; \ for(_he_bkt_i = 0; _he_bkt_i < tbl->num_buckets; _he_bkt_i++) \ { \ _he_thh = tbl->buckets[ _he_bkt_i ].hh_head; \ while (_he_thh) { \ _he_hh_nxt = _he_thh->hh_next; \ HASH_TO_BKT( _he_thh->hashv, tbl->num_buckets*2, _he_bkt); \ _he_newbkt = &(_he_new_buckets[ _he_bkt ]); \ if (++(_he_newbkt->count) > tbl->ideal_chain_maxlen) { \ tbl->nonideal_items++; \ _he_newbkt->expand_mult = _he_newbkt->count / \ tbl->ideal_chain_maxlen; \ } \ _he_thh->hh_prev = NULL; \ _he_thh->hh_next = _he_newbkt->hh_head; \ if (_he_newbkt->hh_head) _he_newbkt->hh_head->hh_prev = \ _he_thh; \ _he_newbkt->hh_head = _he_thh; \ _he_thh = _he_hh_nxt; \ } \ } \ uthash_free( tbl->buckets, tbl->num_buckets*sizeof(struct UT_hash_bucket) ); \ tbl->num_buckets *= 2; \ tbl->log2_num_buckets++; \ tbl->buckets = _he_new_buckets; \ tbl->ineff_expands = (tbl->nonideal_items > (tbl->num_items >> 1)) ? \ (tbl->ineff_expands+1) : 0; \ if (tbl->ineff_expands > 1) { \ tbl->noexpand=1; \ uthash_noexpand_fyi(tbl); \ } \ uthash_expand_fyi(tbl); \ } while(0) /* This is an adaptation of Simon Tatham's O(n log(n)) mergesort */ /* Note that HASH_SORT assumes the hash handle name to be hh. * HASH_SRT was added to allow the hash handle name to be passed in. */ #define HASH_SORT(head,cmpfcn) HASH_SRT(hh,head,cmpfcn) #define HASH_SRT(hh,head,cmpfcn) \ do { \ unsigned _hs_i; \ unsigned _hs_looping,_hs_nmerges,_hs_insize,_hs_psize,_hs_qsize; \ struct UT_hash_handle *_hs_p, *_hs_q, *_hs_e, *_hs_list, *_hs_tail; \ if (head) { \ _hs_insize = 1; \ _hs_looping = 1; \ _hs_list = &((head)->hh); \ while (_hs_looping) { \ _hs_p = _hs_list; \ _hs_list = NULL; \ _hs_tail = NULL; \ _hs_nmerges = 0; \ while (_hs_p) { \ _hs_nmerges++; \ _hs_q = _hs_p; \ _hs_psize = 0; \ for ( _hs_i = 0; _hs_i < _hs_insize; _hs_i++ ) { \ _hs_psize++; \ _hs_q = (UT_hash_handle*)((_hs_q->next) ? \ ((void*)((char*)(_hs_q->next) + \ (head)->hh.tbl->hho)) : NULL); \ if (! (_hs_q) ) break; \ } \ _hs_qsize = _hs_insize; \ while ((_hs_psize > 0) || ((_hs_qsize > 0) && _hs_q )) { \ if (_hs_psize == 0) { \ _hs_e = _hs_q; \ _hs_q = (UT_hash_handle*)((_hs_q->next) ? \ ((void*)((char*)(_hs_q->next) + \ (head)->hh.tbl->hho)) : NULL); \ _hs_qsize--; \ } else if ( (_hs_qsize == 0) || !(_hs_q) ) { \ _hs_e = _hs_p; \ _hs_p = (UT_hash_handle*)((_hs_p->next) ? \ ((void*)((char*)(_hs_p->next) + \ (head)->hh.tbl->hho)) : NULL); \ _hs_psize--; \ } else if (( \ cmpfcn(DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl,_hs_p)), \ DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl,_hs_q))) \ ) <= 0) { \ _hs_e = _hs_p; \ _hs_p = (UT_hash_handle*)((_hs_p->next) ? \ ((void*)((char*)(_hs_p->next) + \ (head)->hh.tbl->hho)) : NULL); \ _hs_psize--; \ } else { \ _hs_e = _hs_q; \ _hs_q = (UT_hash_handle*)((_hs_q->next) ? \ ((void*)((char*)(_hs_q->next) + \ (head)->hh.tbl->hho)) : NULL); \ _hs_qsize--; \ } \ if ( _hs_tail ) { \ _hs_tail->next = ((_hs_e) ? \ ELMT_FROM_HH((head)->hh.tbl,_hs_e) : NULL); \ } else { \ _hs_list = _hs_e; \ } \ _hs_e->prev = ((_hs_tail) ? \ ELMT_FROM_HH((head)->hh.tbl,_hs_tail) : NULL); \ _hs_tail = _hs_e; \ } \ _hs_p = _hs_q; \ } \ _hs_tail->next = NULL; \ if ( _hs_nmerges <= 1 ) { \ _hs_looping=0; \ (head)->hh.tbl->tail = _hs_tail; \ DECLTYPE_ASSIGN(head,ELMT_FROM_HH((head)->hh.tbl, _hs_list)); \ } \ _hs_insize *= 2; \ } \ HASH_FSCK(hh,head); \ } \ } while (0) /* This function selects items from one hash into another hash. * The end result is that the selected items have dual presence * in both hashes. There is no copy of the items made; rather * they are added into the new hash through a secondary hash * hash handle that must be present in the structure. */ #define HASH_SELECT(hh_dst, dst, hh_src, src, cond) \ do { \ unsigned _src_bkt, _dst_bkt; \ void *_last_elt=NULL, *_elt; \ UT_hash_handle *_src_hh, *_dst_hh, *_last_elt_hh=NULL; \ ptrdiff_t _dst_hho = ((char*)(&(dst)->hh_dst) - (char*)(dst)); \ if (src) { \ for(_src_bkt=0; _src_bkt < (src)->hh_src.tbl->num_buckets; _src_bkt++) { \ for(_src_hh = (src)->hh_src.tbl->buckets[_src_bkt].hh_head; \ _src_hh; \ _src_hh = _src_hh->hh_next) { \ _elt = ELMT_FROM_HH((src)->hh_src.tbl, _src_hh); \ if (cond(_elt)) { \ _dst_hh = (UT_hash_handle*)(((char*)_elt) + _dst_hho); \ _dst_hh->key = _src_hh->key; \ _dst_hh->keylen = _src_hh->keylen; \ _dst_hh->hashv = _src_hh->hashv; \ _dst_hh->prev = _last_elt; \ _dst_hh->next = NULL; \ if (_last_elt_hh) { _last_elt_hh->next = _elt; } \ if (!dst) { \ DECLTYPE_ASSIGN(dst,_elt); \ HASH_MAKE_TABLE(hh_dst,dst); \ } else { \ _dst_hh->tbl = (dst)->hh_dst.tbl; \ } \ HASH_TO_BKT(_dst_hh->hashv, _dst_hh->tbl->num_buckets, _dst_bkt); \ HASH_ADD_TO_BKT(_dst_hh->tbl->buckets[_dst_bkt],_dst_hh); \ (dst)->hh_dst.tbl->num_items++; \ _last_elt = _elt; \ _last_elt_hh = _dst_hh; \ } \ } \ } \ } \ HASH_FSCK(hh_dst,dst); \ } while (0) #define HASH_CLEAR(hh,head) \ do { \ if (head) { \ uthash_free((head)->hh.tbl->buckets, \ (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket)); \ HASH_BLOOM_FREE((head)->hh.tbl); \ uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ (head)=NULL; \ } \ } while(0) #ifdef NO_DECLTYPE #define HASH_ITER(hh,head,el,tmp) \ for((el)=(head), (*(char**)(&(tmp)))=(char*)((head)?(head)->hh.next:NULL); \ el; (el)=(tmp),(*(char**)(&(tmp)))=(char*)((tmp)?(tmp)->hh.next:NULL)) #else #define HASH_ITER(hh,head,el,tmp) \ for((el)=(head),(tmp)=DECLTYPE(el)((head)?(head)->hh.next:NULL); \ el; (el)=(tmp),(tmp)=DECLTYPE(el)((tmp)?(tmp)->hh.next:NULL)) #endif /* obtain a count of items in the hash */ #define HASH_COUNT(head) HASH_CNT(hh,head) #define HASH_CNT(hh,head) ((head)?((head)->hh.tbl->num_items):0) typedef struct UT_hash_bucket { struct UT_hash_handle *hh_head; unsigned count; /* expand_mult is normally set to 0. In this situation, the max chain length * threshold is enforced at its default value, HASH_BKT_CAPACITY_THRESH. (If * the bucket's chain exceeds this length, bucket expansion is triggered). * However, setting expand_mult to a non-zero value delays bucket expansion * (that would be triggered by additions to this particular bucket) * until its chain length reaches a *multiple* of HASH_BKT_CAPACITY_THRESH. * (The multiplier is simply expand_mult+1). The whole idea of this * multiplier is to reduce bucket expansions, since they are expensive, in * situations where we know that a particular bucket tends to be overused. * It is better to let its chain length grow to a longer yet-still-bounded * value, than to do an O(n) bucket expansion too often. */ unsigned expand_mult; } UT_hash_bucket; /* random signature used only to find hash tables in external analysis */ #define HASH_SIGNATURE 0xa0111fe1 #define HASH_BLOOM_SIGNATURE 0xb12220f2 typedef struct UT_hash_table { UT_hash_bucket *buckets; unsigned num_buckets, log2_num_buckets; unsigned num_items; struct UT_hash_handle *tail; /* tail hh in app order, for fast append */ ptrdiff_t hho; /* hash handle offset (byte pos of hash handle in element */ /* in an ideal situation (all buckets used equally), no bucket would have * more than ceil(#items/#buckets) items. that's the ideal chain length. */ unsigned ideal_chain_maxlen; /* nonideal_items is the number of items in the hash whose chain position * exceeds the ideal chain maxlen. these items pay the penalty for an uneven * hash distribution; reaching them in a chain traversal takes >ideal steps */ unsigned nonideal_items; /* ineffective expands occur when a bucket doubling was performed, but * afterward, more than half the items in the hash had nonideal chain * positions. If this happens on two consecutive expansions we inhibit any * further expansion, as it's not helping; this happens when the hash * function isn't a good fit for the key domain. When expansion is inhibited * the hash will still work, albeit no longer in constant time. */ unsigned ineff_expands, noexpand; uint32_t signature; /* used only to find hash tables in external analysis */ #ifdef HASH_BLOOM uint32_t bloom_sig; /* used only to test bloom exists in external analysis */ uint8_t *bloom_bv; char bloom_nbits; #endif } UT_hash_table; typedef struct UT_hash_handle { struct UT_hash_table *tbl; void *prev; /* prev element in app order */ void *next; /* next element in app order */ struct UT_hash_handle *hh_prev; /* previous hh in bucket order */ struct UT_hash_handle *hh_next; /* next hh in bucket order */ void *key; /* ptr to enclosing struct's key */ unsigned keylen; /* enclosing struct's key len */ unsigned hashv; /* result of hash-fcn(key) */ } UT_hash_handle; #endif /* UTHASH_H */ hamlib-1.2.15.3/tests/dumpcaps.c0000644000175000017500000005161512044564477013265 00000000000000/* * dumpcaps.c - Copyright (C) 2000-2012 Stephane Fillod * This programs dumps the capabilities of a backend rig. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "misc.h" #include "sprintflst.h" #include "rigctl_parse.h" static int print_ext(RIG *rig, const struct confparams *cfp, rig_ptr_t ptr); int range_sanity_check(const struct freq_range_list range_list[], int rx); int ts_sanity_check(const struct tuning_step_list tuning_step[]); static void dump_chan_caps(const channel_cap_t *chan, FILE *fout); /* * the rig may be in rig_init state, but not openned */ int dumpcaps (RIG* rig, FILE *fout) { const struct rig_caps *caps; int status, i; int can_esplit, can_echannel; char freqbuf[20]; int backend_warnings = 0; static char prntbuf[1024]; /* a malloc would be better.. */ if (!rig || !rig->caps) return -RIG_EINVAL; caps = rig->caps; fprintf(fout, "Caps dump for model: %d\n", caps->rig_model); fprintf(fout, "Model name:\t%s\n", caps->model_name); fprintf(fout, "Mfg name:\t%s\n", caps->mfg_name); fprintf(fout, "Backend version:\t%s\n", caps->version); fprintf(fout, "Backend copyright:\t%s\n", caps->copyright); fprintf(fout, "Backend status:\t%s\n", rig_strstatus(caps->status)); fprintf(fout, "Rig type:\t"); switch (caps->rig_type & RIG_TYPE_MASK) { case RIG_TYPE_TRANSCEIVER: fprintf(fout, "Transceiver\n"); break; case RIG_TYPE_HANDHELD: fprintf(fout, "Handheld\n"); break; case RIG_TYPE_MOBILE: fprintf(fout, "Mobile\n"); break; case RIG_TYPE_RECEIVER: fprintf(fout, "Receiver\n"); break; case RIG_TYPE_PCRECEIVER: fprintf(fout, "PC Receiver\n"); break; case RIG_TYPE_SCANNER: fprintf(fout, "Scanner\n"); break; case RIG_TYPE_TRUNKSCANNER: fprintf(fout, "Trunking scanner\n"); break; case RIG_TYPE_COMPUTER: fprintf(fout, "Computer\n"); break; case RIG_TYPE_TUNER: fprintf(fout, "Tuner\n"); break; case RIG_TYPE_OTHER: fprintf(fout, "Other\n"); break; default: fprintf(fout, "Unknown\n"); backend_warnings++; } fprintf(fout, "PTT type:\t"); switch (caps->ptt_type) { case RIG_PTT_RIG: fprintf(fout, "Rig capable\n"); break; case RIG_PTT_RIG_MICDATA: fprintf(fout, "Rig capable (Mic/Data)\n"); break; case RIG_PTT_PARALLEL: fprintf(fout, "Parallel port (DATA0)\n"); break; case RIG_PTT_SERIAL_RTS: fprintf(fout, "Serial port (CTS/RTS)\n"); break; case RIG_PTT_SERIAL_DTR: fprintf(fout, "Serial port (DTR/DSR)\n"); break; case RIG_PTT_NONE: fprintf(fout, "None\n"); break; default: fprintf(fout, "Unknown\n"); backend_warnings++; } fprintf(fout, "DCD type:\t"); switch (caps->dcd_type) { case RIG_DCD_RIG: fprintf(fout, "Rig capable\n"); break; case RIG_DCD_PARALLEL: fprintf(fout, "Parallel port (/STROBE)\n"); break; case RIG_DCD_SERIAL_CTS: fprintf(fout, "Serial port (CTS/RTS)\n"); break; case RIG_DCD_SERIAL_DSR: fprintf(fout, "Serial port (DTR/DSR)\n"); break; case RIG_DCD_SERIAL_CAR: fprintf(fout, "Serial port (CD)\n"); break; case RIG_DCD_NONE: fprintf(fout, "None\n"); break; default: fprintf(fout, "Unknown\n"); backend_warnings++; } fprintf(fout, "Port type:\t"); switch (caps->port_type) { case RIG_PORT_SERIAL: fprintf(fout, "RS-232\n"); fprintf(fout, "Serial speed: %d..%d bauds, %d%c%d %s\n", caps->serial_rate_min, caps->serial_rate_max, caps->serial_data_bits, caps->serial_parity == RIG_PARITY_NONE ? 'N': caps->serial_parity == RIG_PARITY_ODD ? 'O' : caps->serial_parity == RIG_PARITY_EVEN ? 'E' : caps->serial_parity == RIG_PARITY_MARK ? 'M' : 'S', caps->serial_stop_bits, caps->serial_handshake == RIG_HANDSHAKE_NONE ? "" : (caps->serial_handshake == RIG_HANDSHAKE_XONXOFF ? "XONXOFF" : "CTS/RTS") ); break; case RIG_PORT_PARALLEL: fprintf(fout, "Parallel\n"); break; case RIG_PORT_DEVICE: fprintf(fout, "Device driver\n"); break; case RIG_PORT_USB: fprintf(fout, "USB\n"); break; case RIG_PORT_NETWORK: fprintf(fout, "Network link\n"); break; case RIG_PORT_UDP_NETWORK: fprintf(fout, "UDP Network link\n"); break; case RIG_PORT_NONE: fprintf(fout, "None\n"); break; default: fprintf(fout, "Unknown\n"); backend_warnings++; } fprintf(fout, "Write delay: %dms, timeout %dms, %d retry\n", caps->write_delay, caps->timeout, caps->retry); fprintf(fout, "Post Write delay: %dms\n", caps->post_write_delay); fprintf(fout, "Has targetable VFO: %s\n", caps->targetable_vfo ? "Y" : "N"); fprintf(fout, "Has transceive: %s\n", caps->transceive ? "Y" : "N"); fprintf(fout, "Announce: 0x%x\n", caps->announces); fprintf(fout, "Max RIT: -%ld.%ldkHz/+%ld.%ldkHz\n", caps->max_rit / 1000, caps->max_rit % 1000, caps->max_rit / 1000, caps->max_rit % 1000); fprintf(fout, "Max XIT: -%ld.%ldkHz/+%ld.%ldkHz\n", caps->max_xit / 1000, caps->max_xit % 1000, caps->max_xit / 1000, caps->max_xit % 1000); fprintf(fout, "Max IF-SHIFT: -%ld.%ldkHz/+%ld.%ldkHz\n", caps->max_ifshift / 1000, caps->max_ifshift % 1000, caps->max_ifshift / 1000, caps->max_ifshift % 1000); fprintf(fout, "Preamp:"); for(i = 0; i < MAXDBLSTSIZ && caps->preamp[i] != 0; i++) fprintf(fout, " %ddB", caps->preamp[i]); if (i == 0) fprintf(fout, " None"); fprintf(fout, "\n"); fprintf(fout, "Attenuator:"); for(i = 0; i < MAXDBLSTSIZ && caps->attenuator[i] != 0; i++) fprintf(fout, " %ddB",caps->attenuator[i]); if (i == 0) fprintf(fout, " None"); fprintf(fout, "\n"); fprintf(fout, "CTCSS:"); for(i = 0; caps->ctcss_list && i < 60 && caps->ctcss_list[i] != 0; i++) { fprintf(fout, " %d.%1d", caps->ctcss_list[i] / 10, caps->ctcss_list[i] % 10); } if (i == 0) fprintf(fout, " None"); else fprintf(fout, " Hz, %d tones", i); fprintf(fout, "\n"); fprintf(fout, "DCS:"); for(i = 0; caps->dcs_list && i < 128 && caps->dcs_list[i] != 0; i++) { fprintf(fout, " %d", caps->dcs_list[i]); } if (i == 0) fprintf(fout, " None"); else fprintf(fout, ", %d codes", i); fprintf(fout, "\n"); sprintf_func(prntbuf, caps->has_get_func); fprintf(fout, "Get functions: %s\n", prntbuf); sprintf_func(prntbuf, caps->has_set_func); fprintf(fout, "Set functions: %s\n", prntbuf); sprintf_level_gran(prntbuf, caps->has_get_level, caps->level_gran); fprintf(fout, "Get level: %s\n", prntbuf); if ((caps->has_get_level & RIG_LEVEL_SQLSTAT)) { fprintf(fout, "Warning--backend uses deprecated SQLSTAT level!\n"); backend_warnings++; } if ((caps->has_get_level & RIG_LEVEL_RAWSTR) && caps->str_cal.size == 0 && !(caps->has_get_level & RIG_LEVEL_STRENGTH)) { fprintf(fout, "Warning--backend has get RAWSTR, but not calibration data\n"); backend_warnings++; } sprintf_level_gran(prntbuf, caps->has_set_level, caps->level_gran); fprintf(fout, "Set level: %s\n", prntbuf); if (caps->has_set_level & RIG_LEVEL_READONLY_LIST) { fprintf(fout, "Warning--backend can set readonly levels!\n"); backend_warnings++; } fprintf(fout, "Extra levels:"); rig_ext_level_foreach(rig, print_ext, fout); fprintf(fout, "\n"); sprintf_parm_gran(prntbuf, caps->has_get_parm, caps->parm_gran); fprintf(fout, "Get parameters: %s\n", prntbuf); sprintf_parm_gran(prntbuf, caps->has_set_parm, caps->parm_gran); fprintf(fout, "Set parameters: %s\n", prntbuf); if (caps->has_set_parm & RIG_PARM_READONLY_LIST) { fprintf(fout, "Warning--backend can set readonly parms!\n"); backend_warnings++; } fprintf(fout, "Extra parameters:"); rig_ext_parm_foreach(rig, print_ext, fout); fprintf(fout, "\n"); if (rig->state.mode_list != 0) sprintf_mode(prntbuf, rig->state.mode_list); else { strcpy(prntbuf,"None. This backend might be bogus!\n"); backend_warnings++; } fprintf(fout, "Mode list: %s\n", prntbuf); if (rig->state.vfo_list != 0) sprintf_vfo(prntbuf, rig->state.vfo_list); else { strcpy(prntbuf,"None. This backend might be bogus!\n"); backend_warnings++; } fprintf(fout, "VFO list: %s\n", prntbuf); sprintf_vfop(prntbuf, caps->vfo_ops); fprintf(fout, "VFO Ops: %s\n", prntbuf); sprintf_scan(prntbuf, caps->scan_ops); fprintf(fout, "Scan Ops: %s\n", prntbuf); fprintf(fout, "Number of banks:\t%d\n", caps->bank_qty); fprintf(fout, "Memory name desc size:\t%d\n", caps->chan_desc_sz); fprintf(fout, "Memories:"); for (i = 0; i < CHANLSTSIZ && caps->chan_list[i].type; i++) { fprintf(fout, "\n\t%d..%d: \t%s", caps->chan_list[i].start, caps->chan_list[i].end, rig_strmtype(caps->chan_list[i].type)); fprintf(fout, "\n\t Mem caps: "); dump_chan_caps(&caps->chan_list[i].mem_caps, fout); } if (i == 0) fprintf(fout, " None"); fprintf(fout, "\n"); /* TODO: print rx/tx ranges here */ status = range_sanity_check(caps->tx_range_list1, 0); fprintf(fout, "TX ranges status, region 1:\t%s (%d)\n", status ? "Bad" : "OK", status); if (status) backend_warnings++; status = range_sanity_check(caps->rx_range_list1, 1); fprintf(fout, "RX ranges status, region 1:\t%s (%d)\n", status ? "Bad" : "OK", status); if (status) backend_warnings++; status = range_sanity_check(caps->tx_range_list2, 0); fprintf(fout, "TX ranges status, region 2:\t%s (%d)\n", status ? "Bad" : "OK", status); if (status) backend_warnings++; status = range_sanity_check(caps->rx_range_list2, 1); fprintf(fout, "RX ranges status, region 2:\t%s (%d)\n", status ? "Bad" : "OK", status); if (status) backend_warnings++; fprintf(fout, "Tuning steps:"); for (i = 0; i < TSLSTSIZ && !RIG_IS_TS_END(caps->tuning_steps[i]); i++) { if (caps->tuning_steps[i].ts == RIG_TS_ANY) strcpy(freqbuf, "ANY"); /* strcpy! Looks safe for now */ else sprintf_freq(freqbuf, caps->tuning_steps[i].ts); sprintf_mode(prntbuf, caps->tuning_steps[i].modes); fprintf(fout, "\n\t%s: \t%s", freqbuf, prntbuf); } if (i == 0) { fprintf(fout, " None! This backend might be bogus!"); backend_warnings++; } fprintf(fout, "\n"); status = ts_sanity_check(caps->tuning_steps); fprintf(fout, "Tuning steps status:\t%s (%d)\n",status?"Bad":"OK",status); if (status) backend_warnings++; fprintf(fout, "Filters:"); for (i=0; ifilters[i]); i++) { if (caps->filters[i].width == RIG_FLT_ANY) strcpy(freqbuf, "ANY"); else sprintf_freq(freqbuf,caps->filters[i].width); sprintf_mode(prntbuf,caps->filters[i].modes); fprintf(fout, "\n\t%s: \t%s", freqbuf, prntbuf); } if (i == 0) { fprintf(fout, " None. This backend might be bogus!"); backend_warnings++; } fprintf(fout, "\n"); fprintf(fout, "Bandwidths:"); for (i = 1; i < RIG_MODE_TESTS_MAX; i <<= 1) { pbwidth_t pbnorm = rig_passband_normal(rig, i); if (pbnorm == 0) continue; sprintf_freq(freqbuf, pbnorm); fprintf(fout, "\n\t%s\tNormal: %s,\t", rig_strrmode(i), freqbuf); sprintf_freq(freqbuf, rig_passband_narrow(rig, i)); fprintf(fout, "Narrow: %s,\t", freqbuf); sprintf_freq(freqbuf, rig_passband_wide(rig, i)); fprintf(fout, "Wide: %s", freqbuf); } fprintf(fout, "\n"); fprintf(fout, "Has priv data:\t%c\n", caps->priv != NULL ? 'Y' : 'N'); /* * Status is either 'Y'es, 'E'mulated, 'N'o * * TODO: keep me up-to-date with API call list! */ fprintf(fout, "Has Init:\t%c\n", caps->rig_init != NULL ? 'Y' : 'N'); fprintf(fout, "Has Cleanup:\t%c\n", caps->rig_cleanup != NULL ? 'Y' : 'N'); fprintf(fout, "Has Open:\t%c\n", caps->rig_open != NULL ? 'Y' : 'N'); fprintf(fout, "Has Close:\t%c\n", caps->rig_close != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Conf:\t%c\n", caps->set_conf != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Conf:\t%c\n", caps->get_conf != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Frequency:\t%c\n", caps->set_freq != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Frequency:\t%c\n", caps->get_freq != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Mode:\t%c\n", caps->set_mode != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Mode:\t%c\n", caps->get_mode != NULL ? 'Y' : 'N'); fprintf(fout, "Can set VFO:\t%c\n", caps->set_vfo != NULL ? 'Y' : 'N'); fprintf(fout, "Can get VFO:\t%c\n", caps->get_vfo != NULL ? 'Y' : 'N'); fprintf(fout, "Can set PTT:\t%c\n", caps->set_ptt != NULL ? 'Y' : 'N'); fprintf(fout, "Can get PTT:\t%c\n", caps->get_ptt != NULL ? 'Y' : 'N'); fprintf(fout, "Can get DCD:\t%c\n", caps->get_dcd != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Repeater Duplex:\t%c\n", caps->set_rptr_shift != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Repeater Duplex:\t%c\n", caps->get_rptr_shift != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Repeater Offset:\t%c\n", caps->set_rptr_offs != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Repeater Offset:\t%c\n", caps->get_rptr_offs != NULL ? 'Y' : 'N'); can_esplit = caps->set_split_vfo && (caps->set_vfo || (rig_has_vfo_op(rig, RIG_OP_TOGGLE) && caps->vfo_op)); fprintf(fout, "Can set Split Freq:\t%c\n", caps->set_split_freq != NULL ? 'Y' : (can_esplit && caps->set_freq ? 'E' : 'N')); fprintf(fout, "Can get Split Freq:\t%c\n", caps->get_split_freq != NULL ? 'Y' : (can_esplit && caps->get_freq ? 'E' : 'N')); fprintf(fout, "Can set Split Mode:\t%c\n", caps->set_split_mode != NULL ? 'Y' : (can_esplit && caps->set_mode ? 'E' : 'N')); fprintf(fout, "Can get Split Mode:\t%c\n", caps->get_split_mode != NULL ? 'Y' : (can_esplit && caps->get_mode ? 'E' : 'N')); fprintf(fout, "Can set Split VFO:\t%c\n", caps->set_split_vfo != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Split VFO:\t%c\n", caps->get_split_vfo != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Tuning Step:\t%c\n", caps->set_ts != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Tuning Step:\t%c\n", caps->get_ts != NULL ? 'Y' : 'N'); fprintf(fout, "Can set RIT:\t%c\n", caps->set_rit != NULL ? 'Y' : 'N'); fprintf(fout, "Can get RIT:\t%c\n", caps->get_rit != NULL ? 'Y' : 'N'); fprintf(fout, "Can set XIT:\t%c\n", caps->set_xit != NULL ? 'Y' : 'N'); fprintf(fout, "Can get XIT:\t%c\n", caps->get_xit != NULL ? 'Y' : 'N'); fprintf(fout, "Can set CTCSS:\t%c\n", caps->set_ctcss_tone != NULL ? 'Y' : 'N'); fprintf(fout, "Can get CTCSS:\t%c\n", caps->get_ctcss_tone != NULL ? 'Y' : 'N'); fprintf(fout, "Can set DCS:\t%c\n", caps->set_dcs_code != NULL ? 'Y' : 'N'); fprintf(fout, "Can get DCS:\t%c\n", caps->get_dcs_code != NULL ? 'Y' : 'N'); fprintf(fout, "Can set CTCSS Squelch:\t%c\n", caps->set_ctcss_sql != NULL ? 'Y' : 'N'); fprintf(fout, "Can get CTCSS Squelch:\t%c\n", caps->get_ctcss_sql != NULL ? 'Y' : 'N'); fprintf(fout, "Can set DCS Squelch:\t%c\n", caps->set_dcs_sql != NULL ? 'Y' : 'N'); fprintf(fout, "Can get DCS Squelch:\t%c\n", caps->get_dcs_sql != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Power Stat:\t%c\n", caps->set_powerstat != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Power Stat:\t%c\n", caps->get_powerstat != NULL ? 'Y' : 'N'); fprintf(fout, "Can Reset:\t%c\n", caps->reset != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Ant:\t%c\n", caps->get_ant != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Ant:\t%c\n", caps->set_ant != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Transceive:\t%c\n", caps->set_trn != NULL ? 'Y' : caps->transceive == RIG_TRN_RIG ? 'E' : 'N'); fprintf(fout, "Can get Transceive:\t%c\n", caps->get_trn != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Func:\t%c\n", caps->set_func != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Func:\t%c\n", caps->get_func != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Level:\t%c\n", caps->set_level != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Level:\t%c\n", caps->get_level != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Param:\t%c\n", caps->set_parm != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Param:\t%c\n", caps->get_parm != NULL ? 'Y' : 'N'); fprintf(fout, "Can send DTMF:\t%c\n", caps->send_dtmf != NULL ? 'Y': 'N'); fprintf(fout, "Can recv DTMF:\t%c\n", caps->recv_dtmf != NULL ? 'Y' : 'N'); fprintf(fout, "Can send Morse:\t%c\n", caps->send_morse != NULL ? 'Y' : 'N'); fprintf(fout, "Can decode Events:\t%c\n", caps->decode_event != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Bank:\t%c\n", caps->set_bank != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Mem:\t%c\n", caps->set_mem != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Mem:\t%c\n", caps->get_mem != NULL ? 'Y' : 'N'); can_echannel = caps->set_mem && ( (caps->set_vfo && ((rig->state.vfo_list & RIG_VFO_MEM) == RIG_VFO_MEM)) || (caps->vfo_op && rig_has_vfo_op(rig, RIG_OP_TO_VFO|RIG_OP_FROM_VFO))); fprintf(fout, "Can set Channel:\t%c\n", caps->set_channel != NULL ? 'Y' : (can_echannel ? 'E' : 'N')); fprintf(fout, "Can get Channel:\t%c\n", caps->get_channel != NULL ? 'Y' : (can_echannel ? 'E' : 'N')); fprintf(fout, "Can ctl Mem/VFO:\t%c\n", caps->vfo_op != NULL ? 'Y' : 'N'); fprintf(fout, "Can Scan:\t%c\n", caps->scan != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Info:\t%c\n", caps->get_info != NULL ? 'Y' : 'N'); fprintf(fout, "Can get power2mW:\t%c\n", caps->power2mW != NULL ? 'Y' : 'N'); fprintf(fout, "Can get mW2power:\t%c\n", caps->mW2power != NULL ? 'Y' : 'N'); fprintf(fout, "\nOverall backend warnings: %d\n", backend_warnings); return backend_warnings; } static int print_ext(RIG *rig, const struct confparams *cfp, rig_ptr_t ptr) { fprintf((FILE *)ptr, " %s", cfp->name); return 1; /* process them all */ } /* * check for: * - start_freq < end_freq return_code = -1 * - modes are not 0 return_code = -2 * - if(rx), low_power, high_power set to -1 return_code = -3 * else, power is > 0 * - array is ended by a {0,0,0,0,0} element (before boundary) rc = -4 * - ranges with same modes do not overlap rc = -5 * ->fprintf(stderr,)! * * TODO: array is sorted in ascending freq order */ int range_sanity_check(const struct freq_range_list range_list[], int rx) { int i; for (i = 0; i < FRQRANGESIZ; i++) { if (range_list[i].start == 0 && range_list[i].end == 0) break; if (range_list[i].start > range_list[i].end) return -1; if (range_list[i].modes == 0) return -2; if (rx) { if (range_list[i].low_power > 0 && range_list[i].high_power > 0) return -3; } else { if (!(range_list[i].low_power > 0 && range_list[i].high_power > 0)) return -3; if (range_list[i].low_power > range_list[i].high_power) return -3; } } if (i == FRQRANGESIZ) return -4; return 0; } /* * check for: * - steps sorted in ascending order return_code=-1 * - modes are not 0 return_code=-2 * - array is ended by a {0,0,0,0,0} element (before boundary) rc=-4 * * TODO: array is sorted in ascending freq order */ int ts_sanity_check(const struct tuning_step_list tuning_step[]) { int i; shortfreq_t last_ts; rmode_t last_modes; last_ts = 0; last_modes = RIG_MODE_NONE; for (i=0; ibank_num) fprintf(fout, "BANK "); if (chan->ant) fprintf(fout, "ANT "); if (chan->freq) fprintf(fout, "FREQ "); if (chan->mode) fprintf(fout, "MODE "); if (chan->width) fprintf(fout, "WIDTH "); if (chan->tx_freq) fprintf(fout, "TXFREQ "); if (chan->tx_mode) fprintf(fout, "TXMODE "); if (chan->tx_width) fprintf(fout, "TXWIDTH "); if (chan->split) fprintf(fout, "SPLIT "); if (chan->rptr_shift) fprintf(fout, "RPTRSHIFT "); if (chan->rptr_offs) fprintf(fout, "RPTROFS "); if (chan->tuning_step) fprintf(fout, "TS "); if (chan->rit) fprintf(fout, "RIT "); if (chan->xit) fprintf(fout, "XIT "); if (chan->funcs) fprintf(fout, "FUNC "); /* TODO: iterate over the list */ if (chan->levels) fprintf(fout, "LEVEL "); /* TODO: iterate over the list */ if (chan->ctcss_tone) fprintf(fout, "TONE "); if (chan->ctcss_sql) fprintf(fout, "CTCSS "); if (chan->dcs_code) fprintf(fout, "DCSCODE "); if (chan->dcs_sql) fprintf(fout, "DCSSQL "); if (chan->scan_group) fprintf(fout, "SCANGRP "); if (chan->flags) fprintf(fout, "FLAG "); /* TODO: iterate over the RIG_CHFLAG's */ if (chan->channel_desc) fprintf(fout, "NAME "); if (chan->ext_levels) fprintf(fout, "EXTLVL "); } int dumpconf (RIG* rig, FILE *fout) { rig_token_foreach(rig, print_conf_list, (rig_ptr_t)rig); return 0; } hamlib-1.2.15.3/tests/rotctl_parse.h0000644000175000017500000000257412044564477014157 00000000000000/* * rotctl_parse.h - (C) Stephane Fillod 2000-2008 * * This program test/control a radio using Hamlib. * It takes commands in interactive mode as well as * from command line options. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef ROTCTL_PARSE_H #define ROTCTL_PARSE_H #include #include /* * external prototype */ int dumpcaps_rot (ROT *, FILE *); /* * Prototypes */ void usage_rot(FILE *); void version(); void list_models(); int print_conf_list(const struct confparams *cfp, rig_ptr_t data); int set_conf(ROT *my_rot, char *conf_parms); int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc); #endif /* ROTCTL_PARSE_H */ hamlib-1.2.15.3/tests/rigctl.c0000644000175000017500000002313312044564477012727 00000000000000/* * rigctl.c - (C) Stephane Fillod 2000-2009 * * This program test/control a radio using Hamlib. * It takes commands in interactive mode as well as * from command line options. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include "misc.h" #include "iofunc.h" #include "serial.h" #include "sprintflst.h" #include "rigctl_parse.h" #define MAXNAMSIZ 32 #define MAXNBOPT 100 /* max number of different options */ void usage(void); /* * Reminder: when adding long options, * keep up to date SHORT_OPTIONS, usage()'s output and man page. thanks. * NB: do NOT use -W since it's reserved by POSIX. * TODO: add an option to read from a file */ #define SHORT_OPTIONS "m:r:p:d:P:D:s:c:t:lC:LuovhV" static struct option long_options[] = { {"model", 1, 0, 'm'}, {"rig-file", 1, 0, 'r'}, {"ptt-file", 1, 0, 'p'}, {"dcd-file", 1, 0, 'd'}, {"ptt-type", 1, 0, 'P'}, {"dcd-type", 1, 0, 'D'}, {"serial-speed", 1, 0, 's'}, {"civaddr", 1, 0, 'c'}, {"send-cmd-term", 1, 0, 't'}, {"list", 0, 0, 'l'}, {"set-conf", 1, 0, 'C'}, {"show-conf", 0, 0, 'L'}, {"dump-caps", 0, 0, 'u'}, {"vfo", 0, 0, 'o'}, {"verbose", 0, 0, 'v'}, {"help", 0, 0, 'h'}, {"version", 0, 0, 'V'}, {0, 0, 0, 0} }; #define MAXCONFLEN 128 int interactive = 1; /* if no cmd on command line, switch to interactive */ int prompt = 1; /* Print prompt in rigctl */ int opt_end = 0; /* only used by rigctld */ int vfo_mode = 0; /* vfo_mode = 0 means target VFO is 'currVFO' */ char send_cmd_term = '\r'; /* send_cmd termination char */ int main (int argc, char *argv[]) { RIG *my_rig; /* handle to rig (nstance) */ rig_model_t my_model = RIG_MODEL_DUMMY; int retcode; /* generic return code from functions */ int exitcode; int verbose = 0; int show_conf = 0; int dump_caps_opt = 0; const char *rig_file=NULL, *ptt_file=NULL, *dcd_file=NULL; ptt_type_t ptt_type = RIG_PTT_NONE; dcd_type_t dcd_type = RIG_DCD_NONE; int serial_rate = 0; char *civaddr = NULL; /* NULL means no need to set conf */ char conf_parms[MAXCONFLEN] = ""; while(1) { int c; int option_index = 0; c = getopt_long (argc, argv, SHORT_OPTIONS, long_options, &option_index); if (c == -1) break; switch(c) { case 'h': usage(); exit(0); case 'V': version(); exit(0); case 'm': if (!optarg) { usage(); /* wrong arg count */ exit(1); } my_model = atoi(optarg); break; case 'r': if (!optarg) { usage(); /* wrong arg count */ exit(1); } rig_file = optarg; break; case 'p': if (!optarg) { usage(); /* wrong arg count */ exit(1); } ptt_file = optarg; break; case 'd': if (!optarg) { usage(); /* wrong arg count */ exit(1); } dcd_file = optarg; break; case 'P': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (!strcmp(optarg, "RIG")) ptt_type = RIG_PTT_RIG; else if (!strcmp(optarg, "DTR")) ptt_type = RIG_PTT_SERIAL_DTR; else if (!strcmp(optarg, "RTS")) ptt_type = RIG_PTT_SERIAL_RTS; else if (!strcmp(optarg, "PARALLEL")) ptt_type = RIG_PTT_PARALLEL; else if (!strcmp(optarg, "CM108")) ptt_type = RIG_PTT_CM108; else if (!strcmp(optarg, "NONE")) ptt_type = RIG_PTT_NONE; else ptt_type = atoi(optarg); break; case 'D': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (!strcmp(optarg, "RIG")) dcd_type = RIG_DCD_RIG; else if (!strcmp(optarg, "DSR")) dcd_type = RIG_DCD_SERIAL_DSR; else if (!strcmp(optarg, "CTS")) dcd_type = RIG_DCD_SERIAL_CTS; else if (!strcmp(optarg, "CD")) dcd_type = RIG_DCD_SERIAL_CAR; else if (!strcmp(optarg, "PARALLEL")) dcd_type = RIG_DCD_PARALLEL; else if (!strcmp(optarg, "CM108")) dcd_type = RIG_DCD_CM108; else if (!strcmp(optarg, "NONE")) dcd_type = RIG_DCD_NONE; else dcd_type = atoi(optarg); break; case 'c': if (!optarg) { usage(); /* wrong arg count */ exit(1); } civaddr = optarg; break; case 't': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (strlen(optarg) > 1) send_cmd_term = strtol(optarg, NULL, 0); else send_cmd_term = optarg[0]; break; case 's': if (!optarg) { usage(); /* wrong arg count */ exit(1); } serial_rate = atoi(optarg); break; case 'C': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (*conf_parms != '\0') strcat(conf_parms, ","); strncat(conf_parms, optarg, MAXCONFLEN-strlen(conf_parms)); break; case 'o': vfo_mode++; break; case 'v': verbose++; break; case 'L': show_conf++; break; case 'l': rig_set_debug(verbose); list_models(); exit(0); case 'u': dump_caps_opt++; break; default: usage(); /* unknown option? */ exit(1); } } rig_set_debug(verbose); rig_debug(RIG_DEBUG_VERBOSE, "rigctl, %s\n", hamlib_version); rig_debug(RIG_DEBUG_VERBOSE, "Report bugs to " "\n\n"); /* * at least one command on command line, * disable interactive mode */ if (optind < argc) interactive = 0; my_rig = rig_init(my_model); if (!my_rig) { fprintf(stderr, "Unknown rig num %d, or initialization error.\n", my_model); fprintf(stderr, "Please check with --list option.\n"); exit(2); } retcode = set_conf(my_rig, conf_parms); if (retcode != RIG_OK) { fprintf(stderr, "Config parameter error: %s\n", rigerror(retcode)); exit(2); } if (rig_file) strncpy(my_rig->state.rigport.pathname, rig_file, FILPATHLEN - 1); /* * ex: RIG_PTT_PARALLEL and /dev/parport0 */ if (ptt_type != RIG_PTT_NONE) my_rig->state.pttport.type.ptt = ptt_type; if (dcd_type != RIG_DCD_NONE) my_rig->state.dcdport.type.dcd = dcd_type; if (ptt_file) strncpy(my_rig->state.pttport.pathname, ptt_file, FILPATHLEN - 1); if (dcd_file) strncpy(my_rig->state.dcdport.pathname, dcd_file, FILPATHLEN - 1); /* FIXME: bound checking and port type == serial */ if (serial_rate != 0) my_rig->state.rigport.parm.serial.rate = serial_rate; if (civaddr) rig_set_conf(my_rig, rig_token_lookup(my_rig, "civaddr"), civaddr); /* * print out conf parameters */ if (show_conf) { dumpconf(my_rig, stdout); } /* * print out capabilities, and exists immediately * We may be interested only in only caps, and rig_open may fail. */ if (dump_caps_opt) { dumpcaps(my_rig, stdout); rig_cleanup(my_rig); /* if you care about memory */ exit(0); } retcode = rig_open(my_rig); if (retcode != RIG_OK) { fprintf(stderr,"rig_open: error = %s \n", rigerror(retcode)); exit(2); } if (verbose > 0) printf("Opened rig model %d, '%s'\n", my_rig->caps->rig_model, my_rig->caps->model_name); rig_debug(RIG_DEBUG_VERBOSE, "Backend version: %s, Status: %s\n", my_rig->caps->version, rig_strstatus(my_rig->caps->status)); exitcode = 0; do { retcode = rigctl_parse(my_rig, stdin, stdout, argv, argc); if (retcode == 2) exitcode = 2; } while (retcode == 0 || retcode == 2); rig_close(my_rig); /* close port */ rig_cleanup(my_rig); /* if you care about memory */ return exitcode; } void usage(void) { printf("Usage: rigctl [OPTION]... [COMMAND]...\n" "Send COMMANDs to a connected radio transceiver or receiver.\n\n"); printf( " -m, --model=ID select radio model number. See model list\n" " -r, --rig-file=DEVICE set device of the radio to operate on\n" " -p, --ptt-file=DEVICE set device of the PTT device to operate on\n" " -d, --dcd-file=DEVICE set device of the DCD device to operate on\n" " -P, --ptt-type=TYPE set type of the PTT device to operate on\n" " -D, --dcd-type=TYPE set type of the DCD device to operate on\n" " -s, --serial-speed=BAUD set serial speed of the serial port\n" " -c, --civaddr=ID set CI-V address, decimal (for Icom rigs only)\n" " -t, --send-cmd-term=CHAR set send_cmd command termination char\n" " -C, --set-conf=PARM=VAL set config parameters\n" " -L, --show-conf list all config parameters\n" " -l, --list list all model numbers and exit\n" " -u, --dump-caps dump capabilities and exit\n" " -o, --vfo do not default to VFO_CURR, require extra vfo arg\n" " -v, --verbose set verbose mode, cumulative\n" " -h, --help display this help and exit\n" " -V, --version output version information and exit\n\n" ); usage_rig(stdout); printf("\nReport bugs to .\n"); } hamlib-1.2.15.3/tests/README0000644000175000017500000000427312044564477012163 00000000000000 You will find in the tests/ subdirectory various programs to exercise the Hamlib library. Most of the time, you will have to make sure that the backend for your rig is loaded by passing the model number of your rig by argument. If you don't know the number, listrigs can give it to you, "rigctl --list" will also output something like this: Rig# Mfg Model Vers. 1 Hamlib Dummy 0.1 105 Yaesu FT-747GX 0.1 210 Kenwood TS-870S 0.1 311 Icom IC-706MkIIG 0.2 1506 Winradio WR-3500 0.6 [etc.] In any case, you are encouraged to check for correct initialization by reading the source code, at the begining of the main(). Check also that the program is setup for your rig path strncpy(my_rig->state.rig_path... dumpcaps - Output the caps contents of a rig dumpmem - Dump the memory contents of the rig listrigs - Condensed list of all the models supported by backends rigmatrix - Output the HTML table of supported rigs, with .png files for freqs (Better call 'make rigmatrix.html' which builds the HTML table and additional information in sup-info subdirectory.) testbcd - Simple program to test BCD conversion, takes a number as arg. testfreq - Simple program to test Freq conversion, takes a number as arg. testrig - Sample program calling common API calls, uses rig_probe testtrn - Sample program using event notification (transceive mode) rigctl - Combined tool to execute any call of the API, see man page rigmem - Combined tool to load/save content of rig memory, see man page rotctl - Similar to 'rigctl' but for rotators, see man page rigctld - A simple daemon to process 'rigctl' commands received over a network socket. Useful for scripting languages or remote access via an SSH tunnel (unsecure program). See man page. rotctld - A simple daemon to process 'rotctl' commands received over a network socket. Useful for scripting languages or remote access via an SSH tunnel (unsecure program). See man page. testctld.pl A Perl program to test 'rigctld' and provide some example code. hamlib-1.2.15.3/tests/rotctl.10000644000175000017500000002610112044564477012666 00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH ROTCTL "1" "September 27, 2012" "Hamlib" "Rotator Control Program" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME rotctl \- control antenna rotators .SH SYNOPSIS .B rotctl [\fIOPTION\fR]... [\fICOMMAND\fR]... .SH DESCRIPTION Control antenna rotators. \fBrotctl\fP accepts \fIcommands\fP from the command line as well as in interactive mode if none are provided on the command line. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. Keep in mind that \fBHamlib\fP is BETA level software. While a lot of backend libraries lack complete rig support, the basic functions are usually well supported. The API may change without publicized notice, while an advancement of the minor version (e.g. 1.1.x to 1.2.x) indicates such a change. .PP Please report bugs and provide feedback at the e-mail address given in the REPORTING BUGS section. Patches and code enhancements are also welcome. .SH OPTIONS This program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). Here is s summary of the supported options: .TP .B \-m, --model=id Select rotator model number. See model list (use 'rotctl -l'). .sp NB: \fBrotctl\fP (or third party software) will use rig model 1901 when using \fBrpc.rotd\fP or rig model 2 for NET rotctl (rotctld). .TP .B \-r, --rot-file=device Use \fIdevice\fP as the file name of the port the rotator is connected. Often a serial port, but could be a USB to serial adapter or USB port device. Typically /dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0, etc. on Linux or COM1, COM2, etc. on Win32. .sp Also used to specify the host and port to connect to a listening rotctld daemon on POSIX: .sp -r localhost:4533 .sp and on Win32: .sp -r 127.0.0.1:4533 .TP .B \-s, --serial-speed=baud Set serial speed to \fIbaud\fP rate. Uses maximum serial speed from rotator backend capabilities as default. .TP .B \-t, --send-cmd-term=char Change the termination \fIchar\fP for text protocol when using the \fIsend_cmd\fP command. The default value is . Non ASCII printable characters can be specified as an ASCII number, in hexadecimal format, prepended with 0x. You may pass an empty string for no termination char. The string -1 tells rotctl to switch to binary protocol. See the \fIsend_cmd\fP command for further explanation. .TP .B \-L, --show-conf List all config parameters for the rotor defined with -m above. .TP .B \-C, --set-conf=parm=val[,parm=val]* Set config parameter. e.g. --set_conf=stop_bits=2 .sp Use -L option for a list. .TP .B \-u, --dump-caps Dump capabilities for the rotor defined with -m above and exit. .TP .B \-l, --list List all model numbers defined in \fBHamlib\fP and exit. As of 1.2.15.1 the list is sorted by model number. .sp \fBN.B.\fP In Linux the list can be scrolled back using Shift-PageUp/ Shift-PageDown, or using the scrollbars of a virtual terminal in X or the cmd window in Windows. The output can be piped to 'more' or 'less', e.g. 'rotctl -l | more'. .TP .B \-v, --verbose Set verbose mode, cumulative (see DIAGNOSTICS below). .TP .B \-h, --help Show summary of these options and exit. .TP .B \-V, \-\-version Show version of \fBrotctl\fP and exit. .PP \fBN.B.\fP Some options may not be implemented by a given backend and will return an error. This is most likely to occur with the \fI\-\-set-conf\fP and \fI\-\-show-conf\fP options. .PP Please note that the backend for the rotator to be controlled, or the rotator itself may not support some commands. In that case, the operation will fail with a \fBHamlib\fP error code. .SH COMMANDS Commands can be entered either as a single char, or as a long command name. Basically, the commands do not take a dash in front of them, as the options do. They may be typed in when in interactive mode or provided as argument(s) in command line interface mode. .PP Since most of the \fBHamlib\fP operations have a \fIset\fP and a \fIget\fP method, an upper case letter will be used for \fIset\fP method whereas the corresponding lower case letter refers to the \fIget\fP method. Each operation also has a long name; in interactive mode, prepend a backslash to enter a long command name. .sp Example: Use "\\get_info" to see the rotor's info. .PP Please note that the backend for the rotator to be controlled, or the rotator itself may not support some commands. In that case, the operation will fail with a \fBHamlib\fP error message. .PP A summary of commands is included below (In the case of "set" commands the quoted string is replaced by the value in the description. In the case of "get" commands the quoted string is the key name of the value returned.): .TP .B Q|q, exit rotctl Exit rotctl in interactive mode. .sp When rotctl is controlling the rotor directly, will close the rotor backend and port. When rotctl is connected to rotctld (rotor model 2), the TCP/IP connection to rotctld is closed and rotctld remains running, available for another TCP/IP network connection. .TP .B P, set_pos 'Azimuth' 'Elevation' Set position: Azimuth and Elevation as double precision floating point values. .TP .B p, get_pos Get position: 'Azimuth' and 'Elevation' as double precision floating point values. .TP .B M, move 'Direction' 'Speed' Move the rotator in a specific direction at the given rate. .sp Values are integers where Direction is defined as 2 = Up, 4 = Down, 8 = Left, and 16 = Right. Speed is an integer between 1 and 100. Not all backends that implement the move command use the Speed value. At this time only the gs232a utilizes the Speed parameter. .TP .B S, stop Stop the rotator. .TP .B K, park Park the antenna. .TP .B C, set_conf 'Token' 'Value' Set a configuration parameter. It is safe to give "Token" a value of '0' (zero). "Value" may be a string up to 20 characters. .br See -L output .TP .B R, reset 'Reset' Reset the rotator. .sp Integer value of '1' for Reset All. .TP .B _, get_info Get misc information on the rotator. .sp At the moment returns 'Model Name'. .TP .B w, send_cmd 'Cmd' Send raw command string to the rotator. .br (or send-cmd-term, see \fI-t\fP option) is appended automatically at the end of the command for text protocols. For binary protocols, enter values as \\0xAA\\0xBB .PP \fBLocator Commands\fP .PP These commands offer conversions of Degrees Minutes Seconds to other formats, Maidenhead square locator conversions and distance and azimuth conversions. .TP .B L, lonlat2loc 'Longitude' 'Latitude' 'Loc Len [2-12]' Returns the Maidenhead locator for the given 'Longitude' and 'Latitude'. .sp Both are floating point values. The precision of the returned square is controlled by 'Loc Len' which should be an even numbered integer value between 2 and 12. .sp For example, "+L -170.000000 -85.000000 12\\n" returns "Locator: AA55AA00AA00\\n". .TP .B l, loc2lonlat 'Locator' Returns 'Longitude' and 'Latitude' in decimal degrees at the approximate center of the requested grid square (despite the use of double precision variables internally, some rounding error occurs). West longitude is expressed as a negative value. South latitude is expressed as a negative value. Locator can be from 2 to 12 characters in length. .sp For example, "+l AA55AA00AA00\\n" returns "Longitude: -169.999983\\nLatitude: -84.999991\\n". .TP .B D, dms2dec 'Degrees' 'Minutes' 'Seconds' 'S/W' Returns 'Dec Degrees', a signed floating point value. .sp Degrees and Minutes are integer values and Seconds is a floating point value. S/W is a flag with '1' indicating South latitude or West longitude and '0' North or East (the flag is needed as computers don't recognize a signed zero even though only the Degrees value only is typically signed in DMS notation). .TP .B d, dec2dms 'Dec Degrees' Returns 'Degrees' 'Minutes' 'Seconds' 'S/W'. .sp Values are as in dms2dec above. .TP .B E, dmmm2dec 'Degrees' 'Dec Minutes' 'S/W' Returns 'Dec Degrees', a signed floating point value. .sp Degrees is an integer value and Minutes is a floating point value. S/W is a flag with '1' indicating South latitude or West longitude and '0' North or East (the flag is needed as computers don't recognize a signed zero even though only the Degrees value only is typically signed in DMS notation). .TP .B e, dec2dmmm 'Dec Deg' Returns 'Degrees' 'Minutes' 'S/W'. .sp Values are as in dmmm2dec above. .TP .B B, qrb 'Lon 1' 'Lat 1' 'Lon 2' 'Lat 2' Returns 'Distance' 'Azimuth' where Distance is in km and Azimuth is in degrees. .sp All Lon/Lat values are signed floating point numbers. .TP .B A, a_sp2a_lp 'Short Path Deg' Returns 'Long Path Deg' or -RIG_EINVAL upon input error.. .sp Both are floating point values within the range 0.00 to 360.00. .TP .B a, d_sp2d_lp 'Short Path km' Returns 'Long Path km'. .sp Both are floating point values. .SH EXAMPLES Start \fBrotctl\fP for RotorEZ using the first serial port on Linux: .sp $ rotctl -m 401 -r /dev/ttyS0 .sp Start \fBrotctl\fP for RotorEZ using COM2 on Win32: .sp C:\\> rotctl -m 401 -r COM2 .sp Start \fBrotctl\fP using \fBrpc.rotd\fP and querying the position: .sp $ rotctl -m 101 -r localhost \\get_pos .sp Connect to a running \fBrotctld\fP with rotor model 2 ("NET rotctl") on the local host and specifying the TCP port on POSIX: .sp $ rotctl -m 2 -r localhost:4533 .sp and on Win32: .sp C:\\> rotctl -m 2 -r 127.0.0.1:4533 .SH DIAGNOSTICS The \fB-v\fP, \fB--version\fP option allows different levels of diagnostics to be output to \fBstderr\fP and correspond to -v for BUG, -vv for ERR, -vvv for WARN, -vvvv for VERBOSE, or -vvvvv for TRACE. .PP A given verbose level is useful for providing needed debugging information to the email address below. For example, TRACE output shows all of the values sent to and received from the radio which is very useful for radio backend library development and may be requested by the developers. .SH EXIT STATUS \fBrotctl\fP exits with: .br 0 if all operations completed normally; .br 1 if there was an invalid command line option or argument; .br 2 if an error was returned by \fBHamlib\fP. .SH BUGS .PP This suspiciously empty section... .SH REPORTING BUGS Report bugs to . .PP We are already aware of the bug in the previous section :-) .SH AUTHOR Written by Stephane Fillod, Nate Bargmann, and the Hamlib Group .PP . .SH COPYRIGHT Copyright \(co 2000-2010 Stephane Fillod .br Copyright \(co 2011-2012 Nate Bargmann .br Copyright \(co 2000-2010 the Hamlib Group .PP This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .SH SEE ALSO .BR hamlib (3), .BR rpc.rotd (8) .BR rotctld (8) hamlib-1.2.15.3/tests/listrigs.c0000644000175000017500000000417212044564477013305 00000000000000/* * listrigs.c - Copyright (C) 2000-2008 Stephane Fillod * This programs list all the available the rig capabilities. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include int print_caps_sum(const struct rig_caps *caps, void *data) { printf("%d\t%-10s\t%-12s\t%s\t",caps->rig_model,caps->mfg_name, caps->model_name, caps->version); printf("%-10s\t", rig_strstatus(caps->status)); switch (caps->rig_type & RIG_TYPE_MASK) { case RIG_TYPE_TRANSCEIVER: printf("Transceiver\n"); break; case RIG_TYPE_HANDHELD: printf("Handheld\n"); break; case RIG_TYPE_MOBILE: printf("Mobile\n"); break; case RIG_TYPE_RECEIVER: printf("Receiver\n"); break; case RIG_TYPE_PCRECEIVER: printf("PC Receiver\n"); break; case RIG_TYPE_SCANNER: printf("Scanner\n"); break; case RIG_TYPE_TRUNKSCANNER: printf("Trunking scanner\n"); break; case RIG_TYPE_COMPUTER: printf("Computer\n"); break; case RIG_TYPE_OTHER: printf("Other\n"); break; default: printf("Unknown\n"); } return -1; /* !=0, we want them all ! */ } int main (int argc, char *argv[]) { int status; rig_load_all_backends(); printf("Rig#\tMfg \tModel \tVers.\tStatus \tType\n"); status = rig_list_foreach(print_caps_sum,NULL); if (status != RIG_OK ) { printf("rig_list_foreach: error = %s \n", rigerror(status)); exit(3); } return 0; } hamlib-1.2.15.3/tests/rigmatrix.c0000644000175000017500000003757112044564477013464 00000000000000/* * rigmatrix.c - Copyright (C) 2000-2012 Stephane Fillod * This program generates the supported rig matrix in HTML format. * The code is rather ugly since this is only a try out. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include #include #include #include #include "misc.h" static setting_t bitmap_func, bitmap_level, bitmap_parm; int create_png_range(const freq_range_t rx_range_list[], const freq_range_t tx_range_list[], int num); int print_caps_sum(const struct rig_caps *caps, void *data) { printf("%s%s" "%s%s", caps->rig_model, caps->model_name,caps->mfg_name,caps->version, rig_strstatus(caps->status) ); switch (caps->rig_type & RIG_TYPE_MASK) { case RIG_TYPE_TRANSCEIVER: printf("Transceiver"); break; case RIG_TYPE_HANDHELD: printf("Handheld"); break; case RIG_TYPE_MOBILE: printf("Mobile"); break; case RIG_TYPE_RECEIVER: printf("Receiver"); break; case RIG_TYPE_PCRECEIVER: printf("PC Receiver"); break; case RIG_TYPE_SCANNER: printf("Scanner"); break; case RIG_TYPE_TRUNKSCANNER: printf("Trunking scanner"); break; case RIG_TYPE_COMPUTER: printf("Computer"); break; case RIG_TYPE_OTHER: printf("Other"); break; default: printf("Unknown"); } printf("range" "parms" "caps" "funcs" "funcs" "levels" "levels" "parms" "parms" "\n", caps->rig_model, caps->rig_model, caps->rig_model, caps->rig_model, caps->rig_model, caps->rig_model, caps->rig_model, caps->rig_model, caps->rig_model ); return 1; /* !=0, we want them all ! */ } /* * IO params et al. */ int print_caps_parameters(const struct rig_caps *caps, void *data) { printf("%s", caps->rig_model, caps->model_name); switch (caps->ptt_type) { case RIG_PTT_RIG: printf("rig"); break; case RIG_PTT_PARALLEL: printf("parallel"); break; case RIG_PTT_SERIAL_RTS: case RIG_PTT_SERIAL_DTR: printf("serial"); break; case RIG_PTT_NONE: printf("None"); break; default: printf("Unknown"); } printf(""); switch (caps->dcd_type) { case RIG_DCD_RIG: printf("rig"); break; case RIG_DCD_PARALLEL: printf("parallel"); break; case RIG_DCD_SERIAL_CTS: case RIG_DCD_SERIAL_DSR: printf("serial"); break; case RIG_DCD_NONE: printf("None"); break; default: printf("Unknown"); } printf(""); switch (caps->port_type) { case RIG_PORT_SERIAL: printf("serial"); break; case RIG_PORT_DEVICE: printf("device"); break; case RIG_PORT_NETWORK: printf("network"); break; case RIG_PORT_UDP_NETWORK: printf("UDP network"); break; case RIG_PORT_NONE: printf("None"); break; default: printf("Unknown"); } printf("%d%d%d%c%d%s", caps->serial_rate_min, caps->serial_rate_max, caps->serial_data_bits, caps->serial_parity==RIG_PARITY_NONE?'N': caps->serial_parity==RIG_PARITY_ODD?'O': caps->serial_parity==RIG_PARITY_EVEN?'E': caps->serial_parity==RIG_PARITY_MARK?'M':'S', caps->serial_stop_bits, caps->serial_handshake==RIG_HANDSHAKE_NONE?"none": (caps->serial_handshake==RIG_HANDSHAKE_XONXOFF?"XONXOFF":"CTS/RTS") ); printf("%dms%dms%dms%d\n", caps->write_delay, caps->post_write_delay, caps->timeout, caps->retry); return 1; } /* used by print_caps_caps and print_caps_level */ #define print_yn(fn) printf("%c", (fn) ? 'Y':'N') /* * backend functions definied * * TODO: add new API calls! */ int print_caps_caps(const struct rig_caps *caps, void *data) { printf("%s", caps->rig_model, caps->model_name); /* targetable_vfo is not a function, but a boolean */ print_yn(caps->targetable_vfo); print_yn(caps->set_freq); print_yn(caps->get_freq); print_yn(caps->set_mode); print_yn(caps->get_mode); print_yn(caps->set_vfo); print_yn(caps->get_vfo); print_yn(caps->set_ptt); print_yn(caps->get_ptt); print_yn(caps->get_dcd); print_yn(caps->set_rptr_shift); print_yn(caps->get_rptr_shift); print_yn(caps->set_rptr_offs); print_yn(caps->get_rptr_offs); print_yn(caps->set_split_freq); print_yn(caps->get_split_freq); print_yn(caps->set_split_vfo); print_yn(caps->get_split_vfo); print_yn(caps->set_ts); print_yn(caps->get_ts); print_yn(caps->set_ctcss_tone); print_yn(caps->get_ctcss_tone); print_yn(caps->set_dcs_code); print_yn(caps->get_dcs_code); print_yn(caps->set_powerstat); print_yn(caps->get_powerstat); print_yn(caps->set_trn); print_yn(caps->set_trn); print_yn(caps->decode_event); print_yn(caps->get_info); printf("\n"); return 1; } /* * Get/Set parm abilities */ int print_caps_parm(const struct rig_caps *caps, void *data) { setting_t parm; int i; if (!data) return 0; parm = (*(int*)data)? caps->has_set_parm : caps->has_get_parm; printf("%s", (*(int*)data)? "set":"get", caps->rig_model, caps->model_name); /* * bitmap_parm: only those who have a label */ for (i = 0; i < RIG_SETTING_MAX; i++) { if (rig_idx2setting(i) & bitmap_parm) print_yn(parm & rig_idx2setting(i)); } printf("\n"); return 1; } /* * Get/Set level abilities */ int print_caps_level(const struct rig_caps *caps, void *data) { setting_t level; int i; if (!data) return 0; level = (*(int*)data)? caps->has_set_level : caps->has_get_level; printf("%s", (*(int*)data)? "set":"get", caps->rig_model, caps->model_name); /* * bitmap_level: only those who have a label */ for (i = 0; i < 32; i++) { if (rig_idx2setting(i) & bitmap_level) print_yn(level & rig_idx2setting(i)); } printf("\n"); return 1; } /* * Get/Set func abilities */ int print_caps_func(const struct rig_caps *caps, void *data) { setting_t func; int i; if (!data) return 0; func = (*(int*)data)? caps->has_set_func : caps->has_get_func; printf("%s", (*(int*)data)? "set":"get", caps->rig_model, caps->model_name); /* * bitmap_func: only those who have a label */ for (i = 0; i < RIG_SETTING_MAX; i++) { if (rig_idx2setting(i) & bitmap_func) print_yn(func & rig_idx2setting(i)); } printf("\n"); return 1; } /* * inlined PNG graphics * * FIXME: default output pics is for region2: add region 1 too! */ int print_caps_range(const struct rig_caps *caps, void *data) { create_png_range(caps->rx_range_list2, caps->tx_range_list2, caps->rig_model); printf("%s" "", caps->rig_model, caps->model_name, caps->rig_model); return 1; } #define RANGE_WIDTH 600 #define RANGE_HEIGHT 16 #define RANGE_MIDHEIGHT (RANGE_HEIGHT/2) #define RX_R 0 #define RX_G 255 #define RX_B 255 #define TX_R 0 #define TX_G 0 #define TX_B 255 #define HF_H 10 #define VHF_H 30 #define UHF_H 50 #define IM_LGD 21 static void draw_range(const freq_range_t range_list[], gdImagePtr im_rng, int h1, int h2, int rgb) { int i; for (i=0; i= RANGE_WIDTH) end_pix = RANGE_WIDTH-1; start_pix += IM_LGD; end_pix += IM_LGD; gdImageFilledRectangle(im_rng, start_pix, HF_H+h1, end_pix, HF_H+h2, rgb); } /* * VHF */ start_pix = range_list[i].start; end_pix = range_list[i].end; if ((range_list[i].start > MHz(30) && range_list[i].start < MHz(300)) || (range_list[i].start < MHz(30) && range_list[i].end > MHz(30))) { start_pix = (start_pix-MHz(30)) / MHz(300) * RANGE_WIDTH; end_pix = (end_pix-MHz(30)) / MHz(300) * RANGE_WIDTH; if (start_pix < 0) start_pix = 0; if (end_pix >= RANGE_WIDTH) end_pix = RANGE_WIDTH-1; start_pix += IM_LGD; end_pix += IM_LGD; gdImageFilledRectangle(im_rng, start_pix, VHF_H+h1, end_pix, VHF_H+h2, rgb); } /* * UHF */ start_pix = range_list[i].start; end_pix = range_list[i].end; if ((range_list[i].start > MHz(300) && range_list[i].start < GHz(3)) || (range_list[i].start < MHz(300) && range_list[i].end > MHz(300))) { start_pix = (start_pix-MHz(300)) / GHz(3) * RANGE_WIDTH; end_pix = (end_pix-MHz(300)) / GHz(3) * RANGE_WIDTH; if (start_pix < 0) start_pix = 0; if (end_pix >= RANGE_WIDTH) end_pix = RANGE_WIDTH-1; start_pix += IM_LGD; end_pix += IM_LGD; gdImageFilledRectangle(im_rng, start_pix, UHF_H+h1, end_pix, UHF_H+h2, rgb); } } } int create_png_range(const freq_range_t rx_range_list[], const freq_range_t tx_range_list[], int num) { FILE *out; /* Input and output images */ gdImagePtr im_rng; char rng_fname[128]; /* Color indexes */ int white, black; int rx_rgb,tx_rgb; /* Create output image, x by y pixels. */ im_rng = gdImageCreate(RANGE_WIDTH+IM_LGD, UHF_H+RANGE_HEIGHT); /* First color allocated is background. */ white = gdImageColorAllocate(im_rng, 255, 255, 255); black = gdImageColorAllocate(im_rng, 0, 0, 0); #if 0 /* Set transparent color. */ gdImageColorTransparent(im_rng, white); #endif /* Try to load demoin.png and paste part of it into the output image. */ tx_rgb = gdImageColorAllocate(im_rng, TX_R, TX_G, TX_B); rx_rgb = gdImageColorAllocate(im_rng, RX_R, RX_G, RX_B); draw_range(rx_range_list, im_rng, 0, RANGE_MIDHEIGHT-1, rx_rgb); draw_range(tx_range_list, im_rng, RANGE_MIDHEIGHT, RANGE_HEIGHT-1, tx_rgb); gdImageRectangle(im_rng, IM_LGD, HF_H, IM_LGD+RANGE_WIDTH-1, HF_H+RANGE_HEIGHT-1, black); gdImageRectangle(im_rng, IM_LGD, VHF_H, IM_LGD+RANGE_WIDTH-1, VHF_H+RANGE_HEIGHT-1, black); gdImageRectangle(im_rng, IM_LGD, UHF_H, IM_LGD+RANGE_WIDTH-1, UHF_H+RANGE_HEIGHT-1, black); /* gdImageStringUp */ gdImageString(im_rng, gdFontSmall, 1, HF_H+1, (unsigned char *) "HF", black); gdImageString(im_rng, gdFontSmall, 1, VHF_H+1, (unsigned char *) "VHF", black); gdImageString(im_rng, gdFontSmall, 1, UHF_H+1, (unsigned char *) "UHF", black); /* Make output image interlaced (allows "fade in" in some viewers, and in the latest web browsers) */ gdImageInterlace(im_rng, 1); sprintf(rng_fname, "range%d.png", num); out = fopen(rng_fname, "wb"); /* Write PNG */ gdImagePng(im_rng, out); fclose(out); gdImageDestroy(im_rng); return 0; } int main (int argc, char *argv[]) { int status; time_t gentime; int set_or_get; int i; char *pbuf, prntbuf[512]; rig_load_all_backends(); printf(""); printf("" "" "" "" "" "" "" "" "" "\n"); status = rig_list_foreach(print_caps_sum,NULL); printf("
ModelMfgVers.StatusTypeFreq. rangeParametersCapabilitiesGet funcSet funcGet levelSet levelGet parmSet parm
\n"); printf("

"); printf("\n"); printf("" "" "" "\n"); status = rig_list_foreach(print_caps_parameters,NULL); printf("
ModelPTTDCDPortSpeed minSpeed maxParm.HandshakeWrite delayPost delayTimeoutRetry
\n"); printf("

"); printf("\n"); printf("\n"); status = rig_list_foreach(print_caps_range,NULL); printf("
ModelFreq. range
\n"); printf("

"); printf("\n"); printf("" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "\n"); status = rig_list_foreach(print_caps_caps,NULL); printf("
ModelTarget VFOSet freqGet freqSet modeGet modeSet VFOGet VFOSet PTTGet PTTGet DCDSet rptr shiftGet rptr shiftSet rptr offsGet rptr offsSet split frqGet split frqSet splitGet splitSet tsGet tsSet CTCSSGet CTCSSSet DCSGet DCSSet Power StatGet Power StatSet trnGet trnDecodeGet info
\n"); printf("

"); bitmap_func = 0; prntbuf[0] = '\0'; pbuf = prntbuf; for (i = 0; i < RIG_SETTING_MAX; i++) { setting_t func = rig_idx2setting(i); const char *s = rig_strfunc(func); if (!s) continue; bitmap_func |= func; pbuf += sprintf(pbuf, "%s", s); } printf("Has set func"); printf("\n"); printf("%s\n", prntbuf); set_or_get = 1; status = rig_list_foreach(print_caps_func,&set_or_get); printf("
Model
\n"); printf("

"); printf("Has get func"); printf("\n"); printf("%s\n", prntbuf); set_or_get = 0; status = rig_list_foreach(print_caps_func,&set_or_get); printf("
Model
\n"); printf("

"); bitmap_level = 0; prntbuf[0] = '\0'; pbuf = prntbuf; for (i = 0; i < RIG_SETTING_MAX; i++) { setting_t level = rig_idx2setting(i); const char *s = rig_strlevel(level); if (!s) continue; bitmap_level |= level; pbuf += sprintf(pbuf, "%s", s); } printf("Set level"); printf("\n"); printf("%s\n", prntbuf); set_or_get = 1; status = rig_list_foreach(print_caps_level,&set_or_get); printf("
Model
\n"); printf("

"); printf("Get level"); printf("\n"); printf("%s\n", prntbuf); set_or_get = 0; status = rig_list_foreach(print_caps_level,&set_or_get); printf("
Model
\n"); printf("

"); bitmap_parm = 0; prntbuf[0] = '\0'; pbuf = prntbuf; for (i = 0; i < RIG_SETTING_MAX; i++) { setting_t parm = rig_idx2setting(i); const char *s = rig_strparm(parm); if (!s) continue; bitmap_parm |= parm; pbuf += sprintf(pbuf, "%s", s); } printf("Set parm"); printf("\n"); printf("%s\n", prntbuf); set_or_get = 1; status = rig_list_foreach(print_caps_parm,&set_or_get); printf("
Model
\n"); printf("

"); printf("Get parm"); printf("\n"); printf("%s\n", prntbuf); set_or_get = 0; status = rig_list_foreach(print_caps_parm,&set_or_get); printf("
Model
\n"); printf("

"); time(&gentime); printf("Rigmatrix generated %s by %s\n",ctime(&gentime), getenv("USER")); printf("\n"); return 0; } hamlib-1.2.15.3/tests/testfreq.c0000644000175000017500000000256212044564477013303 00000000000000 /* * Very simple test program to check freq convertion --SF * This is mainly to test kHz, MHz, GHz macros and int64_t support. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "misc.h" int main (int argc, char *argv[]) { freq_t f=0; #if 0 if (argc != 2) { fprintf(stderr,"Usage: %s \n",argv[0]); exit(1); } f = atoi(argv[1]); #endif printf("%s\n", hamlib_version); printf("caps size: %d\n", sizeof(struct rig_caps)); printf("state size: %d\n", sizeof(struct rig_state)); printf("RIG size: %d\n", sizeof(struct rig)); printf("freq_t size: %d\n", sizeof(freq_t)); printf("shortfreq_t size: %d\n", sizeof(shortfreq_t)); /* freq on 31bits test */ f = GHz(2); printf("GHz(2) = %"PRIll"\n", (int64_t)f); /* freq on 32bits test */ f = GHz(4); printf("GHz(4) = %"PRIll"\n", (int64_t)f); /* freq on >32bits test */ f = GHz(5); printf("GHz(5) = %"PRIll"\n", (int64_t)f); /* floating point to freq conversion test */ f = GHz(1.3); printf("GHz(1.3) = %"PRIll"\n", (int64_t)f); /* floating point to freq conversion precision test */ f = GHz(1.234567890); printf("GHz(1.234567890) = %"PRIll"\n", (int64_t)f); /* floating point to freq conversion precision test, with freq >32bits */ f = GHz(123.456789012); printf("GHz(123.456789012) = %"PRIll"\n", (int64_t)f); return 0; } hamlib-1.2.15.3/tests/Makefile.in0000644000175000017500000014061212044564557013345 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ # Current Autotools documentation suggests that DejaGNU is obsolete # and replaced by Autotest. TODO: implement Autotest # AUTOMAKE_OPTIONS = dejagnu # DEJATOOL = testfreq testbcd testloc rigctl VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = rigctl$(EXEEXT) rigmem$(EXEEXT) rigswr$(EXEEXT) \ rigsmtr$(EXEEXT) rotctl$(EXEEXT) rigctld$(EXEEXT) \ rotctld$(EXEEXT) check_PROGRAMS = dumpmem$(EXEEXT) testrig$(EXEEXT) testtrn$(EXEEXT) \ testbcd$(EXEEXT) testfreq$(EXEEXT) listrigs$(EXEEXT) \ testloc$(EXEEXT) rig_bench$(EXEEXT) @RIGMATRIX@ EXTRA_PROGRAMS = rigmatrix$(EXEEXT) rigctld$(EXEEXT) rotctld$(EXEEXT) subdir = tests DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ "$(DESTDIR)$(man8dir)" PROGRAMS = $(bin_PROGRAMS) dumpmem_SOURCES = dumpmem.c dumpmem_OBJECTS = dumpmem.$(OBJEXT) dumpmem_LDADD = $(LDADD) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent dumpmem_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(dumpmem_LDFLAGS) $(LDFLAGS) -o $@ listrigs_SOURCES = listrigs.c listrigs_OBJECTS = listrigs.$(OBJEXT) listrigs_LDADD = $(LDADD) listrigs_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(listrigs_LDFLAGS) $(LDFLAGS) -o $@ rig_bench_SOURCES = rig_bench.c rig_bench_OBJECTS = rig_bench.$(OBJEXT) rig_bench_LDADD = $(LDADD) rig_bench_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(rig_bench_LDFLAGS) $(LDFLAGS) -o $@ am_rigctl_OBJECTS = rigctl.$(OBJEXT) rigctl_parse.$(OBJEXT) \ dumpcaps.$(OBJEXT) sprintflst.$(OBJEXT) rigctl_OBJECTS = $(am_rigctl_OBJECTS) rigctl_LDADD = $(LDADD) rigctl_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(rigctl_LDFLAGS) $(LDFLAGS) -o $@ am_rigctld_OBJECTS = rigctld.$(OBJEXT) rigctl_parse.$(OBJEXT) \ dumpcaps.$(OBJEXT) sprintflst.$(OBJEXT) rigctld_OBJECTS = $(am_rigctld_OBJECTS) rigctld_LDADD = $(LDADD) rigctld_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(rigctld_LDFLAGS) $(LDFLAGS) -o $@ rigmatrix_SOURCES = rigmatrix.c rigmatrix_OBJECTS = rigmatrix.$(OBJEXT) rigmatrix_LDADD = $(LDADD) rigmatrix_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(rigmatrix_LDFLAGS) $(LDFLAGS) -o $@ am_rigmem_OBJECTS = rigmem-rigmem.$(OBJEXT) rigmem-memsave.$(OBJEXT) \ rigmem-memload.$(OBJEXT) rigmem-memcsv.$(OBJEXT) \ rigmem-sprintflst.$(OBJEXT) rigmem_OBJECTS = $(am_rigmem_OBJECTS) rigmem_LDADD = $(LDADD) rigmem_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(rigmem_CFLAGS) $(CFLAGS) \ $(rigmem_LDFLAGS) $(LDFLAGS) -o $@ am_rigsmtr_OBJECTS = rigsmtr.$(OBJEXT) rigsmtr_OBJECTS = $(am_rigsmtr_OBJECTS) rigsmtr_LDADD = $(LDADD) rigsmtr_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(rigsmtr_LDFLAGS) $(LDFLAGS) -o $@ am_rigswr_OBJECTS = rigswr.$(OBJEXT) rigswr_OBJECTS = $(am_rigswr_OBJECTS) rigswr_LDADD = $(LDADD) rigswr_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(rigswr_LDFLAGS) $(LDFLAGS) -o $@ am_rotctl_OBJECTS = rotctl.$(OBJEXT) rotctl_parse.$(OBJEXT) \ dumpcaps_rot.$(OBJEXT) rotctl_OBJECTS = $(am_rotctl_OBJECTS) rotctl_LDADD = $(LDADD) rotctl_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(rotctl_LDFLAGS) $(LDFLAGS) -o $@ am_rotctld_OBJECTS = rotctld.$(OBJEXT) rotctl_parse.$(OBJEXT) \ dumpcaps_rot.$(OBJEXT) rotctld_OBJECTS = $(am_rotctld_OBJECTS) rotctld_LDADD = $(LDADD) rotctld_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(rotctld_LDFLAGS) $(LDFLAGS) -o $@ testbcd_SOURCES = testbcd.c testbcd_OBJECTS = testbcd.$(OBJEXT) testbcd_LDADD = $(LDADD) testbcd_DEPENDENCIES = $(top_builddir)/src/libhamlib.la \ $(top_builddir)/lib/libmisc.la testbcd_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(testbcd_LDFLAGS) $(LDFLAGS) -o $@ testfreq_SOURCES = testfreq.c testfreq_OBJECTS = testfreq.$(OBJEXT) testfreq_LDADD = $(LDADD) testfreq_DEPENDENCIES = $(top_builddir)/src/libhamlib.la \ $(top_builddir)/lib/libmisc.la testloc_SOURCES = testloc.c testloc_OBJECTS = testloc.$(OBJEXT) testloc_LDADD = $(LDADD) testloc_DEPENDENCIES = $(top_builddir)/src/libhamlib.la \ $(top_builddir)/lib/libmisc.la testloc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(testloc_LDFLAGS) $(LDFLAGS) -o $@ testrig_SOURCES = testrig.c testrig_OBJECTS = testrig.$(OBJEXT) testrig_LDADD = $(LDADD) testrig_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(testrig_LDFLAGS) $(LDFLAGS) -o $@ testtrn_SOURCES = testtrn.c testtrn_OBJECTS = testtrn.$(OBJEXT) testtrn_LDADD = $(LDADD) testtrn_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(testtrn_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = dumpmem.c listrigs.c rig_bench.c $(rigctl_SOURCES) \ $(rigctld_SOURCES) rigmatrix.c $(rigmem_SOURCES) \ $(rigsmtr_SOURCES) $(rigswr_SOURCES) $(rotctl_SOURCES) \ $(rotctld_SOURCES) testbcd.c testfreq.c testloc.c testrig.c \ testtrn.c DIST_SOURCES = dumpmem.c listrigs.c rig_bench.c $(rigctl_SOURCES) \ $(rigctld_SOURCES) rigmatrix.c $(rigmem_SOURCES) \ $(rigsmtr_SOURCES) $(rigswr_SOURCES) $(rotctl_SOURCES) \ $(rotctld_SOURCES) testbcd.c testfreq.c testloc.c testrig.c \ testtrn.c am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' man1dir = $(mandir)/man1 man8dir = $(mandir)/man8 NROFF = nroff MANS = $(man_MANS) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DISTCLEANFILES = rigctl.log rigctl.sum testbcd.log testbcd.sum man_MANS = rigctl.1 rigmem.1 rigswr.1 rigsmtr.1 rotctl.1 rigctld.8 rotctld.8 rigctl_SOURCES = rigctl.c rigctl_parse.c dumpcaps.c sprintflst.c rigctld_SOURCES = rigctld.c rigctl_parse.c dumpcaps.c sprintflst.c rotctl_SOURCES = rotctl.c rotctl_parse.c dumpcaps_rot.c rotctld_SOURCES = rotctld.c rotctl_parse.c dumpcaps_rot.c rigswr_SOURCES = rigswr.c rigsmtr_SOURCES = rigsmtr.c rigmem_SOURCES = rigmem.c memsave.c memload.c memcsv.c sprintflst.c noinst_HEADERS = sprintflst.h rigctl_parse.h rotctl_parse.h uthash.h # all the programs need this LDADD = $(top_builddir)/src/libhamlib.la $(top_builddir)/lib/libmisc.la DEPENDENCIES = $(top_builddir)/src/libhamlib.la rigmem_CFLAGS = $(AM_CFLAGS) @LIBXML2_CFLAGS@ listrigs_LDFLAGS = @BACKENDLNK@ dumpmem_LDFLAGS = @BACKENDLNK@ testrig_LDFLAGS = @BACKENDLNK@ rig_bench_LDFLAGS = $(top_builddir)/lib/libmisc.la @BACKENDLNK@ testtrn_LDFLAGS = @BACKENDLNK@ rigctl_LDFLAGS = @BACKENDLNK@ @WINEXELDFLAGS@ rigswr_LDFLAGS = @BACKENDLNK@ @WINEXELDFLAGS@ rigsmtr_LDFLAGS = @BACKENDLNK@ @WINEXELDFLAGS@ rigmem_LDFLAGS = @BACKENDLNK@ @LIBXML2_LIBS@ @WINEXELDFLAGS@ rotctl_LDFLAGS = @ROT_BACKENDLNK@ @WINEXELDFLAGS@ rigctld_LDFLAGS = @BACKENDLNK@ @PTHREAD_LIBS@ @NET_LIBS@ @WINEXELDFLAGS@ rotctld_LDFLAGS = @ROT_BACKENDLNK@ @PTHREAD_LIBS@ @NET_LIBS@ @WINEXELDFLAGS@ # temporary hack testbcd_LDFLAGS = -dlpreopen self testloc_LDFLAGS = -dlpreopen self # rigmatrix needs also libgd rigmatrix_LDFLAGS = -lgd -lz @BACKENDLNK@ dumpmem_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ testrig_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rig_bench_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ testtrn_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ listrigs_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rigctl_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rigmem_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rigswr_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rigsmtr_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rotctl_DEPENDENCIES = $(DEPENDENCIES) @ROT_BACKENDEPS@ rigmatrix_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rigctld_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rotctld_DEPENDENCIES = $(DEPENDENCIES) @ROT_BACKENDEPS@ EXTRA_DIST = rigmatrix_head.html rig_split_lst.awk $(man_MANS) testctld.pl testrotctld.pl # Support 'make check' target for simple tests check_SCRIPTS = testrig.sh testfreq.sh testbcd.sh testloc.sh TESTS = $(check_SCRIPTS) CLEANFILES = testrig.sh testfreq.sh testbcd.sh testloc.sh all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list dumpmem$(EXEEXT): $(dumpmem_OBJECTS) $(dumpmem_DEPENDENCIES) @rm -f dumpmem$(EXEEXT) $(AM_V_CCLD)$(dumpmem_LINK) $(dumpmem_OBJECTS) $(dumpmem_LDADD) $(LIBS) listrigs$(EXEEXT): $(listrigs_OBJECTS) $(listrigs_DEPENDENCIES) @rm -f listrigs$(EXEEXT) $(AM_V_CCLD)$(listrigs_LINK) $(listrigs_OBJECTS) $(listrigs_LDADD) $(LIBS) rig_bench$(EXEEXT): $(rig_bench_OBJECTS) $(rig_bench_DEPENDENCIES) @rm -f rig_bench$(EXEEXT) $(AM_V_CCLD)$(rig_bench_LINK) $(rig_bench_OBJECTS) $(rig_bench_LDADD) $(LIBS) rigctl$(EXEEXT): $(rigctl_OBJECTS) $(rigctl_DEPENDENCIES) @rm -f rigctl$(EXEEXT) $(AM_V_CCLD)$(rigctl_LINK) $(rigctl_OBJECTS) $(rigctl_LDADD) $(LIBS) rigctld$(EXEEXT): $(rigctld_OBJECTS) $(rigctld_DEPENDENCIES) @rm -f rigctld$(EXEEXT) $(AM_V_CCLD)$(rigctld_LINK) $(rigctld_OBJECTS) $(rigctld_LDADD) $(LIBS) rigmatrix$(EXEEXT): $(rigmatrix_OBJECTS) $(rigmatrix_DEPENDENCIES) @rm -f rigmatrix$(EXEEXT) $(AM_V_CCLD)$(rigmatrix_LINK) $(rigmatrix_OBJECTS) $(rigmatrix_LDADD) $(LIBS) rigmem$(EXEEXT): $(rigmem_OBJECTS) $(rigmem_DEPENDENCIES) @rm -f rigmem$(EXEEXT) $(AM_V_CCLD)$(rigmem_LINK) $(rigmem_OBJECTS) $(rigmem_LDADD) $(LIBS) rigsmtr$(EXEEXT): $(rigsmtr_OBJECTS) $(rigsmtr_DEPENDENCIES) @rm -f rigsmtr$(EXEEXT) $(AM_V_CCLD)$(rigsmtr_LINK) $(rigsmtr_OBJECTS) $(rigsmtr_LDADD) $(LIBS) rigswr$(EXEEXT): $(rigswr_OBJECTS) $(rigswr_DEPENDENCIES) @rm -f rigswr$(EXEEXT) $(AM_V_CCLD)$(rigswr_LINK) $(rigswr_OBJECTS) $(rigswr_LDADD) $(LIBS) rotctl$(EXEEXT): $(rotctl_OBJECTS) $(rotctl_DEPENDENCIES) @rm -f rotctl$(EXEEXT) $(AM_V_CCLD)$(rotctl_LINK) $(rotctl_OBJECTS) $(rotctl_LDADD) $(LIBS) rotctld$(EXEEXT): $(rotctld_OBJECTS) $(rotctld_DEPENDENCIES) @rm -f rotctld$(EXEEXT) $(AM_V_CCLD)$(rotctld_LINK) $(rotctld_OBJECTS) $(rotctld_LDADD) $(LIBS) testbcd$(EXEEXT): $(testbcd_OBJECTS) $(testbcd_DEPENDENCIES) @rm -f testbcd$(EXEEXT) $(AM_V_CCLD)$(testbcd_LINK) $(testbcd_OBJECTS) $(testbcd_LDADD) $(LIBS) testfreq$(EXEEXT): $(testfreq_OBJECTS) $(testfreq_DEPENDENCIES) @rm -f testfreq$(EXEEXT) $(AM_V_CCLD)$(LINK) $(testfreq_OBJECTS) $(testfreq_LDADD) $(LIBS) testloc$(EXEEXT): $(testloc_OBJECTS) $(testloc_DEPENDENCIES) @rm -f testloc$(EXEEXT) $(AM_V_CCLD)$(testloc_LINK) $(testloc_OBJECTS) $(testloc_LDADD) $(LIBS) testrig$(EXEEXT): $(testrig_OBJECTS) $(testrig_DEPENDENCIES) @rm -f testrig$(EXEEXT) $(AM_V_CCLD)$(testrig_LINK) $(testrig_OBJECTS) $(testrig_LDADD) $(LIBS) testtrn$(EXEEXT): $(testtrn_OBJECTS) $(testtrn_DEPENDENCIES) @rm -f testtrn$(EXEEXT) $(AM_V_CCLD)$(testtrn_LINK) $(testtrn_OBJECTS) $(testtrn_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumpcaps.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumpcaps_rot.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumpmem.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listrigs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rig_bench.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rigctl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rigctl_parse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rigctld.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rigmatrix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rigmem-memcsv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rigmem-memload.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rigmem-memsave.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rigmem-rigmem.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rigmem-sprintflst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rigsmtr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rigswr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rotctl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rotctl_parse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rotctld.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sprintflst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testbcd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testfreq.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testrig.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testtrn.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< rigmem-rigmem.o: rigmem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -MT rigmem-rigmem.o -MD -MP -MF $(DEPDIR)/rigmem-rigmem.Tpo -c -o rigmem-rigmem.o `test -f 'rigmem.c' || echo '$(srcdir)/'`rigmem.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rigmem-rigmem.Tpo $(DEPDIR)/rigmem-rigmem.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rigmem.c' object='rigmem-rigmem.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -c -o rigmem-rigmem.o `test -f 'rigmem.c' || echo '$(srcdir)/'`rigmem.c rigmem-rigmem.obj: rigmem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -MT rigmem-rigmem.obj -MD -MP -MF $(DEPDIR)/rigmem-rigmem.Tpo -c -o rigmem-rigmem.obj `if test -f 'rigmem.c'; then $(CYGPATH_W) 'rigmem.c'; else $(CYGPATH_W) '$(srcdir)/rigmem.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rigmem-rigmem.Tpo $(DEPDIR)/rigmem-rigmem.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rigmem.c' object='rigmem-rigmem.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -c -o rigmem-rigmem.obj `if test -f 'rigmem.c'; then $(CYGPATH_W) 'rigmem.c'; else $(CYGPATH_W) '$(srcdir)/rigmem.c'; fi` rigmem-memsave.o: memsave.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -MT rigmem-memsave.o -MD -MP -MF $(DEPDIR)/rigmem-memsave.Tpo -c -o rigmem-memsave.o `test -f 'memsave.c' || echo '$(srcdir)/'`memsave.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rigmem-memsave.Tpo $(DEPDIR)/rigmem-memsave.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='memsave.c' object='rigmem-memsave.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -c -o rigmem-memsave.o `test -f 'memsave.c' || echo '$(srcdir)/'`memsave.c rigmem-memsave.obj: memsave.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -MT rigmem-memsave.obj -MD -MP -MF $(DEPDIR)/rigmem-memsave.Tpo -c -o rigmem-memsave.obj `if test -f 'memsave.c'; then $(CYGPATH_W) 'memsave.c'; else $(CYGPATH_W) '$(srcdir)/memsave.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rigmem-memsave.Tpo $(DEPDIR)/rigmem-memsave.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='memsave.c' object='rigmem-memsave.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -c -o rigmem-memsave.obj `if test -f 'memsave.c'; then $(CYGPATH_W) 'memsave.c'; else $(CYGPATH_W) '$(srcdir)/memsave.c'; fi` rigmem-memload.o: memload.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -MT rigmem-memload.o -MD -MP -MF $(DEPDIR)/rigmem-memload.Tpo -c -o rigmem-memload.o `test -f 'memload.c' || echo '$(srcdir)/'`memload.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rigmem-memload.Tpo $(DEPDIR)/rigmem-memload.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='memload.c' object='rigmem-memload.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -c -o rigmem-memload.o `test -f 'memload.c' || echo '$(srcdir)/'`memload.c rigmem-memload.obj: memload.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -MT rigmem-memload.obj -MD -MP -MF $(DEPDIR)/rigmem-memload.Tpo -c -o rigmem-memload.obj `if test -f 'memload.c'; then $(CYGPATH_W) 'memload.c'; else $(CYGPATH_W) '$(srcdir)/memload.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rigmem-memload.Tpo $(DEPDIR)/rigmem-memload.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='memload.c' object='rigmem-memload.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -c -o rigmem-memload.obj `if test -f 'memload.c'; then $(CYGPATH_W) 'memload.c'; else $(CYGPATH_W) '$(srcdir)/memload.c'; fi` rigmem-memcsv.o: memcsv.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -MT rigmem-memcsv.o -MD -MP -MF $(DEPDIR)/rigmem-memcsv.Tpo -c -o rigmem-memcsv.o `test -f 'memcsv.c' || echo '$(srcdir)/'`memcsv.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rigmem-memcsv.Tpo $(DEPDIR)/rigmem-memcsv.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='memcsv.c' object='rigmem-memcsv.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -c -o rigmem-memcsv.o `test -f 'memcsv.c' || echo '$(srcdir)/'`memcsv.c rigmem-memcsv.obj: memcsv.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -MT rigmem-memcsv.obj -MD -MP -MF $(DEPDIR)/rigmem-memcsv.Tpo -c -o rigmem-memcsv.obj `if test -f 'memcsv.c'; then $(CYGPATH_W) 'memcsv.c'; else $(CYGPATH_W) '$(srcdir)/memcsv.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rigmem-memcsv.Tpo $(DEPDIR)/rigmem-memcsv.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='memcsv.c' object='rigmem-memcsv.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -c -o rigmem-memcsv.obj `if test -f 'memcsv.c'; then $(CYGPATH_W) 'memcsv.c'; else $(CYGPATH_W) '$(srcdir)/memcsv.c'; fi` rigmem-sprintflst.o: sprintflst.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -MT rigmem-sprintflst.o -MD -MP -MF $(DEPDIR)/rigmem-sprintflst.Tpo -c -o rigmem-sprintflst.o `test -f 'sprintflst.c' || echo '$(srcdir)/'`sprintflst.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rigmem-sprintflst.Tpo $(DEPDIR)/rigmem-sprintflst.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sprintflst.c' object='rigmem-sprintflst.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -c -o rigmem-sprintflst.o `test -f 'sprintflst.c' || echo '$(srcdir)/'`sprintflst.c rigmem-sprintflst.obj: sprintflst.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -MT rigmem-sprintflst.obj -MD -MP -MF $(DEPDIR)/rigmem-sprintflst.Tpo -c -o rigmem-sprintflst.obj `if test -f 'sprintflst.c'; then $(CYGPATH_W) 'sprintflst.c'; else $(CYGPATH_W) '$(srcdir)/sprintflst.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rigmem-sprintflst.Tpo $(DEPDIR)/rigmem-sprintflst.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sprintflst.c' object='rigmem-sprintflst.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rigmem_CFLAGS) $(CFLAGS) -c -o rigmem-sprintflst.obj `if test -f 'sprintflst.c'; then $(CYGPATH_W) 'sprintflst.c'; else $(CYGPATH_W) '$(srcdir)/sprintflst.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man1: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list=''; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } install-man8: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)" @list=''; test -n "$(man8dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ done; } uninstall-man8: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man8dir)" && rm -f $$files; } ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man8dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-man8 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-man uninstall-man: uninstall-man1 uninstall-man8 .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-binPROGRAMS clean-checkPROGRAMS clean-generic \ clean-libtool ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man1 install-man8 install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-man uninstall-man1 uninstall-man8 rigmatrix.html: rigmatrix_head.html rigmatrix listrigs mkdir -p sup-info/support ( cat $(srcdir)/rigmatrix_head.html && cd sup-info && ../rigmatrix ) > sup-info/rigmatrix.html for f in `./listrigs | tail -n +2 | cut -f1` ; do ( ./rigctl -m $$f -u > sup-info/support/model$$f.txt || exit 0 ) ; done ./rigctl -l |sort -n | $(srcdir)/rig_split_lst.awk -v lst_dir="sup-info" testrig.sh: echo './testrig 1' > testrig.sh chmod +x ./testrig.sh testfreq.sh: echo './testfreq' > testfreq.sh chmod +x ./testfreq.sh testbcd.sh: echo './testbcd 146520000 10' > testbcd.sh chmod +x ./testbcd.sh testloc.sh: echo './testloc EM79UT96LW 5' > testloc.sh chmod +x ./testloc.sh # 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: hamlib-1.2.15.3/tests/rigmatrix_head.html0000644000175000017500000000022012044564477015144 00000000000000 Hamlib rig matrix

hamlib-1.2.15.3/tests/dumpcaps_rot.c0000644000175000017500000001144512044564477014146 00000000000000/* * dumpcaps_rot.c - Copyright (C) 2000-2012 Stephane Fillod * This programs dumps the capabilities of a backend rig. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "misc.h" #include "sprintflst.h" #include "rotctl_parse.h" /* * the rot may be in rot_init state, but not openned */ int dumpcaps_rot (ROT* rot, FILE *fout) { const struct rot_caps *caps; int backend_warnings = 0; if (!rot || !rot->caps) return -RIG_EINVAL; caps = rot->caps; fprintf(fout, "Caps dump for model:\t%d\n", caps->rot_model); fprintf(fout, "Model name:\t\t%s\n", caps->model_name); fprintf(fout, "Mfg name:\t\t%s\n", caps->mfg_name); fprintf(fout, "Backend version:\t%s\n", caps->version); fprintf(fout, "Backend copyright:\t%s\n", caps->copyright); fprintf(fout, "Backend status:\t\t%s\n", rig_strstatus(caps->status)); fprintf(fout, "Rot type:\t\t"); switch (caps->rot_type & ROT_TYPE_MASK) { case ROT_TYPE_OTHER: fprintf(fout, "Other\n"); break; case ROT_TYPE_AZIMUTH: fprintf(fout, "Azimuth\n"); break; case ROT_TYPE_ELEVATION: fprintf(fout, "Elevation\n"); break; case ROT_TYPE_AZEL: fprintf(fout, "Az-El\n"); break; default: fprintf(fout, "Unknown\n"); backend_warnings++; } fprintf(fout, "Port type:\t\t"); switch (caps->port_type) { case RIG_PORT_SERIAL: fprintf(fout, "RS-232\n"); fprintf(fout, "Serial speed:\t\t%d..%d bauds, %d%c%d%s\n", caps->serial_rate_min, caps->serial_rate_max, caps->serial_data_bits, caps->serial_parity == RIG_PARITY_NONE ? 'N': caps->serial_parity == RIG_PARITY_ODD ? 'O' : caps->serial_parity == RIG_PARITY_EVEN ? 'E' : caps->serial_parity == RIG_PARITY_MARK ? 'M' : 'S', caps->serial_stop_bits, caps->serial_handshake == RIG_HANDSHAKE_NONE ? "" : (caps->serial_handshake == RIG_HANDSHAKE_XONXOFF ? " XONXOFF" : " CTS/RTS") ); break; case RIG_PORT_PARALLEL: fprintf(fout, "Parallel\n"); break; case RIG_PORT_DEVICE: fprintf(fout, "Device driver\n"); break; case RIG_PORT_USB: fprintf(fout, "USB\n"); break; case RIG_PORT_NETWORK: fprintf(fout, "Network link\n"); break; case RIG_PORT_UDP_NETWORK: fprintf(fout, "UDP Network link\n"); break; case RIG_PORT_NONE: fprintf(fout, "None\n"); break; default: fprintf(fout, "Unknown\n"); backend_warnings++; } fprintf(fout, "Write delay:\t\t%dmS, timeout %dmS, %d retr%s\n", caps->write_delay, caps->timeout, caps->retry, (caps->retry == 1) ? "y" : "ies"); fprintf(fout, "Post Write delay:\t%dmS\n", caps->post_write_delay); fprintf(fout, "Min Azimuth:\t\t%.2f\n", caps->min_az); fprintf(fout, "Max Azimuth:\t\t%.2f\n", caps->max_az); fprintf(fout, "Min Elevation:\t\t%.2f\n", caps->min_el); fprintf(fout, "Max Elevation:\t\t%.2f\n", caps->max_el); fprintf(fout, "Has priv data:\t\t%c\n", caps->priv != NULL ? 'Y' : 'N'); /* * Status is either 'Y'es, 'E'mulated, 'N'o * * TODO: keep me up-to-date with API call list! */ fprintf(fout, "Has Init:\t\t%c\n", caps->rot_init != NULL ? 'Y' : 'N'); fprintf(fout, "Has Cleanup:\t\t%c\n", caps->rot_cleanup != NULL ? 'Y' : 'N'); fprintf(fout, "Has Open:\t\t%c\n", caps->rot_open != NULL ? 'Y' : 'N'); fprintf(fout, "Has Close:\t\t%c\n", caps->rot_close != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Conf:\t\t%c\n", caps->set_conf != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Conf:\t\t%c\n", caps->get_conf != NULL ? 'Y' : 'N'); fprintf(fout, "Can set Position:\t%c\n", caps->set_position != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Position:\t%c\n", caps->get_position != NULL ? 'Y' : 'N'); fprintf(fout, "Can Stop:\t\t%c\n", caps->stop != NULL ? 'Y' : 'N'); fprintf(fout, "Can Park:\t\t%c\n", caps->park != NULL ? 'Y' : 'N'); fprintf(fout, "Can Reset:\t\t%c\n", caps->reset != NULL ? 'Y' : 'N'); fprintf(fout, "Can Move:\t\t%c\n", caps->move != NULL ? 'Y' : 'N'); fprintf(fout, "Can get Info:\t\t%c\n", caps->get_info != NULL ? 'Y' : 'N'); fprintf(fout, "\nOverall backend warnings: %d\n", backend_warnings); return backend_warnings; } hamlib-1.2.15.3/tests/dumpmem.c0000644000175000017500000001667412044564477013123 00000000000000/* * dumpmem.c - Copyright (C) 2001 Stephane Fillod * This programs dumps the mmeory contents of a rig. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #include #include #include #include #include "misc.h" #define SERIAL_PORT "/dev/ttyS0" static char *decode_modes(rmode_t modes); static int dump_chan(RIG *rig, int chan_num); int main (int argc, char *argv[]) { RIG *my_rig; int status,i,j; if (argc != 2) { fprintf(stderr,"%s \n",argv[0]); exit(1); } my_rig = rig_init(atoi(argv[1])); if (!my_rig) { fprintf(stderr,"Unknown rig num: %d\n",atoi(argv[1])); fprintf(stderr,"Please check riglist.h\n"); exit(1); /* whoops! something went wrong (mem alloc?) */ } strncpy(my_rig->state.rigport.pathname, SERIAL_PORT, FILPATHLEN - 1); if (rig_open(my_rig)) exit(2); status = rig_set_vfo(my_rig, RIG_VFO_B); if (status != RIG_OK ) { printf("rig_set_vfo: error = %s \n", rigerror(status)); } /* * chan_t is used to describe what memory your rig is equipped with * cf. chan_list field in caps * Example for the Ic706MkIIG (99 memory channels, 2 scan edges, 2 call chans): * chan_t chan_list[] = { * { 1, 99, RIG_MTYPE_MEM, 0 }, * { 100, 103, RIG_MTYPE_EDGE, 0 }, * { 104, 105, RIG_MTYPE_CALL, 0 }, * RIG_CHAN_END * } */ for (i=0; my_rig->state.chan_list[i].type && i < CHANLSTSIZ; i++) { for (j = my_rig->state.chan_list[i].start; j <= my_rig->state.chan_list[i].end; j++) { dump_chan(my_rig, j); } } rig_close(my_rig); /* close port */ rig_cleanup(my_rig); /* if you care about memory */ printf("port %s closed ok \n",SERIAL_PORT); return 0; } /* * NB: this function is not reentrant, because of the static buf. * but who cares? --SF */ static char *decode_modes(rmode_t modes) { static char buf[80]; buf[0] = '\0'; if (modes&RIG_MODE_AM) strcat(buf,"AM "); if (modes&RIG_MODE_CW) strcat(buf,"CW "); if (modes&RIG_MODE_USB) strcat(buf,"USB "); if (modes&RIG_MODE_LSB) strcat(buf,"LSB "); if (modes&RIG_MODE_RTTY) strcat(buf,"RTTY "); if (modes&RIG_MODE_FM) strcat(buf,"FM "); #ifdef RIG_MODE_WFM if (modes&RIG_MODE_WFM) strcat(buf,"WFM "); #endif return buf; } int dump_chan(RIG *rig, int chan_num) { channel_t chan; int status; char freqbuf[20]; chan.vfo = RIG_VFO_MEM; chan.channel_num = chan_num; status=rig_get_channel(rig, &chan); if (status != RIG_OK ) { printf("rig_get_channel: error = %s \n", rigerror(status)); return status; } printf("Channel: %d\n", chan.channel_num); sprintf_freq(freqbuf,chan.freq); printf("Frequency: %s\n", freqbuf); printf("Mode: %s\n", decode_modes(chan.mode)); sprintf_freq(freqbuf,chan.width); printf("Width: %s\n", freqbuf); printf("VFO: %d\n", chan.vfo); printf("Split: %d\n", chan.split); sprintf_freq(freqbuf,chan.tx_freq); printf("TXFrequency: %s\n", freqbuf); printf("TXMode: %s\n", decode_modes(chan.tx_mode)); sprintf_freq(freqbuf,chan.tx_width); printf("TXWidth: %s\n", freqbuf); printf("Shift: %s\n", rig_strptrshift(chan.rptr_shift)); sprintf_freq(freqbuf,chan.rptr_offs); printf("Offset: %s%s\n", chan.rptr_offs>0?"+":"", freqbuf); printf("Antenna: %d\n", chan.ant); sprintf_freq(freqbuf,chan.tuning_step); printf("Step: %s\n", freqbuf); sprintf_freq(freqbuf,chan.rit); printf("RIT: %s%s\n", chan.rit>0?"+":"", freqbuf); sprintf_freq(freqbuf,chan.xit); printf("XIT: %s%s\n", chan.xit>0?"+":"", freqbuf); printf("CTCSS: %d.%dHz\n", chan.ctcss_tone/10, chan.ctcss_tone%10); printf("CTCSSsql: %d.%dHz\n", chan.ctcss_sql/10, chan.ctcss_sql%10); printf("DCS: %d.%d\n", chan.dcs_code/10, chan.dcs_code%10); printf("DCSsql: %d.%d\n", chan.dcs_sql/10, chan.dcs_sql%10); printf("Name: %s\n", chan.channel_desc); printf("Functions: "); if (chan.funcs!=0) { if (chan.funcs&RIG_FUNC_FAGC) printf("FAGC "); if (chan.funcs&RIG_FUNC_NB) printf("NB "); if (chan.funcs&RIG_FUNC_COMP) printf("COMP "); if (chan.funcs&RIG_FUNC_VOX) printf("VOX "); if (chan.funcs&RIG_FUNC_TONE) printf("TONE "); if (chan.funcs&RIG_FUNC_TSQL) printf("TSQL "); if (chan.funcs&RIG_FUNC_SBKIN) printf("SBKIN "); if (chan.funcs&RIG_FUNC_FBKIN) printf("FBKIN "); if (chan.funcs&RIG_FUNC_ANF) printf("ANF "); if (chan.funcs&RIG_FUNC_NR) printf("NR "); if (chan.funcs&RIG_FUNC_AIP) printf("AIP "); if (chan.funcs&RIG_FUNC_APF) printf("APF "); if (chan.funcs&RIG_FUNC_MON) printf("MON "); if (chan.funcs&RIG_FUNC_MN) printf("MN "); if (chan.funcs&RIG_FUNC_RF) printf("RF "); printf("\n"); } else printf("none\n"); if (rig_has_set_level(rig, RIG_LEVEL_PREAMP)) printf("PREAMP: %ddB\n",chan.levels[rig_setting2idx(RIG_LEVEL_PREAMP)].i); if (rig_has_set_level(rig, RIG_LEVEL_ATT)) printf("ATT: %ddB\n",chan.levels[rig_setting2idx(RIG_LEVEL_ATT)].i); if (rig_has_set_level(rig, RIG_LEVEL_AF)) printf("AF: %g%%\n",100*chan.levels[rig_setting2idx(RIG_LEVEL_AF)].f); if (rig_has_set_level(rig, RIG_LEVEL_RF)) printf("RF: %g%%\n",100*chan.levels[rig_setting2idx(RIG_LEVEL_RF)].f); if (rig_has_set_level(rig, RIG_LEVEL_SQL)) printf("SQL: %g%%\n",100*chan.levels[rig_setting2idx(RIG_LEVEL_SQL)].f); if (rig_has_set_level(rig, RIG_LEVEL_IF)) printf("IF: %dHz\n",chan.levels[rig_setting2idx(RIG_LEVEL_IF)].i); if (rig_has_set_level(rig, RIG_LEVEL_APF)) printf("APF: %g%%\n",100*chan.levels[rig_setting2idx(RIG_LEVEL_APF)].f); if (rig_has_set_level(rig, RIG_LEVEL_NR)) printf("NR: %g%%\n",100*chan.levels[rig_setting2idx(RIG_LEVEL_NR)].f); if (rig_has_set_level(rig, RIG_LEVEL_PBT_IN)) printf("PBT_IN: %g%%\n",100*chan.levels[rig_setting2idx(RIG_LEVEL_PBT_IN)].f); if (rig_has_set_level(rig, RIG_LEVEL_PBT_OUT)) printf("PBT_OUT: %g%%\n",100*chan.levels[rig_setting2idx(RIG_LEVEL_PBT_OUT)].f); if (rig_has_set_level(rig, RIG_LEVEL_CWPITCH)) printf("CWPITCH: %dHz\n",chan.levels[rig_setting2idx(RIG_LEVEL_CWPITCH)].i); if (rig_has_set_level(rig, RIG_LEVEL_RFPOWER)) printf("RFPOWER: %g%%\n",100*chan.levels[rig_setting2idx(RIG_LEVEL_RFPOWER)].f); if (rig_has_set_level(rig, RIG_LEVEL_MICGAIN)) printf("MICGAIN: %g%%\n",100*chan.levels[rig_setting2idx(RIG_LEVEL_MICGAIN)].f); if (rig_has_set_level(rig, RIG_LEVEL_COMP)) printf("COMP: %g%%\n",100*chan.levels[rig_setting2idx(RIG_LEVEL_COMP)].f); if (rig_has_set_level(rig, RIG_LEVEL_BALANCE)) printf("BALANCE: %g%%\n",100*chan.levels[rig_setting2idx(RIG_LEVEL_BALANCE)].f); if (rig_has_set_level(rig, RIG_LEVEL_KEYSPD)) printf("KEYSPD: %d\n",chan.levels[rig_setting2idx(RIG_LEVEL_KEYSPD)].i); if (rig_has_set_level(rig, RIG_LEVEL_NOTCHF)) printf("NOTCHF: %d\n",chan.levels[rig_setting2idx(RIG_LEVEL_NOTCHF)].i); if (rig_has_set_level(rig, RIG_LEVEL_AGC)) printf("AGC: %d\n",chan.levels[rig_setting2idx(RIG_LEVEL_AGC)].i); if (rig_has_set_level(rig, RIG_LEVEL_BKINDL)) printf("BKINDL: %d\n",chan.levels[rig_setting2idx(RIG_LEVEL_BKINDL)].i); return 0; } hamlib-1.2.15.3/tests/rotctl_parse.c0000644000175000017500000006442212044564477014152 00000000000000/* * rotctl_parse.c - (C) Stephane Fillod 2000-2010 * * This program test/control a rotator using Hamlib. * It takes commands in interactive mode as well as * from command line options. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include "serial.h" #include "misc.h" #include "rotctl_parse.h" /* Hash table implementation See: http://uthash.sourceforge.net/ */ #include "uthash.h" #ifdef HAVE_PTHREAD #include static pthread_mutex_t rot_mutex = PTHREAD_MUTEX_INITIALIZER; #endif #define MAXNAMSIZ 32 #define MAXNBOPT 100 /* max number of different options */ #define ARG_IN1 0x01 #define ARG_OUT1 0x02 #define ARG_IN2 0x04 #define ARG_OUT2 0x08 #define ARG_IN3 0x10 #define ARG_OUT3 0x20 #define ARG_IN4 0x40 #define ARG_OUT4 0x80 #define ARG_IN_LINE 0x4000 #define ARG_NONE 0 #define ARG_IN (ARG_IN1|ARG_IN2|ARG_IN3|ARG_IN4) #define ARG_OUT (ARG_OUT1|ARG_OUT2|ARG_OUT3|ARG_OUT4) struct test_table { unsigned char cmd; const char *name; int (*rot_routine)(ROT*, FILE*, int, const struct test_table*, const char*, const char*, const char*, const char*, const char*, const char*); int flags; const char *arg1; const char *arg2; const char *arg3; const char *arg4; const char *arg5; const char *arg6; }; #define CHKSCN1ARG(a) if ((a) != 1) return -RIG_EINVAL; else do {} while(0) #define declare_proto_rot(f) static int (f)(ROT *rot, FILE *fout, int interactive, \ const struct test_table *cmd, const char *arg1, const char *arg2, \ const char *arg3, const char *arg4, const char *arg5, const char *arg6) declare_proto_rot(set_position); declare_proto_rot(get_position); declare_proto_rot(stop); declare_proto_rot(park); declare_proto_rot(reset); declare_proto_rot(move); declare_proto_rot(get_info); declare_proto_rot(inter_set_conf); /* interactive mode set_conf */ declare_proto_rot(send_cmd); declare_proto_rot(dump_state); declare_proto_rot(dump_caps); /* Follows are functions from locator.c */ declare_proto_rot(loc2lonlat); declare_proto_rot(lonlat2loc); declare_proto_rot(d_m_s2dec); declare_proto_rot(dec2d_m_s); declare_proto_rot(d_mm2dec); declare_proto_rot(dec2d_mm); declare_proto_rot(coord2qrb); declare_proto_rot(az_sp2az_lp); declare_proto_rot(dist_sp2dist_lp); /* * convention: upper case cmd is set, lowercase is get * * NB: 'q' 'Q' '?' are reserved by interactive mode interface */ struct test_table test_list[] = { { 'P', "set_pos", set_position, ARG_IN, "Azimuth", "Elevation" }, { 'p', "get_pos", get_position, ARG_OUT, "Azimuth", "Elevation" }, { 'K', "park", park, ARG_NONE, }, { 'S', "stop", stop, ARG_NONE, }, { 'R', "reset", reset, ARG_IN, "Reset" }, { 'M', "move", move, ARG_IN, "Direction", "Speed" }, { 'C', "set_conf", inter_set_conf, ARG_IN, "Token", "Value" }, { '_', "get_info", get_info, ARG_OUT, "Info" }, { 'w', "send_cmd", send_cmd, ARG_IN1|ARG_IN_LINE|ARG_OUT2, "Cmd", "Reply" }, { '1', "dump_caps", dump_caps, }, { 0x8f,"dump_state",dump_state, ARG_OUT }, { 'L', "lonlat2loc",lonlat2loc, ARG_IN1|ARG_IN2|ARG_IN3|ARG_OUT1, "Longitude", "Latitude", "Loc Len [2-12]", "Locator" }, { 'l', "loc2lonlat",loc2lonlat, ARG_IN1|ARG_OUT1|ARG_OUT2, "Locator", "Longitude", "Latitude" }, { 'D', "dms2dec", d_m_s2dec, ARG_IN1|ARG_IN2|ARG_IN3|ARG_IN4|ARG_OUT1, "Degrees", "Minutes", "Seconds", "S/W", "Dec Degrees" }, { 'd', "dec2dms", dec2d_m_s, ARG_IN1|ARG_OUT1|ARG_OUT2|ARG_OUT3|ARG_OUT4, "Dec Degrees", "Degrees", "Minutes", "Seconds", "S/W" }, { 'E', "dmmm2dec", d_mm2dec, ARG_IN1|ARG_IN2|ARG_IN3|ARG_OUT1, "Degrees", "Dec Minutes", "S/W", "Dec Deg" }, { 'e', "dec2dmmm", dec2d_mm, ARG_IN1|ARG_OUT1|ARG_OUT2|ARG_OUT3, "Dec Deg", "Degrees", "Dec Minutes", "S/W" }, { 'B', "qrb", coord2qrb, ARG_IN1|ARG_IN2|ARG_IN3|ARG_IN4|ARG_OUT1|ARG_OUT2, "Lon 1", "Lat 1", "Lon 2", "Lat 2", "QRB Distance", "QRB Azimuth" }, { 'A', "a_sp2a_lp", az_sp2az_lp, ARG_IN1|ARG_OUT1, "Short Path Deg", "Long Path Deg" }, { 'a', "d_sp2d_lp", dist_sp2dist_lp,ARG_IN1|ARG_OUT1, "Short Path km", "Long Path km" }, { 0x00, "", NULL }, }; struct test_table *find_cmd_entry(int cmd) { int i; for (i = 0; i < MAXNBOPT && test_list[i].cmd != 0x00; i++) if (test_list[i].cmd == cmd) break; if (i >= MAXNBOPT || test_list[i].cmd == 0x00) return NULL; return &test_list[i]; } /* Structure for hash table provided by uthash.h * * Structure and hash funtions patterned after/copied from example.c * distributed with the uthash package. See: http://uthash.sourceforge.net/ */ struct mod_lst { int id; /* caps->rot_model This is the hash key */ char mfg_name[32]; /* caps->mfg_name */ char model_name[32]; /* caps->model_name */ char version[32]; /* caps->version */ char status[32]; /* caps->status */ UT_hash_handle hh; /* makes this structure hashable */ }; /* Hash declaration. Must be initialized to NULL */ struct mod_lst *models = NULL; /* Add model information to the hash */ void hash_add_model(int id, const char *mfg_name, const char *model_name, const char *version, const char *status) { struct mod_lst *s; s = (struct mod_lst*)malloc(sizeof(struct mod_lst)); s->id = id; snprintf(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name); snprintf(s->model_name, sizeof(s->model_name), "%s", model_name); snprintf(s->version, sizeof(s->version), "%s", version); snprintf(s->status, sizeof(s->status), "%s", status); HASH_ADD_INT(models, id, s); /* id: name of key field */ } /* Hash sorting functions */ int hash_model_id_sort(struct mod_lst *a, struct mod_lst *b) { return (a->id - b->id); } void hash_sort_by_model_id() { HASH_SORT(models, hash_model_id_sort); } /* Delete hash */ void hash_delete_all() { struct mod_lst *current_model, *tmp; HASH_ITER(hh, models, current_model, tmp) { HASH_DEL(models, current_model); /* delete it (models advances to next) */ free(current_model); /* free it */ } } /* * TODO: use Lex? */ char parse_arg(const char *arg) { int i; for (i = 0; i < MAXNBOPT && test_list[i].cmd != 0; i++) if (!strncmp(arg, test_list[i].name, MAXNAMSIZ)) return test_list[i].cmd; return 0; } /* * This scanf works even in presence of signals (timer, SIGIO, ..) */ static int scanfc(FILE *fin, const char *format, void *p) { int ret; do { ret = fscanf(fin, format, p); if (ret < 0) { if (errno == EINTR) continue; rig_debug(RIG_DEBUG_ERR, "fscanf: %s\n", strerror(errno)); } return ret; } while(1); } #define fprintf_flush(f, a...) \ ({ int __ret; \ __ret = fprintf((f), a); \ fflush((f)); \ __ret; \ }) #define MAXARGSZ 127 extern int interactive; extern int prompt; extern int opt_end; extern char send_cmd_term; int ext_resp = 0; unsigned char resp_sep = '\n'; /* Default response separator */ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc) { int retcode; /* generic return code from functions */ unsigned char cmd; struct test_table *cmd_entry; char arg1[MAXARGSZ + 1], *p1; char arg2[MAXARGSZ + 1], *p2; char arg3[MAXARGSZ + 1], *p3; char arg4[MAXARGSZ + 1], *p4; char *p5, *p6; static int last_was_ret = 1; if (interactive) { if (prompt) fprintf_flush(fout, "\nRotator command: "); do { if (scanfc(fin, "%c", &cmd) < 1) return -1; /* Extended response protocol requested with leading '+' on command * string--rotctld only! */ if (cmd == '+' && !prompt) { ext_resp = 1; if (scanfc(fin, "%c", &cmd) < 1) return -1; } else if (cmd == '+' && prompt) { return 0; } if (cmd != '\\' && cmd != '_' && cmd != '#' && ispunct(cmd) && !prompt) { ext_resp = 1; resp_sep = cmd; if (scanfc(fin, "%c", &cmd) < 1) return -1; } else if (cmd != '\\' && cmd != '?' && cmd != '_' && cmd != '#' && ispunct(cmd) && prompt) { return 0; } /* command by name */ if (cmd == '\\') { unsigned char cmd_name[MAXNAMSIZ], *pcmd = cmd_name; int c_len = MAXNAMSIZ; if (scanfc(fin, "%c", pcmd) < 1) return -1; while(c_len-- && (isalnum(*pcmd) || *pcmd == '_' )) if (scanfc(fin, "%c", ++pcmd) < 1) return -1; *pcmd = '\0'; cmd = parse_arg((char *) cmd_name); break; } if (cmd == 0x0a || cmd == 0x0d) { if (last_was_ret) { if (prompt) { fprintf_flush(fout, "? for help, q to quit.\n"); } return 0; } last_was_ret = 1; } } while (cmd == 0x0a || cmd == 0x0d); last_was_ret = 0; /* comment line */ if (cmd == '#') { while( cmd != '\n' && cmd != '\r') if (scanfc(fin, "%c", &cmd) < 1) return -1; return 0; } if (cmd == 'Q' || cmd == 'q') return 1; if (cmd == '?') { usage_rot(fout); fflush(fout); return 0; } } else { /* parse rest of command line */ if (optind >= argc) return 1; if (argv[optind][1] == '\0') cmd = argv[optind][0]; else cmd = parse_arg(argv[optind]); optind++; } cmd_entry = find_cmd_entry(cmd); if (!cmd_entry) { fprintf_flush(stderr, "Command '%c' not found!\n", cmd); return 0; } p1 = p2 = p3 = p4 = p5 = p6 = NULL; if ((cmd_entry->flags & ARG_IN_LINE) && (cmd_entry->flags & ARG_IN1) && cmd_entry->arg1) { if (interactive) { char *nl; if (prompt) fprintf_flush(fout, "%s: ", cmd_entry->arg1); if (fgets(arg1, MAXARGSZ, fin) == NULL) return -1; if (arg1[0] == 0xa) if (fgets(arg1, MAXARGSZ, fin) == NULL) return -1; nl = strchr(arg1, 0xa); if (nl) *nl = '\0'; /* chomp */ p1 = arg1[0]==' '?arg1+1:arg1; } else { if (!argv[optind]) { fprintf(stderr, "Invalid arg for command '%s'\n", cmd_entry->name); exit(1); } p1 = argv[optind++]; } } else if ((cmd_entry->flags & ARG_IN1) && cmd_entry->arg1) { if (interactive) { if (prompt) fprintf_flush(fout, "%s: ", cmd_entry->arg1); if (scanfc(fin, "%s", arg1) < 1) return -1; p1 = arg1; } else { if (!argv[optind]) { fprintf(stderr, "Invalid arg for command '%s'\n", cmd_entry->name); exit(1); } p1 = argv[optind++]; } } if (p1 && p1[0]!='?' && (cmd_entry->flags & ARG_IN2) && cmd_entry->arg2) { if (interactive) { if (prompt) fprintf_flush(fout, "%s: ", cmd_entry->arg2); if (scanfc(fin, "%s", arg2) < 1) return -1; p2 = arg2; } else { if (!argv[optind]) { fprintf(stderr, "Invalid arg for command '%s'\n", cmd_entry->name); exit(1); } p2 = argv[optind++]; } } if (p1 && p1[0]!='?' && (cmd_entry->flags & ARG_IN3) && cmd_entry->arg3) { if (interactive) { if (prompt) fprintf_flush(fout, "%s: ", cmd_entry->arg3); if (scanfc(fin, "%s", arg3) < 1) return -1; p3 = arg3; } else { if (!argv[optind]) { fprintf(stderr, "Invalid arg for command '%s'\n", cmd_entry->name); exit(1); } p3 = argv[optind++]; } } if (p1 && p1[0]!='?' && (cmd_entry->flags & ARG_IN4) && cmd_entry->arg4) { if (interactive) { if (prompt) fprintf_flush(fout, "%s: ", cmd_entry->arg4); if (scanfc(fin, "%s", arg4) < 1) return -1; p4 = arg4; } else { if (!argv[optind]) { fprintf(stderr, "Invalid arg for command '%s'\n", cmd_entry->name); exit(1); } p4 = argv[optind++]; } } /* * mutex locking needed because rigctld is multithreaded * and hamlib is not MT-safe */ #ifdef HAVE_PTHREAD pthread_mutex_lock(&rot_mutex); #endif if (!prompt) rig_debug(RIG_DEBUG_TRACE, "rotctl(d): %c '%s' '%s' '%s' '%s'\n", cmd, p1?p1:"", p2?p2:"", p3?p3:"", p4?p4:""); /* * Extended Response protocol: output received command name and arguments * response. */ if (interactive && ext_resp && !prompt) { char a1[MAXARGSZ + 1]; char a2[MAXARGSZ + 1]; char a3[MAXARGSZ + 1]; char a4[MAXARGSZ + 1]; p1 == NULL ? a1[0] = '\0' : snprintf(a1, sizeof(a1), " %s", p1); p2 == NULL ? a2[0] = '\0' : snprintf(a2, sizeof(a2), " %s", p2); p3 == NULL ? a3[0] = '\0' : snprintf(a3, sizeof(a3), " %s", p3); p4 == NULL ? a4[0] = '\0' : snprintf(a4, sizeof(a4), " %s", p4); fprintf(fout, "%s:%s%s%s%s%c", cmd_entry->name, a1, a2, a3, a4, resp_sep); } retcode = (*cmd_entry->rot_routine)(my_rot, fout, interactive, cmd_entry, p1, p2 ? p2 : "", p3 ? p3 : "", p4 ? p4 : "", p5 ? p5 : "", p6 ? p6 : ""); #ifdef HAVE_PTHREAD pthread_mutex_unlock(&rot_mutex); #endif if (retcode != RIG_OK) { /* only for rotctld */ if (interactive && !prompt) { fprintf(fout, NETROTCTL_RET "%d\n", retcode); ext_resp = 0; resp_sep = '\n'; } else fprintf(fout, "%s: error = %s\n", cmd_entry->name, rigerror(retcode)); } else { /* only for rotctld */ if (interactive && !prompt) { /* netrotctl RIG_OK */ if (!(cmd_entry->flags & ARG_OUT) && !opt_end && !ext_resp) fprintf(fout, NETROTCTL_RET "0\n"); /* Extended Response protocol */ else if (ext_resp && cmd != 0xf0) { fprintf(fout, NETROTCTL_RET "0\n"); ext_resp = 0; resp_sep = '\n'; } /* Nate's protocol (obsolete) */ else if ((cmd_entry->flags & ARG_OUT) && opt_end) fprintf(fout, "END\n"); } } fflush(fout); return retcode != RIG_OK ? 2 : 0; } void version() { printf("rotctl, %s\n\n", hamlib_version); printf("%s\n", hamlib_copyright); } void usage_rot(FILE *fout) { int i, nbspaces; fprintf(fout, "Commands (some may not be available for this rig):\n"); for (i = 0; test_list[i].cmd != 0; i++) { fprintf(fout, "%c: %-12s(", isprint(test_list[i].cmd) ? test_list[i].cmd : '?', test_list[i].name); nbspaces = 16; if (test_list[i].arg1 && (test_list[i].flags&ARG_IN1)) nbspaces -= fprintf(fout, "%s", test_list[i].arg1); if (test_list[i].arg2 && (test_list[i].flags&ARG_IN2)) nbspaces -= fprintf(fout, ", %s", test_list[i].arg2); if (test_list[i].arg3 && (test_list[i].flags&ARG_IN3)) nbspaces -= fprintf(fout, ", %s", test_list[i].arg3); if (test_list[i].arg4 && (test_list[i].flags&ARG_IN4)) nbspaces -= fprintf(fout, ", %s", test_list[i].arg4); fprintf(fout, ")\n"); } } int print_conf_list(const struct confparams *cfp, rig_ptr_t data) { ROT *rot = (ROT*) data; int i; char buf[128] = ""; rot_get_conf(rot, cfp->token, buf); printf("%s: \"%s\"\n" "\tDefault: %s, Value: %s\n", cfp->name, cfp->tooltip, cfp->dflt, buf ); switch (cfp->type) { case RIG_CONF_NUMERIC: printf("\tRange: %.1f..%.1f, step %.1f\n", cfp->u.n.min, cfp->u.n.max, cfp->u.n.step); break; case RIG_CONF_COMBO: if (!cfp->u.c.combostr) break; printf("\tCombo: %s", cfp->u.c.combostr[0]); for (i = 1 ; i < RIG_COMBO_MAX && cfp->u.c.combostr[i]; i++) printf(", %s", cfp->u.c.combostr[i]); printf("\n"); break; default: break; } return 1; /* != 0, we want them all ! */ } static int hash_model_list(const struct rot_caps *caps, void *data) { hash_add_model(caps->rot_model, caps->mfg_name, caps->model_name, caps->version, rig_strstatus(caps->status)); return 1; /* !=0, we want them all ! */ } void print_model_list() { struct mod_lst *s; for (s = models; s != NULL; s = (struct mod_lst *)(s->hh.next)) { printf("%6d %-23s%-24s%-16s%s\n", s->id, s->mfg_name, s->model_name, s->version, s->status); } } void list_models() { int status; rot_load_all_backends(); printf(" Rig # Mfg Model Version Status\n"); status = rot_list_foreach(hash_model_list, NULL); if (status != RIG_OK ) { printf("rot_list_foreach: error = %s \n", rigerror(status)); exit(2); } hash_sort_by_model_id(); print_model_list(); hash_delete_all(); } int set_conf(ROT *my_rot, char *conf_parms) { char *p, *q, *n; int ret; p = conf_parms; while (p && *p != '\0') { /* FIXME: left hand value of = cannot be null */ q = strchr(p, '='); if ( !q ) return RIG_EINVAL; *q++ = '\0'; n = strchr(q, ','); if (n) *n++ = '\0'; ret = rot_set_conf(my_rot, rot_token_lookup(my_rot, p), q); if (ret != RIG_OK) return ret; p = n; } return RIG_OK; } /* * static int (f)(ROT *rot, int interactive, const void *arg1, const void *arg2, const void *arg3, const void *arg4) */ /* 'P' */ declare_proto_rot(set_position) { azimuth_t az; elevation_t el; CHKSCN1ARG(sscanf(arg1, "%f", &az)); CHKSCN1ARG(sscanf(arg2, "%f", &el)); return rot_set_position(rot, az, el); } /* 'p' */ declare_proto_rot(get_position) { int status; azimuth_t az; elevation_t el; status = rot_get_position(rot, &az, &el); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%f%c", az, resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg2); fprintf(fout, "%f%c", el, resp_sep); return status; } /* 'S' */ declare_proto_rot(stop) { return rot_stop(rot); } /* 'K' */ declare_proto_rot(park) { return rot_park(rot); } /* 'R' */ declare_proto_rot(reset) { rot_reset_t reset; CHKSCN1ARG(sscanf(arg1, "%d", &reset)); return rot_reset(rot, reset); } /* '_' */ declare_proto_rot(get_info) { const char *s; s = rot_get_info(rot); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg1); fprintf(fout, "%s%c", s ? s : "None", resp_sep); return RIG_OK; } /* 'M' */ declare_proto_rot(move) { int direction; int speed; if (!strcmp(arg1, "LEFT") || !strcmp(arg1, "CCW")) direction = ROT_MOVE_LEFT; else if (!strcmp(arg1, "RIGHT") || !strcmp(arg1, "CW")) direction = ROT_MOVE_RIGHT; else if (!strcmp(arg1, "UP")) direction = ROT_MOVE_UP; else if (!strcmp(arg1, "DOWN")) direction = ROT_MOVE_DOWN; else CHKSCN1ARG(sscanf(arg1, "%d", &direction)); CHKSCN1ARG(sscanf(arg2, "%d", &speed)); return rot_move(rot, direction, speed); } /* 'C' */ declare_proto_rot(inter_set_conf) { token_t token; CHKSCN1ARG(sscanf(arg1, "%ld", &token)); if (!arg2 || arg2[0] == '\0') return -RIG_EINVAL; return rot_set_conf(rot, token, arg2); } /* '1' */ declare_proto_rot(dump_caps) { dumpcaps_rot(rot, fout); return RIG_OK; } /* For rotctld internal use * '0x8f' */ declare_proto_rot(dump_state) { struct rot_state *rs = &rot->state; /* * - Protocol version */ #define ROTCTLD_PROT_VER 0 if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "rotctld Protocol Ver: "); fprintf(fout, "%d%c", ROTCTLD_PROT_VER, resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "Rotor Model: "); fprintf(fout, "%d%c", rot->caps->rot_model, resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "Minimum Azimuth: "); fprintf(fout, "%lf%c", rs->min_az, resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "Maximum Azimuth: "); fprintf(fout, "%lf%c", rs->max_az, resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "Minimum Elevation: "); fprintf(fout, "%lf%c", rs->min_el, resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "Maximum Elevation: "); fprintf(fout, "%lf%c", rs->max_el, resp_sep); return RIG_OK; } /* * special debugging purpose send command * display reply until there's a timeout * * 'w' */ declare_proto_rot(send_cmd) { int retval; struct rot_state *rs; int backend_num, cmd_len; #define BUFSZ 128 char bufcmd[BUFSZ]; char buf[BUFSZ]; char eom_buf[4] = { 0xa, 0xd, 0, 0 }; /* * binary protocols enter values as \0xZZ\0xYY.. * * Rem: no binary protocol for rotator as of now */ backend_num = ROT_BACKEND_NUM(rot->caps->rot_model); if (send_cmd_term == -1 || backend_num == -1) { const char *p = arg1, *pp = NULL; int i; for (i = 0; i < BUFSZ - 1 && p != pp; i++) { pp = p + 1; bufcmd[i] = strtol(p + 1, (char **) &p, 0); } /* must save length to allow 0x00 to be sent as part of a command */ cmd_len = i - 1; /* no End Of Message chars */ eom_buf[0] = '\0'; } else { /* text protocol */ strncpy(bufcmd,arg1, BUFSZ); bufcmd[BUFSZ - 2] = '\0'; cmd_len = strlen(bufcmd); /* Automatic termination char */ if (send_cmd_term != 0) bufcmd[cmd_len++] = send_cmd_term; eom_buf[2] = send_cmd_term; } rs = &rot->state; serial_flush(&rs->rotport); retval = write_block(&rs->rotport, bufcmd, cmd_len); if (retval != RIG_OK) return retval; if (interactive && prompt) fprintf(fout, "%s: ", cmd->arg2); do { /* * assumes CR or LF is end of line char * for all ascii protocols */ retval = read_string(&rs->rotport, buf, BUFSZ, eom_buf, strlen(eom_buf)); if (retval < 0) break; if (retval < BUFSZ) buf[retval] = '\0'; else buf[BUFSZ-1] = '\0'; fprintf(fout, "%s\n", buf); } while (retval > 0); if (retval > 0 || retval == -RIG_ETIMEOUT) retval = RIG_OK; return retval; } /* 'L' */ declare_proto_rot(lonlat2loc) { unsigned char loc[MAXARGSZ + 1]; double lat, lon; int err, pair; CHKSCN1ARG(sscanf(arg1, "%lf", &lon)); CHKSCN1ARG(sscanf(arg2, "%lf", &lat)); CHKSCN1ARG(sscanf(arg3, "%d", &pair)); pair /= 2; err = longlat2locator(lon, lat, (char *)&loc, pair); if (err != RIG_OK) return err; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg4); fprintf(fout, "%s%c", loc, resp_sep); return err; } /* 'l' */ declare_proto_rot(loc2lonlat) { unsigned char loc[MAXARGSZ + 1]; double lat, lon; int status; CHKSCN1ARG(sscanf(arg1, "%s", (char *)&loc)); status = locator2longlat(&lon, &lat, (const char *)loc); if (status != RIG_OK) return status; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg2); fprintf(fout, "%f%c", lon, resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg3); fprintf(fout, "%f%c", lat, resp_sep); return status; } /* 'D' */ declare_proto_rot(d_m_s2dec) { int deg, min, sw; double sec, dec_deg; CHKSCN1ARG(sscanf(arg1, "%d", °)); CHKSCN1ARG(sscanf(arg2, "%d", &min)); CHKSCN1ARG(sscanf(arg3, "%lf", &sec)); CHKSCN1ARG(sscanf(arg4, "%d", &sw)); dec_deg = dms2dec(deg, min, sec, sw); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg5); fprintf(fout, "%lf%c", dec_deg, resp_sep); return RIG_OK; } /* 'd' */ declare_proto_rot(dec2d_m_s) { int deg, min, sw, err; double sec, dec_deg; CHKSCN1ARG(sscanf(arg1, "%lf", &dec_deg)); err = dec2dms(dec_deg, °, &min, &sec, &sw); if (err != RIG_OK) return err; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg2); fprintf(fout, "%d%c", deg, resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg3); fprintf(fout, "%d%c", min, resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg4); fprintf(fout, "%lf%c", sec, resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg5); fprintf(fout, "%d%c", sw, resp_sep); return err; } /* 'E' */ declare_proto_rot(d_mm2dec) { int deg, sw; double dec_deg, min; CHKSCN1ARG(sscanf(arg1, "%d", °)); CHKSCN1ARG(sscanf(arg2, "%lf", &min)); CHKSCN1ARG(sscanf(arg3, "%d", &sw)); dec_deg = dmmm2dec(deg, min, sw); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg4); fprintf(fout, "%lf%c", dec_deg, resp_sep); return RIG_OK; } /* 'e' */ declare_proto_rot(dec2d_mm) { int deg, sw, err; double min, dec_deg; CHKSCN1ARG(sscanf(arg1, "%lf", &dec_deg)); err = dec2dmmm(dec_deg, °, &min, &sw); if (err != RIG_OK) return err; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg2); fprintf(fout, "%d%c", deg, resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg3); fprintf(fout, "%lf%c", min, resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg4); fprintf(fout, "%d%c", sw, resp_sep); return err; } /* 'B' */ declare_proto_rot(coord2qrb) { double lon1, lat1, lon2, lat2, dist, az; int err; CHKSCN1ARG(sscanf(arg1, "%lf", &lon1)); CHKSCN1ARG(sscanf(arg2, "%lf", &lat1)); CHKSCN1ARG(sscanf(arg3, "%lf", &lon2)); CHKSCN1ARG(sscanf(arg4, "%lf", &lat2)); err = qrb(lon1, lat1, lon2, lat2, &dist, &az); if (err != RIG_OK) return err; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg5); fprintf(fout, "%lf%c", dist, resp_sep); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg6); fprintf(fout, "%lf%c", az, resp_sep); return err; } /* 'A' */ declare_proto_rot(az_sp2az_lp) { double az_sp, az_lp; CHKSCN1ARG(sscanf(arg1, "%lf", &az_sp)); az_lp = azimuth_long_path(az_sp); if (az_lp < 0) return -RIG_EINVAL; if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg2); fprintf(fout, "%lf%c", az_lp, resp_sep); return RIG_OK; } /* 'a' */ declare_proto_rot(dist_sp2dist_lp) { double dist_sp, dist_lp; CHKSCN1ARG(sscanf(arg1, "%lf", &dist_sp)); dist_lp = distance_long_path(dist_sp); if ((interactive && prompt) || (interactive && !prompt && ext_resp)) fprintf(fout, "%s: ", cmd->arg2); fprintf(fout, "%lf%c", dist_lp, resp_sep); return RIG_OK; } hamlib-1.2.15.3/tests/rigctld.80000644000175000017500000005622412044564477013027 00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH RIGCTLD "8" "September 27, 2012" "Hamlib" "Rig Control Daemon" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME rigctld \- Hamlib TCP rig control daemon .SH SYNOPSIS .B rigctld [\fIOPTION\fR]... .SH DESCRIPTION The \fBrigctld\fP program is a NEW \fBHamlib\fP rig control daemon ready for testing that handles client requests via TCP sockets. This allows multiple user programs to share one radio (this needs testing), except on Win32 where pthreads are not available. Multiple radios can be controlled on different TCP ports by use of multiple \fBrigctld\fP processes. The syntax of the commands are the same as \fBrigctl\fP. It is hoped that \fBrigctld\fP will be especially useful for client authors using languages such as Perl, Python, PHP, and others. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invoke bold face and italics, .\" respectively. \fBrigctld\fP communicates to a client through a TCP socket using text commands shared with \fBrigctl\fP. The protocol is simple; commands are sent to \fBrigctld\fP on one line and \fBrigctld\fP responds to "get" commands with the requested values, one per line, when successful, otherwise, it responds with one line "RPRT x", where x is a negative number indicating the error code. Commands that do not return values respond with the line "RPRT x", where x is zero when successful, otherwise is a regative number indicating the error code. Each line is terminated with a newline '\\n' character. This protocol is primarily for use by the \fINET rigctl\fP (rig model 2)backend. .PP A separate \fBExtended Response\fP protocol extends the above behavior by echoing the received command string as a header, any returned values as a key: value pair, and the "RPRT x" string as the end of response marker which includes the \fBHamlib\fP success or failure value. See the \fIPROTOCOL\fP section for details. Consider using this protocol for clients that will interact with \fBrigctld\fP directly through a TCP socket. .PP Keep in mind that \fBHamlib\fP is BETA level software. While a lot of backend libraries lack complete rig support, the basic functions are usually well supported. The API may change without publicized notice, while an advancement of the minor version (e.g. 1.1.x to 1.2.x) indicates such a change. .PP Please report bugs and provide feedback at the e-mail address given in the \fIREPORTING BUGS\fP section. Patches and code enhancements are also welcome. .SH OPTIONS This program follows the usual GNU command line syntax, with long options starting with two dashes ('-'). .PP Here is a summary of the supported options: .TP .B \-m, --model=id Select radio model number. See the -l, --list option below. .TP .B \-r, --rig-file=device Use \fIdevice\fP as the file name of the port the radio is connected. Often a serial port, but could be a USB to serial adapter or USB port device. Typically /dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0, etc. on Linux or COM1, COM2, etc. on Win32. .TP .B \-p, --ptt-file=device Use \fIdevice\fP as the file name of the Push-To-Talk device using a device file as described above. .TP .B \-d, --dcd-file=device Use \fIdevice\fP as the file name of the Data Carrier Detect device using a device file as described above. .TP .B \-P, --ptt-type=type Use \fItype\fP of Push-To-Talk device. Supported types are RIG (CAT command), DTR, RTS, PARALLEL, NONE. .TP .B \-D, --dcd-type=type Use \fItype\fP of Data Carrier Detect device. Supported types are RIG (CAT command), DSR, CTS, CD, PARALLEL, NONE. .TP .B \-s, --serial-speed=baud Set serial speed to \fIbaud\fP rate. Uses maximum serial speed from rig backend capabilities (set by -m above) as the default. .TP .B \-c, --civaddr=id Use \fIid\fP as the CI-V address to communicate with the rig. Only useful for Icom rigs. .sp \fBN.B.\fP: The \fIid\fP is in decimal notation, unless prefixed by \fI0x\fP for a hexadecimal value. .TP .B \-T, --listen-addr=IPADDR Use \fIIPADDR\fP as the listening IP address. The default is ANY. .sp N.B.: This option seems mandatory on Win32, eg: -T 127.0.0.1 .TP .B \-t, --port=number Use \fInumber\fP as the TCP listening port. The default is 4532. .sp \fBN.B.\fP: As \fBrotctld\fP's default port is 4533, it is advisable to use even numbered ports for \fBrigctld\fP, e.g. 4532, 4534, 4536, etc. .sp N.B.: This option seems mandatory on Win32, eg: -t 4532 .TP .B \-L, --show-conf List all config parameters for the radio defined with -m above. .TP .B \-C, --set-conf=parm=val[,parm=val]* Set config parameter. e.g. --set-conf=stop_bits=2 .sp Use -L option for a list. .TP .B \-l, --list List all model numbers defined in \fBHamlib\fP and exit. As of 1.2.15.1 the list is sorted by model number. .sp \fBN.B.\fP In Linux the list can be scrolled back using Shift-PageUp/ Shift-PageDown, or using the scrollbars of a virtual terminal in X or the cmd window in Windows. The output can be piped to 'more' or 'less', e.g. 'rigctld -l | more'. .TP .B \-u, --dump-caps Dump capabilities for the radio defined with -m above and exit. .TP .B \-o, --vfo Set vfo mode, requiring an extra VFO argument in front of each appropriate command (except \fI\\set_vfo\fP!). Otherwise, 'currVFO' is assumed when this option is not set and an extra VFO argument is not used. See \fI\\chk_vfo\fP below. .TP .B \-e, --end-marker Use END marker in rigctld protocol. .sp \fBN.B.\fP: This option should be considered obsolete. Please consider using the Extended Response protocol instead (see \fIPROTOCOL\fP below). This option will be removed in a future Hamlib release. .TP .B \-v, --verbose Set verbose mode, cumulative (see \fIDIAGNOSTICS\fP below). .TP .B \-h, --help Show a summary of these options and exit. .TP .B \-V, --version Show the version of \fBrigctld\fP and exit. .PP \fBN.B.\fP Some options may not be implemented by a given backend and will return an error. This is most likely to occur with the \fI\-\-set-conf\fP and \fI\-\-show-conf\fP options. .PP Please note that the backend for the radio to be controlled, or the radio itself may not support some commands. In that case, the operation will fail with a \fBHamlib\fP error code. .SH COMMANDS Commands can be sent over the TCP socket either as a single char, or as a long command name plus the value(s) space separated on one '\\n' terminated line. See \fIPROTOCOL\fP. .PP Since most of the \fBHamlib\fP operations have a \fIset\fP and a \fIget\fP method, an upper case letter will be used for \fIset\fP methods whereas the corresponding lower case letter refers to the \fIget\fP method. Each operation also has a long name; prepend a backslash to send a long command name. .PP Example (Perl): `print $socket "\\\\dump_caps\\n";' to see what the radio's backend can do .br (\fBN.B.\fP: In Perl and many other languages a '\\' will need to be escaped with a preceding '\\' so that even though two backslash characters appear in the code, only one will be passed to \fBrigctld\fP. This is a possible bug, beware!). .PP Please note that the backend for the radio to be controlled, or the radio itself may not support some commands. In that case, the operation will fail with a \fBHamlib\fP error message. .PP Here is a summary of the supported commands (In the case of "set" commands the quoted string is replaced by the value in the description. In the case of "get" commands the quoted string is the key name of the value returned.): .TP .B F, set_freq 'Frequency' Set 'Frequency', in Hz. .TP .B f, get_freq Get 'Frequency', in Hz. .TP .B M, set_mode 'Mode' 'Passband' Set 'Mode': USB, LSB, CW, CWR, RTTY, RTTYR, AM, FM, WFM, AMS, PKTLSB, PKTUSB, PKTFM, ECSSUSB, ECSSLSB, FAX, SAM, SAL, SAH, DSB. .sp Set 'Passband' in Hz, or '0' for the Hamlib backend default. .TP .B m, get_mode Get 'Mode' 'Passband'. .sp Returns Mode as a string from \fIset_mode\fP above and Passband in Hz. .TP .B V, set_vfo 'VFO' Set 'VFO': VFOA, VFOB, VFOC, currVFO, VFO, MEM, Main, Sub, TX, RX. .sp In VFO mode only a single VFO parameter is required. .TP .B v, get_vfo Get current 'VFO'. .sp Returns VFO as a string from \fIset_vfo\fP above. .TP .B J, set_rit 'RIT' Set 'RIT', in Hz, can be + or -. .sp A value of '0' resets RIT and *should* turn RIT off. If not, file a bug report against the Hamlib backend. .TP .B j, get_rit Get 'RIT', in Hz. .TP .B Z, set_xit 'XIT' Set 'XIT', in Hz can be + or -. .sp A value of '0' resets RIT and *should* turn RIT off. If not, file a bug report against the Hamlib backend. .TP .B z, get_xit Get 'XIT', in Hz. .TP .B T, set_ptt 'PTT' Set 'PTT', 0 (RX) or 1 (TX). .TP .B t, get_ptt Get 'PTT' status. .TP .B 0x8b, get_dcd Get 'DCD' (squelch) status, 0 (Closed) or 1 (Open) .TP .B R, set_rptr_shift 'Rptr Shift' Set 'Rptr Shift': "+", "-" or something else for none. .TP .B r, get_rptr_shift Get 'Rptr Shift'. Returns "+", "-" or "None". .TP .B O, set_rptr_offs 'Rptr Offset' Set 'Rptr Offset', in Hz. .TP .B o, get_rptr_offs Get 'Rptr Offset', in Hz. .TP .B C, set_ctcss_tone 'CTCSS Tone' Set 'CTCSS Tone', in tenths of Hz. .TP .B c, get_ctcss_tone Get 'CTCSS Tone', in tenths of Hz. .TP .B D, set_dcs_code 'DCS Code' Set 'DCS Code'. .TP .B d, get_dcs_code Get 'DCS Code'. .TP .B 0x90, set_ctcss_sql 'CTCSS Sql' Set 'CTCSS Sql' tone, in tenths of Hz. .TP .B 0x91, get_ctcss_sql Get 'CTCSS Sql' tone, in tenths of Hz. .TP .B 0x92, set_dcs_sql 'DCS Sql' Set 'DCS Sql' code. .TP .B 0x93, get_dcs_sql Get 'DCS Sql' code. .TP .B I, set_split_freq 'Tx Frequency' Set 'TX Frequency', in Hz. .TP .B i, get_split_freq Get 'TX Frequency', in Hz. .TP .B X, set_split_mode 'TX Mode' 'TX Passband' Set 'TX Mode': AM, FM, CW, CWR, USB, LSB, RTTY, RTTYR, WFM, AMS, PKTLSB, PKTUSB, PKTFM, ECSSUSB, ECSSLSB, FAX, SAM, SAL, SAH, DSB. .sp The 'TX Passband' is the exact passband in Hz, or '0' for the Hamlib backend default. .TP .B x, get_split_mode Get 'TX Mode' and 'TX Passband'. .sp Returns TX mode as a string from \fIset_split_mode\fP above and TX passband in Hz. .TP .B S, set_split_vfo 'Split' 'TX VFO' Set 'Split' mode, '0' or '1', and 'TX VFO' from \fIset_vfo\fP above. .TP .B s, get_split_vfo Get 'Split' mode, '0' or '1', and 'TX VFO'. .TP .B N, set_ts 'Tuning Step' Set 'Tuning Step', in Hz. .TP .B n, get_ts Get 'Tuning Step', in Hz. .TP .B U, set_func 'Func' 'Func Status' Set 'Func' 'Func Status'. .sp Func is one of: FAGC, NB, COMP, VOX, TONE, TSQL, SBKIN, FBKIN, ANF, NR, AIP, APF, MON, MN, RF, ARO, LOCK, MUTE, VSC, REV, SQL, ABM, BC, MBC, AFC, SATMODE, SCOPE, RESUME, TBURST, TUNER. .sp Func Status argument is a non null value for "activate", "de-activate" otherwise, much as TRUE/FALSE definitions in C language. .TP .B u, get_func Get 'Func' 'Func Status'. .sp Returns Func as a string from \fIset_func\fP above and Func status as a non null value. .TP .B L, set_level 'Level' 'Level Value' Set 'Level' and 'Level Value'. .sp Level is one of: PREAMP, ATT, VOX, AF, RF, SQL, IF, APF, NR, PBT_IN, PBT_OUT, CWPITCH, RFPOWER, MICGAIN, KEYSPD, NOTCHF, COMP, AGC, BKINDL, BAL, METER, VOXGAIN, ANTIVOX, SLOPE_LOW, SLOPE_HIGH, RAWSTR, SQLSTAT, SWR, ALC, STRENGTH. .sp The Level Value can be a float or an integer. .TP .B l, get_level Get 'Level' 'Level Value'. .sp Returns Level as a string from \fIset_level\fP above and Level value as a float or integer. .TP .B P, set_parm 'Parm' 'Parm Value' Set 'Parm' 'Parm Value' .sp Parm is one of: ANN, APO, BACKLIGHT, BEEP, TIME, BAT, KEYLIGHT. .TP .B p, get_parm Get 'Parm' 'Parm Value'. .sp Returns Parm as a string from \fIset_parm\fP above and Parm Value as a float or integer. .TP .B B, set_bank 'Bank' Set 'Bank'. Sets the current memory bank number. .TP .B E, set_mem 'Memory#' Set 'Memory#' channel number. .TP .B e, get_mem Get 'Memory#' channel number. .TP .B G, vfo_op 'Mem/VFO Op' Perform 'Mem/VFO Op'. .sp Mem VFO operation is one of: CPY, XCHG, FROM_VFO, TO_VFO, MCL, UP, DOWN, BAND_UP, BAND_DOWN, LEFT, RIGHT, TUNE, TOGGLE. .TP .B g, scan 'Scan Fct' 'Scan Channel' Perform 'Scan Fct' 'Scan Channel'. .sp Scan function/channel is one of: STOP, MEM, SLCT, PRIO, PROG, DELTA, VFO, PLT. .TP .B H, set_channel 'Channel' Set memory 'Channel' data. Not implemented yet. .TP .B h, get_channel Get memory 'Channel' data. Not implemented yet. .TP .B A, set_trn 'Transceive' Set 'Transceive' mode (reporting event): OFF, RIG, POLL. .TP .B a, get_trn Get 'Transceive' mode (reporting event) as in \fIset_trn\fP above. .TP .B Y, set_ant 'Antenna' Set 'Antenna' number (0, 1, 2, ..). .TP .B y, get_ant Get 'Antenna' number (0, 1, 2, ..). .TP .B *, reset 'Reset' Perform rig 'Reset'. .sp 0 = None, 1 = Software reset, 2 = VFO reset, 4 = Memory Clear reset, 8 = Master reset. Since these values are defined as a bitmask in rig.h, it should be possible to AND these values together to do multiple resets at once, if the backend supports it or supports a reset action via rig control at all. .TP .B b, send_morse 'Morse' Send 'Morse' symbols. .TP .B 0x87, set_powerstat 'Power Status' Set power On/Off/Standby 'Power Status'. .sp 0 = Power Off, 1 = Power On, 2 = Power Standby. Defined as a bitmask in rig.h. .TP .B 0x88, get_powerstat Get power On/Off/Standby 'Power Status' as in \fIset_powerstat\fP above. .TP .B 0x89, send_dtmf 'Digits' Set DTMF 'Digits'. .TP .B 0x8a, recv_dtmf Get DTMF 'Digits'. .TP .B _, get_info Get misc information about the rig (no VFO in 'VFO mode' or value is passed). .TP .B 1, dump_caps Not a real rig remote command, it just dumps capabilities, i.e. what the backend knows about this model, and what it can do. TODO: Ensure this is in a consistent format so it can be read into a hash, dictionary, etc. Bug reports requested. .sp \fBN.B.\fP: This command will produce many lines of output so be very careful if using a fixed length array! For example, running this command against the Dummy backend results in over 5kB of text output. .sp VFO parameter not used in 'VFO mode'. .TP .B 2, power2mW 'Power [0.0..1.0]' 'Frequency' 'Mode' Returns 'Power mW' .sp Converts a Power value in a range of \fI0.0 ... 1.0\fP to the real transmit power in milli-Watts (integer). The \fIfrequency\fP and \fImode\fP also need to be provided as output power may vary according to these values. .sp VFO parameter not used in 'VFO mode'. .TP .B 4, mW2power 'Power mW' 'Frequency' 'Mode' Returns 'Power [0.0..1.0]' .sp Converts the real transmit power in milli-Watts (integer) to a Power value in a range of \fI0.0 ... 1.0\fP. The \fIfrequency\fP and \fImode\fP also need to be provided as output power may vary according to these values. .sp VFO parameter not used in 'VFO mode'. .TP .B w, send_cmd 'Cmd' Send raw command string to rig. .sp For binary protocols enter values as \\0xAA\\0xBB. Expect a 'Reply' from the rig which will likely be a binary block or an ASCII string. .TP .B chk_vfo Returns "CHKVFO 1\\n" (single line only) if \fBrigctld\fP was invoked with the \fI-o\fP or \fI--vfo\fP option, "CHKVFO 0\\n" if not. .sp When in VFO mode the client will need to pass 'VFO' as the first parameter to \fI\\set\fP or \fI\\get\fP commands. 'VFO' is one of the strings defined for \fI\\set_vfo\fP above. .SH PROTOCOL \fBDefault Protocol\fP .PP The \fBrigctld\fP protocol is intentionally simple. Commands are entered on a single line with any needed values. In Perl, reliable results are obtained by terminating each command string with a newline character, '\\n'. .sp Example \fIset\fP (Perl code): .sp print $socket "F 14250000\\n"; .br print $socket "\\\\set_mode LSB 2400\\n"; # escape leading '\\' .PP A one line response will be sent as a reply to \fIset\fP commands, "RPRT \fIx\fP\\n" where \fIx\fP is the Hamlib error code with '0' indicating success of the command. .PP Responses from \fBrigctld\fP \fIget\fP commands are text values and match the same tokens used in the \fIset\fP commands. Each value is returned on its own line. On error the string "RPRT \fIx\fP\\n" is returned where \fIx\fP is the Hamlib error code. .sp Example \fIget\fP (Perl code): .sp print $socket "f\\n"; .br "14250000\\n" .PP Most \fIget\fP functions return one to three values. A notable exception is the \fI\\dump_caps\fP function which returns many lines of key:value pairs. .PP This protocol is primarily used by the \fINET rigctl\fP (rigctl model 2) backend which allows applications already written for Hamlib's C API to take advantage of \fBrigctld\fP without the need of rewriting application code. An application's user can select rig model 2 ("NET rigctl") and then set rig_pathname to "localhost:4532" or other network host:port (set by the \fI-t\fP option above). .PP \fBExtended Response Protocol\fP .PP An \fIEXPERIMENTAL\fP Extended Response protocol has been introduced into \fBrigctld\fP as of February 16, 2010. This protocol adds several rules to the strings returned by \fBrigctld\fP and adds a rule for the command syntax. .PP 1. The command received by \fBrigctld\fP is echoed with its long command name followed by the value(s) (if any) received from the client terminated by the specified response separator as the record line of the response. .PP 2. The last line of each block is the string "RPRT \fIx\fP\\n" where \fIx\fP is the numeric return value of the Hamlib backend function that was called by the command. .PP 3. Any records consisting of data values returned by the rig backend are prepended by a string immediately followed by a colon then a space and then the value terminated by the response separator. e.g. "Frequency: 14250000\\n" when the command was prepended by '+'. .PP 4. All commands received will be acknowledged by \fBrigctld\fP with lines from rules 1 and 2. Lines from rule 3 are only returned when data values must be returned to the client. .PP An example response to a \fI+\\set_mode\fP command sent from the shell prompt (note the prepended '+'): .sp $ echo "+M USB 2400" | nc -w 1 localhost 4532 .br set_mode: USB 2400 .br RPRT 0 .PP In this case the long command name and values are returned on the first line and the second line contains the end of block marker and the numeric rig backend return value indicating success. .PP An example response to a \fI\\get_mode\fP query: .sp $ echo "+\\get_mode" | nc -w 1 localhost 4532 .br get_mode: .br Mode: USB .br Passband: 2400 .br RPRT 0 .PP In this case, as no value is passed to \fBrigctld\fP, the first line consists only of the long command name. The final line shows that the command was processed successfully by the rig backend. .PP Invoking the Extended Response protocol requires prepending a command with a punctuation character. As shown in the examples above, prepending a '+' character to the command results in the responses being separated by a newline character ('\\n'). Any other punctuation character recognized by the C \fIispunct()\fP function except '\\', '?', or '_' will cause that character to become the response separator and the entire response will be on one line. .PP Separator character summary: .TP .B '+' .br Each record of the response is appended with a newline ('\\n'). .TP .B ';', '|', or ',' .br Each record of the response is appended by the given character resulting in entire response on one line. .sp Common record separators for text representations of spreadsheet data, etc. .TP .B '?' .br Reserved for 'help' in rigctl short command .TP .B '_' .br Reserved for \\get_info short command .TP .B '#' .br Reserved for comments when reading a command file script .sp Other punctuation characters have not been tested! Use at your own risk. .PP For example, invoking a \fI;\\get_mode\fP query with a leading ';' returns: .sp get_mode:;Mode: USB;Passband: 2400;RPRT 0 .sp Or, using the pipe character '|' returns: .sp get_mode:|Mode: USB|Passband: 2400|RPRT 0 .sp And a \\set_mode command prepended with a '|' returns: .sp set_mode: USB 2400|RPRT 0 .PP Such a format will allow reading a response as a single event using a preferred response separator. Other punctuation characters have not been tested! .PP The following commands have been tested with the Extended Response protocol and the included \fBtestctld.pl\fP script: .br \fI\\set_freq\fP \fI\\get_freq\fP \fI\\set_split_freq\fP \fI\\get_split_freq\fP .br \fI\\set_mode\fP \fI\\get_mode\fP \fI\\set_split_mode\fP \fI\\get_split_mode\fP .br \fI\\set_vfo\fP \fI\\get_vfo\fP \fI\\set_split_vfo\fP \fI\\get_split_vfo\fP .br \fI\\set_rit\fP \fI\\get_rit\fP .br \fI\\set_xit\fP \fI\\get_xit\fP .br \fI\\set_ptt\fP \fI\\get_ptt\fP .br \fI\\power2mW\fP \fI\\mW2power\fP .br \fI\\dump_caps\fP .SH EXAMPLES Start \fBrigctld\fP for a Yaesu FT-920 using a USB-to-serial adapter and backgrounding on Linux: .PP $ rigctld -m 114 -r /dev/ttyUSB1 & .PP Start \fBrigctld\fP for a Yaesu FT-920 using a USB to serial adapter while setting baud rate and stop bits, and backgrounding: .PP $ rigctld -m 114 -r /dev/ttyUSB1 -s 4800 -C stop_bits=2 & .PP Start \fBrigctld\fP for an Elecraft K3 using COM2 on Win32 and specifying the listening address and port: .sp C:\\> rigctld -m 229 -r COM2 -T 127.0.0.1 -t 4532 .sp Connect to the already running \fBrigctld\fP, and set current frequency to 14.266 MHz with a 1 second read timeout using the default protocol from the shell prompt on POSIX: .PP $ echo "\\set_freq 14266000" | nc -w 1 localhost 4532 .PP Connect to a running \fBrigctld\fP with \fBrigctl\fP on the local host on POSIX: .sp $ rigctl -m 2 .sp and on Win32: .sp C:\\> rigctl -m 2 -r 127.0.0.1:4532 .SH DIAGNOSTICS The \fB-v\fP, \fB--verbose\fP, option allows different levels of diagnostics to be output to \fBstderr\fP and correspond to -v for BUG, -vv for ERR, -vvv for WARN, -vvvv for VERBOSE, or -vvvvv for TRACE. .PP A given verbose level is useful for providing needed debugging information to the email address below. For example, TRACE output shows all of the values sent to and received from the radio which is very useful for radio backend library development and may be requested by the developers. See the \fBREADME.betatester\fP and \fBREADME.developer\fP files for more information. .SH SECURITY No authentication whatsoever; DO NOT leave this TCP port open wide to the Internet. Please ask if stronger security is needed or consider using an SSH tunnel. .PP As \fBrigctld\fP does not need any greater permissions than \fBrigctl\fP, it is advisable to not start \fBrigctld\fP as \fIroot\fP or another system user account in order to limit any vulnerability. .SH BUGS The daemon is not detaching and backgrounding itself. .PP Much testing needs to be done. .SH REPORTING BUGS Report bugs to . .PP We are already aware of the bugs in the previous section :-) .SH AUTHORS Written by Stephane Fillod, Nate Bargmann, and the Hamlib Group .PP . .SH COPYRIGHT Copyright \(co 2000-2010 Stephane Fillod .br Copyright \(co 2011-2012 Nate Bargmann .br Copyright \(co 2000-2010 the Hamlib Group. .PP This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .SH SEE ALSO .BR rigctl (1), .BR hamlib (3) hamlib-1.2.15.3/tests/rigctl_parse.h0000644000175000017500000000267212044564477014133 00000000000000/* * rigctl_parse.h - (C) Stephane Fillod 2000-2010 * * This program test/control a radio using Hamlib. * It takes commands in interactive mode as well as * from command line options. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifndef RIGCTL_PARSE_H #define RIGCTL_PARSE_H #include #include /* * external prototype */ int dumpcaps (RIG *, FILE *); int dumpconf (RIG *, FILE *); /* * Prototypes */ void usage_rig(FILE *); void version(); void list_models(); int dump_chan(FILE *, RIG*, channel_t*); int print_conf_list(const struct confparams *cfp, rig_ptr_t data); int set_conf(RIG *my_rig, char *conf_parms); int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc); #endif /* RIGCTL_PARSE_H */ hamlib-1.2.15.3/tests/rigctld.c0000644000175000017500000003425312044564477013100 00000000000000/* * rigctld.c - (C) Stephane Fillod 2000-2011 * * This program test/control a radio using Hamlib. * It takes commands from network connection. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include /* See NOTES */ #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #elif HAVE_WS2TCPIP_H #include #include #endif #ifdef HAVE_NETDB_H #include #endif #ifdef HAVE_PTHREAD #include #endif #include #include "misc.h" #include "iofunc.h" #include "serial.h" #include "sprintflst.h" #include "rigctl_parse.h" /* * Reminder: when adding long options, * keep up to date SHORT_OPTIONS, usage()'s output and man page. thanks. * NB: do NOT use -W since it's reserved by POSIX. * TODO: add an option to read from a file */ #define SHORT_OPTIONS "m:r:p:d:P:D:s:c:T:t:C:lLuoevhV" static struct option long_options[] = { {"model", 1, 0, 'm'}, {"rig-file", 1, 0, 'r'}, {"ptt-file", 1, 0, 'p'}, {"dcd-file", 1, 0, 'd'}, {"ptt-type", 1, 0, 'P'}, {"dcd-type", 1, 0, 'D'}, {"serial-speed",1, 0, 's'}, {"civaddr", 1, 0, 'c'}, {"listen-addr", 1, 0, 'T'}, {"port", 1, 0, 't'}, {"set-conf", 1, 0, 'C'}, {"list", 0, 0, 'l'}, {"show-conf", 0, 0, 'L'}, {"dump-caps", 0, 0, 'u'}, {"vfo", 0, 0, 'o'}, {"end-marker", 0, 0, 'e'}, {"verbose", 0, 0, 'v'}, {"help", 0, 0, 'h'}, {"version", 0, 0, 'V'}, {0, 0, 0, 0} }; struct handle_data { RIG *rig; int sock; struct sockaddr_in cli_addr; socklen_t clilen; }; void * handle_socket(void * arg); void usage(void); int interactive = 1; /* no cmd because of daemon */ int prompt = 0; /* Daemon mode for rigparse return string */ int opt_end = 0; /* END marker for rigctld */ int vfo_mode = 0; /* vfo_mode=0 means target VFO is current VFO */ char send_cmd_term = '\r'; /* send_cmd termination char */ const char *portno = "4532"; const char *src_addr = NULL; /* INADDR_ANY */ #define MAXCONFLEN 128 int main (int argc, char *argv[]) { RIG *my_rig; /* handle to rig (instance) */ rig_model_t my_model = RIG_MODEL_DUMMY; int retcode; /* generic return code from functions */ int verbose = 0; int show_conf = 0; int dump_caps_opt = 0; const char *rig_file=NULL, *ptt_file=NULL, *dcd_file=NULL; ptt_type_t ptt_type = RIG_PTT_NONE; dcd_type_t dcd_type = RIG_DCD_NONE; int serial_rate = 0; char *civaddr = NULL; /* NULL means no need to set conf */ char conf_parms[MAXCONFLEN] = ""; struct addrinfo hints, *result; int sock_listen; int reuseaddr = 1; while(1) { int c; int option_index = 0; c = getopt_long (argc, argv, SHORT_OPTIONS, long_options, &option_index); if (c == -1) break; switch(c) { case 'h': usage(); exit(0); case 'V': version(); exit(0); case 'm': if (!optarg) { usage(); /* wrong arg count */ exit(1); } my_model = atoi(optarg); break; case 'r': if (!optarg) { usage(); /* wrong arg count */ exit(1); } rig_file = optarg; break; case 'p': if (!optarg) { usage(); /* wrong arg count */ exit(1); } ptt_file = optarg; break; case 'd': if (!optarg) { usage(); /* wrong arg count */ exit(1); } dcd_file = optarg; break; case 'P': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (!strcmp(optarg, "RIG")) ptt_type = RIG_PTT_RIG; else if (!strcmp(optarg, "DTR")) ptt_type = RIG_PTT_SERIAL_DTR; else if (!strcmp(optarg, "RTS")) ptt_type = RIG_PTT_SERIAL_RTS; else if (!strcmp(optarg, "PARALLEL")) ptt_type = RIG_PTT_PARALLEL; else if (!strcmp(optarg, "CM108")) ptt_type = RIG_PTT_CM108; else if (!strcmp(optarg, "NONE")) ptt_type = RIG_PTT_NONE; else ptt_type = atoi(optarg); break; case 'D': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (!strcmp(optarg, "RIG")) dcd_type = RIG_DCD_RIG; else if (!strcmp(optarg, "DSR")) dcd_type = RIG_DCD_SERIAL_DSR; else if (!strcmp(optarg, "CTS")) dcd_type = RIG_DCD_SERIAL_CTS; else if (!strcmp(optarg, "CD")) dcd_type = RIG_DCD_SERIAL_CAR; else if (!strcmp(optarg, "PARALLEL")) dcd_type = RIG_DCD_PARALLEL; else if (!strcmp(optarg, "NONE")) dcd_type = RIG_DCD_NONE; else dcd_type = atoi(optarg); break; case 'c': if (!optarg) { usage(); /* wrong arg count */ exit(1); } civaddr = optarg; break; case 's': if (!optarg) { usage(); /* wrong arg count */ exit(1); } serial_rate = atoi(optarg); break; case 'C': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (*conf_parms != '\0') strcat(conf_parms, ","); strncat(conf_parms, optarg, MAXCONFLEN-strlen(conf_parms)); break; case 't': if (!optarg) { usage(); /* wrong arg count */ exit(1); } portno = optarg; break; case 'T': if (!optarg) { usage(); /* wrong arg count */ exit(1); } src_addr = optarg; break; case 'o': vfo_mode++; break; case 'v': verbose++; break; case 'L': show_conf++; break; case 'l': list_models(); exit(0); case 'u': dump_caps_opt++; break; case 'e': opt_end++; fprintf(stderr, "-e|--end-marker option is deprecated!\nPlease consider using the Extended Response protocol instead.\n"); break; default: usage(); /* unknown option? */ exit(1); } } rig_set_debug(verbose); rig_debug(RIG_DEBUG_VERBOSE, "rigctld, %s\n", hamlib_version); rig_debug(RIG_DEBUG_VERBOSE, "Report bugs to " "\n\n"); my_rig = rig_init(my_model); if (!my_rig) { fprintf(stderr, "Unknown rig num %d, or initialization error.\n", my_model); fprintf(stderr, "Please check with --list option.\n"); exit(2); } retcode = set_conf(my_rig, conf_parms); if (retcode != RIG_OK) { fprintf(stderr, "Config parameter error: %s\n", rigerror(retcode)); exit(2); } if (rig_file) strncpy(my_rig->state.rigport.pathname, rig_file, FILPATHLEN - 1); /* * ex: RIG_PTT_PARALLEL and /dev/parport0 */ if (ptt_type != RIG_PTT_NONE) my_rig->state.pttport.type.ptt = ptt_type; if (dcd_type != RIG_DCD_NONE) my_rig->state.dcdport.type.dcd = dcd_type; if (ptt_file) strncpy(my_rig->state.pttport.pathname, ptt_file, FILPATHLEN - 1); if (dcd_file) strncpy(my_rig->state.dcdport.pathname, dcd_file, FILPATHLEN - 1); /* FIXME: bound checking and port type == serial */ if (serial_rate != 0) my_rig->state.rigport.parm.serial.rate = serial_rate; if (civaddr) rig_set_conf(my_rig, rig_token_lookup(my_rig, "civaddr"), civaddr); /* * print out conf parameters */ if (show_conf) { rig_token_foreach(my_rig, print_conf_list, (rig_ptr_t)my_rig); } /* * print out conf parameters, and exits immediately * We may be interested only in only caps, and rig_open may fail. */ if (dump_caps_opt) { dumpcaps(my_rig, stdout); rig_cleanup(my_rig); /* if you care about memory */ exit(0); } retcode = rig_open(my_rig); if (retcode != RIG_OK) { fprintf(stderr,"rig_open: error = %s \n", rigerror(retcode)); exit(2); } if (verbose > 0) printf("Opened rig model %d, '%s'\n", my_rig->caps->rig_model, my_rig->caps->model_name); rig_debug(RIG_DEBUG_VERBOSE, "Backend version: %s, Status: %s\n", my_rig->caps->version, rig_strstatus(my_rig->caps->status)); #ifdef __MINGW32__ # ifndef SO_OPENTYPE # define SO_OPENTYPE 0x7008 # endif # ifndef SO_SYNCHRONOUS_NONALERT # define SO_SYNCHRONOUS_NONALERT 0x20 # endif # ifndef INVALID_SOCKET # define INVALID_SOCKET -1 # endif WSADATA wsadata; if (WSAStartup(MAKEWORD(1,1), &wsadata) == SOCKET_ERROR) { fprintf(stderr,"WSAStartup socket error\n"); exit(1); } int sockopt = SO_SYNCHRONOUS_NONALERT; setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *)&sockopt, sizeof(sockopt)); #endif /* * Prepare listening socket */ memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ hints.ai_socktype = SOCK_STREAM;/* TCP socket */ hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */ hints.ai_protocol = 0; /* Any protocol */ retcode = getaddrinfo(src_addr, portno, &hints, &result); if (retcode != 0) { fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(retcode)); exit(2); } sock_listen = socket(result->ai_family, result->ai_socktype, result->ai_protocol); if (sock_listen < 0) { perror("ERROR opening socket"); exit(2); } if (setsockopt(sock_listen, SOL_SOCKET, SO_REUSEADDR, (char *)&reuseaddr, sizeof(reuseaddr)) < 0) { rig_debug(RIG_DEBUG_ERR, "setsockopt: %s\n", strerror(errno)); exit (1); } if (bind(sock_listen, result->ai_addr, result->ai_addrlen) < 0) { rig_debug(RIG_DEBUG_ERR, "binding: %s\n", strerror(errno)); exit (1); } freeaddrinfo(result); /* No longer needed */ if (listen(sock_listen, 4) < 0) { rig_debug(RIG_DEBUG_ERR, "listening: %s\n", strerror(errno)); exit (1); } /* * main loop accepting connections */ do { #ifdef HAVE_PTHREAD pthread_t thread; pthread_attr_t attr; #endif struct handle_data *arg; arg = malloc(sizeof(struct handle_data)); if (!arg) { rig_debug(RIG_DEBUG_ERR, "malloc: %s\n", strerror(errno)); exit (1); } arg->rig = my_rig; arg->clilen = sizeof(arg->cli_addr); arg->sock = accept(sock_listen, (struct sockaddr *)&arg->cli_addr, &arg->clilen); if (arg->sock < 0) { rig_debug(RIG_DEBUG_ERR, "accept: %s\n", strerror(errno)); break; } rig_debug(RIG_DEBUG_VERBOSE, "Connection opened from %s:%d\n", inet_ntoa(arg->cli_addr.sin_addr), ntohs(arg->cli_addr.sin_port)); #ifdef HAVE_PTHREAD pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); retcode = pthread_create(&thread, &attr, handle_socket, arg); if (retcode != 0) { rig_debug(RIG_DEBUG_ERR, "pthread_create: %s\n", strerror(retcode)); break; } #else handle_socket(arg); #endif } while (retcode == 0); rig_close(my_rig); /* close port */ rig_cleanup(my_rig); /* if you care about memory */ #ifdef __MINGW32__ WSACleanup(); #endif return 0; } /* * This is the function run by the threads */ void * handle_socket(void *arg) { struct handle_data *handle_data_arg = (struct handle_data *)arg; FILE *fsockin; FILE *fsockout; int retcode; #ifdef __MINGW32__ int sock_osfhandle = _open_osfhandle(handle_data_arg->sock, _O_RDONLY); if (sock_osfhandle == -1) { rig_debug(RIG_DEBUG_ERR, "_open_osfhandle error: %s\n", strerror(errno)); goto handle_exit; } fsockin = _fdopen(sock_osfhandle, "rb"); #else fsockin = fdopen(handle_data_arg->sock, "rb"); #endif if (!fsockin) { rig_debug(RIG_DEBUG_ERR, "fdopen in: %s\n", strerror(errno)); goto handle_exit; } #ifdef __MINGW32__ fsockout = _fdopen(sock_osfhandle, "wb"); #else fsockout = fdopen(handle_data_arg->sock, "wb"); #endif if (!fsockout) { rig_debug(RIG_DEBUG_ERR, "fdopen out: %s\n", strerror(errno)); fclose(fsockin); goto handle_exit; } do { retcode = rigctl_parse(handle_data_arg->rig, fsockin, fsockout, NULL, 0); if (ferror(fsockin) || ferror(fsockout)) retcode = 1; } while (retcode == 0 || retcode == 2); rig_debug(RIG_DEBUG_VERBOSE, "Connection closed from %s:%d\n", inet_ntoa(handle_data_arg->cli_addr.sin_addr), ntohs(handle_data_arg->cli_addr.sin_port)); fclose(fsockin); fclose(fsockout); handle_exit: #ifdef __MINGW32__ closesocket(handle_data_arg->sock); #else close(handle_data_arg->sock); #endif free(arg); #ifdef HAVE_PTHREAD pthread_exit(NULL); #endif return NULL; } void usage(void) { printf("Usage: rigctld [OPTION]...\n" "Daemon serving COMMANDs to a connected radio transceiver or receiver.\n\n"); printf( " -m, --model=ID select radio model number. See model list\n" " -r, --rig-file=DEVICE set device of the radio to operate on\n" " -p, --ptt-file=DEVICE set device of the PTT device to operate on\n" " -d, --dcd-file=DEVICE set device of the DCD device to operate on\n" " -P, --ptt-type=TYPE set type of the PTT device to operate on\n" " -D, --dcd-type=TYPE set type of the DCD device to operate on\n" " -s, --serial-speed=BAUD set serial speed of the serial port\n" " -c, --civaddr=ID set CI-V address, decimal (for Icom rigs only)\n" " -t, --port=NUM set TCP listening port, default %s\n" " -T, --listen-addr=IPADDR set listening IP address, default ANY\n" " -C, --set-conf=PARM=VAL set config parameters\n" " -L, --show-conf list all config parameters\n" " -l, --list list all model numbers and exit\n" " -u, --dump-caps dump capabilities and exit\n" " -o, --vfo do not default to VFO_CURR, require extra vfo arg\n" " -e, --end-marker use END marker in rigctld protocol (obsolete)\n" " -v, --verbose set verbose mode, cumulative\n" " -h, --help display this help and exit\n" " -V, --version output version information and exit\n\n", portno ); usage_rig(stdout); printf("\nReport bugs to .\n"); } hamlib-1.2.15.3/tests/rigswr.c0000644000175000017500000001645512044564477012771 00000000000000/* * rigswr.c - (C) Stephane Fillod and Thierry Leconte 2004 * * This program output swr curve value * using Hamlib. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include "misc.h" /* * Prototypes */ static void usage(); static void version(); static int set_conf(RIG *rig, char *conf_parms); /* * Reminder: when adding long options, * keep up to date SHORT_OPTIONS, usage()'s output and man page. thanks. * NB: do NOT use -W since it's reserved by POSIX. */ #define SHORT_OPTIONS "m:r:s:c:C:p:P:vhV" static struct option long_options[] = { {"model", 1, 0, 'm'}, {"rig-file", 1, 0, 'r'}, {"serial-speed", 1, 0, 's'}, {"civaddr", 1, 0, 'c'}, {"set-conf", 1, 0, 'C'}, {"ptt-file", 1, 0, 'p'}, {"ptt-type", 1, 0, 'P'}, {"verbose", 0, 0, 'v'}, {"help", 0, 0, 'h'}, {"version", 0, 0, 'V'}, {0, 0, 0, 0} }; #define MAXCONFLEN 128 int main (int argc, char *argv[]) { RIG *rig; /* handle to rig (nstance) */ rig_model_t my_model = RIG_MODEL_DUMMY; int retcode; /* generic return code from functions */ int verbose = 0; const char *rig_file=NULL, *ptt_file=NULL; ptt_type_t ptt_type = RIG_PTT_NONE; int serial_rate = 0; char *civaddr = NULL; /* NULL means no need to set conf */ char conf_parms[MAXCONFLEN] = ""; freq_t freq,freqstop; freq_t step=kHz(100); value_t pwr; while(1) { int c; int option_index = 0; c = getopt_long (argc, argv, SHORT_OPTIONS, long_options, &option_index); if (c == -1) break; switch(c) { case 'h': usage(); exit(0); case 'V': version(); exit(0); case 'm': if (!optarg) { usage(); /* wrong arg count */ exit(1); } my_model = atoi(optarg); break; case 'r': if (!optarg) { usage(); /* wrong arg count */ exit(1); } rig_file = optarg; break; case 'c': if (!optarg) { usage(); /* wrong arg count */ exit(1); } civaddr = optarg; break; case 's': if (!optarg) { usage(); /* wrong arg count */ exit(1); } serial_rate = atoi(optarg); break; case 'C': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (*conf_parms != '\0') strcat(conf_parms, ","); strncat(conf_parms, optarg, MAXCONFLEN-strlen(conf_parms)); break; case 'p': if (!optarg) { usage(); /* wrong arg count */ exit(1); } ptt_file = optarg; break; case 'P': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (!strcmp(optarg, "RIG")) ptt_type = RIG_PTT_RIG; else if (!strcmp(optarg, "DTR")) ptt_type = RIG_PTT_SERIAL_DTR; else if (!strcmp(optarg, "RTS")) ptt_type = RIG_PTT_SERIAL_RTS; else if (!strcmp(optarg, "PARALLEL")) ptt_type = RIG_PTT_PARALLEL; else if (!strcmp(optarg, "NONE")) ptt_type = RIG_PTT_NONE; else ptt_type = atoi(optarg); break; case 'v': verbose++; break; default: usage(); /* unknown option? */ exit(1); } } rig_set_debug(verbose<2 ? RIG_DEBUG_WARN: verbose); rig_debug(RIG_DEBUG_VERBOSE, "rigswr, %s\n", hamlib_version); rig_debug(RIG_DEBUG_VERBOSE, "Report bugs to " "\n\n"); if (optind+1 >= argc) { usage(); exit(1); } rig = rig_init(my_model); if (!rig) { fprintf(stderr, "Unknown rig num %d, or initialization error.\n", my_model); fprintf(stderr, "Please check with --list option.\n"); exit(2); } retcode = set_conf(rig, conf_parms); if (retcode != RIG_OK) { fprintf(stderr, "Config parameter error: %s\n", rigerror(retcode)); exit(2); } if (ptt_type != RIG_PTT_NONE) rig->state.pttport.type.ptt = ptt_type; if (ptt_file) strncpy(rig->state.pttport.pathname, ptt_file, FILPATHLEN - 1); if (rig_file) strncpy(rig->state.rigport.pathname, rig_file, FILPATHLEN - 1); /* FIXME: bound checking and port type == serial */ if (serial_rate != 0) rig->state.rigport.parm.serial.rate = serial_rate; if (civaddr) rig_set_conf(rig, rig_token_lookup(rig, "civaddr"), civaddr); if(!rig_has_get_level(rig,RIG_LEVEL_SWR) || rig->state.pttport.type.ptt == RIG_PTT_NONE) { fprintf(stderr,"rig backend for %s could not get SWR" "or has unsufficient capability\nSorry\n", rig->caps->model_name); exit(3); } retcode = rig_open(rig); if (retcode != RIG_OK) { fprintf(stderr,"rig_open: error = %s \n", rigerror(retcode)); exit(2); } if (verbose > 0) printf("Opened rig model %d, '%s'\n", rig->caps->rig_model, rig->caps->model_name); freq=atof(argv[optind++]); freqstop=atof(argv[optind++]); if (optind < argc) step=atof(argv[optind]); rig_set_freq(rig,RIG_VFO_CURR,freq); rig_set_mode(rig,RIG_VFO_CURR,RIG_MODE_CW,RIG_PASSBAND_NORMAL); pwr.f = 0.25; /* 25% of RF POWER */ rig_set_level(rig,RIG_VFO_CURR,RIG_LEVEL_RFPOWER,pwr); while(freq<=freqstop) { value_t swr; rig_set_ptt(rig,RIG_VFO_CURR,RIG_PTT_ON); usleep(500000); rig_get_level(rig,RIG_VFO_CURR,RIG_LEVEL_SWR,&swr); rig_set_ptt(rig,RIG_VFO_CURR,RIG_PTT_OFF); printf("%10.0f %4.2f\n",freq,swr.f); freq+=step; rig_set_freq(rig,RIG_VFO_CURR,freq); } rig_close(rig); return 0; } void version() { printf("rigswr, %s\n\n", hamlib_version); printf("%s\n", hamlib_copyright); } void usage() { printf("Usage: rigswr [OPTION]... start_freq stop_freq [freq_step]\n" "Output SWR vs Frequency.\n\n"); printf( " -m, --model=ID select radio model number. See model list\n" " -r, --rig-file=DEVICE set device of the radio to operate on\n" " -s, --serial-speed=BAUD set serial speed of the serial port\n" " -c, --civaddr=ID set CI-V address, decimal (for Icom rigs only)\n" " -C, --set-conf=PARM=VAL set config parameters\n" " -p, --ptt-file=DEVICE set device of the PTT device to operate on\n" " -P, --ptt-type=TYPE set type of the PTT device to operate on\n" " -v, --verbose set verbose mode, cumulative\n" " -h, --help display this help and exit\n" " -V, --version output version information and exit\n\n" ); printf("\nReport bugs to .\n"); } int set_conf(RIG *rig, char *conf_parms) { char *p, *q, *n; int ret; p = conf_parms; while (p && *p != '\0') { /* FIXME: left hand value of = cannot be null */ q = strchr(p, '='); if ( !q ) return RIG_EINVAL; *q++ = '\0'; n = strchr(q, ','); if (n) *n++ = '\0'; ret = rig_set_conf(rig, rig_token_lookup(rig, p), q); if (ret != RIG_OK) return ret; p = n; } return RIG_OK; } hamlib-1.2.15.3/tests/memload.c0000644000175000017500000001536612044564477013072 00000000000000/* * memload.c - Copyright (C) 2003 Thierry Leconte * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include "misc.h" #ifdef HAVE_XML2 #include #include static int set_chan(RIG *rig, channel_t *chan ,xmlNodePtr node); #endif int xml_load (RIG *my_rig, const char *infilename) { #ifdef HAVE_XML2 xmlDocPtr Doc; xmlNodePtr node; /* load xlm Doc */ Doc=xmlParseFile(infilename); if(Doc==NULL) { fprintf(stderr,"xmlParse failed\n"); exit(2); } node=xmlDocGetRootElement(Doc); if (node == NULL) { fprintf(stderr,"get root failed\n"); exit(2); } if(strcmp((char *) node->name, "hamlib")) { fprintf(stderr,"no hamlib tag found\n"); exit(2); } for(node=node->xmlChildrenNode;node!=NULL;node=node->next) { if(xmlNodeIsText(node)) continue; if(strcmp((char *) node->name, "channels")==0) break; } if(node==NULL) { fprintf(stderr,"no channels\n"); exit(2); } for(node=node->xmlChildrenNode;node!=NULL;node=node->next) { channel_t chan; int status; if(xmlNodeIsText(node)) continue; set_chan(my_rig,&chan,node); status=rig_set_channel(my_rig, &chan); if (status != RIG_OK ) { printf("rig_get_channel: error = %s \n", rigerror(status)); return status; } } xmlFreeDoc(Doc); xmlCleanupParser(); return 0; #else return -RIG_ENAVAIL; #endif } int xml_parm_load (RIG *my_rig, const char *infilename) { return -RIG_ENIMPL; } #ifdef HAVE_XML2 int set_chan(RIG *rig, channel_t *chan, xmlNodePtr node) { xmlChar *prop; int i,n; memset(chan,0,sizeof(channel_t)); chan->vfo = RIG_VFO_MEM; prop=xmlGetProp(node,(unsigned char *) "num"); if(prop==NULL) { fprintf(stderr,"no num\n"); return -1; } n=chan->channel_num = atoi((char *) prop); /* find chanel caps */ for(i=0;istate.chan_list[i].start<=n && rig->state.chan_list[i].end>=n) break; fprintf(stderr,"node %d %d\n",n,i); if (rig->state.chan_list[i].mem_caps.bank_num) { prop=xmlGetProp(node, (unsigned char *) "bank_num"); if(prop!=NULL) chan->bank_num = atoi((char *) prop); } if (rig->state.chan_list[i].mem_caps.channel_desc) { prop=xmlGetProp(node, (unsigned char *) "channel_desc"); if(prop!=NULL) strncpy(chan->channel_desc, (char *) prop, 7); } if (rig->state.chan_list[i].mem_caps.ant) { prop=xmlGetProp(node, (unsigned char *) "ant"); if(prop!=NULL) chan->ant = atoi((char *) prop); } if (rig->state.chan_list[i].mem_caps.freq) { prop=xmlGetProp(node, (unsigned char *) "freq"); if(prop!=NULL) sscanf((char *) prop,"%"SCNfreq,&chan->freq); } if (rig->state.chan_list[i].mem_caps.mode) { prop=xmlGetProp(node, (unsigned char *) "mode"); if(prop!=NULL) chan->mode = rig_parse_mode((char *) prop); } if (rig->state.chan_list[i].mem_caps.width) { prop=xmlGetProp(node, (unsigned char *) "width"); if(prop!=NULL) chan->width = atoi((char *) prop); } if (rig->state.chan_list[i].mem_caps.tx_freq) { prop=xmlGetProp(node, (unsigned char *) "tx_freq"); if(prop!=NULL) sscanf((char *) prop,"%"SCNfreq,&chan->tx_freq); } if (rig->state.chan_list[i].mem_caps.tx_mode) { prop=xmlGetProp(node, (unsigned char *)"tx_mode"); if(prop!=NULL) chan->tx_mode = rig_parse_mode((char *) prop); } if (rig->state.chan_list[i].mem_caps.tx_width) { prop=xmlGetProp(node, (unsigned char *)"tx_width"); if(prop!=NULL) chan->tx_width = atoi((char *) prop); } if (rig->state.chan_list[i].mem_caps.split) { chan->split=RIG_SPLIT_OFF; prop=xmlGetProp(node, (unsigned char *)"split"); if(prop!=NULL) { if(strcmp((char *) prop,"on")==0) { chan->split=RIG_SPLIT_ON; if (rig->state.chan_list[i].mem_caps.tx_vfo) { prop=xmlGetProp(node, (unsigned char *)"tx_vfo"); if(prop!=NULL) sscanf((char *) prop,"%x",&chan->tx_vfo); } } } } if (rig->state.chan_list[i].mem_caps.rptr_shift) { prop=xmlGetProp(node, (unsigned char *)"rptr_shift"); if(prop) switch(prop[0]) { case '=': chan->rptr_shift=RIG_RPT_SHIFT_NONE; break; case '+': chan->rptr_shift=RIG_RPT_SHIFT_PLUS; break; case '-': chan->rptr_shift=RIG_RPT_SHIFT_MINUS; break; } if (rig->state.chan_list[i].mem_caps.rptr_offs && chan->rptr_shift!=RIG_RPT_SHIFT_NONE) { prop=xmlGetProp(node, (unsigned char *)"rptr_offs"); if(prop!=NULL) chan->rptr_offs = atoi((char *) prop); } } if (rig->state.chan_list[i].mem_caps.tuning_step) { prop=xmlGetProp(node, (unsigned char *)"tuning_step"); if(prop!=NULL) chan->tuning_step = atoi((char *) prop); } if (rig->state.chan_list[i].mem_caps.rit) { prop=xmlGetProp(node, (unsigned char *)"rit"); if(prop!=NULL) chan->rit = atoi((char *) prop); } if (rig->state.chan_list[i].mem_caps.xit) { prop=xmlGetProp(node, (unsigned char *)"xit"); if(prop!=NULL) chan->xit = atoi((char *) prop); } if (rig->state.chan_list[i].mem_caps.funcs) { prop=xmlGetProp(node, (unsigned char *)"funcs"); if(prop!=NULL) sscanf((char *) prop,"%lx",&chan->funcs); } if (rig->state.chan_list[i].mem_caps.ctcss_tone) { prop=xmlGetProp(node, (unsigned char *)"ctcss_tone"); if(prop!=NULL) chan->ctcss_tone = atoi((char *) prop); } if (rig->state.chan_list[i].mem_caps.ctcss_sql) { prop=xmlGetProp(node, (unsigned char *)"ctcss_sql"); if(prop!=NULL) chan->ctcss_sql = atoi((char *) prop); } if (rig->state.chan_list[i].mem_caps.dcs_code) { prop=xmlGetProp(node, (unsigned char *)"dcs_code"); if(prop!=NULL) chan->dcs_code = atoi((char *) prop); } if (rig->state.chan_list[i].mem_caps.dcs_sql) { prop=xmlGetProp(node, (unsigned char *)"dcs_sql"); if(prop!=NULL) chan->dcs_sql = atoi((char *) prop); } if (rig->state.chan_list[i].mem_caps.scan_group) { prop=xmlGetProp(node, (unsigned char *)"scan_group"); if(prop!=NULL) chan->scan_group = atoi((char *) prop); } if (rig->state.chan_list[i].mem_caps.flags) { prop=xmlGetProp(node, (unsigned char *)"flags"); if(prop!=NULL) sscanf((char *) prop,"%x",&chan->flags); } return 0; } #endif hamlib-1.2.15.3/tests/sprintflst.h0000644000175000017500000000303512044564477013657 00000000000000/* * Hamlib Interface - sprintf toolbox header * Copyright (c) 2003-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _SPRINTFLST_H #define _SPRINTFLST_H 1 #include #define SPRINTF_MAX_SIZE 256 __BEGIN_DECLS extern int sprintf_mode(char *str, rmode_t); extern int sprintf_vfo(char *str, vfo_t); extern int sprintf_func(char *str, setting_t); extern int sprintf_level(char *str, setting_t); extern int sprintf_level_ext(char *str, const struct confparams *); extern int sprintf_level_gran(char *str, setting_t, const gran_t gran[]); extern int sprintf_parm(char *str, setting_t); extern int sprintf_parm_gran(char *str, setting_t, const gran_t gran[]); extern int sprintf_vfop(char *str, vfo_op_t); extern int sprintf_scan(char *str, scan_t); __END_DECLS #endif /* _SPRINTFLST_H */ hamlib-1.2.15.3/tests/rigmem.c0000644000175000017500000002233012044564477012721 00000000000000/* * rigmem.c - (C) Thierry Leconte 2003-2005 * (C) Stephane Fillod 2003-2009 * * This program exercises the backup and restore of a radio * using Hamlib. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include "misc.h" #include "sprintflst.h" #define MAXNAMSIZ 32 #define MAXNBOPT 100 /* max number of different options */ /* * external prototype */ extern int xml_save (RIG *rig, const char *outfilename); extern int xml_load (RIG *rig, const char *infilename); extern int xml_parm_save (RIG *rig, const char *outfilename); extern int xml_parm_load (RIG *rig, const char *infilename); extern int csv_save (RIG *rig, const char *outfilename); extern int csv_load (RIG *rig, const char *infilename); extern int csv_parm_save (RIG *rig, const char *outfilename); extern int csv_parm_load (RIG *rig, const char *infilename); /* * Prototypes */ void usage(); void version(); int set_conf(RIG *rig, char *conf_parms); int clear_chans (RIG *rig, const char *infilename); /* * Reminder: when adding long options, * keep up to date SHORT_OPTIONS, usage()'s output and man page. thanks. * NB: do NOT use -W since it's reserved by POSIX. */ #define SHORT_OPTIONS "m:r:s:c:C:p:axvhV" static struct option long_options[] = { {"model", 1, 0, 'm'}, {"rig-file", 1, 0, 'r'}, {"serial-speed", 1, 0, 's'}, {"civaddr", 1, 0, 'c'}, {"set-conf", 1, 0, 'C'}, {"set-separator", 1, 0, 'p'}, {"all", 0, 0, 'a'}, #ifdef HAVE_XML2 {"xml", 0, 0, 'x'}, #endif {"verbose", 0, 0, 'v'}, {"help", 0, 0, 'h'}, {"version", 0, 0, 'V'}, {0, 0, 0, 0} }; #define MAXCONFLEN 128 int all; int main (int argc, char *argv[]) { RIG *rig; /* handle to rig (nstance) */ rig_model_t my_model = RIG_MODEL_DUMMY; int retcode; /* generic return code from functions */ int verbose = 0, xml = 0; const char *rig_file=NULL; int serial_rate = 0; char *civaddr = NULL; /* NULL means no need to set conf */ char conf_parms[MAXCONFLEN] = ""; extern char csv_sep; while(1) { int c; int option_index = 0; c = getopt_long (argc, argv, SHORT_OPTIONS, long_options, &option_index); if (c == -1) break; switch(c) { case 'h': usage(); exit(0); case 'V': version(); exit(0); case 'm': if (!optarg) { usage(); /* wrong arg count */ exit(1); } my_model = atoi(optarg); break; case 'r': if (!optarg) { usage(); /* wrong arg count */ exit(1); } rig_file = optarg; break; case 'c': if (!optarg) { usage(); /* wrong arg count */ exit(1); } civaddr = optarg; break; case 's': if (!optarg) { usage(); /* wrong arg count */ exit(1); } serial_rate = atoi(optarg); break; case 'C': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (*conf_parms != '\0') strcat(conf_parms, ","); strncat(conf_parms, optarg, MAXCONFLEN-strlen(conf_parms)); break; case 'p': if (!optarg) { usage(); /* wrong arg count */ exit(1); } csv_sep = optarg[0]; break; case 'a': all++; break; #ifdef HAVE_XML2 case 'x': xml++; break; #endif case 'v': verbose++; break; default: usage(); /* unknown option? */ exit(1); } } rig_set_debug(verbose<2 ? RIG_DEBUG_WARN: verbose); rig_debug(RIG_DEBUG_VERBOSE, "rigmem, %s\n", hamlib_version); rig_debug(RIG_DEBUG_VERBOSE, "Report bugs to " "\n\n"); if (optind+1 >= argc) { usage(); exit(1); } rig = rig_init(my_model); if (!rig) { fprintf(stderr, "Unknown rig num %d, or initialization error.\n", my_model); fprintf(stderr, "Please check with --list option.\n"); exit(2); } retcode = set_conf(rig, conf_parms); if (retcode != RIG_OK) { fprintf(stderr, "Config parameter error: %s\n", rigerror(retcode)); exit(2); } /* check channel support */ if (rig->caps->set_channel == NULL && rig->caps->get_channel == NULL && rig->caps->set_chan_all_cb == NULL && rig->caps->get_chan_all_cb == NULL && (rig->caps->set_mem == NULL || rig->caps->set_vfo == NULL)) { fprintf(stderr, "Error: rig num %d has no memory support implemented/available.\n", my_model); exit(3); } /* check channel description */ if (rig->caps->chan_list[0].type == 0) { fprintf(stderr, "Error: rig num %d has no channel list.\n", my_model); exit(3); } if (rig_file) strncpy(rig->state.rigport.pathname, rig_file, FILPATHLEN - 1); /* FIXME: bound checking and port type == serial */ if (serial_rate != 0) rig->state.rigport.parm.serial.rate = serial_rate; if (civaddr) rig_set_conf(rig, rig_token_lookup(rig, "civaddr"), civaddr); retcode = rig_open(rig); if (retcode != RIG_OK) { fprintf(stderr,"rig_open: error = %s \n", rigerror(retcode)); exit(2); } if (verbose > 0) printf("Opened rig model %d, '%s'\n", rig->caps->rig_model, rig->caps->model_name); rig_debug(RIG_DEBUG_VERBOSE, "Backend version: %s, Status: %s\n", rig->caps->version, rig_strstatus(rig->caps->status)); /* on some rigs, this accelerates the backup/restore */ rig_set_vfo(rig, RIG_VFO_MEM); if (!strcmp(argv[optind], "save")) { if (xml) retcode = xml_save(rig, argv[optind+1]); else retcode = csv_save(rig, argv[optind+1]); } else if (!strcmp(argv[optind], "load")) { if (xml) retcode = xml_load(rig, argv[optind+1]); else retcode = csv_load(rig, argv[optind+1]); } else if (!strcmp(argv[optind], "save_parm")) { if (xml) retcode = xml_parm_save(rig, argv[optind+1]); else retcode = csv_parm_save(rig, argv[optind+1]); } else if (!strcmp(argv[optind], "load_parm")) { if (xml) retcode = xml_parm_load(rig, argv[optind+1]); else retcode = csv_parm_load(rig, argv[optind+1]); } else if (!strcmp(argv[optind], "clear")) { retcode = clear_chans(rig, argv[optind+1]); } else { usage(); exit(1); } rig_close(rig); /* close port */ rig_cleanup(rig); /* if you care about memory */ if (retcode != 0) { fprintf(stderr, "Hamlib error: %s\n", rigerror(retcode)); exit(2); } return 0; } void version() { printf("rigmem, %s\n\n", hamlib_version); printf("%s\n", hamlib_copyright); } void usage() { printf("Usage: rigmem [OPTION]... COMMAND...FILE\n" "Backup/restore COMMANDs to a connected radio transceiver or receiver.\n\n"); printf( " -m, --model=ID select radio model number. See model list\n" " -r, --rig-file=DEVICE set device of the radio to operate on\n" " -s, --serial-speed=BAUD set serial speed of the serial port\n" " -c, --civaddr=ID set CI-V address, decimal (for Icom rigs only)\n" " -C, --set-conf=PARM=VAL set config parameters\n" " -p, --set-separator=SEP set character separator instead of the CSV comma\n" " -a, --all bypass mem_caps, apply to all fields of channel_t\n" #ifdef HAVE_XML2 " -x, --xml use XML format instead of CSV\n" #endif " -v, --verbose set verbose mode, cumulative\n" " -h, --help display this help and exit\n" " -V, --version output version information and exit\n\n" ); printf( "COMMANDs:\n" " load\n" " save\n" " load_parm\n" " save_parm\n" " clear\n\n" ); printf("\nReport bugs to .\n"); } int set_conf(RIG *rig, char *conf_parms) { char *p, *q, *n; int ret; p = conf_parms; while (p && *p != '\0') { /* FIXME: left hand value of = cannot be null */ q = strchr(p, '='); if ( !q ) return RIG_EINVAL; *q++ = '\0'; n = strchr(q, ','); if (n) *n++ = '\0'; ret = rig_set_conf(rig, rig_token_lookup(rig, p), q); if (ret != RIG_OK) return ret; p = n; } return RIG_OK; } /* * Pretty nasty, clears everything you have in rig memory */ int clear_chans (RIG *rig, const char *infilename) { int i,j,ret; channel_t chan; memset(&chan, 0, sizeof(chan)); chan.freq = RIG_FREQ_NONE; chan.tx_freq = RIG_FREQ_NONE; chan.mode = RIG_MODE_NONE; chan.tx_mode = RIG_MODE_NONE; chan.vfo = RIG_VFO_MEM; for (i=0; rig->state.chan_list[i].type && i < CHANLSTSIZ; i++) { for (j = rig->state.chan_list[i].start; j <= rig->state.chan_list[i].end; j++) { chan.channel_num = j; ret = rig_set_channel(rig, &chan); if (ret != RIG_OK) { return ret; } } } return 0; } hamlib-1.2.15.3/tests/testrotctld.pl0000755000175000017500000005072312044564477014217 00000000000000#! /usr/bin/perl # testrotctld.pl - (C) 2008,2010 Nate Bargmann, n0nb@arrl.net # A Perl test script for the rotctld program. # # # It connects to the rotctld TCP port (default 4533) and queries the daemon # for some common rot information and sets some values. It also aims to # provide a bit of example code for Perl scripting. # # This program utilizes the Extended Response protocol of rotctld in line # response mode. See the rotctld(8) man page for details. ############################################################################# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU 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 General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # See the file 'COPYING' in the main Hamlib distribution directory for the # complete text of the GNU Public License version 2. # ############################################################################# # Perl modules this script uses use warnings; use strict; use IO::Socket; use Getopt::Long; use Pod::Usage; # Global variables my $socket; my $host = 'localhost'; my $port = 4533; my %rot_state = (); # State of the rotor--position, etc. my %rot_caps = (); # Rotor capabilities from \dump_caps my $man = 0; my $help = 0; my $debug = 0; my $user_in; my $ret_val; # Error values returned from rotctld by Hamlib name my %errstr = ( RIG_OK => "0", # No error, operation completed successfully RIG_EINVAL => "-1", # invalid parameter RIG_ECONF => "-2", # invalid configuration (serial,..) RIG_ENOMEM => "-3", # memory shortage RIG_ENIMPL => "-4", # function not implemented, but will be RIG_ETIMEOUT => "-5", # communication timed out RIG_EIO => "-6", # IO error, including open failed RIG_EINTERNAL => "-7", # Internal Hamlib error, huh?! RIG_EPROTO => "-8", # Protocol error RIG_ERJCTED => "-9", # Command rejected by the rot RIG_ETRUNC => "-10", # Command performed, but arg truncated RIG_ENAVAIL => "-11", # function not available RIG_ENTARGET => "-12", # VFO not targetable RIG_BUSERROR => "-13", # Error talking on the bus RIG_BUSBUSY => "-14", # Collision on the bus RIG_EARG => "-15", # NULL RIG handle or any invalid pointer parameter in get arg RIG_EVFO => "-16", # Invalid VFO RIG_EDOM => "-17", # Argument out of domain of func # testctld specific error values from -100 onward CTLD_OK => "-100", # testrotctld -- No error CTLD_ENIMPL => "-103", # testrotctld -- %rot_caps reports backend function not implemented CTLD_EPROTO => "-108", # testrotctld -- Echoed command mismatch or other error ); # Error values returned from rotctld by Hamlib value my %errval = reverse %errstr; # Rotor '\move' command token values my %direct = ( UP => '2', DOWN => '4', LEFT => '8', CCW => '8', # Synonym for LEFT RIGHT => '16', CW => '16', # Synonym for RIGHT ); ############################################################################# # Main program # ############################################################################# # Parse command line options argv_opts(); # Create the new socket. # 'localhost' may be replaced by any hostname or IP address where a # rotctld instance is running. # Timeout is set to 5 seconds. $socket = new IO::Socket::INET (PeerAddr => $host, PeerPort => $port, Proto => 'tcp', Type => SOCK_STREAM, Timeout => 5 ) or die $@; print "Welcome to testrotctld.pl a program to test `rotctld'\n"; print "Type '?' or 'help' for commands help.\n\n"; # Populate %rot_caps from \dump_caps $ret_val = dump_caps(); # Tell user what rotor rotctld is working with if ($ret_val eq $errstr{'RIG_OK'}) { print "Hamlib Model: " . $rot_caps{'Caps dump for model'} . "\t"; print "Common Name: " . $rot_caps{'Mfg name'} . ' ' . $rot_caps{'Model name'} . "\n\n\n"; } else { errmsg ($ret_val); } # Interactive loop do { print "rotctld command: "; chomp($user_in = <>); # P, \set_pos if ($user_in =~ /^(P|\\set_pos)\s+([-+]?([0-9]*\.)?[0-9]+)\s+([-+]?([0-9]*\.)?[0-9]+)\b$/) { if ($rot_caps{'Can set Position'} eq 'Y') { # Get the entered az and el values print "Az = $2, El = $4\n" if $debug; $ret_val = rot_cmd('set_pos', $2, $4); unless ($ret_val eq $errstr{'RIG_OK'}) { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # p, \get_pos elsif ($user_in =~ /^(p|\\get_pos)\b$/) { if ($rot_caps{'Can get Position'} eq 'Y') { # Query rot and process result $ret_val = rot_cmd('get_pos'); if ($ret_val eq $errstr{'RIG_OK'}) { print "Azimuth: " . $rot_state{Azimuth} . "\n"; print "Elevation: " . $rot_state{Elevation} . "\n\n"; } else { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # M, \move elsif ($user_in =~ /^(M|\\move)\s+([A-Z]+)\s+(\d+)\b$/) { if ($rot_caps{'Can Move'} eq 'Y') { # Get the entered mode and passband values print "Move = $direct{$2}, Speed = $3\n" if $debug; $ret_val = rot_cmd('move', $direct{$2}, $3); unless ($ret_val eq $errstr{'RIG_OK'}) { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # S, \stop elsif ($user_in =~ /^(S|\\stop)\b$/) { if ($rot_caps{'Can Stop'} eq 'Y') { print "Stop\n" if $debug; $ret_val = rot_cmd('stop'); # $vfo not used! unless ($ret_val eq $errstr{'RIG_OK'}) { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # K, \park elsif ($user_in =~ /^(K|\\park)\b$/) { if ($rot_caps{'Can Park'} eq 'Y') { print "Park\n" if $debug; $ret_val = rot_cmd('park'); unless ($ret_val eq $errstr{'RIG_OK'}) { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # R, \reset elsif ($user_in =~ /^(R|\\reset)\s+(\d)\b$/) { if ($rot_caps{'Can Reset'} eq 'Y') { print "Reset\n" if $debug; $ret_val = rot_cmd('reset', $2); unless ($ret_val eq $errstr{'RIG_OK'}) { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # _, \get_info elsif ($user_in =~ /^(_|\\get_info)\b$/) { if ($rot_caps{'Can get Info'} eq 'Y') { print "Get info\n" if $debug; $ret_val = rot_cmd('get_info'); if ($ret_val eq $errstr{'RIG_OK'}) { print "Info: " . $rot_state{Info} . "\n\n"; } else { errmsg ($ret_val); } } else { errmsg($errstr{'CTLD_ENIMPL'}); } } # L, \lonlat2loc elsif ($user_in =~ /^(L|\\lonlat2loc)\s+([-+]?([0-9]*\.)?[0-9]+)\s+([-+]?([0-9]*\.)?[0-9]+)\s+(\d+)\b$/) { print "Longitude = $2, Latitude = $4, Length = $6\n" if $debug; $ret_val = rot_cmd('lonlat2loc', $2, $4, $6); if ($ret_val eq $errstr{'RIG_OK'}) { print "Locator: " . $rot_state{Locator} . "\n\n"; } else { errmsg ($ret_val); } } # l, \loc2lonlat elsif ($user_in =~ /^(l|\\loc2lonlat)\s+([A-Za-z0-9]+)\b$/) { print "Locator = $2\n" if $debug; $ret_val = rot_cmd('loc2lonlat', $2); if ($ret_val eq $errstr{'RIG_OK'}) { print "Longitude: " . $rot_state{Longitude} . "\n"; print "Latitude: " . $rot_state{Latitude} . "\n\n"; } else { errmsg ($ret_val); } } # D, \dms2dec elsif ($user_in =~ /^(D|\\dms2dec)\s+[+-]?(\d+)\s+(\d+)\s+(([0-9]*\.)?[0-9]+)\s+(\d)\b$/) { print "Degrees = $2, Minutes = $3, Seconds = $4, S/W = $6\n" if $debug; $ret_val = rot_cmd('dms2dec', $2, $3, $4, $6); if ($ret_val eq $errstr{'RIG_OK'}) { print "Decimal Degrees: " . $rot_state{'Dec Degrees'} . "\n\n"; } else { errmsg ($ret_val); } } # d, \dec2dms elsif ($user_in =~ /^(d|\\dec2dms)\s+([-+]?([0-9]*\.)?[0-9]+)\b$/) { print "Decimal Degrees = $2\n" if $debug; $ret_val = rot_cmd('dec2dms', $2); if ($ret_val eq $errstr{'RIG_OK'}) { print "Degrees: " . $rot_state{Degrees} . "\n"; print "Minutes: " . $rot_state{Minutes} . "\n"; print "Seconds: " . $rot_state{Seconds} . "\n"; print "South/West: " . $rot_state{'S/W'} . "\n\n"; } else { errmsg ($ret_val); } } # E, \dmmm2dec elsif ($user_in =~ /^(E|\\dmmm2dec)\s+[+-]?(\d+)\s+(([0-9]*\.)?[0-9]+)\s+(\d)\b$/) { print "Degrees = $2, Minutes = $3, S/W = $5\n" if $debug; $ret_val = rot_cmd('dmmm2dec', $2, $3, $5); if ($ret_val eq $errstr{'RIG_OK'}) { print "Decimal Degrees: " . $rot_state{'Dec Deg'} . "\n\n"; } else { errmsg ($ret_val); } } # e, \dec2dmmm elsif ($user_in =~ /^(e|\\dec2dmmm)\s+([-+]?([0-9]*\.)?[0-9]+)\b$/) { print "Decimal Degrees = $2\n" if $debug; $ret_val = rot_cmd('dec2dmmm', $2); if ($ret_val eq $errstr{'RIG_OK'}) { print "Degrees: " . $rot_state{Degrees} . "\n"; print "Decimal Minutes: " . $rot_state{'Dec Minutes'} . "\n"; print "South/West: " . $rot_state{'S/W'} . "\n\n"; } else { errmsg ($ret_val); } } # B, \qrb elsif ($user_in =~ /^(B|\\qrb)\s+([-+]?([0-9]*\.)?[0-9]+)\s+([-+]?([0-9]*\.)?[0-9]+)\s+([-+]?([0-9]*\.)?[0-9]+)\s+([-+]?([0-9]*\.)?[0-9]+)\b$/) { print "Lon 1 = $2, Lat 1 = $4, Lon 2 = $6, Lat 2 = $8\n" if $debug; $ret_val = rot_cmd('qrb', $2, $4, $6, $8); if ($ret_val eq $errstr{'RIG_OK'}) { print "Distance (km): " . $rot_state{'QRB Distance'} . "\n"; print "Azimuth (Deg): " . $rot_state{'QRB Azimuth'} . "\n\n"; } else { errmsg ($ret_val); } } # A, \a_sp2a_lp elsif ($user_in =~ /^(A|\\a_sp2a_lp)\s+([-+]?([0-9]*\.)?[0-9]+)\b$/) { print "Short Path Degrees = $2\n" if $debug; $ret_val = rot_cmd('a_sp2a_lp', $2); if ($ret_val eq $errstr{'RIG_OK'}) { print "Long Path Degrees: " . $rot_state{'Long Path Deg'} . "\n\n"; } else { errmsg ($ret_val); } } # a, \d_sp2d_lp elsif ($user_in =~ /^(a|\\d_sp2d_lp)\s+([-+]?([0-9]*\.)?[0-9]+)\b$/) { print "Short Path km = $2\n" if $debug; $ret_val = rot_cmd('d_sp2d_lp', $2); if ($ret_val eq $errstr{'RIG_OK'}) { print "Long Path km: " . $rot_state{'Long Path km'} . "\n\n"; } else { errmsg ($ret_val); } } # 1, \dump_caps elsif ($user_in =~ /^(1|\\dump_caps)\b$/) { $ret_val = dump_caps(); if ($ret_val eq $errstr{'RIG_OK'}) { print "Model: " . $rot_caps{'Caps dump for model'} . "\n"; print "Manufacturer: " . $rot_caps{'Mfg name'} . "\n"; print "Name: " . $rot_caps{'Model name'} . "\n\n"; } else { errmsg ($ret_val); } } # ?, help elsif ($user_in =~ /^\?|^help\b$/) { print <) { # rotctld terminates each line with '\n' chomp; push @lines, $_; return @lines if $_ =~ /^RPRT/; } } # Builds the %rot_state hash from the lines returned by rotctld which are of the # form "Azimuth: 90.000000, elevation: 45.000000", etc. sub get_state { my ($key, $val); foreach (@_) { ($key, $val) = split(/: /, $_); $rot_state{$key} = $val; } } # Parse the (large) \dump_caps command response into %rot_caps. # TODO: process all lines of output sub get_caps { my ($key, $val); foreach (@_) { if (($_ =~ /^Caps .*:/) or ($_ =~ /^Model .*:/) or ($_ =~ /^Mfg .*:/) or ($_ =~ /^Can .*:/) ) { ($key, $val) = split(/:\s+/, $_); $rot_caps{$key} = $val; } } } # Extract the Hamlib error value returned with the last line from rotctld sub get_errno { chomp @_; my @errno = split(/ /, $_[0]); return $errno[1]; } # FIXME: Better argument handling sub errmsg { unless (($_[0] eq $errstr{'CTLD_EPROTO'}) or ($_[0] eq $errstr{'CTLD_ENIMPL'})) { print "rotctld returned Hamlib $errval{$_[0]}\n\n"; } elsif ($_[0] eq $errstr{'CTLD_EPROTO'}) { print "Echoed command mismatch\n\n"; } elsif ($_[0] eq $errstr{'CTLD_ENIMPL'}) { print "Function not yet implemented in Hamlib rot backend\n\n"; } } # Parse the command line for supported options. Print help text as needed. sub argv_opts { # Parse options and print usage if there is a syntax error, # or if usage was explicitly requested. GetOptions('help|?' => \$help, man => \$man, "port=i" => \$port, "host=s" => \$host, debug => \$debug ) or pod2usage(2); pod2usage(1) if $help; pod2usage(-verbose => 2) if $man; } # POD for pod2usage __END__ =head1 NAME testctld.pl - A test and example program for `rotctld' written in Perl. =head1 SYNOPSIS testctld.pl [options] Options: --host Hostname or IP address of target `rotctld' process --port TCP Port of target `rotctld' process --help Brief help message --man Full documentation --debug Enable debugging output =head1 DESCRIPTION B provides a set of functions to interactively test the Hamlib I TCP/IP network daemon. It also aims to be an example of programming code to control a rotor via TCP/IP in Hamlib. =head1 OPTIONS =over 8 =item B<--host> Hostname or IP address of the target I process. Default is I which should resolve to 127.0.0.1 if I is configured correctly. =item B<--port> TCP port of the target I process. Default is 4533. Mutliple instances of I will require unique port numbers. =item B<--help> Prints a brief help message and exits. =item B<--man> Prints this manual page and exits. =item B<--debug> Enables debugging output to the console. =back =head1 COMMANDS Commands are the same as described in the rotctld(8) man page. This is only a brief summary. P, \set_pos Set the rotor's Azimuth and Elevation p, \get_pos Get the rotor's Azimuth and Elevation M. \move Move Up, Down, Left, Right at Speed S, \stop Stop rotation K, \park Set the rotor to the park position R, \reset Reset the rotor _, \get_info Get the rotor Model Name 1, \dump_caps Get the rot capabilities and display select values These commands are for the locator support API. L, \lonlat2loc Convert Longitude and Latitude to Maidenhead square l, \loc2lonlat Convert Maidenhead square to Longitude and Latitude D, \dms2dec Convert Degrees, Minutes, Seconds to Decimal Degrees d, \dec2dms Convert Decimal Degrees to Degrees, Minutes, Seconds E, \dmmm2dec Convert Degrees, Decimal Minutes to Decimal Degrees e, \dec2dmmm Convert Decimal Degrees to Degrees, Decimal Minutes B, \qrb Compute distance and azimuth between Lon 1, Lat 1, and Lon 2, Lat 2 A, \a_sp2a_lp Compute Long Path Azimuth from Short Path Azimuth a, \d_sp2d_lp Compute Long Path Distance from Short Path Distance =cut hamlib-1.2.15.3/tests/Makefile.am0000644000175000017500000000704712044564477013341 00000000000000# Current Autotools documentation suggests that DejaGNU is obsolete # and replaced by Autotest. TODO: implement Autotest # AUTOMAKE_OPTIONS = dejagnu # DEJATOOL = testfreq testbcd testloc rigctl DISTCLEANFILES = rigctl.log rigctl.sum testbcd.log testbcd.sum bin_PROGRAMS = rigctl rigmem rigswr rigsmtr rotctl rigctld rotctld man_MANS = rigctl.1 rigmem.1 rigswr.1 rigsmtr.1 rotctl.1 rigctld.8 rotctld.8 check_PROGRAMS = dumpmem testrig testtrn testbcd testfreq listrigs \ testloc rig_bench @RIGMATRIX@ rigctl_SOURCES = rigctl.c rigctl_parse.c dumpcaps.c sprintflst.c rigctld_SOURCES = rigctld.c rigctl_parse.c dumpcaps.c sprintflst.c rotctl_SOURCES = rotctl.c rotctl_parse.c dumpcaps_rot.c rotctld_SOURCES = rotctld.c rotctl_parse.c dumpcaps_rot.c rigswr_SOURCES = rigswr.c rigsmtr_SOURCES = rigsmtr.c rigmem_SOURCES = rigmem.c memsave.c memload.c memcsv.c sprintflst.c noinst_HEADERS = sprintflst.h rigctl_parse.h rotctl_parse.h uthash.h EXTRA_PROGRAMS = rigmatrix rigctld rotctld # all the programs need this LDADD = $(top_builddir)/src/libhamlib.la $(top_builddir)/lib/libmisc.la DEPENDENCIES = $(top_builddir)/src/libhamlib.la rigmem_CFLAGS = $(AM_CFLAGS) @LIBXML2_CFLAGS@ ## Linker options listrigs_LDFLAGS = @BACKENDLNK@ dumpmem_LDFLAGS = @BACKENDLNK@ testrig_LDFLAGS = @BACKENDLNK@ rig_bench_LDFLAGS = $(top_builddir)/lib/libmisc.la @BACKENDLNK@ testtrn_LDFLAGS = @BACKENDLNK@ rigctl_LDFLAGS = @BACKENDLNK@ @WINEXELDFLAGS@ rigswr_LDFLAGS = @BACKENDLNK@ @WINEXELDFLAGS@ rigsmtr_LDFLAGS = @BACKENDLNK@ @WINEXELDFLAGS@ rigmem_LDFLAGS = @BACKENDLNK@ @LIBXML2_LIBS@ @WINEXELDFLAGS@ rotctl_LDFLAGS = @ROT_BACKENDLNK@ @WINEXELDFLAGS@ rigctld_LDFLAGS = @BACKENDLNK@ @PTHREAD_LIBS@ @NET_LIBS@ @WINEXELDFLAGS@ rotctld_LDFLAGS = @ROT_BACKENDLNK@ @PTHREAD_LIBS@ @NET_LIBS@ @WINEXELDFLAGS@ # temporary hack testbcd_LDFLAGS = -dlpreopen self testloc_LDFLAGS = -dlpreopen self # rigmatrix needs also libgd rigmatrix_LDFLAGS = -lgd -lz @BACKENDLNK@ ## Dependencies dumpmem_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ testrig_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rig_bench_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ testtrn_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ listrigs_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rigctl_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rigmem_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rigswr_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rigsmtr_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rotctl_DEPENDENCIES = $(DEPENDENCIES) @ROT_BACKENDEPS@ rigmatrix_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rigctld_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ rotctld_DEPENDENCIES = $(DEPENDENCIES) @ROT_BACKENDEPS@ rigmatrix.html: rigmatrix_head.html rigmatrix listrigs mkdir -p sup-info/support ( cat $(srcdir)/rigmatrix_head.html && cd sup-info && ../rigmatrix ) > sup-info/rigmatrix.html for f in `./listrigs | tail -n +2 | cut -f1` ; do ( ./rigctl -m $$f -u > sup-info/support/model$$f.txt || exit 0 ) ; done ./rigctl -l |sort -n | $(srcdir)/rig_split_lst.awk -v lst_dir="sup-info" EXTRA_DIST = rigmatrix_head.html rig_split_lst.awk $(man_MANS) testctld.pl testrotctld.pl # Support 'make check' target for simple tests check_SCRIPTS = testrig.sh testfreq.sh testbcd.sh testloc.sh TESTS = $(check_SCRIPTS) testrig.sh: echo './testrig 1' > testrig.sh chmod +x ./testrig.sh testfreq.sh: echo './testfreq' > testfreq.sh chmod +x ./testfreq.sh testbcd.sh: echo './testbcd 146520000 10' > testbcd.sh chmod +x ./testbcd.sh testloc.sh: echo './testloc EM79UT96LW 5' > testloc.sh chmod +x ./testloc.sh CLEANFILES = testrig.sh testfreq.sh testbcd.sh testloc.sh hamlib-1.2.15.3/tests/rigsmtr.10000644000175000017500000001062412044564477013051 00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH RIGSMTR "1" "January 5, 2008" "Hamlib" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME rigsmtr \- measure S-Meter vs azimuth using Hamlib .SH SYNOPSIS .B rigsmtr [\fIOPTION\fR]... [time_step] .SH DESCRIPTION \fBrigsmtr\fP uses Hamlib to control a rig to measure S-Meter vs azimuth: .br It rotates the antenna from minimum azimuth to maximum azimuth. Every second or \fItime_step\fP if specified in seconds, it retrieves the signal strength. .br Azimuth in degree and corresponding S-Meter level in dB relative to S9 are then printed on stdout. .br To work correctly, rigsmtr needs a rig that could measure S-Meter and a Hamlib backend that is able to get it, mounted on a Hamlib supported rotator. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. Keep in mind that \fBHamlib\fP is still BETA level software. A lof of stuff hasn't been tested thoroughly, and the API may change without publicised notice. Please report bugs and feedback at the e-mail address given in the REPORTING BUGS section. .SH OPTIONS This program follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. .TP .B \-m, \-\-model=id Select radio model number. See model list provided by rigctl. .TP .B \-r, \-\-rig\-file=device Use \fBdevice\fP as the file name of the radio to operate on. .TP .B \-s, \-\-serial\-speed=baud Set radio serial speed to \fBbaud\fP rate. Uses maximal rig speed as default. .TP .B \-c, \-\-civaddr=id Use \fBid\fP as the CI-V address to communicate with the rig. Only for Icom rigs. NB: the id is in decimal, unless prefixed by \fB0x\fP, in which case it is hexadecimal. .TP .B \-C, \-\-set\-conf=parm=val[,parm=val]* Set radio config parameter. See -L option of rigctl for a list. .TP .B \-M, \-\-rot\-model=id Select radio model number. See model list provided by rotctl. .TP .B \-R, \-\-rot\-file=device Use \fBdevice\fP as the file name of the rotator to operate on. .TP .B \-S, \-\-rot\-serial\-speed=baud Set rotator serial speed to \fBbaud\fP rate. Uses maximal speed as default. .TP .B \-N, \-\-rot\-set\-conf=parm=val[,parm=val]* Set rotator config parameter. See -L option of rotctl for a list. .TP .B \-v, \-\-verbose Set verbose mode, cumulative (BUG, ERR, WARN, VERBOSE, TRACE). .TP .B \-h, \-\-help Show summary of options and exit. .TP .B \-V, \-\-version Show version of program and exit. .SH RETURN VALUE rigsmtr exits with: 0 if all operations went fine; 1 if there was an invalid command line option or arg; 2 if an error was returned by Hamlib; 3 if the rig doesn't have the required capabilities. .SH EXAMPLE rigsmtr -m 209 -r /dev/ttyS1 -M 202 > csmtr .br Collect S-Meter readings on a TS850 while an EasycommII rotator makes a full 360\(de, and record measurements in file csmtr. .br After completion, csmtr file contains for example the following lines : .br 0 -47 .br 30 -40 .br 60 -22 .br 90 -3 .br 120 10 .br 150 1 .br 180 -11 .br 210 -24 .br 240 -35 .br 270 -42 .br 300 -48 .br 330 -51 .br 360 -49 .TP Result could then be ploted with gnuplot: .br gnuplot .br set angles degrees .br set polar .br set grid polar 15. .br unset border .br unset param .br set style data line .br set rrange [-60:60] .br set xrange [-60:60] .br set yrange [-60:60] .br plot "csmtr" .SH AUTHOR Man page written by Stephane Fillod. .SH BUGS Need more testing. Reports are welcome. .SH REPORTING BUGS Report bugs to . .SH COPYRIGHT Copyright \(co 2004-2009 Thierry Leconte & Stephane Fillod .br This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .SH SEE ALSO .BR hamlib (3), rigctl (1), rotctl (1) hamlib-1.2.15.3/tests/sprintflst.c0000644000175000017500000001445512044564477013662 00000000000000/* * Hamlib Interface - sprintf toolbox * Copyright (c) 2000-2009 by Stephane Fillod * Copyright (c) 2000-2003 by Frank Singleton * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* Standard input/output definitions */ #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include #include "sprintflst.h" #include "misc.h" /* #define DUMMY_ALL 0x7ffffffffffffffLL */ #define DUMMY_ALL ((setting_t)-1) int sprintf_vfo(char *str, vfo_t vfo) { int i, len=0; const char *sv; *str = '\0'; if (vfo == RIG_VFO_NONE) return 0; sv = rig_strvfo(vfo & RIG_VFO_CURR); if (sv && sv[0]) len += sprintf(str+len, "%s ", sv); sv = rig_strvfo(vfo & RIG_VFO_MEM); if (sv && sv[0]) len += sprintf(str+len, "%s ", sv); sv = rig_strvfo(vfo & RIG_VFO_VFO); if (sv && sv[0]) len += sprintf(str+len, "%s ", sv); sv = rig_strvfo(vfo & RIG_VFO_MAIN); if (sv && sv[0]) len += sprintf(str+len, "%s ", sv); sv = rig_strvfo(vfo & RIG_VFO_SUB); if (sv && sv[0]) len += sprintf(str+len, "%s ", sv); for (i=0; i<16; i++) { sv = rig_strvfo(vfo & RIG_VFO_N(i)); if (sv && sv[0]) len += sprintf(str+len, "%s ", sv); } return len; } int sprintf_mode(char *str, rmode_t mode) { int i, len=0; *str = '\0'; if (mode == RIG_MODE_NONE) return 0; for (i = 0; i < 30; i++) { const char *ms = rig_strrmode(mode & (1UL<token != RIG_CONF_END; extlevels++) { if (!extlevels->name) continue; /* no name */ switch (extlevels->type) { case RIG_CONF_CHECKBUTTON: case RIG_CONF_COMBO: case RIG_CONF_NUMERIC: case RIG_CONF_STRING: strcat(str, extlevels->name); strcat(str, " "); len += strlen(extlevels->name) + 1; break; case RIG_CONF_BUTTON: /* ignore case RIG_CONF_BUTTON */ break; } } return len; } int sprintf_level_gran(char *str, setting_t level, const gran_t gran[]) { int i, len=0; *str = '\0'; if (level == RIG_LEVEL_NONE) return 0; for (i = 0; i < RIG_SETTING_MAX; i++) { const char *ms; if (!(level & rig_idx2setting(i))) continue; ms = rig_strlevel(level & rig_idx2setting(i)); if (!ms || !ms[0]) { if (level != DUMMY_ALL && level != RIG_LEVEL_SET(DUMMY_ALL)) rig_debug(RIG_DEBUG_BUG, "unknown level idx %d\n", i); continue; } if (RIG_LEVEL_IS_FLOAT(rig_idx2setting(i))) len += sprintf(str+len, "%s(%g..%g/%g) ", ms, gran[i].min.f,gran[i].max.f,gran[i].step.f); else len += sprintf(str+len, "%s(%d..%d/%d) ", ms, gran[i].min.i,gran[i].max.i,gran[i].step.i); } return len; } int sprintf_parm(char *str, setting_t parm) { int i, len=0; *str = '\0'; if (parm == RIG_PARM_NONE) return 0; for (i = 0; i < RIG_SETTING_MAX; i++) { const char *ms = rig_strparm(parm & rig_idx2setting(i)); if (!ms || !ms[0]) continue; /* unknown, FIXME! */ strcat(str, ms); strcat(str, " "); len += strlen(ms) + 1; } return len; } int sprintf_parm_gran(char *str, setting_t parm, const gran_t gran[]) { int i, len=0; *str = '\0'; if (parm == RIG_PARM_NONE) return 0; for (i = 0; i < RIG_SETTING_MAX; i++) { const char *ms; if (!(parm & rig_idx2setting(i))) continue; ms = rig_strparm(parm & rig_idx2setting(i)); if (!ms || !ms[0]) { if (parm != DUMMY_ALL && parm != RIG_PARM_SET(DUMMY_ALL)) rig_debug(RIG_DEBUG_BUG, "unknown parm idx %d\n", i); continue; } if (RIG_PARM_IS_FLOAT(rig_idx2setting(i))) len += sprintf(str+len, "%s(%g..%g/%g) ", ms, gran[i].min.f,gran[i].max.f,gran[i].step.f); else len += sprintf(str+len, "%s(%d..%d/%d) ", ms, gran[i].min.i,gran[i].max.i,gran[i].step.i); } return len; } int sprintf_vfop(char *str, vfo_op_t op) { int i, len=0; *str = '\0'; if (op == RIG_OP_NONE) return 0; for (i = 0; i < 30; i++) { const char *ms = rig_strvfop(op & (1UL< insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME rigmem \- backup and restore memory of radio transceivers and receivers .SH SYNOPSIS .B rigmem [\fIOPTION\fR]... [\fICOMMAND\fR]... .SH DESCRIPTION Backup and restore memory of radio transceivers and receivers. \fBrigmem\fP accepts \fIcommands\fP from the command line only. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invoke bold face and italics, .\" respectively. Keep in mind that \fBHamlib\fP is BETA level software. While a lot of backend libraries lack complete rig support, the basic functions are usually well supported. The API may change without publicized notice, while an advancement of the minor version (e.g. 1.1.x to 1.2.x) indicates such a change. .PP Please report bugs and provide feedback at the e-mail address given in the REPORTING BUGS section. Patches and code enhancements are also welcome. .SH OPTIONS This program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). Here is a summary of the supported options: .TP .B \-m, --model=id Select radio model number. See model list (use 'rigctl -l'). .br NB: \fBrigmem\fP (or third party software) will use rig model 1901 when using \fBrpc.rigd\fP. .TP .B \-r, --rig-file=device Use \fIdevice\fP as the file name of the port the radio is connected. Often a serial port, but could be a USB to serial adapter. Typically /dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0, etc. .TP .B \-s, --serial-speed=baud Set serial speed to \fIbaud\fP rate. Uses maximum serial speed from rig backend capabilities as the default. .TP .B \-c, --civaddr=id Use \fIid\fP as the CI-V address to communicate with the rig. Only useful for Icom rigs. .br NB: the \fIid\fP is in decimal notation, unless prefixed by \fI0x\fP, in which case it is hexadecimal. .TP .B \-C, --set-conf=parm=val[,parm=val]* Set config parameter. e.g. stop_bits=2 .br Use -L option of \fBrigctl\fP for a list. .TP .B \-x, --xml Use XML format instead of CSV, if libxml2 is available. .TP .B \-v, --verbose Set verbose mode, cumulative (see DIAGNOSTICS below). .TP .B \-h, --help Show a summary of these options and exit. .TP .B \-V, --version Show version of \fBrigmem\fP and exit. .PP \fBNOTE!\fP Some options may not be implemented by a given backend and will return an error. This is most likely to occur with the \fI\-\-set-conf\fP option. .SH COMMANDS Backup and restore are supported for basic CSV file and XML format where available. .PP Please note that the backend for the radio to be controlled, or the radio itself may not support some commands. In that case, the operation will fail with a \fBHamlib\fP error message. .PP Here is a summary of the supported commands: .TP .B save Save all the content of memory in a CSV (or XML) file given as an argument to the command. .TP .B load Load the content into all the memory from a CSV (or XML) file given as an argument to the command. .TP .B save_parm Save all the parameters of the radio in a CSV (or XML) file given as an argument to the command. .TP .B load_parm Load the parameters of the radio from a CSV (or XML) file given as an argument to the command. .TP .B clear This is a very \fBDANGEROUS\fP command, as it will completely clear out everything you have programmed in the memory of your radio. \fBALL DATA WILL BE LOST\fP. Use at your own risk! .SH DIAGNOSTICS The \fB-v\fP, \fB--version\fP option allows different levels of diagnostics to be output to \fBstderr\fP and correspond to -v for BUG, -vv for ERR, -vvv for WARN, -vvvv for VERBOSE, or -vvvvv for TRACE. A given verbose level is useful for providing needed debugging information to the email address below. For example, TRACE output shows all of the values sent to and received from the radio which is very useful for radio backend library development and may be requested by the developers. .SH EXIT STATUS \fBrigmem\fP exits with: .br 0 if all operations completed normally; .br 1 if there was an invalid command line option or argument; .br 2 if an error was returned by \fBHamlib\fP. .br 3 the \fBHamlib\fP backend has no memory support implemented and/or the rig has no memory access available. .SH BUGS This empty section... .SH REPORTING BUGS Report bugs to . .br We are already aware of the bug in the previous section :-) .SH AUTHOR Written by Stephane Fillod and the Hamlib Group .br . .SH COPYRIGHT Copyright \(co 2000-2009 Stephane Fillod and the Hamlib Group. .br This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .SH SEE ALSO .BR rigctl (1), .BR hamlib (3) hamlib-1.2.15.3/tests/rotctld.c0000644000175000017500000002643412044564477013125 00000000000000/* * rotctld.c - (C) Stephane Fillod 2000-2011 * * This program test/control a rotator using Hamlib. * It takes commands from network connection. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include /* See NOTES */ #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #elif HAVE_WS2TCPIP_H #include #include #endif #ifdef HAVE_NETDB_H #include #endif #ifdef HAVE_PTHREAD #include #endif #include #include "misc.h" #include "rotctl_parse.h" struct handle_data { ROT *rot; int sock; struct sockaddr_in cli_addr; socklen_t clilen; }; void * handle_socket(void * arg); void usage(); /* * Reminder: when adding long options, * keep up to date SHORT_OPTIONS, usage()'s output and man page. thanks. * NB: do NOT use -W since it's reserved by POSIX. * TODO: add an option to read from a file */ #define SHORT_OPTIONS "m:r:s:C:t:T:LuevhVl" static struct option long_options[] = { {"model", 1, 0, 'm'}, {"rot-file", 1, 0, 'r'}, {"serial-speed",1, 0, 's'}, {"port", 1, 0, 't'}, {"listen-addr", 1, 0, 'T'}, {"list", 0, 0, 'l'}, {"set-conf", 1, 0, 'C'}, {"show-conf", 0, 0, 'L'}, {"dump-caps", 0, 0, 'u'}, {"end-marker", 0, 0, 'e'}, {"verbose", 0, 0, 'v'}, {"help", 0, 0, 'h'}, {"version", 0, 0, 'V'}, {0, 0, 0, 0} }; int interactive = 1; /* no cmd because of daemon */ int prompt= 0 ; /* Daemon mode for rigparse return string */ int opt_end= 0 ; /* END marker for rotctld */ const char *portno = "4533"; const char *src_addr = NULL; /* INADDR_ANY */ char send_cmd_term = '\r'; /* send_cmd termination char */ #define MAXCONFLEN 128 int main (int argc, char *argv[]) { ROT *my_rot; /* handle to rot (instance) */ rot_model_t my_model = ROT_MODEL_DUMMY; int retcode; /* generic return code from functions */ int verbose = 0; int show_conf = 0; int dump_caps_opt = 0; const char *rot_file=NULL; int serial_rate = 0; char conf_parms[MAXCONFLEN] = ""; struct addrinfo hints, *result; int sock_listen; int reuseaddr = 1; while(1) { int c; int option_index = 0; c = getopt_long (argc, argv, SHORT_OPTIONS, long_options, &option_index); if (c == -1) break; switch(c) { case 'h': usage(); exit(0); case 'V': version(); exit(0); case 'm': if (!optarg) { usage(); /* wrong arg count */ exit(1); } my_model = atoi(optarg); break; case 'r': if (!optarg) { usage(); /* wrong arg count */ exit(1); } rot_file = optarg; break; case 's': if (!optarg) { usage(); /* wrong arg count */ exit(1); } serial_rate = atoi(optarg); break; case 'C': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (*conf_parms != '\0') strcat(conf_parms, ","); strncat(conf_parms, optarg, MAXCONFLEN-strlen(conf_parms)); break; case 't': if (!optarg) { usage(); /* wrong arg count */ exit(1); } portno = optarg; break; case 'T': if (!optarg) { usage(); /* wrong arg count */ exit(1); } src_addr = optarg; break; case 'v': verbose++; break; case 'L': show_conf++; break; case 'l': list_models(); exit(0); case 'u': dump_caps_opt++; break; case 'e': opt_end = 1; fprintf(stderr, "-e|--end-marker option is deprecated!\nPlease consider using the Extended Response protocol instead.\n"); break; default: usage(); /* unknown option? */ exit(1); } } rig_set_debug(verbose); rig_debug(RIG_DEBUG_VERBOSE, "rotctld, %s\n", hamlib_version); rig_debug(RIG_DEBUG_VERBOSE, "Report bugs to " "\n\n"); my_rot = rot_init(my_model); if (!my_rot) { fprintf(stderr, "Unknown rot num %d, or initialization error.\n", my_model); fprintf(stderr, "Please check with --list option.\n"); exit(2); } retcode = set_conf(my_rot, conf_parms); if (retcode != RIG_OK) { fprintf(stderr, "Config parameter error: %s\n", rigerror(retcode)); exit(2); } if (rot_file) strncpy(my_rot->state.rotport.pathname, rot_file, FILPATHLEN - 1); /* FIXME: bound checking and port type == serial */ if (serial_rate != 0) my_rot->state.rotport.parm.serial.rate = serial_rate; /* * print out conf parameters */ if (show_conf) { rot_token_foreach(my_rot, print_conf_list, (rig_ptr_t)my_rot); } /* * print out conf parameters, and exits immediately * We may be interested only in only caps, and rig_open may fail. */ if (dump_caps_opt) { dumpcaps_rot(my_rot, stdout); rot_cleanup(my_rot); /* if you care about memory */ exit(0); } retcode = rot_open(my_rot); if (retcode != RIG_OK) { fprintf(stderr,"rot_open: error = %s \n", rigerror(retcode)); exit(2); } if (verbose > 0) printf("Opened rot model %d, '%s'\n", my_rot->caps->rot_model, my_rot->caps->model_name); rig_debug(RIG_DEBUG_VERBOSE, "Backend version: %s, Status: %s\n", my_rot->caps->version, rig_strstatus(my_rot->caps->status)); #ifdef __MINGW32__ # ifndef SO_OPENTYPE # define SO_OPENTYPE 0x7008 # endif # ifndef SO_SYNCHRONOUS_NONALERT # define SO_SYNCHRONOUS_NONALERT 0x20 # endif # ifndef INVALID_SOCKET # define INVALID_SOCKET -1 # endif WSADATA wsadata; if (WSAStartup(MAKEWORD(1,1), &wsadata) == SOCKET_ERROR) { fprintf(stderr,"WSAStartup socket error\n"); exit(1); } int sockopt = SO_SYNCHRONOUS_NONALERT; setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *)&sockopt, sizeof(sockopt)); #endif /* * Prepare listening socket */ memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ hints.ai_socktype = SOCK_STREAM;/* TCP socket */ hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */ hints.ai_protocol = 0; /* Any protocol */ retcode = getaddrinfo(src_addr, portno, &hints, &result); if (retcode != 0) { fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(retcode)); exit(2); } sock_listen = socket(result->ai_family, result->ai_socktype, result->ai_protocol); if (sock_listen < 0) { perror("ERROR opening socket"); exit(1); } if (setsockopt(sock_listen, SOL_SOCKET, SO_REUSEADDR, (char *)&reuseaddr,sizeof(reuseaddr)) < 0) { rig_debug(RIG_DEBUG_ERR, "setsockopt: %s\n", strerror(errno)); exit (1); } if (bind(sock_listen, result->ai_addr, result->ai_addrlen) < 0) { rig_debug(RIG_DEBUG_ERR, "binding: %s\n", strerror(errno)); exit (1); } freeaddrinfo(result); /* No longer needed */ if (listen(sock_listen,4) < 0) { rig_debug(RIG_DEBUG_ERR, "listening: %s\n", strerror(errno)); exit (1); } /* * main loop accepting connections */ do { #ifdef HAVE_PTHREAD pthread_t thread; pthread_attr_t attr; #endif struct handle_data *arg; arg = malloc(sizeof(struct handle_data)); if (!arg) { rig_debug(RIG_DEBUG_ERR, "malloc: %s\n", strerror(errno)); exit (1); } arg->rot = my_rot; arg->clilen = sizeof(arg->cli_addr); arg->sock = accept(sock_listen, (struct sockaddr *) &arg->cli_addr, &arg->clilen); if (arg->sock < 0) { rig_debug(RIG_DEBUG_ERR, "accept: %s\n", strerror(errno)); break; } rig_debug(RIG_DEBUG_VERBOSE, "Connection opened from %s:%d\n", inet_ntoa(arg->cli_addr.sin_addr), ntohs(arg->cli_addr.sin_port)); #ifdef HAVE_PTHREAD pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); retcode = pthread_create(&thread, &attr, handle_socket, arg); if (retcode != 0) { rig_debug(RIG_DEBUG_ERR, "pthread_create: %s\n", strerror(retcode)); break; } #else handle_socket(arg); #endif } while (retcode == 0); rot_close(my_rot); /* close port */ rot_cleanup(my_rot); /* if you care about memory */ #ifdef __MINGW32__ WSACleanup(); #endif return 0; } /* * This is the function run by the threads */ void * handle_socket(void *arg) { struct handle_data *handle_data_arg = (struct handle_data *)arg; FILE *fsockin; FILE *fsockout; int retcode; #ifdef __MINGW32__ int sock_osfhandle = _open_osfhandle(handle_data_arg->sock, _O_RDONLY); if (sock_osfhandle == -1) { rig_debug(RIG_DEBUG_ERR, "_open_osfhandle error: %s\n", strerror(errno)); goto handle_exit; } fsockin = _fdopen(sock_osfhandle, "rb"); #else fsockin = fdopen(handle_data_arg->sock, "rb"); #endif if (!fsockin) { rig_debug(RIG_DEBUG_ERR, "fdopen in: %s\n", strerror(errno)); goto handle_exit; } #ifdef __MINGW32__ fsockout = _fdopen(sock_osfhandle, "wb"); #else fsockout = fdopen(handle_data_arg->sock, "wb"); #endif if (!fsockout) { rig_debug(RIG_DEBUG_ERR, "fdopen out: %s\n", strerror(errno)); fclose(fsockin); goto handle_exit; } do { retcode = rotctl_parse(handle_data_arg->rot, fsockin, fsockout, NULL, 0); if (ferror(fsockin) || ferror(fsockout)) retcode = 1; } while (retcode == 0 || retcode == 2); rig_debug(RIG_DEBUG_VERBOSE, "Connection closed from %s:%d\n", inet_ntoa(handle_data_arg->cli_addr.sin_addr), ntohs(handle_data_arg->cli_addr.sin_port)); fclose(fsockin); fclose(fsockout); handle_exit: #ifdef __MINGW32__ closesocket(handle_data_arg->sock); #else close(handle_data_arg->sock); #endif free(arg); #ifdef HAVE_PTHREAD pthread_exit(NULL); #endif return NULL; } void usage() { printf("Usage: rotctld [OPTION]... [COMMAND]...\n" "Daemon serving COMMANDs to a connected antenna rotator.\n\n"); printf( " -m, --model=ID select rotator model number. See model list\n" " -r, --rot-file=DEVICE set device of the rotator to operate on\n" " -s, --serial-speed=BAUD set serial speed of the serial port\n" " -t, --port=NUM set TCP listening port, default %s\n" " -T, --listen-addr=IPADDR set listening IP address, default ANY\n" " -C, --set-conf=PARM=VAL set config parameters\n" " -L, --show-conf list all config parameters\n" " -l, --list list all model numbers and exit\n" " -u, --dump-caps dump capabilities and exit\n" " -e, --end-marker use END marker in rotctld protocol (obsolete)\n" " -v, --verbose set verbose mode, cumulative\n" " -h, --help display this help and exit\n" " -V, --version output version information and exit\n\n", portno); usage_rot(stdout); printf("\nReport bugs to .\n"); } hamlib-1.2.15.3/winradio/0000755000175000017500000000000012044565023012013 500000000000000hamlib-1.2.15.3/winradio/NOTES0000644000175000017500000000253312044564477012565 00000000000000Mail from , 02/06/01 Stephane mentioned the hamlib project to the linradio.sourceforge.net developers a few weeks ago. I believe my reply was routed to /dev/null@shell1.sourceforge.net. Anyway I have put some notes and early untested code at: http://linradio.sourceforge.net/hamlib.html Here are some winradio-specific issues: - Winradios are simple (henceforth cheap) receivers. The software driver does a lot of work that you would normally expect to see in an embedded controller. The driver is about 100KB of C. - Receivers come with ISA, PCMCIA and RS232 interfaces. - The protocol varies a lot across the model range. - Most models barely have an internal state. They can't even tell which frequency they are tuned to. - With most models, frequency sweeping must be done in software. This requires real-time tricks with RS232 (currently suboptimal). - High-end models have a DSP (not supported with Linux). We are currently providing two abstractions for all of this: - A kernel module which provides /dev/winradioX devices and ioctl API (radio_ioctl.h). - A user-mode driver which has problems with security (being root to use ISA receivers) and RS232 performance. The best approach is to create a hamlib-X.Y.Z/winradio/winradio.c file that wraps our ioctl API (toolkit/driver/radio_ioctl.h) into a "struct rig_caps". hamlib-1.2.15.3/winradio/wr1550.c0000644000175000017500000000724712044564477013070 00000000000000/* * Hamlib WiNRADiO backend - WR1550 description * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include #include #include "winradio.h" #ifdef WINRADIO_IOCTL /* * Winradio rigs capabilities. */ #define WR1550_FUNC RIG_FUNC_NONE #define WR1550_SET_LEVEL (RIG_LEVEL_ATT | RIG_LEVEL_AF) #define WR1550_LEVEL (WR1550_SET_LEVEL | RIG_LEVEL_STRENGTH) #define WR1550_MODES (RIG_MODE_AM | RIG_MODE_CW | \ RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_FM) const struct rig_caps wr1550_caps = { .rig_model = RIG_MODEL_WR1550, .model_name = "WR-1550", .mfg_name = "Winradio", .version = "0.6", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_PCRECEIVER, .port_type = RIG_PORT_DEVICE, .targetable_vfo = 0, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .has_get_func = WR1550_FUNC, .has_set_func = WR1550_FUNC, .has_get_level = WR1550_LEVEL, .has_set_level = WR1550_SET_LEVEL, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .chan_list = { RIG_CHAN_END, }, .transceive = RIG_TRN_OFF, .max_ifshift = kHz(2), .attenuator = { 20, RIG_DBLST_END, }, .rx_range_list1 = { {.start = kHz(150),.end = MHz(1500),.modes = WR1550_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(30),.end = MHz(1500),.modes = RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .rx_range_list2 = { {.start = kHz(150),.end = MHz(824),.modes = WR1550_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(30),.end = MHz(824),.modes = RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(849),.end = MHz(869), .modes = WR1550_MODES|RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(894),.end = MHz(1500), .modes = WR1550_MODES|RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_SSB|RIG_MODE_CW,1}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM,10}, RIG_TS_END, }, .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.5)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_WFM, kHz(230)}, RIG_FLT_END, }, .priv = NULL, /* priv */ .rig_init = wr_rig_init, .set_freq = wr_set_freq, .get_freq = wr_get_freq, .set_mode = wr_set_mode, .get_mode = wr_get_mode, .set_powerstat = wr_set_powerstat, .get_powerstat = wr_get_powerstat, .set_level = wr_set_level, .get_level = wr_get_level, .set_func = NULL, .get_func = NULL, .get_info = wr_get_info, }; #endif /* WINRADIO_IOCTL */ hamlib-1.2.15.3/winradio/g313.c0000644000175000017500000003650712044564477012603 00000000000000/* * Hamlib WiNRADiO backend - WR-G313 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include #include #include "winradio.h" #ifdef _WIN32 #ifdef HAVE_WINDOWS_H #include #endif #ifdef HAVE_WINBASE_H #include #endif /* * Winradio G3 capabilities. * * TODO: rig_probe, rig_scan */ #define WAVEOUT_SOUNDCARDID 0x150901 const struct confparams g313_cfg_params[] = { { WAVEOUT_SOUNDCARDID, "wodeviceid", "WaveOut Device ID", "Sound card device ID for playing IF signal from receiver", "-1", RIG_CONF_NUMERIC, { .n = { -3, 32, 1 } } }, { RIG_CONF_END, NULL, } }; #define WRG313DLL "wrg3130api.dll" #define G313_FUNC RIG_FUNC_NONE #define G313_LEVEL (RIG_LEVEL_ATT | RIG_LEVEL_AGC | RIG_LEVEL_RF | RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR) #define G313_MODES (RIG_MODE_NONE) static int g313_init(RIG *rig); static int g313_cleanup(RIG *rig); static int g313_open(RIG *rig); static int g313_close(RIG *rig); static int g313_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int g313_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int g313_set_powerstat(RIG *rig, powerstat_t status); static int g313_get_powerstat(RIG *rig, powerstat_t *status); static int g313_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int g313_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static const char* g313_get_info(RIG *rig); int g313_set_conf(RIG *rig, token_t token, const char *val); int g313_get_conf(RIG *rig, token_t token, char *val); /* #pragma pack(1) // set byte packing */ typedef struct { int bLength; char szSerNum[9]; char szProdName[9]; DWORD dwMinFreq; DWORD dwMaxFreq; BYTE bNumBands; DWORD dwBandFreq[16]; DWORD dwLOfreq; BYTE bNumVcos; DWORD dwVcoFreq[8]; WORD wVcoDiv[8]; BYTE bVcoBits[8]; DWORD dwRefClk1; DWORD dwRefClk2; BYTE IF1DAC[8]; } __attribute__((packed)) RADIO_INFO; /* #pragma pack() // set back the default packing */ /* Some type definitions needed for dll access */ typedef int (__stdcall *FNCOpenRadioDevice)(int iDeviceNum); typedef BOOL (__stdcall *FNCCloseRadioDevice)(int hRadio); typedef BOOL (__stdcall *FNCG3SetFrequency)(int hRadio, DWORD dwFreq); typedef DWORD (__stdcall *FNCG3GetFrequency)(int hRadio); typedef BOOL (__stdcall *FNCSetPower)(int hRadio, BOOL rPower); typedef BOOL (__stdcall *FNCGetPower)(int hRadio); typedef BOOL (__stdcall *FNCSetAtten)(int hRadio, BOOL rAtten); typedef BOOL (__stdcall *FNCGetAtten)(int hRadio); typedef BOOL (__stdcall *FNCSetAGC)(int hRadio, int rAGC); typedef int (__stdcall *FNCGetAGC)(int hRadio); typedef BOOL (__stdcall *FNCSetIFGain)(int hRadio, int rIFGain); typedef int (__stdcall *FNCGetIFGain)(int hRadio); typedef int (__stdcall *FNCGetSignalStrengthdBm)(int hRadio); typedef int (__stdcall *FNCGetRawSignalStrength)(int hRadio); typedef BOOL (__stdcall *FNCG3GetInfo)(int hRadio,RADIO_INFO *info); typedef MMRESULT (__stdcall *TwaveOutGetDevCaps)(UINT_PTR uDeviceID,LPWAVEOUTCAPS pwoc,UINT cbwoc); typedef UINT (__stdcall *TwaveOutGetNumDevs)(void); typedef HANDLE (__stdcall *TStartWaveOut)(LONG hRadio,LONG WaveOutDeviceIndex); typedef void (__stdcall *TStopWaveOut)(HANDLE hWaveOut); struct g313_priv_data { HMODULE dll; int hRadio; FNCOpenRadioDevice OpenRadioDevice; FNCCloseRadioDevice CloseRadioDevice; FNCG3SetFrequency G3SetFrequency; FNCG3GetFrequency G3GetFrequency; FNCSetPower SetPower; FNCGetPower GetPower; FNCSetAtten SetAtten; FNCGetAtten GetAtten; FNCSetAGC SetAGC; FNCGetAGC GetAGC; FNCSetIFGain SetIFGain; FNCGetIFGain GetIFGain; FNCGetSignalStrengthdBm GetSignalStrengthdBm; FNCGetRawSignalStrength GetRawSignalStrength; FNCG3GetInfo G3GetInfo; HMODULE WinMM; TwaveOutGetDevCaps waveOutGetDevCaps; TwaveOutGetNumDevs waveOutGetNumDevs; HMODULE hWRG313WO; int WaveOutDeviceID; HANDLE hWaveOut; TStartWaveOut StartWaveOut; TStopWaveOut StopWaveOut; int Opened; }; const struct rig_caps g313_caps = { .rig_model = RIG_MODEL_G313, .model_name = "WR-G313", .mfg_name = "Winradio", .version = "0.1", .copyright = "LGPL", /* This wrapper, not the G313 DLL */ .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_PCRECEIVER, .port_type = RIG_PORT_NONE, .targetable_vfo = 0, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .has_get_func = G313_FUNC, .has_set_func = G313_FUNC, .has_get_level = G313_LEVEL, .has_set_level = RIG_LEVEL_SET(G313_LEVEL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .chan_list = { RIG_CHAN_END }, .transceive = RIG_TRN_OFF, .max_ifshift = kHz(2), .attenuator = { 20, RIG_DBLST_END, }, /* TBC */ .rx_range_list1 = { {.start = kHz(9),.end = MHz(30),.modes = G313_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {.start = kHz(9),.end = MHz(30),.modes = G313_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {G313_MODES,1}, RIG_TS_END, }, .filters = { {G313_MODES, kHz(12)}, RIG_FLT_END, }, .cfgparams = g313_cfg_params, .set_conf = g313_set_conf, .get_conf = g313_get_conf, .rig_init = g313_init, .rig_cleanup = g313_cleanup, .rig_open = g313_open, .rig_close = g313_close, .set_freq = g313_set_freq, .get_freq = g313_get_freq, .set_powerstat = g313_set_powerstat, .get_powerstat = g313_get_powerstat, .set_level = g313_set_level, .get_level = g313_get_level, .get_info = g313_get_info, }; int g313_init(RIG *rig) { struct g313_priv_data *priv; priv = (struct g313_priv_data*)malloc(sizeof(struct g313_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } priv->WaveOutDeviceID=-1; priv->Opened=0; priv->hWaveOut=NULL; priv->WinMM=LoadLibrary("WinMM.dll"); if(priv->WinMM==NULL) { free(priv); return -RIG_EIO; } priv->hWRG313WO=LoadLibrary("WRG313WO.dll"); if(priv->hWRG313WO==NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Unable to LoadLibrary WRG313WO.dll\n", __FUNCTION__); FreeLibrary(priv->WinMM); free(priv); return -RIG_EIO; } priv->StartWaveOut=(TStartWaveOut)GetProcAddress(priv->hWRG313WO,"StartWaveOut"); priv->StopWaveOut=(TStopWaveOut)GetProcAddress(priv->hWRG313WO,"StopWaveOut"); if(!priv->StartWaveOut || !priv->StopWaveOut) { rig_debug(RIG_DEBUG_ERR, "%s: Unable to load valid WRG313WO.dll library\n", __FUNCTION__); FreeLibrary(priv->hWRG313WO); FreeLibrary(priv->WinMM); free(priv); return -RIG_EIO; } /* Try to load required dll */ priv->dll = LoadLibrary(WRG313DLL); if (!priv->dll) { rig_debug(RIG_DEBUG_ERR, "%s: Unable to LoadLibrary %s\n", __FUNCTION__, WRG313DLL); FreeLibrary(priv->hWRG313WO); FreeLibrary(priv->WinMM); free(priv); return -RIG_EIO; /* huh! */ } /* Get process addresses from dll for function access */ priv->OpenRadioDevice = (FNCOpenRadioDevice) GetProcAddress(priv->dll, "OpenRadioDevice"); priv->CloseRadioDevice = (FNCCloseRadioDevice) GetProcAddress(priv->dll, "CloseRadioDevice"); priv->G3SetFrequency = (FNCG3SetFrequency) GetProcAddress(priv->dll, "SetFrequency"); priv->G3GetFrequency = (FNCG3GetFrequency) GetProcAddress(priv->dll, "GetFrequency"); priv->SetPower = (FNCSetPower) GetProcAddress(priv->dll, "SetPower"); priv->GetPower = (FNCGetPower) GetProcAddress(priv->dll, "GetPower"); priv->SetAtten = (FNCSetAtten) GetProcAddress(priv->dll, "SetAtten"); priv->GetAtten = (FNCGetAtten) GetProcAddress(priv->dll, "GetAtten"); priv->SetAGC = (FNCSetAGC) GetProcAddress(priv->dll, "SetAGC"); priv->GetAGC = (FNCGetAGC) GetProcAddress(priv->dll, "GetAGC"); priv->SetIFGain = (FNCSetIFGain) GetProcAddress(priv->dll, "SetIFGain"); priv->GetIFGain = (FNCGetIFGain) GetProcAddress(priv->dll, "GetIFGain"); priv->GetSignalStrengthdBm = (FNCGetSignalStrengthdBm) GetProcAddress(priv->dll, "GetSignalStrengthdBm"); priv->GetRawSignalStrength = (FNCGetRawSignalStrength) GetProcAddress(priv->dll, "GetRawSignalStrength"); priv->G3GetInfo = (FNCG3GetInfo) GetProcAddress(priv->dll, "G3GetInfo"); if(!priv->OpenRadioDevice || !priv->CloseRadioDevice || !priv->G3SetFrequency || !priv->G3GetFrequency || !priv->SetPower || !priv->GetPower || !priv->SetAtten || !priv->GetAtten || !priv->SetAGC || !priv->GetAGC || !priv->SetIFGain || !priv->GetIFGain || !priv->GetSignalStrengthdBm || !priv->GetRawSignalStrength) { rig_debug(RIG_DEBUG_ERR, "%s: Unable to load valid %s library\n", __FUNCTION__, WRG313DLL); FreeLibrary(priv->dll); FreeLibrary(priv->hWRG313WO); FreeLibrary(priv->WinMM); free(priv); return -RIG_EIO; } priv->waveOutGetDevCaps=(TwaveOutGetDevCaps)GetProcAddress(priv->WinMM,"waveOutGetDevCapsA"); priv->waveOutGetNumDevs=(TwaveOutGetNumDevs)GetProcAddress(priv->WinMM,"waveOutGetNumDevs"); rig->state.priv = (void*)priv; return RIG_OK; } int g313_findVSC(struct g313_priv_data *priv) { int OutIndex; WAVEOUTCAPS Caps; int Count; int i; OutIndex=-1; Count=priv->waveOutGetNumDevs(); for(i=0;iwaveOutGetDevCaps(i, &Caps, sizeof(Caps))==MMSYSERR_NOERROR) { if(strncmp(Caps.szPname,"WiNRADiO Virtual Sound Card",27)==0) { OutIndex=i; break; } } } return OutIndex; } int g313_open(RIG *rig) { struct g313_priv_data *priv = (struct g313_priv_data *)rig->state.priv; int device_num; int Count; int id; device_num = atoi(rig->state.rigport.pathname); Count=priv->waveOutGetNumDevs(); if(Count==0) { return -RIG_EIO; } if(priv->WaveOutDeviceID==-2) { id=g313_findVSC(priv); } else { id=priv->WaveOutDeviceID; } /* Open Winradio receiver handle */ priv->hRadio = priv->OpenRadioDevice(device_num); if (priv->hRadio == 0) { return -RIG_EIO; /* huh! */ } /* Make sure the receiver is switched on */ priv->SetPower(priv->hRadio, TRUE); if(id>-3) { priv->hWaveOut=priv->StartWaveOut(priv->hRadio,id); if(priv->hWaveOut==NULL) { priv->CloseRadioDevice(priv->hRadio); return -RIG_EIO; } } else { priv->hWaveOut=NULL; } priv->Opened=1; return RIG_OK; } int g313_close(RIG *rig) { struct g313_priv_data *priv = (struct g313_priv_data *)rig->state.priv; if(!priv->Opened) { return RIG_OK; } priv->Opened=0; if(priv->hWaveOut) { priv->StopWaveOut(priv->hWaveOut); } priv->CloseRadioDevice(priv->hRadio); return RIG_OK; } int g313_cleanup(RIG *rig) { struct g313_priv_data *priv; if (!rig) return -RIG_EINVAL; priv=(struct g313_priv_data *)rig->state.priv; /* Clean up the dll access */ FreeLibrary(priv->dll); FreeLibrary(priv->WinMM); FreeLibrary(priv->hWRG313WO); if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } int g313_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct g313_priv_data *priv = (struct g313_priv_data *)rig->state.priv; int ret; ret = priv->G3SetFrequency(priv->hRadio, (DWORD) (freq)); ret = ret==TRUE ? RIG_OK : -RIG_EIO; return ret; } int g313_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct g313_priv_data *priv = (struct g313_priv_data *)rig->state.priv; *freq = (freq_t) priv->G3GetFrequency(priv->hRadio); return *freq != 0 ? RIG_OK : -RIG_EIO; } int g313_set_powerstat(RIG *rig, powerstat_t status) { struct g313_priv_data *priv = (struct g313_priv_data *)rig->state.priv; int ret; ret = priv->SetPower(priv->hRadio, status==RIG_POWER_ON ? TRUE : FALSE); ret = ret==TRUE ? RIG_OK : -RIG_EIO; return ret; } int g313_get_powerstat(RIG *rig, powerstat_t *status) { struct g313_priv_data *priv = (struct g313_priv_data *)rig->state.priv; int ret; ret = priv->GetPower(priv->hRadio); *status = ret==TRUE ? RIG_POWER_ON : RIG_POWER_OFF; return RIG_OK; } int g313_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct g313_priv_data *priv = (struct g313_priv_data *)rig->state.priv; int ret, agc; switch(level) { case RIG_LEVEL_ATT: ret = priv->SetAtten(priv->hRadio, val.i != 0 ? TRUE : FALSE); break; case RIG_LEVEL_AGC: switch (val.i) { case RIG_AGC_OFF: agc = 0; break; case RIG_AGC_SLOW: agc = 1; break; case RIG_AGC_MEDIUM: agc = 2; break; case RIG_AGC_FAST: agc = 3; break; default: return -RIG_EINVAL; } ret = priv->SetAGC(priv->hRadio, agc); break; case RIG_LEVEL_RF: ret = priv->SetIFGain(priv->hRadio, (int)(val.f*100)); break; default: return -RIG_EINVAL; } ret = ret==TRUE ? RIG_OK : -RIG_EIO; return ret; } int g313_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct g313_priv_data *priv = (struct g313_priv_data *)rig->state.priv; int ret; ret = RIG_OK; switch(level) { case RIG_LEVEL_ATT: val->i = priv->GetAtten(priv->hRadio)?rig->caps->attenuator[0]:0; break; case RIG_LEVEL_AGC: switch (priv->GetAGC(priv->hRadio)) { case 0: val->i = RIG_AGC_OFF; break; case 1: val->i = RIG_AGC_SLOW; break; case 2: val->i = RIG_AGC_MEDIUM; break; case 3: val->i = RIG_AGC_FAST; break; case -1: ret = -RIG_EIO; break; default: return -RIG_EINVAL; } break; case RIG_LEVEL_STRENGTH: val->i = priv->GetSignalStrengthdBm(priv->hRadio)/10+73; break; case RIG_LEVEL_RAWSTR: val->i = priv->GetRawSignalStrength(priv->hRadio); break; default: return -RIG_EINVAL; } return ret; } static const char* g313_get_info(RIG *rig) { struct g313_priv_data *priv = (struct g313_priv_data *)rig->state.priv; static RADIO_INFO info; info.bLength = sizeof(RADIO_INFO); if (priv->G3GetInfo(priv->hRadio,&info) == FALSE) return NULL; return info.szSerNum; } int g313_set_conf(RIG *rig, token_t token, const char *val) { struct g313_priv_data *priv = (struct g313_priv_data *)rig->state.priv; int id; switch(token) { case WAVEOUT_SOUNDCARDID: if (val[0] == '0' && val[1] == 'x') id = strtol(val, (char **)NULL, 16); else id = atoi(val); if(id<-3 || id>32) { return -RIG_EINVAL; } priv->WaveOutDeviceID=id; if(priv->Opened) { if(id==-2) { id=g313_findVSC(priv); } if(priv->hWaveOut) { priv->StopWaveOut(priv->hWaveOut); } if(id>-3) { priv->hWaveOut=priv->StartWaveOut(priv->hRadio,id); } else { priv->hWaveOut=NULL; } } break; default: return -RIG_EINVAL; } return RIG_OK; } int g313_get_conf(RIG *rig, token_t token, char *val) { struct g313_priv_data *priv = (struct g313_priv_data *)rig->state.priv; switch(token) { case WAVEOUT_SOUNDCARDID: sprintf(val,"%d",priv->WaveOutDeviceID); break; default: return -RIG_EINVAL; } return RIG_OK; } #endif /* _WIN32 */ hamlib-1.2.15.3/winradio/winradio.h0000644000175000017500000000434312044564477013740 00000000000000/* * Hamlib WiNRADiO backend - main header * Copyright (c) 2000-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _WINRADIO_H #define _WINRADIO_H 1 #ifdef HAVE_CONFIG_H #include "config.h" #endif /* * So far, only Linux has Linradio support through ioctl, * until someone port it to some other OS... */ #ifdef HAVE_LINUX_IOCTL_H #define WINRADIO_IOCTL #endif #include int wr_rig_init(RIG *rig); int wr_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int wr_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int wr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int wr_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int wr_set_powerstat(RIG *rig, powerstat_t status); int wr_get_powerstat(RIG *rig, powerstat_t *status); int wr_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int wr_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); int wr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int wr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); const char *wr_get_info(RIG *rig); extern const struct rig_caps wr1000_caps; extern const struct rig_caps wr1500_caps; extern const struct rig_caps wr1550_caps; extern const struct rig_caps wr3100_caps; extern const struct rig_caps wr3150_caps; extern const struct rig_caps wr3500_caps; extern const struct rig_caps wr3700_caps; extern const struct rig_caps g303_caps; extern const struct rig_caps g305_caps; extern const struct rig_caps g313_caps; #endif /* _WINRADIO_H */ hamlib-1.2.15.3/winradio/wr1000.c0000644000175000017500000000673112044564477013053 00000000000000/* * Hamlib WiNRADiO backend - WR1000 description * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include #include #include "winradio.h" #ifdef WINRADIO_IOCTL /* * Winradio rigs capabilities. */ #define WR1000_FUNC 0 #define WR1000_SET_LEVEL (RIG_LEVEL_ATT | RIG_LEVEL_AF) #define WR1000_LEVEL (WR1000_SET_LEVEL | RIG_LEVEL_STRENGTH) #define WR1000_MODES (RIG_MODE_AM | \ RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_FM) const struct rig_caps wr1000_caps = { .rig_model = RIG_MODEL_WR1000, .model_name = "WR-1000", .mfg_name = "Winradio", .version = "0.6", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_PCRECEIVER, .port_type = RIG_PORT_DEVICE, .targetable_vfo = 0, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .has_get_func = WR1000_FUNC, .has_set_func = WR1000_FUNC, .has_get_level = WR1000_LEVEL, .has_set_level = WR1000_SET_LEVEL, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .chan_list = { RIG_CHAN_END, }, .transceive = RIG_TRN_OFF, .attenuator = { 20, RIG_DBLST_END, }, .rx_range_list1 = { {.start=kHz(500),.end=MHz(1300),.modes=WR1000_MODES, .low_power=-1,.high_power=-1,.vfo=RIG_VFO_A}, {.start=MHz(30),.end=MHz(1300),.modes=RIG_MODE_WFM, .low_power=-1,.high_power=-1,.vfo=RIG_VFO_A}, RIG_FRNG_END, }, .rx_range_list2 = { {.start=kHz(500),.end=MHz(824),.modes=WR1000_MODES, .low_power=-1,.high_power=-1,.vfo=RIG_VFO_A}, {.start=MHz(30),.end=MHz(824),.modes=RIG_MODE_WFM, .low_power=-1,.high_power=-1,.vfo=RIG_VFO_A}, {.start=MHz(849),.end=MHz(869), .modes=WR1000_MODES|RIG_MODE_WFM, .low_power=-1,.high_power=-1,.vfo=RIG_VFO_A}, {.start=MHz(894),.end=MHz(1300), .modes=WR1000_MODES|RIG_MODE_WFM, .low_power=-1,.high_power=-1,.vfo=RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {WR1000_MODES|RIG_MODE_WFM,100}, RIG_TS_END, }, .filters = { {RIG_MODE_SSB|RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(17)}, {RIG_MODE_WFM, kHz(230)}, RIG_FLT_END, }, .priv = NULL, /* priv */ .rig_init = wr_rig_init, .set_freq = wr_set_freq, .get_freq = wr_get_freq, .set_mode = wr_set_mode, .get_mode = wr_get_mode, .set_powerstat = wr_set_powerstat, .get_powerstat = wr_get_powerstat, .set_level = wr_set_level, .get_level = wr_get_level, .set_func = NULL, .get_func = NULL, .get_info = wr_get_info, }; #endif /* WINRADIO_IOCTL */ hamlib-1.2.15.3/winradio/wr3700.c0000644000175000017500000000743412044564477013065 00000000000000/* * Hamlib WiNRADiO backend - WR3700 description * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include #include #include "winradio.h" #ifdef WINRADIO_IOCTL /* * Winradio rigs capabilities. */ #define WR3700_FUNC RIG_FUNC_FAGC #define WR3700_SET_LEVEL (RIG_LEVEL_ATT | RIG_LEVEL_AF | RIG_LEVEL_IF | RIG_LEVEL_RF) #define WR3700_LEVEL (WR3700_SET_LEVEL | RIG_LEVEL_STRENGTH) #define WR3700_MODES (RIG_MODE_AM | RIG_MODE_CW | \ RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_FM) const struct rig_caps wr3700_caps = { .rig_model = RIG_MODEL_WR3700, .model_name = "WR-3700", .mfg_name = "Winradio", .version = "0.6", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_PCRECEIVER, .port_type = RIG_PORT_DEVICE, .targetable_vfo = 0, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .has_get_func = WR3700_FUNC, .has_set_func = WR3700_FUNC, .has_get_level = WR3700_LEVEL, .has_set_level = WR3700_SET_LEVEL, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .chan_list = { RIG_CHAN_END, }, .transceive = RIG_TRN_OFF, .max_ifshift = kHz(2), .attenuator = { 20, RIG_DBLST_END, }, .rx_range_list1 = { {.start = kHz(150),.end = GHz(4),.modes = WR3700_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(30),.end = GHz(4),.modes = RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .rx_range_list2 = { {.start = kHz(150),.end = MHz(824),.modes = WR3700_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(30),.end = MHz(824),.modes = RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(849),.end = MHz(869), .modes = WR3700_MODES|RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(894),.end = GHz(4), .modes = WR3700_MODES|RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_SSB|RIG_MODE_CW,1}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM,10}, RIG_TS_END, }, .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.5)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_FM, kHz(6)}, {RIG_MODE_FM, kHz(50)}, {RIG_MODE_WFM, kHz(230)}, RIG_FLT_END, }, .priv = NULL, /* priv */ .rig_init = wr_rig_init, .set_freq = wr_set_freq, .get_freq = wr_get_freq, .set_mode = wr_set_mode, .get_mode = wr_get_mode, .set_powerstat = wr_set_powerstat, .get_powerstat = wr_get_powerstat, .set_level = wr_set_level, .get_level = wr_get_level, .set_func = wr_set_func, .get_func = wr_get_func, .get_info = wr_get_info, }; #endif /* WINRADIO_IOCTL */ hamlib-1.2.15.3/winradio/winradio.c0000644000175000017500000001624012044564477013732 00000000000000/* * Hamlib WiNRADiO backend - main file for interface through /dev/winradio API * Copyright (C) 2001 pab@users.sourceforge.net * Derived from hamlib code (C) 2000-2009 Stephane Fillod. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "winradio.h" /* config.h */ #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #ifdef HAVE_SYS_IOCTL_H #include #endif #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "register.h" #ifdef WINRADIO_IOCTL #include #include #define DEFAULT_WINRADIO_PATH "/dev/winradio0" int wr_rig_init(RIG *rig) { rig->state.rigport.type.rig = RIG_PORT_DEVICE; strncpy(rig->state.rigport.pathname, DEFAULT_WINRADIO_PATH, FILPATHLEN - 1); return RIG_OK; } int wr_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned long f; if (freq > GHz(4.2)) return -RIG_EINVAL; f = (unsigned long)freq; if ( ioctl(rig->state.rigport.fd, RADIO_SET_FREQ, &f) ) return -RIG_EINVAL; return RIG_OK; } int wr_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { unsigned long f; if ( ioctl(rig->state.rigport.fd, RADIO_GET_FREQ, &f) < 0 ) return -RIG_EINVAL; *freq = (freq_t)f; return RIG_OK; } int wr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { unsigned long m; switch ( mode ) { case RIG_MODE_AM: m = RMD_AM; break; case RIG_MODE_CW: m = RMD_CW; break; case RIG_MODE_LSB: m = RMD_LSB; break; case RIG_MODE_USB: m = RMD_USB; break; case RIG_MODE_WFM: m = RMD_FMW; break; case RIG_MODE_FM: switch ( width ) { case RIG_PASSBAND_NORMAL: case (int)kHz(17): case (int)kHz(15): m = RMD_FMN; break; case (int)kHz(6): m = RMD_FM6; break; case (int)kHz(50): m = RMD_FMM; break; default: return -RIG_EINVAL; } default: return -RIG_EINVAL; } if ( ioctl(rig->state.rigport.fd, RADIO_SET_MODE, &m) ) return -RIG_EINVAL; return RIG_OK; } int wr_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { unsigned long m; if ( ioctl(rig->state.rigport.fd, RADIO_GET_MODE, &m) ) return -RIG_EINVAL; *width = RIG_PASSBAND_NORMAL; switch ( m ) { case RMD_CW: *mode = RIG_MODE_CW; break; case RMD_AM: *mode = RIG_MODE_AM; break; case RMD_FMN: *mode = RIG_MODE_FM; break; /* 15kHz or 17kHz on WR-3100 */ case RMD_FM6: *mode = RIG_MODE_FM; break; /* 6kHz */ case RMD_FMM: *mode = RIG_MODE_FM; break; /* 50kHz */ case RMD_FMW: *mode = RIG_MODE_WFM; break; case RMD_LSB: *mode = RIG_MODE_LSB; break; case RMD_USB: *mode = RIG_MODE_USB; break; default: return -RIG_EINVAL; } if (*width == RIG_PASSBAND_NORMAL) *width = rig_passband_normal(rig,*mode); return RIG_OK; } int wr_set_powerstat(RIG *rig, powerstat_t status) { unsigned long p = 1; p = status==RIG_POWER_ON ? 1 : 0; if ( ioctl(rig->state.rigport.fd, RADIO_SET_POWER, &p) ) return -RIG_EINVAL; return RIG_OK; } int wr_get_powerstat(RIG *rig, powerstat_t *status) { unsigned long p; if ( ioctl(rig->state.rigport.fd, RADIO_GET_POWER, &p) ) return -RIG_EINVAL; *status = p ? RIG_POWER_ON : RIG_POWER_OFF; return RIG_OK; } int wr_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { switch ( func ) { case RIG_FUNC_FAGC: { unsigned long v = status ? 1 : 0; if ( ioctl(rig->state.rigport.fd, RADIO_SET_AGC, &v) ) return -RIG_EINVAL; return RIG_OK; } default: return -RIG_EINVAL; } } int wr_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { switch ( func ) { case RIG_FUNC_FAGC: { unsigned long v; if ( ioctl(rig->state.rigport.fd, RADIO_GET_AGC, &v) ) return -RIG_EINVAL; *status = v; return RIG_OK; } default: return -RIG_EINVAL; } } int wr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { switch ( level ) { case RIG_LEVEL_AF: { unsigned long v; if ( ioctl(rig->state.rigport.fd, RADIO_GET_MAXVOL, &v) ) return -RIG_EINVAL; v *= val.f; if ( ioctl(rig->state.rigport.fd, RADIO_SET_VOL, &v) ) return -RIG_EINVAL; return RIG_OK; } case RIG_LEVEL_ATT: { unsigned long v = val.i ? 1 : 0; if ( ioctl(rig->state.rigport.fd, RADIO_SET_ATTN, &v) ) return -RIG_EINVAL; return RIG_OK; } case RIG_LEVEL_IF: { long v = val.i; if ( ioctl(rig->state.rigport.fd, RADIO_SET_IFS, &v) ) return -RIG_EINVAL; return RIG_OK; } case RIG_LEVEL_RF: { long v = val.f*100; /* iMaxIFGain on wHWVer > RHV_3150 */ if ( ioctl(rig->state.rigport.fd, RADIO_SET_IFG, &v) ) return -RIG_EINVAL; return RIG_OK; } default: return -RIG_EINVAL; } } int wr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { switch ( level ) { case RIG_LEVEL_AF: { unsigned long v, mv; if ( ioctl(rig->state.rigport.fd, RADIO_GET_MAXVOL, &mv) ) return -RIG_EINVAL; if ( ioctl(rig->state.rigport.fd, RADIO_GET_VOL, &v) ) return -RIG_EINVAL; val->f = (float)v / mv; return RIG_OK; } case RIG_LEVEL_ATT: { unsigned long v; if ( ioctl(rig->state.rigport.fd, RADIO_GET_VOL, &v) ) return -RIG_EINVAL; val->i = v ? rig->state.attenuator[0] : 0; return RIG_OK; } case RIG_LEVEL_STRENGTH: { unsigned long v; if ( ioctl(rig->state.rigport.fd, RADIO_GET_SS, &v) ) return -RIG_EINVAL; val->i = v-60; /* 0..120, Hamlib assumes S9 = 0dB */ return RIG_OK; } case RIG_LEVEL_IF: { long v; if ( ioctl(rig->state.rigport.fd, RADIO_GET_IFS, &v) ) return -RIG_EINVAL; val->i = v; return RIG_OK; } case RIG_LEVEL_RF: { long v; if ( ioctl(rig->state.rigport.fd, RADIO_GET_IFG, &v) ) return -RIG_EINVAL; val->f = (float)v/100; /* iMaxIFGain on wHWVer > RHV_3150 */ return RIG_OK; } default: return -RIG_EINVAL; } } /* * FIXME: static buf does not allow reentrancy! */ const char *wr_get_info(RIG *rig) { static char buf[100]; if ( ioctl(rig->state.rigport.fd, RADIO_GET_DESCR, buf) < 0 ) return "?"; return buf; } #endif /* WINRADIO_IOCTL */ DECLARE_INITRIG_BACKEND(winradio) { rig_debug(RIG_DEBUG_VERBOSE, "winradio: _init called\n"); #ifdef WINRADIO_IOCTL rig_register(&wr1000_caps); rig_register(&wr1500_caps); rig_register(&wr1550_caps); rig_register(&wr3100_caps); rig_register(&wr3150_caps); rig_register(&wr3500_caps); rig_register(&wr3700_caps); #endif /* WINRADIO_IOCTL */ /* Receivers with DLL only available under Windows */ #ifdef _WIN32 rig_register(&g303_caps); rig_register(&g305_caps); rig_register(&g313_caps); #endif return RIG_OK; } hamlib-1.2.15.3/winradio/wr3150.c0000644000175000017500000000724612044564477013065 00000000000000/* * Hamlib WiNRADiO backend - WR3150 description * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include #include #include "winradio.h" #ifdef WINRADIO_IOCTL /* * Winradio rigs capabilities. */ #define WR3150_FUNC RIG_FUNC_NONE #define WR3150_SET_LEVEL (RIG_LEVEL_ATT | RIG_LEVEL_AF) #define WR3150_LEVEL (WR3150_SET_LEVEL | RIG_LEVEL_STRENGTH) #define WR3150_MODES (RIG_MODE_AM | RIG_MODE_CW | \ RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_FM) const struct rig_caps wr3150_caps = { .rig_model = RIG_MODEL_WR3150, .model_name = "WR-3150", .mfg_name = "Winradio", .version = "0.6", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_PCRECEIVER, .port_type = RIG_PORT_DEVICE, .targetable_vfo = 0, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .has_get_func = WR3150_FUNC, .has_set_func = WR3150_FUNC, .has_get_level = WR3150_LEVEL, .has_set_level = WR3150_SET_LEVEL, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .chan_list = { RIG_CHAN_END, }, .transceive = RIG_TRN_OFF, .max_ifshift = kHz(2), .attenuator = { 20, RIG_DBLST_END, }, .rx_range_list1 = { {.start = kHz(150),.end = MHz(1500),.modes = WR3150_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(30),.end = MHz(1500),.modes = RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .rx_range_list2 = { {.start = kHz(150),.end = MHz(824),.modes = WR3150_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(30),.end = MHz(824),.modes = RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(849),.end = MHz(869), .modes = WR3150_MODES|RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(894),.end = MHz(1500), .modes = WR3150_MODES|RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_SSB|RIG_MODE_CW,1}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM,10}, RIG_TS_END, }, .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.5)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_WFM, kHz(230)}, RIG_FLT_END, }, .priv = NULL, /* priv */ .rig_init = wr_rig_init, .set_freq = wr_set_freq, .get_freq = wr_get_freq, .set_mode = wr_set_mode, .get_mode = wr_get_mode, .set_powerstat = wr_set_powerstat, .get_powerstat = wr_get_powerstat, .set_level = wr_set_level, .get_level = wr_get_level, .set_func = NULL, .get_func = NULL, .get_info = wr_get_info, }; #endif /* WINRADIO_IOCTL */ hamlib-1.2.15.3/winradio/Makefile.in0000644000175000017500000005144112044564560014012 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = winradio DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_winradio_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = wr1000.lo wr1500.lo wr1550.lo wr3100.lo wr3150.lo \ wr3500.lo wr3700.lo g303.lo g313.lo g305.lo am_hamlib_winradio_la_OBJECTS = $(am__objects_1) winradio.lo hamlib_winradio_la_OBJECTS = $(am_hamlib_winradio_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_winradio_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_winradio_la_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_winradio_la_SOURCES) DIST_SOURCES = $(hamlib_winradio_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ WRSRCLIST = wr1000.c wr1500.c wr1550.c wr3100.c wr3150.c wr3500.c wr3700.c \ g303.c g313.c g305.c pkglib_LTLIBRARIES = hamlib-winradio.la hamlib_winradio_la_SOURCES = $(WRSRCLIST) winradio.c hamlib_winradio_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_winradio_la_LIBADD = $(top_builddir)/src/libhamlib.la EXTRA_DIST = NOTES noinst_HEADERS = winradio.h linradio/radio_ioctl.h linradio/wrapi.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu winradio/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu winradio/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-winradio.la: $(hamlib_winradio_la_OBJECTS) $(hamlib_winradio_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_winradio_la_LINK) -rpath $(pkglibdir) $(hamlib_winradio_la_OBJECTS) $(hamlib_winradio_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g303.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g305.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g313.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winradio.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wr1000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wr1500.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wr1550.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wr3100.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wr3150.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wr3500.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wr3700.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/winradio/wr3100.c0000644000175000017500000000724712044564477013061 00000000000000/* * Hamlib WiNRADiO backend - WR3100 description * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include #include #include "winradio.h" #ifdef WINRADIO_IOCTL /* * Winradio rigs capabilities. */ #define WR3100_FUNC RIG_FUNC_NONE #define WR3100_SET_LEVEL (RIG_LEVEL_ATT | RIG_LEVEL_AF) #define WR3100_LEVEL (WR3100_SET_LEVEL | RIG_LEVEL_STRENGTH) #define WR3100_MODES (RIG_MODE_AM | RIG_MODE_CW | \ RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_FM) const struct rig_caps wr3100_caps = { .rig_model = RIG_MODEL_WR3100, .model_name = "WR-3100", .mfg_name = "Winradio", .version = "0.6", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_PCRECEIVER, .port_type = RIG_PORT_DEVICE, .targetable_vfo = 0, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .has_get_func = WR3100_FUNC, .has_set_func = WR3100_FUNC, .has_get_level = WR3100_LEVEL, .has_set_level = WR3100_SET_LEVEL, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .chan_list = { RIG_CHAN_END, }, .transceive = RIG_TRN_OFF, .max_ifshift = kHz(2), .attenuator = { 20, RIG_DBLST_END, }, .rx_range_list2 = { {.start = kHz(150),.end = MHz(1500),.modes = WR3100_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(30),.end = MHz(1500),.modes = RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .rx_range_list1 = { {.start = kHz(150),.end = MHz(824),.modes = WR3100_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(30),.end = MHz(824),.modes = RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(849),.end = MHz(869), .modes = WR3100_MODES|RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(894),.end = MHz(1500), .modes = WR3100_MODES|RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_SSB|RIG_MODE_CW,1}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM,10}, RIG_TS_END, }, .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.5)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(17)}, {RIG_MODE_WFM, kHz(230)}, RIG_FLT_END, }, .priv = NULL, /* priv */ .rig_init = wr_rig_init, .set_freq = wr_set_freq, .get_freq = wr_get_freq, .set_mode = wr_set_mode, .get_mode = wr_get_mode, .set_powerstat = wr_set_powerstat, .get_powerstat = wr_get_powerstat, .set_level = wr_set_level, .get_level = wr_get_level, .set_func = NULL, .get_func = NULL, .get_info = wr_get_info, }; #endif /* WINRADIO_IOCTL */ hamlib-1.2.15.3/winradio/g305.c0000644000175000017500000002526112044564477012577 00000000000000/* * Hamlib WiNRADiO backend - WR-G305 description * Copyright (c) 2001-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include #include #include "winradio.h" #ifdef _WIN32 #ifdef HAVE_WINDOWS_H #include #endif #ifdef HAVE_WINBASE_H #include #endif /* * Winradio G3 capabilities. * Cloned from G303 * * TODO: rig_probe, rig_scan */ #define WRG3DLL "wrg3api.dll" #define G305_FUNC RIG_FUNC_NONE #define G305_LEVEL (RIG_LEVEL_ATT | RIG_LEVEL_AGC | RIG_LEVEL_RF | RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR) #define G305_MODES (RIG_MODE_USB) /* FIXME? */ static int g3_init(RIG *rig); static int g3_cleanup(RIG *rig); static int g3_open(RIG *rig); static int g3_close(RIG *rig); static int g3_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int g3_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int g3_set_powerstat(RIG *rig, powerstat_t status); static int g3_get_powerstat(RIG *rig, powerstat_t *status); static int g3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int g3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static const char* g3_get_info(RIG *rig); /* #pragma pack(1) // set byte packing */ typedef struct { int bLength; char szSerNum[9]; char szProdName[9]; DWORD dwMinFreq; DWORD dwMaxFreq; BYTE bNumBands; DWORD dwBandFreq[16]; DWORD dwLOfreq; BYTE bNumVcos; DWORD dwVcoFreq[8]; WORD wVcoDiv[8]; BYTE bVcoBits[8]; DWORD dwRefClk1; DWORD dwRefClk2; BYTE IF1DAC[8]; } __attribute__((packed)) RADIO_INFO; /* #pragma pack() // set back the default packing */ /* Some type definitions needed for dll access */ typedef int (__stdcall *FNCOpenRadioDevice)(int iDeviceNum); typedef BOOL (__stdcall *FNCCloseRadioDevice)(int hRadio); typedef BOOL (__stdcall *FNCG3SetFrequency)(int hRadio, DWORD dwFreq); typedef DWORD (__stdcall *FNCG3GetFrequency)(int hRadio); typedef BOOL (__stdcall *FNCSetPower)(int hRadio, BOOL rPower); typedef BOOL (__stdcall *FNCGetPower)(int hRadio); typedef BOOL (__stdcall *FNCSetAtten)(int hRadio, BOOL rAtten); typedef BOOL (__stdcall *FNCGetAtten)(int hRadio); typedef BOOL (__stdcall *FNCSetAGC)(int hRadio, int rAGC); typedef int (__stdcall *FNCGetAGC)(int hRadio); typedef BOOL (__stdcall *FNCSetIFGain)(int hRadio, int rIFGain); typedef int (__stdcall *FNCGetIFGain)(int hRadio); typedef int (__stdcall *FNCGetSignalStrengthdBm)(int hRadio); typedef int (__stdcall *FNCGetRawSignalStrength)(int hRadio); typedef BOOL (__stdcall *FNCG3GetInfo)(int hRadio,RADIO_INFO *info); struct g3_priv_data { HMODULE dll; int hRadio; FNCOpenRadioDevice OpenRadioDevice; FNCCloseRadioDevice CloseRadioDevice; FNCG3SetFrequency G3SetFrequency; FNCG3GetFrequency G3GetFrequency; FNCSetPower SetPower; FNCGetPower GetPower; FNCSetAtten SetAtten; FNCGetAtten GetAtten; FNCSetAGC SetAGC; FNCGetAGC GetAGC; FNCSetIFGain SetIFGain; FNCGetIFGain GetIFGain; FNCGetSignalStrengthdBm GetSignalStrengthdBm; FNCGetRawSignalStrength GetRawSignalStrength; FNCG3GetInfo G3GetInfo; }; const struct rig_caps g305_caps = { .rig_model = RIG_MODEL_G305, .model_name = "WR-G305", .mfg_name = "Winradio", .version = "0.2.1", .copyright = "LGPL", /* This wrapper, not the G3 DLL */ .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_PCRECEIVER, .port_type = RIG_PORT_NONE, .targetable_vfo = 0, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .has_get_func = G305_FUNC, .has_set_func = G305_FUNC, .has_get_level = G305_LEVEL, .has_set_level = RIG_LEVEL_SET(G305_LEVEL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .chan_list = { RIG_CHAN_END }, .transceive = RIG_TRN_OFF, .max_ifshift = kHz(2), .attenuator = { 20, RIG_DBLST_END, }, /* TBC */ .rx_range_list1 = { {.start = kHz(9),.end = MHz(30),.modes = G305_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {.start = kHz(9),.end = MHz(30),.modes = G305_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {G305_MODES,1}, RIG_TS_END, }, .filters = { {G305_MODES, kHz(12)}, RIG_FLT_END, }, .rig_init = g3_init, .rig_cleanup = g3_cleanup, .rig_open = g3_open, .rig_close = g3_close, .set_freq = g3_set_freq, .get_freq = g3_get_freq, .set_powerstat = g3_set_powerstat, .get_powerstat = g3_get_powerstat, .set_level = g3_set_level, .get_level = g3_get_level, .get_info = g3_get_info, }; int g3_init(RIG *rig) { struct g3_priv_data *priv; priv = (struct g3_priv_data*)malloc(sizeof(struct g3_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } /* Try to load required dll */ priv->dll = LoadLibrary(WRG3DLL); if (!priv->dll) { rig_debug(RIG_DEBUG_ERR, "%s: Unable to LoadLibrary %s\n", __FUNCTION__, WRG3DLL); free(priv); return -RIG_EIO; /* huh! */ } /* Get process addresses from dll for function access */ priv->OpenRadioDevice = (FNCOpenRadioDevice) GetProcAddress(priv->dll, "OpenRadioDevice"); priv->CloseRadioDevice = (FNCCloseRadioDevice) GetProcAddress(priv->dll, "CloseRadioDevice"); priv->G3SetFrequency = (FNCG3SetFrequency) GetProcAddress(priv->dll, "SetFrequency"); priv->G3GetFrequency = (FNCG3GetFrequency) GetProcAddress(priv->dll, "GetFrequency"); priv->SetPower = (FNCSetPower) GetProcAddress(priv->dll, "SetPower"); priv->GetPower = (FNCGetPower) GetProcAddress(priv->dll, "GetPower"); priv->SetAtten = (FNCSetAtten) GetProcAddress(priv->dll, "SetAtten"); priv->GetAtten = (FNCGetAtten) GetProcAddress(priv->dll, "GetAtten"); priv->SetAGC = (FNCSetAGC) GetProcAddress(priv->dll, "SetAGC"); priv->GetAGC = (FNCGetAGC) GetProcAddress(priv->dll, "GetAGC"); priv->SetIFGain = (FNCSetIFGain) GetProcAddress(priv->dll, "SetIFGain"); priv->GetIFGain = (FNCGetIFGain) GetProcAddress(priv->dll, "GetIFGain"); priv->GetSignalStrengthdBm = (FNCGetSignalStrengthdBm) GetProcAddress(priv->dll, "GetSignalStrengthdBm"); priv->GetRawSignalStrength = (FNCGetRawSignalStrength) GetProcAddress(priv->dll, "GetRawSignalStrength"); priv->G3GetInfo = (FNCG3GetInfo) GetProcAddress(priv->dll, "G3GetInfo"); rig->state.priv = (void*)priv; return RIG_OK; } int g3_open(RIG *rig) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; int device_num; device_num = atoi(rig->state.rigport.pathname); /* Open Winradio receiver handle */ priv->hRadio = priv->OpenRadioDevice(device_num); if (priv->hRadio == 0) return -RIG_EIO; /* huh! */ /* Make sure the receiver is switched on */ priv->SetPower(priv->hRadio, TRUE); return RIG_OK; } int g3_close(RIG *rig) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; priv->CloseRadioDevice(priv->hRadio); return RIG_OK; } int g3_cleanup(RIG *rig) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; /* Clean up the dll access */ FreeLibrary(priv->dll); if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } int g3_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; int ret; ret = priv->G3SetFrequency(priv->hRadio, (DWORD) (freq)); ret = ret==TRUE ? RIG_OK : -RIG_EIO; return ret; } int g3_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; *freq = (freq_t) priv->G3GetFrequency(priv->hRadio); return *freq != 0 ? RIG_OK : -RIG_EIO; } int g3_set_powerstat(RIG *rig, powerstat_t status) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; int ret; ret = priv->SetPower(priv->hRadio, status==RIG_POWER_ON ? TRUE : FALSE); ret = ret==TRUE ? RIG_OK : -RIG_EIO; return ret; } int g3_get_powerstat(RIG *rig, powerstat_t *status) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; int ret; ret = priv->GetPower(priv->hRadio); *status = ret==TRUE ? RIG_POWER_ON : RIG_POWER_OFF; return RIG_OK; } int g3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; int ret, agc; switch(level) { case RIG_LEVEL_ATT: ret = priv->SetAtten(priv->hRadio, val.i != 0 ? TRUE : FALSE); break; case RIG_LEVEL_AGC: switch (val.i) { case RIG_AGC_OFF: agc = 0; break; case RIG_AGC_SLOW: agc = 1; break; case RIG_AGC_MEDIUM: agc = 2; break; case RIG_AGC_FAST: agc = 3; break; default: return -RIG_EINVAL; } ret = priv->SetAGC(priv->hRadio, agc); break; case RIG_LEVEL_RF: ret = priv->SetIFGain(priv->hRadio, (int)(val.f*100)); break; default: return -RIG_EINVAL; } ret = ret==TRUE ? RIG_OK : -RIG_EIO; return ret; } int g3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; int ret; ret = RIG_OK; switch(level) { case RIG_LEVEL_ATT: val->i = priv->GetAtten(priv->hRadio)?rig->caps->attenuator[0]:0; break; case RIG_LEVEL_AGC: switch (priv->GetAGC(priv->hRadio)) { case 0: val->i = RIG_AGC_OFF; break; case 1: val->i = RIG_AGC_SLOW; break; case 2: val->i = RIG_AGC_MEDIUM; break; case 3: val->i = RIG_AGC_FAST; break; case -1: ret = -RIG_EIO; break; default: return -RIG_EINVAL; } break; case RIG_LEVEL_STRENGTH: val->i = priv->GetSignalStrengthdBm(priv->hRadio)/10+73; break; case RIG_LEVEL_RAWSTR: val->i = priv->GetRawSignalStrength(priv->hRadio); break; default: return -RIG_EINVAL; } return ret; } static const char* g3_get_info(RIG *rig) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; static RADIO_INFO info; info.bLength = sizeof(RADIO_INFO); if (priv->G3GetInfo(priv->hRadio,&info) == FALSE) return NULL; return info.szSerNum; } #endif /* _WIN32 */ hamlib-1.2.15.3/winradio/wr1500.c0000644000175000017500000000724612044564477013062 00000000000000/* * Hamlib WiNRADiO backend - WR1500 description * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include #include #include "winradio.h" #ifdef WINRADIO_IOCTL /* * Winradio rigs capabilities. */ #define WR1500_FUNC RIG_FUNC_NONE #define WR1500_SET_LEVEL (RIG_LEVEL_ATT | RIG_LEVEL_AF) #define WR1500_LEVEL (WR1500_SET_LEVEL | RIG_LEVEL_STRENGTH) #define WR1500_MODES (RIG_MODE_AM | RIG_MODE_CW | \ RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_FM) const struct rig_caps wr1500_caps = { .rig_model = RIG_MODEL_WR1500, .model_name = "WR-1500", .mfg_name = "Winradio", .version = "0.6", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_PCRECEIVER, .port_type = RIG_PORT_DEVICE, .targetable_vfo = 0, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .has_get_func = WR1500_FUNC, .has_set_func = WR1500_FUNC, .has_get_level = WR1500_LEVEL, .has_set_level = WR1500_SET_LEVEL, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .chan_list = { RIG_CHAN_END, }, .transceive = RIG_TRN_OFF, .max_ifshift = kHz(2), .attenuator = { 20, RIG_DBLST_END, }, .rx_range_list1 = { {.start = kHz(150),.end = MHz(1500),.modes = WR1500_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(30),.end = MHz(1500),.modes = RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .rx_range_list2 = { {.start = kHz(150),.end = MHz(824),.modes = WR1500_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(30),.end = MHz(824),.modes = RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(849),.end = MHz(869), .modes = WR1500_MODES|RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(894),.end = MHz(1500), .modes = WR1500_MODES|RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_SSB|RIG_MODE_CW,1}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM,10}, RIG_TS_END, }, .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.5)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(17)}, {RIG_MODE_WFM, kHz(230)}, RIG_FLT_END, }, .priv = NULL, /* priv */ .rig_init = wr_rig_init, .set_freq = wr_set_freq, .get_freq = wr_get_freq, .set_mode = wr_set_mode, .get_mode = wr_get_mode, .set_powerstat = wr_set_powerstat, .get_powerstat = wr_get_powerstat, .set_level = wr_set_level, .get_level = wr_get_level, .set_func = NULL, .get_func = NULL, .get_info = wr_get_info, }; #endif /* WINRADIO_IOCTL */ hamlib-1.2.15.3/winradio/wr3500.c0000644000175000017500000000744312044564477013063 00000000000000/* * Hamlib WiNRADiO backend - WR3500 description * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include #include #include "winradio.h" #ifdef WINRADIO_IOCTL /* * Winradio rigs capabilities. */ #define WR3500_FUNC RIG_FUNC_FAGC #define WR3500_SET_LEVEL (RIG_LEVEL_ATT | RIG_LEVEL_AF | RIG_LEVEL_IF | RIG_LEVEL_RF) #define WR3500_LEVEL (WR3500_SET_LEVEL | RIG_LEVEL_STRENGTH) #define WR3500_MODES (RIG_MODE_AM | RIG_MODE_CW | \ RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_FM) const struct rig_caps wr3500_caps = { .rig_model = RIG_MODEL_WR3500, .model_name = "WR-3500", .mfg_name = "Winradio", .version = "0.6", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_PCRECEIVER, .port_type = RIG_PORT_DEVICE, .targetable_vfo = 0, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .has_get_func = WR3500_FUNC, .has_set_func = WR3500_FUNC, .has_get_level = WR3500_LEVEL, .has_set_level = WR3500_SET_LEVEL, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .chan_list = { RIG_CHAN_END, }, .transceive = RIG_TRN_OFF, .max_ifshift = kHz(2), .attenuator = { 20, RIG_DBLST_END, }, .rx_range_list1 = { {.start = kHz(150),.end = GHz(2.6),.modes = WR3500_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(30),.end = GHz(2.6),.modes = RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .rx_range_list2 = { {.start = kHz(150),.end = MHz(824),.modes = WR3500_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(30),.end = MHz(824),.modes = RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(849),.end = MHz(869), .modes = WR3500_MODES|RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, {.start = MHz(894),.end = GHz(2.6), .modes = WR3500_MODES|RIG_MODE_WFM, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_SSB|RIG_MODE_CW,1}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM,10}, RIG_TS_END, }, .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.5)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_FM, kHz(6)}, {RIG_MODE_FM, kHz(50)}, {RIG_MODE_WFM, kHz(230)}, RIG_FLT_END, }, .priv = NULL, /* priv */ .rig_init = wr_rig_init, .set_freq = wr_set_freq, .get_freq = wr_get_freq, .set_mode = wr_set_mode, .get_mode = wr_get_mode, .set_powerstat = wr_set_powerstat, .get_powerstat = wr_get_powerstat, .set_level = wr_set_level, .get_level = wr_get_level, .set_func = wr_set_func, .get_func = wr_get_func, .get_info = wr_get_info, }; #endif /* WINRADIO_IOCTL */ hamlib-1.2.15.3/winradio/Makefile.am0000644000175000017500000000063612044564477014010 00000000000000 WRSRCLIST = wr1000.c wr1500.c wr1550.c wr3100.c wr3150.c wr3500.c wr3700.c \ g303.c g313.c g305.c pkglib_LTLIBRARIES = hamlib-winradio.la hamlib_winradio_la_SOURCES = $(WRSRCLIST) winradio.c hamlib_winradio_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_winradio_la_LIBADD = $(top_builddir)/src/libhamlib.la EXTRA_DIST = NOTES noinst_HEADERS = winradio.h linradio/radio_ioctl.h linradio/wrapi.h hamlib-1.2.15.3/winradio/g303.c0000644000175000017500000002523112044564477012572 00000000000000/* * Hamlib WiNRADiO backend - WR-G303 description * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include #include #include "winradio.h" #ifdef _WIN32 #ifdef HAVE_WINDOWS_H #include #endif #ifdef HAVE_WINBASE_H #include #endif /* * Winradio G3 capabilities. * * TODO: rig_probe, rig_scan */ #define WRG3DLL "wrg3api.dll" #define G303_FUNC RIG_FUNC_NONE #define G303_LEVEL (RIG_LEVEL_ATT | RIG_LEVEL_AGC | RIG_LEVEL_RF | RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR) #define G303_MODES (RIG_MODE_USB) /* FIXME? */ static int g3_init(RIG *rig); static int g3_cleanup(RIG *rig); static int g3_open(RIG *rig); static int g3_close(RIG *rig); static int g3_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int g3_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int g3_set_powerstat(RIG *rig, powerstat_t status); static int g3_get_powerstat(RIG *rig, powerstat_t *status); static int g3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int g3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static const char* g3_get_info(RIG *rig); /* #pragma pack(1) // set byte packing */ typedef struct { int bLength; char szSerNum[9]; char szProdName[9]; DWORD dwMinFreq; DWORD dwMaxFreq; BYTE bNumBands; DWORD dwBandFreq[16]; DWORD dwLOfreq; BYTE bNumVcos; DWORD dwVcoFreq[8]; WORD wVcoDiv[8]; BYTE bVcoBits[8]; DWORD dwRefClk1; DWORD dwRefClk2; BYTE IF1DAC[8]; } __attribute__((packed)) RADIO_INFO; /* #pragma pack() // set back the default packing */ /* Some type definitions needed for dll access */ typedef int (__stdcall *FNCOpenRadioDevice)(int iDeviceNum); typedef BOOL (__stdcall *FNCCloseRadioDevice)(int hRadio); typedef BOOL (__stdcall *FNCG3SetFrequency)(int hRadio, DWORD dwFreq); typedef DWORD (__stdcall *FNCG3GetFrequency)(int hRadio); typedef BOOL (__stdcall *FNCSetPower)(int hRadio, BOOL rPower); typedef BOOL (__stdcall *FNCGetPower)(int hRadio); typedef BOOL (__stdcall *FNCSetAtten)(int hRadio, BOOL rAtten); typedef BOOL (__stdcall *FNCGetAtten)(int hRadio); typedef BOOL (__stdcall *FNCSetAGC)(int hRadio, int rAGC); typedef int (__stdcall *FNCGetAGC)(int hRadio); typedef BOOL (__stdcall *FNCSetIFGain)(int hRadio, int rIFGain); typedef int (__stdcall *FNCGetIFGain)(int hRadio); typedef int (__stdcall *FNCGetSignalStrengthdBm)(int hRadio); typedef int (__stdcall *FNCGetRawSignalStrength)(int hRadio); typedef BOOL (__stdcall *FNCG3GetInfo)(int hRadio,RADIO_INFO *info); struct g3_priv_data { HMODULE dll; int hRadio; FNCOpenRadioDevice OpenRadioDevice; FNCCloseRadioDevice CloseRadioDevice; FNCG3SetFrequency G3SetFrequency; FNCG3GetFrequency G3GetFrequency; FNCSetPower SetPower; FNCGetPower GetPower; FNCSetAtten SetAtten; FNCGetAtten GetAtten; FNCSetAGC SetAGC; FNCGetAGC GetAGC; FNCSetIFGain SetIFGain; FNCGetIFGain GetIFGain; FNCGetSignalStrengthdBm GetSignalStrengthdBm; FNCGetRawSignalStrength GetRawSignalStrength; FNCG3GetInfo G3GetInfo; }; const struct rig_caps g303_caps = { .rig_model = RIG_MODEL_G303, .model_name = "WR-G303", .mfg_name = "Winradio", .version = "0.2.1", .copyright = "LGPL", /* This wrapper, not the G3 DLL */ .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_PCRECEIVER, .port_type = RIG_PORT_NONE, .targetable_vfo = 0, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .has_get_func = G303_FUNC, .has_set_func = G303_FUNC, .has_get_level = G303_LEVEL, .has_set_level = RIG_LEVEL_SET(G303_LEVEL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .chan_list = { RIG_CHAN_END }, .transceive = RIG_TRN_OFF, .max_ifshift = kHz(2), .attenuator = { 20, RIG_DBLST_END, }, /* TBC */ .rx_range_list1 = { {.start = kHz(9),.end = MHz(30),.modes = G303_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {.start = kHz(9),.end = MHz(30),.modes = G303_MODES, .low_power = -1,.high_power = -1,.vfo = RIG_VFO_A}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {G303_MODES,1}, RIG_TS_END, }, .filters = { {G303_MODES, kHz(12)}, RIG_FLT_END, }, .rig_init = g3_init, .rig_cleanup = g3_cleanup, .rig_open = g3_open, .rig_close = g3_close, .set_freq = g3_set_freq, .get_freq = g3_get_freq, .set_powerstat = g3_set_powerstat, .get_powerstat = g3_get_powerstat, .set_level = g3_set_level, .get_level = g3_get_level, .get_info = g3_get_info, }; int g3_init(RIG *rig) { struct g3_priv_data *priv; priv = (struct g3_priv_data*)malloc(sizeof(struct g3_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } /* Try to load required dll */ priv->dll = LoadLibrary(WRG3DLL); if (!priv->dll) { rig_debug(RIG_DEBUG_ERR, "%s: Unable to LoadLibrary %s\n", __FUNCTION__, WRG3DLL); free(priv); return -RIG_EIO; /* huh! */ } /* Get process addresses from dll for function access */ priv->OpenRadioDevice = (FNCOpenRadioDevice) GetProcAddress(priv->dll, "OpenRadioDevice"); priv->CloseRadioDevice = (FNCCloseRadioDevice) GetProcAddress(priv->dll, "CloseRadioDevice"); priv->G3SetFrequency = (FNCG3SetFrequency) GetProcAddress(priv->dll, "SetFrequency"); priv->G3GetFrequency = (FNCG3GetFrequency) GetProcAddress(priv->dll, "GetFrequency"); priv->SetPower = (FNCSetPower) GetProcAddress(priv->dll, "SetPower"); priv->GetPower = (FNCGetPower) GetProcAddress(priv->dll, "GetPower"); priv->SetAtten = (FNCSetAtten) GetProcAddress(priv->dll, "SetAtten"); priv->GetAtten = (FNCGetAtten) GetProcAddress(priv->dll, "GetAtten"); priv->SetAGC = (FNCSetAGC) GetProcAddress(priv->dll, "SetAGC"); priv->GetAGC = (FNCGetAGC) GetProcAddress(priv->dll, "GetAGC"); priv->SetIFGain = (FNCSetIFGain) GetProcAddress(priv->dll, "SetIFGain"); priv->GetIFGain = (FNCGetIFGain) GetProcAddress(priv->dll, "GetIFGain"); priv->GetSignalStrengthdBm = (FNCGetSignalStrengthdBm) GetProcAddress(priv->dll, "GetSignalStrengthdBm"); priv->GetRawSignalStrength = (FNCGetRawSignalStrength) GetProcAddress(priv->dll, "GetRawSignalStrength"); priv->G3GetInfo = (FNCG3GetInfo) GetProcAddress(priv->dll, "G3GetInfo"); rig->state.priv = (void*)priv; return RIG_OK; } int g3_open(RIG *rig) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; int device_num; device_num = atoi(rig->state.rigport.pathname); /* Open Winradio receiver handle */ priv->hRadio = priv->OpenRadioDevice(device_num); if (priv->hRadio == 0) return -RIG_EIO; /* huh! */ /* Make sure the receiver is switched on */ priv->SetPower(priv->hRadio, TRUE); return RIG_OK; } int g3_close(RIG *rig) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; priv->CloseRadioDevice(priv->hRadio); return RIG_OK; } int g3_cleanup(RIG *rig) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; /* Clean up the dll access */ FreeLibrary(priv->dll); if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } int g3_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; int ret; ret = priv->G3SetFrequency(priv->hRadio, (DWORD) (freq)); ret = ret==TRUE ? RIG_OK : -RIG_EIO; return ret; } int g3_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; *freq = (freq_t) priv->G3GetFrequency(priv->hRadio); return *freq != 0 ? RIG_OK : -RIG_EIO; } int g3_set_powerstat(RIG *rig, powerstat_t status) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; int ret; ret = priv->SetPower(priv->hRadio, status==RIG_POWER_ON ? TRUE : FALSE); ret = ret==TRUE ? RIG_OK : -RIG_EIO; return ret; } int g3_get_powerstat(RIG *rig, powerstat_t *status) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; int ret; ret = priv->GetPower(priv->hRadio); *status = ret==TRUE ? RIG_POWER_ON : RIG_POWER_OFF; return RIG_OK; } int g3_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; int ret, agc; switch(level) { case RIG_LEVEL_ATT: ret = priv->SetAtten(priv->hRadio, val.i != 0 ? TRUE : FALSE); break; case RIG_LEVEL_AGC: switch (val.i) { case RIG_AGC_OFF: agc = 0; break; case RIG_AGC_SLOW: agc = 1; break; case RIG_AGC_MEDIUM: agc = 2; break; case RIG_AGC_FAST: agc = 3; break; default: return -RIG_EINVAL; } ret = priv->SetAGC(priv->hRadio, agc); break; case RIG_LEVEL_RF: ret = priv->SetIFGain(priv->hRadio, (int)(val.f*100)); break; default: return -RIG_EINVAL; } ret = ret==TRUE ? RIG_OK : -RIG_EIO; return ret; } int g3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; int ret; ret = RIG_OK; switch(level) { case RIG_LEVEL_ATT: val->i = priv->GetAtten(priv->hRadio)?rig->caps->attenuator[0]:0; break; case RIG_LEVEL_AGC: switch (priv->GetAGC(priv->hRadio)) { case 0: val->i = RIG_AGC_OFF; break; case 1: val->i = RIG_AGC_SLOW; break; case 2: val->i = RIG_AGC_MEDIUM; break; case 3: val->i = RIG_AGC_FAST; break; case -1: ret = -RIG_EIO; break; default: return -RIG_EINVAL; } break; case RIG_LEVEL_STRENGTH: val->i = priv->GetSignalStrengthdBm(priv->hRadio)/10+73; break; case RIG_LEVEL_RAWSTR: val->i = priv->GetRawSignalStrength(priv->hRadio); break; default: return -RIG_EINVAL; } return ret; } static const char* g3_get_info(RIG *rig) { struct g3_priv_data *priv = (struct g3_priv_data *)rig->state.priv; static RADIO_INFO info; info.bLength = sizeof(RADIO_INFO); if (priv->G3GetInfo(priv->hRadio,&info) == FALSE) return NULL; return info.szSerNum; } #endif /* _WIN32 */ hamlib-1.2.15.3/winradio/linradio/0000755000175000017500000000000012044565023013614 500000000000000hamlib-1.2.15.3/winradio/linradio/wrapi.h0000644000175000017500000001374412044564477015054 00000000000000/****************************************************************************/ /* Low-level receiver interface code. */ /* Copyright (C) 2000 WiNRADiO Communications. */ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; Version 2, June 1991. */ /* */ /* 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 */ /* General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #ifndef _WRAPI_H_ #define _WRAPI_H_ #ifdef __cplusplus extern "C" { #endif /* WiNRADiO Information Features (capabilities) */ #define RIF_USVERSION 0x00000001 /* set if hardware is US version */ #define RIF_DSP 0x00000002 /* set if DSP is present */ #define RIF_LSBUSB 0x00000004 /* set if receiver as CW/LSB/USB instead of SSB */ #define RIF_CWIFSHIFT 0x00000008 /* set if receiver uses IFShift in CW (not BFOOffset) */ #define RIF_AGC 0x00000100 /* set if receiver supports AGC on/off */ #define RIF_IFGAIN 0x00000200 /* set if receiver has manual IF gain control */ /* WiNRADiO Modes */ #define RMD_CW 0 #define RMD_AM 1 #define RMD_FMN 2 #define RMD_FMW 3 #define RMD_LSB 4 #define RMD_USB 5 #define RMD_FMM 6 /* 50kHz FM */ #define RMD_FM6 7 /* 6kHz FMN */ /* WiNRADiO Hardware Versions */ #define RHV_1000a 0x0100 /* older WR-1000 series */ #define RHV_1000b 0x010a /* current WR-1000 series */ #define RHV_1500 0x0132 #define RHV_1550 0x0137 /* new WR-1550 receiver */ #define RHV_3000 0x0200 /* Spectrum Monitor series */ #define RHV_3100 0x020a #define RHV_3150 0x020f /* new WR-3150 receiver */ #define RHV_3200 0x0214 #define RHV_3500 0x0232 #define RHV_3700 0x0246 #define RHV_2000 0x0300 /* frequency x10 multiplier (ie. 2-20 GHz maximum support) */ #define RFQ_X10 0x80000000L /* WiNRADiO Hardware Interfaces */ #define RHI_ISA 0 #define RHI_SERIAL 1 #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE 1 #endif typedef unsigned long DWORD; typedef int BOOL; typedef unsigned int UINT; typedef unsigned char BYTE; typedef unsigned short WORD; typedef float FLOAT; typedef FLOAT *PFLOAT; typedef BOOL *PBOOL; typedef BOOL *LPBOOL; typedef BYTE *PBYTE; typedef BYTE *LPBYTE; typedef int *PINT; typedef int *LPINT; typedef UINT *PUINT; typedef UINT *LPUINT; typedef WORD *PWORD; typedef WORD *LPWORD; typedef long *LPLONG; typedef DWORD *PDWORD; typedef DWORD *LPDWORD; typedef void *LPVOID; typedef int *MODELIST; typedef MODELIST *LPMODELIST; typedef struct _RADIOINFO { DWORD dwSize; /* size of structure (must be set before calling GetRadioDeviceInfo) */ DWORD dwFeatures; /* bit flags for extra features (RIF_XXX) */ WORD wAPIVer; /* driver version */ WORD wHWVer; /* hardware version (RHV_XXX) */ DWORD dwMinFreq; /* minimum frequency receiver can tune to */ DWORD dwMaxFreq; /* maximum frequency receiver can tune to */ int iFreqRes; /* resolution of receiver in Hz */ int iNumModes; /* number of modes that can be set */ int iMaxVolume; /* maximum volume level */ int iMaxBFO; /* maximum BFO offset range (+/- in Hz) */ int iMaxFMScanRate; /* maximum scan rate for FM scanning/sweeping */ int iMaxAMScanRate; /* maximum scan rate for AM scanning/sweeping */ int iHWInterface; /* physical interface radio is connected to (RHI_XXX) */ int iDeviceNum; /* logical radio device number */ int iNumSources; /* number of selectable audio sources */ int iMaxIFShift; /* maximum IF shift */ DWORD dwWaveFormats; /* bit array of supported rec/play formats (RWF_XXX) */ int iDSPSources; /* number of selectable DSP input sources */ LPMODELIST lpSupportedModes; /* list of available modes (length specified by iNumModes) */ DWORD dwMaxFreqkHz; /* same as dwMaxFreq, but in kHz */ char szDeviceName[64]; /* not used in DOSRADIO */ int iMaxIFGain; /* the maximum manual IF gain level */ char descr[80]; /* Description (PB) */ } RADIOINFO, *PRADIOINFO, *LPRADIOINFO; int OpenRadioDevice(WORD); BOOL CloseRadioDevice(int); int GetRadioDeviceInfo(int, LPRADIOINFO); int GetSignalStrength(int); BOOL SetFrequency(int, DWORD); BOOL SetMode(int, int); BOOL SetVolume(int, int); BOOL SetAtten(int, BOOL); BOOL SetMute(int, BOOL); BOOL SetPower(int, BOOL); BOOL SetBFOOffset(int, int); BOOL SetIFShift(int, int); BOOL SetAGC(int, BOOL); BOOL SetIFGain(int, int); DWORD GetFrequency(int); int GetMode(int); int GetMaxVolume(int); int GetVolume(int); BOOL GetAtten(int); BOOL GetMute(int); BOOL GetPower(int); int GetBFOOffset(int); int GetIFShift(int); BOOL GetAGC(int); int GetMaxIFGain(int); int GetIFGain(int); char *GetDescr(int); #ifdef __cplusplus } #endif #ifdef __KERNEL__ /* Hooks called when rescheduling */ extern void (*yield_hook)(); extern void (*reenter_hook)(); #endif #endif hamlib-1.2.15.3/winradio/linradio/radio_ioctl.h0000644000175000017500000000375612044564477016224 00000000000000/* ioctl API for radio devices. * (C) 1997 Michael McCormack * * Adapted for wrkit and newer winradio receivers. * (C) 1999-2000 */ #ifndef RADIO_H #define RADIO_H #include /* define ioctl() numbers for the radio */ #define RADIO_ID 0x8C /* See linux/Documentation/ioctl-number.txt */ #define RADIO_GET_POWER _IOR(RADIO_ID,0x00,long) #define RADIO_SET_POWER _IOW(RADIO_ID,0x01,long) #define RADIO_GET_MODE _IOR(RADIO_ID,0x02,long) #define RADIO_SET_MODE _IOW(RADIO_ID,0x03,long) #define RADIO_GET_MUTE _IOR(RADIO_ID,0x04,long) #define RADIO_SET_MUTE _IOW(RADIO_ID,0x05,long) #define RADIO_GET_ATTN _IOR(RADIO_ID,0x06,long) #define RADIO_SET_ATTN _IOW(RADIO_ID,0x07,long) #define RADIO_GET_VOL _IOR(RADIO_ID,0x08,long) #define RADIO_SET_VOL _IOW(RADIO_ID,0x09,long) #define RADIO_GET_FREQ _IOR(RADIO_ID,0x0a,long) /* Hz */ #define RADIO_SET_FREQ _IOW(RADIO_ID,0x0b,long) #define RADIO_GET_BFO _IOR(RADIO_ID,0x0c,long) /* Hz */ #define RADIO_SET_BFO _IOW(RADIO_ID,0x0d,long) /* #define RADIO_GET_SSAM _IOR(RADIO_ID,0x0e,long) #define RADIO_GET_SSFMN _IOR(RADIO_ID,0x0f,long) #define RADIO_GET_SSFMW1 _IOR(RADIO_ID,0x10,long) #define RADIO_GET_SSFMW2 _IOR(RADIO_ID,0x11,long) */ #define RADIO_GET_SS _IOR(RADIO_ID,0x12,long) /* 0..120 */ #define RADIO_GET_IFS _IOR(RADIO_ID,0x13,long) /* Hz */ #define RADIO_SET_IFS _IOW(RADIO_ID,0x14,long) #define RADIO_GET_DESCR _IOR(RADIO_ID,0x15,char[256]) #define RADIO_GET_AGC _IOR(RADIO_ID,0x16,long) #define RADIO_SET_AGC _IOW(RADIO_ID,0x17,long) #define RADIO_GET_IFG _IOR(RADIO_ID,0x18,long) #define RADIO_SET_IFG _IOW(RADIO_ID,0x19,long) /* Someone forgot 0x1A-0x1F ? */ #define RADIO_GET_MAXVOL _IOR(RADIO_ID,0x20,long) #define RADIO_GET_MAXIFG _IOR(RADIO_ID,0x21,long) /* radio modes */ typedef enum { RADIO_CW = 0, RADIO_AM = 1, RADIO_FMN = 2, RADIO_FMW = 3, RADIO_LSB = 4, RADIO_USB = 5, RADIO_FMM = 6, RADIO_FM6 = 7, } radio_mode; #endif /* RADIO_H */ hamlib-1.2.15.3/macros/0000755000175000017500000000000012044564777011502 500000000000000hamlib-1.2.15.3/macros/libtool.m40000644000175000017500000077464712044564516013350 00000000000000# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file 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. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 56 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl _LT_PROG_ECHO_BACKSLASH case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Fix-up fallback echo if it was mangled by the above quoting rules. case \$lt_ECHO in *'\\\[$]0 --fallback-echo"')dnl " lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` ;; esac _LT_OUTPUT_LIBTOOL_INIT ]) # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) cat >"$CONFIG_LT" <<_LTEOF #! $SHELL # Generated by $as_me. # Run this file to recreate a libtool stub with the current configuration. lt_cl_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2008 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. if test "$no_create" != yes; then lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) fi ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_XSI_SHELLFNS sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES # -------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(whole_archive_flag_spec, $1)='' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=echo _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX # ----------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl AC_LINK_IFELSE(AC_LANG_PROGRAM,[ lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], [AC_DIVERT_PUSH(NOTICE)]) $1 AC_DIVERT_POP ])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. m4_defun([_LT_PROG_ECHO_BACKSLASH], [_LT_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$lt_ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` ;; esac ECHO=${lt_ECHO-echo} if test "X[$]1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then # Yippee, $ECHO works! : else # Restart under the correct shell. exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} fi if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat <<_LT_EOF [$]* _LT_EOF exit 0 fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test -z "$lt_ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if { echo_test_string=`eval $cmd`; } 2>/dev/null && { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null then break fi done fi if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$ECHO" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. ECHO='print -r' elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} else # Try using printf. ECHO='printf %s\n' if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL ECHO="$CONFIG_SHELL [$]0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$CONFIG_SHELL [$]0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "[$]0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} else # Oops. We lost completely, so just stick with echo. ECHO=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. lt_ECHO=$ECHO if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" fi AC_SUBST(lt_ECHO) ]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that does not interpret backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [AC_CHECK_TOOL(AR, ar, false) test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1]) AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ = "XX$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line __oline__ "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` else lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[123]]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[[3-9]]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method == "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ const struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= AC_MSG_CHECKING([for $compiler option to produce PIC]) m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC*) # IBM XL 8.0 on PPC _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl*) # IBM XL C 8.0/Fortran 10.1 on PPC _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' ;; linux* | k*bsd*-gnu) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag= tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_TAGVAR(ld_shlibs, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE(int foo(void) {}, _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' ) LDFLAGS="$save_LDFLAGS" else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_MSG_CHECKING([whether -lc should be explicitly linked in]) $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then _LT_TAGVAR(archive_cmds_need_lc, $1)=no else _LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], [[If ld is used when linking, flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [fix_srcfile_path], [1], [Fix the shell variable $srcfile for the compiler]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_PROG_CXX # ------------ # Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ # compiler, we have our own version here. m4_defun([_LT_PROG_CXX], [ pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) AC_PROG_CXX if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_CXX dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_CXX], []) # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [AC_REQUIRE([_LT_PROG_CXX])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 will use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; xl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=echo else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ]) dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_PROG_F77 # ------------ # Since AC_PROG_F77 is broken, in that it returns the empty string # if there is no fortran compiler, we have our own version here. m4_defun([_LT_PROG_F77], [ pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) AC_PROG_F77 if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_F77 dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_F77], []) # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_REQUIRE([_LT_PROG_F77])dnl AC_LANG_PUSH(Fortran 77) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC CC=${F77-"f77"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_PROG_FC # ----------- # Since AC_PROG_FC is broken, in that it returns the empty string # if there is no fortran compiler, we have our own version here. m4_defun([_LT_PROG_FC], [ pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) AC_PROG_FC if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_FC dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_FC], []) # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_REQUIRE([_LT_PROG_FC])dnl AC_LANG_PUSH(Fortran) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC CC=${FC-"f95"} compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC="$lt_save_CC" ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC GCC= CC=${RC-"windres"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC="$lt_save_CC" ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_XSI_SHELLFNS # --------------------- # Bourne and XSI compatible variants of some useful shell functions. m4_defun([_LT_PROG_XSI_SHELLFNS], [case $xsi_shell in yes) cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac } # func_basename file func_basename () { func_basename_result="${1##*/}" } # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}" } # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). func_stripname () { # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"} } # func_opt_split func_opt_split () { func_opt_split_opt=${1%%=*} func_opt_split_arg=${1#*=} } # func_lo2o object func_lo2o () { case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac } # func_xform libobj-or-source func_xform () { func_xform_result=${1%.*}.lo } # func_arith arithmetic-term... func_arith () { func_arith_result=$(( $[*] )) } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=${#1} } _LT_EOF ;; *) # Bourne compatible functions. cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_basename file func_basename () { func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } dnl func_dirname_and_basename dnl A portable version of this function is already defined in general.m4sh dnl so there is no need for it here. # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; esac } # sed scripts: my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' my_sed_long_arg='1s/^-[[^=]]*=//' # func_opt_split func_opt_split () { func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` } # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` } # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` } # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "$[@]"` } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` } _LT_EOF esac case $lt_shell_append in yes) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$[1]+=\$[2]" } _LT_EOF ;; *) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$[1]=\$$[1]\$[2]" } _LT_EOF ;; esac ]) hamlib-1.2.15.3/macros/perl.m40000644000175000017500000000304312044564477012623 00000000000000#------------------------------------------------------------------------ # SC_PATH_PERLINC -- # # Locate the perl include files # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --with-perl-inc=... # # Defines the following vars: # PERL_INC_DIR Full path to the directory containing # the perl include files #------------------------------------------------------------------------ AC_DEFUN([SC_PATH_PERLINC], [ # we reset no_perl in case something fails here no_perl=true AC_ARG_WITH(perl-inc, [ --with-perl-inc directory containing perl includes], with_perl_inc=${withval}) AC_MSG_CHECKING([for perl headers]) AC_CACHE_VAL(ac_cv_c_perl_inc,[ # First check to see if --with-perl-inc was specified. if test x"${with_perl_inc}" != x ; then if test -f "${with_perl_inc}/perl.h" ; then ac_cv_c_perl_inc=`(cd ${with_perl_inc}; pwd)` else AC_MSG_ERROR([${with_perl_inc} directory doesn't contain perl.h]) fi fi # then check for a private Perl installation if test x"${ac_cv_c_perl_inc}" = x ; then eval `perl -V:archlibexp` if test -f "${archlibexp}/CORE/perl.h" ; then ac_cv_c_perl_inc=`(cd ${archlibexp}/CORE; pwd)` else AC_MSG_WARN([${with_perl_inc} directory doesn't contain perl.h]) fi fi ]) if test x"${ac_cv_c_perl_inc}" = x ; then PERL_INC_DIR= AC_MSG_WARN(Can't find Perl header files) else no_perl= PERL_INC_DIR=${ac_cv_c_perl_inc} AC_MSG_RESULT(found $PERL_INC_DIR) fi AC_SUBST(PERL_INC_DIR) ]) hamlib-1.2.15.3/macros/gr_pwin32.m40000644000175000017500000000622512044564477013500 00000000000000# Check for (mingw)win32 POSIX replacements. -*- Autoconf -*- # Copyright 2003 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # GNU Radio 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. AC_DEFUN([GR_PWIN32], [ AC_REQUIRE([AC_HEADER_TIME]) AC_CHECK_HEADERS([sys/types.h]) AC_CHECK_HEADERS([windows.h]) AC_CHECK_HEADERS([winioctl.h winbase.h], [], [], [ #if HAVE_WINDOWS_H #include #endif ]) AC_CHECK_FUNCS([getopt getopt_long usleep sleep gettimeofday]) AC_CHECK_TYPES([struct timezone, ssize_t],[],[],[ #if HAVE_SYS_TYPES_H # include #endif #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif ]) dnl Checks for replacements AC_REPLACE_FUNCS([getopt getopt_long usleep gettimeofday]) AC_MSG_CHECKING(for Sleep) AC_TRY_LINK([ #include #include ], [ Sleep(0); ], [AC_DEFINE(HAVE_SSLEEP,1,[Define to 1 if you have win32 Sleep]) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no) ) AH_BOTTOM( [ /* Define missing prototypes, implemented in replacement lib */ #ifdef __cplusplus extern "C" { #endif #ifndef HAVE_GETOPT int getopt (int argc, char * const argv[], const char * optstring); extern char * optarg; extern int optind, opterr, optopt; #endif #ifndef HAVE_GETOPT_LONG struct option; int getopt_long (int argc, char * const argv[], const char * optstring, const struct option * longopts, int * longindex); #endif #ifndef HAVE_USLEEP int usleep(unsigned long usec); /* SUSv2 */ #endif #if defined(HAVE_SSLEEP) && !defined(HAVE_SLEEP) #ifdef HAVE_WINBASE_H #include #include #endif /* TODO: what about SleepEx? */ static inline unsigned int sleep (unsigned int nb_sec) { Sleep(nb_sec*1000); return 0; } #endif #ifndef HAVE_GETTIMEOFDAY #ifdef HAVE_SYS_TIME_H #include #endif #ifndef HAVE_STRUCT_TIMEZONE struct timezone { int tz_minuteswest; int tz_dsttime; }; #endif int gettimeofday(struct timeval *tv, struct timezone *tz); #endif #ifndef timersub # define timersub(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ if ((result)->tv_usec < 0) { \ --(result)->tv_sec; \ (result)->tv_usec += 1000000; \ } \ } while (0) #endif #ifndef HAVE_SSIZE_T typedef size_t ssize_t; #endif #ifdef __cplusplus } #endif ]) ]) hamlib-1.2.15.3/macros/ac_python_devel.m40000644000175000017500000002662012044564477015032 00000000000000# =========================================================================== # http://autoconf-archive.cryp.to/ac_python_devel.html # =========================================================================== # # SYNOPSIS # # AC_PYTHON_DEVEL([version]) # # DESCRIPTION # # Note: Defines as a precious variable "PYTHON_VERSION". Don't override it # in your configure.ac. # # This macro checks for Python and tries to get the include path to # 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) # output variables. It also exports $(PYTHON_EXTRA_LIBS) and # $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code. # # You can search for some particular version of Python by passing a # parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please # note that you *have* to pass also an operator along with the version to # match, and pay special attention to the single quotes surrounding the # version number. Don't use "PYTHON_VERSION" for this: that environment # variable is declared as precious and thus reserved for the end-user. # # This macro should work for all versions of Python >= 2.1.0. As an end # user, you can disable the check for the python version by setting the # PYTHON_NOVERSIONCHECK environment variable to something else than the # empty string. # # If you need to use this macro for an older Python version, please # contact the authors. We're always open for feedback. # # LICENSE # # Copyright (c) 2009 Sebastian Huber # Copyright (c) 2009 Alan W. Irwin # Copyright (c) 2009 Rafael Laboissiere # Copyright (c) 2009 Andrew Collier # Copyright (c) 2009 Matteo Settenvini # Copyright (c) 2009 Horst Knorr # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 3 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 General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. AC_DEFUN([AC_PYTHON_DEVEL],[ # # Allow the use of a (user set) custom python version # AC_ARG_VAR([PYTHON_VERSION],[The installed Python version to use, for example '2.3'. This string will be appended to the Python interpreter canonical name.]) AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]]) if test -z "$PYTHON"; then AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path]) PYTHON_VERSION="" fi # # Check for a version of Python >= 2.1.0 # AC_MSG_CHECKING([for a version of Python >= '2.1.0']) ac_supports_python_ver=`$PYTHON -c "import sys; \ ver = sys.version.split ()[[0]]; \ print (ver >= '2.1.0')"` if test "$ac_supports_python_ver" != "True"; then if test -z "$PYTHON_NOVERSIONCHECK"; then AC_MSG_RESULT([no]) AC_MSG_FAILURE([ This version of the AC@&t@_PYTHON_DEVEL macro doesn't work properly with versions of Python before 2.1.0. You may need to re-run configure, setting the variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. Moreover, to disable this check, set PYTHON_NOVERSIONCHECK to something else than an empty string. ]) else AC_MSG_RESULT([skip at user request]) fi else AC_MSG_RESULT([yes]) fi # # if the macro parameter ``version'' is set, honour it # if test -n "$1"; then AC_MSG_CHECKING([for a version of Python $1]) ac_supports_python_ver=`$PYTHON -c "import sys; \ ver = sys.version.split ()[[0]]; \ print (ver $1)"` if test "$ac_supports_python_ver" = "True"; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) AC_MSG_ERROR([this package requires Python $1. If you have it installed, but it isn't the default Python interpreter in your system path, please pass the PYTHON_VERSION variable to configure. See ``configure --help'' for reference. ]) PYTHON_VERSION="" fi fi # # Check if you have distutils, else fail # AC_MSG_CHECKING([for the distutils Python package]) ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` if test -z "$ac_distutils_result"; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) AC_MSG_ERROR([cannot import Python module "distutils". Please check your Python installation. The error was: $ac_distutils_result]) PYTHON_VERSION="" fi # # Check for Python include path # AC_MSG_CHECKING([for Python include path]) if test -z "$PYTHON_CPPFLAGS"; then python_path=`$PYTHON -c "import distutils.sysconfig; \ print (distutils.sysconfig.get_python_inc ());"` if test -n "${python_path}"; then python_path="-I$python_path" fi PYTHON_CPPFLAGS=$python_path fi AC_MSG_RESULT([$PYTHON_CPPFLAGS]) AC_SUBST([PYTHON_CPPFLAGS]) # # Check for Python library path # AC_MSG_CHECKING([for Python library path]) if test -z "$PYTHON_LDFLAGS"; then # (makes two attempts to ensure we've got a version number # from the interpreter) ac_python_version=`cat<]], [[Py_Initialize();]]) ],[pythonexists=yes],[pythonexists=no]) AC_LANG_POP([C]) # turn back to default flags CPPFLAGS="$ac_save_CPPFLAGS" LIBS="$ac_save_LIBS" AC_MSG_RESULT([$pythonexists]) if test ! "x$pythonexists" = "xyes"; then AC_MSG_FAILURE([ Could not link test program to Python. Maybe the main Python library has been installed in some non-standard library path. If so, pass it to configure, via the LDFLAGS environment variable. Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib" ============================================================================ ERROR! You probably have to install the development version of the Python package for your distribution. The exact name of this package varies among them. ============================================================================ ]) PYTHON_VERSION="" fi # # all done! # ]) hamlib-1.2.15.3/macros/ltsugar.m40000644000175000017500000001042412044564521013331 00000000000000# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file 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. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) hamlib-1.2.15.3/macros/ltversion.m40000644000175000017500000000127712044564522013704 00000000000000# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file 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. # Generated from ltversion.in. # serial 3017 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.2.6b]) m4_define([LT_PACKAGE_REVISION], [1.3017]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.2.6b' macro_revision='1.3017' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) hamlib-1.2.15.3/macros/aclocal-include.m40000644000175000017500000000056412044564477014705 00000000000000# aclocal-include.m4 # # This macro adds the name macrodir to the set of directories # that `aclocal' searches for macros. # serial 1 dnl AM_ACLOCAL_INCLUDE(macrodir) AC_DEFUN([AM_ACLOCAL_INCLUDE], [ AM_CONDITIONAL(INSIDE_GNOME_COMMON, test x = y) test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done ]) hamlib-1.2.15.3/macros/ltoptions.m40000644000175000017500000002724212044564520013710 00000000000000# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file 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. # serial 6 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [0], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) hamlib-1.2.15.3/macros/gr_swig.m40000644000175000017500000000622112044564477013323 00000000000000dnl dnl Copyright 2003 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl dnl GNU Radio is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2, or (at your option) dnl any later version. dnl dnl GNU Radio is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with GNU Radio; see the file COPYING. If not, write to dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, dnl Boston, MA 02111-1307, USA. dnl # SWIG_PROG([required-version]) # # Checks for the SWIG program. If found you can (and should) call SWIG via $(SWIG). # You can use the optional first argument to check if the version of the available SWIG # is greater or equal to the value of the argument. It should have the format: # N[.N[.N]] (N is a number between 0 and 999. Only the first N is mandatory.) AC_DEFUN([SWIG_PROG],[ AC_REQUIRE([AC_PROG_MAKE_SET]) AC_CHECK_PROG(SWIG,swig,[`which swig`]) if test -z "$SWIG" ; then AC_MSG_WARN([cannot find 'swig' program]) SWIG=false elif test -n "$1" ; then AC_MSG_CHECKING([for SWIG version]) swig_version=`$SWIG -version 2>&1 | \ awk '/^SWIG Version [[0-9]+\.[0-9]+\.[0-9]]+.*$/ { split($[3],a,"[[^.0-9]]"); print a[[1]] }'` AC_MSG_RESULT([$swig_version]) if test -n "$swig_version" ; then swig_version=`echo $swig_version | \ awk '{ split($[1],a,"\."); print [a[1]*1000000+a[2]*1000+a[3]] }' 2>/dev/null` swig_required_version=`echo $1 | \ awk '{ split($[1],a,"\."); print [a[1]*1000000+a[2]*1000+a[3]] }' 2>/dev/null` if test $swig_required_version -gt $swig_version ; then AC_MSG_WARN([SWIG version $1 required]) SWIG=false fi else AC_MSG_WARN([cannot determine SWIG version]) SWIG=false fi fi ]) # SWIG_ENABLE_CXX() # # Enable swig C++ support. This effects all invocations of $(SWIG). AC_DEFUN([SWIG_ENABLE_CXX],[ AC_REQUIRE([SWIG_PROG]) AC_REQUIRE([AC_PROG_CXX]) if test "$SWIG" != "false" ; then SWIG="$SWIG -c++" fi ]) # SWIG_PYTHON([use-shadow-classes]) # # Checks for Python and provides the $(SWIG_PYTHON_CPPFLAGS), # $(SWIG_PYTHON_LIB) and $(SWIG_PYTHON_OPT) output variables. # $(SWIG_PYTHON_OPT) contains all necessary swig options to generate # code for Python. If you need multi module support use # $(SWIG_PYTHON_LIB) (provided by the SWIG_MULTI_MODULE_SUPPORT() # macro) to link against the appropriate library. It contains the # SWIG Python runtime library that is needed by the type check system # for example. AC_DEFUN([SWIG_PYTHON],[ AC_REQUIRE([SWIG_PROG]) AC_REQUIRE([PYTHON_DEVEL]) if test "$SWIG" != "false" ; then AC_SUBST(SWIG_PYTHON_LIB,[-lswigpy]) dnl test ! "x$1" = "xno" && swig_shadow=" -shadow" || swig_shadow="" dnl AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow]) AC_SUBST(SWIG_PYTHON_OPT,[-python]) fi AC_SUBST(SWIG_PYTHON_CPPFLAGS,[$PYTHON_CPPFLAGS]) ]) hamlib-1.2.15.3/macros/hl_getaddrinfo.m40000644000175000017500000000627212044564477014641 00000000000000# Check for getaddrinfo replacement. -*- Autoconf -*- # Copyright (c) 2010 by Stephane Fillod # # This file is part of Hamlib # # 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. AC_DEFUN([HL_GETADDRINFO], [ AC_CHECK_TYPES([struct addrinfo],[],[],[ #if HAVE_NETDB_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #elif HAVE_WS2TCPIP_H # include #endif ]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include #if HAVE_NETDB_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #elif HAVE_WS2TCPIP_H # include #endif #include ]], [[getaddrinfo("", "", NULL, NULL);]])], [ac_cv_func_getaddrinfo=yes AC_DEFINE(HAVE_GETADDRINFO,[1],[Define if getaddrinfo is available])], [ac_cv_func_getaddrinfo=no]) AC_CHECK_DECLS([gai_strerror], [], [], [[ #include #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_NETDB_H #include #endif #ifdef HAVE_WS2TCPIP_H #include #endif #include ]]) dnl Checks for replacements AC_REPLACE_FUNCS([getaddrinfo]) AH_BOTTOM( [ /* Define missing prototypes, implemented in replacement lib */ #ifdef __cplusplus extern "C" { #endif #ifndef HAVE_STRUCT_ADDRINFO #ifdef HAVE_NETINET_IN_H #include #endif #if HAVE_NETDB_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #elif HAVE_WS2TCPIP_H #include #endif struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; socklen_t ai_addrlen; struct sockaddr *ai_addr; }; #endif #ifndef HAVE_GETADDRINFO #ifdef HAVE_NETINET_IN_H #include #endif #if HAVE_NETDB_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #elif HAVE_WS2TCPIP_H #include #endif #ifndef AI_PASSIVE #define AI_PASSIVE 0x0001 #endif int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res); void freeaddrinfo(struct addrinfo *res); #endif #if !defined(HAVE_DECL_GAI_STRERROR) && !defined(gai_strerror) const char *gai_strerror(int errcode); #endif /* !HAVE_DECL_GAI_STRERROR */ #ifdef __cplusplus } #endif ]) ]) hamlib-1.2.15.3/macros/Makefile.in0000644000175000017500000003067112044564554013467 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = macros DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ MACROS = \ aclocal-include.m4 \ acx_pthread.m4 \ lf_warnings.m4 \ gr_doxygen.m4 \ gr_pwin32.m4 \ gr_swig.m4 \ hl_getaddrinfo.m4 \ perl.m4 \ ac_python_devel.m4 \ tcl.m4 EXTRA_DIST = $(MACROS) MAINTAINERCLEANFILES = macros.dep all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu macros/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu macros/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am @MAINT@macros.dep: Makefile.am @MAINT@ @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=macros/%)' > $@ # 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: hamlib-1.2.15.3/macros/lt~obsolete.m40000644000175000017500000001311312044564524014223 00000000000000# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file 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. # serial 4 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) hamlib-1.2.15.3/macros/lf_warnings.m40000644000175000017500000001012312044564477014167 00000000000000dnl Copyright (C) 1988 Eleftherios Gkioulekas dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. dnl dnl As a special exception to the GNU General Public License, if you dnl distribute this file as part of a program that contains a configuration dnl script generated by Autoconf, you may include it under the same dnl distribution terms that you use for the rest of that program. # -------------------------------------------------------------------------- # Check whether the C++ compiler accepts a certain flag # If it does it adds the flag to CXXFLAGS # If it does not then it returns an error to lf_ok # Usage: # LF_CHECK_CXX_FLAG(-flag1 -flag2 -flag3 ...) # ------------------------------------------------------------------------- AC_DEFUN([LF_CHECK_CXX_FLAG],[ echo 'void f(){}' > conftest.cc for i in $1 do AC_MSG_CHECKING([whether $CXX accepts $i]) if test -z "`${CXX} $i -c conftest.cc 2>&1`" then CXXFLAGS="${CXXFLAGS} $i" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi done rm -f conftest.cc conftest.o ]) # -------------------------------------------------------------------------- # Check whether the C compiler accepts a certain flag # If it does it adds the flag to CFLAGS # If it does not then it returns an error to lf_ok # Usage: # LF_CHECK_CC_FLAG(-flag1 -flag2 -flag3 ...) # ------------------------------------------------------------------------- AC_DEFUN([LF_CHECK_CC_FLAG],[ echo 'void f(){}' > conftest.c for i in $1 do AC_MSG_CHECKING([whether $CC accepts $i]) if test -z "`${CC} $i -c conftest.c 2>&1`" then CFLAGS="${CFLAGS} $i" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi done rm -f conftest.c conftest.o ]) # -------------------------------------------------------------------------- # Check whether the Fortran compiler accepts a certain flag # If it does it adds the flag to FFLAGS # If it does not then it returns an error to lf_ok # Usage: # LF_CHECK_F77_FLAG(-flag1 -flag2 -flag3 ...) # ------------------------------------------------------------------------- AC_DEFUN([LF_CHECK_F77_FLAG],[ cat << EOF > conftest.f c....:++++++++++++++++++++++++ PROGRAM MAIN PRINT*,'Hello World!' END EOF for i in $1 do AC_MSG_CHECKING([whether $F77 accepts $i]) if test -z "`${F77} $i -c conftest.f 2>&1`" then FFLAGS="${FFLAGS} $i" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi done rm -f conftest.f conftest.o ]) # ---------------------------------------------------------------------- # Provide the configure script with an --with-warnings option that # turns on warnings. Call this command AFTER you have configured ALL your # compilers. # ---------------------------------------------------------------------- AC_DEFUN([LF_SET_WARNINGS],[ dnl Check for --with-warnings AC_MSG_CHECKING([whether user wants warnings]) AC_ARG_WITH(warnings, [ --with-warnings Turn on warnings], [ lf_warnings=yes ], [ lf_warnings=no ]) lf_warnings=yes # hard code for now -eb AC_MSG_RESULT($lf_warnings) dnl Warnings for the two main compilers cc_warning_flags="-Wall" cxx_warning_flags="-Wall -Woverloaded-virtual" if test $lf_warnings = yes then if test -n "${CC}" then LF_CHECK_CC_FLAG($cc_warning_flags) fi if test -n "${CXX}" then LF_CHECK_CXX_FLAG($cxx_warning_flags) fi fi ]) hamlib-1.2.15.3/macros/gr_doxygen.m40000644000175000017500000000410112044564477014022 00000000000000dnl dnl Copyright 2003 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl dnl GNU Radio is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2, or (at your option) dnl any later version. dnl dnl GNU Radio is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with GNU Radio; see the file COPYING. If not, write to dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, dnl Boston, MA 02111-1307, USA. dnl AC_DEFUN([GR_CHECK_DOXYGEN],[ AC_ARG_ENABLE(doxygen, [ --enable-doxygen enable documentation generation with doxygen (auto)]) AC_ARG_ENABLE(dot, [ --enable-dot use 'dot' to generate graphs in doxygen (auto)]) AC_ARG_ENABLE(html-docs, [ --enable-html-docs enable HTML generation with doxygen (yes)], [], [ enable_html_docs=yes]) AC_ARG_ENABLE(latex-docs, [ --enable-latex-docs enable LaTeX doc generation with doxygen (no)], [], [ enable_latex_docs=no]) if test "x$enable_doxygen" = xno; then enable_doc=no else AC_PATH_PROG(DOXYGEN, doxygen, , $PATH) if test x$DOXYGEN = x; then if test "x$enable_doxygen" = xyes; then AC_MSG_ERROR([could not find doxygen]) fi enable_doc=no else enable_doc=yes AC_PATH_PROG(DOT, dot, , $PATH) fi fi AM_CONDITIONAL(DOC, test x$enable_doc = xyes) if test x$DOT = x; then if test "x$enable_dot" = xyes; then AC_MSG_ERROR([could not find dot]) fi enable_dot=no else enable_dot=yes fi AC_SUBST(enable_dot) AC_SUBST(enable_html_docs) AC_SUBST(enable_latex_docs) ]) hamlib-1.2.15.3/macros/tcl.m40000644000175000017500000000776512044564477012462 00000000000000#------------------------------------------------------------------------ # SC_PATH_TCLCONFIG -- # # Locate the tclConfig.sh file and perform a sanity check on # the Tcl compile flags # # Arguments: # none # # Results: # # Adds the following arguments to configure: # --with-tcl=... # # Defines the following vars: # TCL_BIN_DIR Full path to the directory containing # the tclConfig.sh file #------------------------------------------------------------------------ AC_DEFUN([SC_PATH_TCLCONFIG], [ # # Ok, lets find the tcl configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-tcl # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true AC_ARG_WITH(tcl, [ --with-tcl=PATH directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval}) AC_MSG_CHECKING([for Tcl configuration]) AC_CACHE_VAL(ac_cv_c_tclconfig,[ # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` else AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh]) fi fi # then check for a private Tcl installation if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ../tcl \ `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ ../../tcl \ `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ ../../../tcl \ `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break fi done fi # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -dr /usr/lib/tcl[[8-9]].[[0-9]]* 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i; pwd)` break fi done fi # check in a few other private locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ${srcdir}/../tcl \ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break fi done fi ]) if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" AC_MSG_WARN(Can't find Tcl configuration definitions) else no_tcl= TCL_BIN_DIR=${ac_cv_c_tclconfig} AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh) fi fi ]) #------------------------------------------------------------------------ # SC_LOAD_TCLCONFIG -- # # Load the tclConfig.sh file # # Arguments: # # Requires the following vars to be set: # TCL_BIN_DIR # # Results: # # Subst the following vars: # TCL_BIN_DIR # TCL_SRC_DIR # TCL_LIB_FILE # #------------------------------------------------------------------------ AC_DEFUN([SC_LOAD_TCLCONFIG], [ AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh]) if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then AC_MSG_RESULT([loading]) . $TCL_BIN_DIR/tclConfig.sh else AC_MSG_RESULT([file not found]) fi # # The eval is required to do the TCL_DBGX substitution in the # TCL_LIB_FILE variable # eval TCL_LIB_FILE=${TCL_LIB_FILE} eval TCL_LIB_FLAG=${TCL_LIB_FLAG} AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_SRC_DIR) AC_SUBST(TCL_LIB_FILE) ]) hamlib-1.2.15.3/macros/Makefile.am0000644000175000017500000000061512044564477013455 00000000000000## Please update this variable if any new macros are created MACROS = \ aclocal-include.m4 \ acx_pthread.m4 \ lf_warnings.m4 \ gr_doxygen.m4 \ gr_pwin32.m4 \ gr_swig.m4 \ hl_getaddrinfo.m4 \ perl.m4 \ ac_python_devel.m4 \ tcl.m4 EXTRA_DIST=$(MACROS) MAINTAINERCLEANFILES=macros.dep @MAINT@macros.dep: Makefile.am @MAINT@ @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=macros/%)' > $@ hamlib-1.2.15.3/macros/acx_pthread.m40000644000175000017500000002547512044564477014160 00000000000000# =========================================================================== # http://autoconf-archive.cryp.to/acx_pthread.html # =========================================================================== # # SYNOPSIS # # ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) # # DESCRIPTION # # This macro figures out how to build C programs using POSIX threads. It # sets the PTHREAD_LIBS output variable to the threads library and linker # flags, and the PTHREAD_CFLAGS output variable to any special C compiler # flags that are needed. (The user can also force certain compiler # flags/libs to be tested by setting these environment variables.) # # Also sets PTHREAD_CC to any special C compiler that is needed for # multi-threaded programs (defaults to the value of CC otherwise). (This # is necessary on AIX to use the special cc_r compiler alias.) # # NOTE: You are assumed to not only compile your program with these flags, # but also link it with them as well. e.g. you should link with # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS # # If you are only building threads programs, you may wish to use these # variables in your default LIBS, CFLAGS, and CC: # # LIBS="$PTHREAD_LIBS $LIBS" # CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # CC="$PTHREAD_CC" # # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant # has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name # (e.g. PTHREAD_CREATE_UNDETACHED on AIX). # # ACTION-IF-FOUND is a list of shell commands to run if a threads library # is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it # is not found. If ACTION-IF-FOUND is not specified, the default action # will define HAVE_PTHREAD. # # Please let the authors know if this macro fails on any platform, or if # you have any other suggestions or comments. This macro was based on work # by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help # from M. Frigo), as well as ac_pthread and hb_pthread macros posted by # Alejandro Forero Cuervo to the autoconf macro repository. We are also # grateful for the helpful feedback of numerous users. # # LAST MODIFICATION # # 2008-04-12 # # COPYLEFT # # Copyright (c) 2008 Steven G. Johnson # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 3 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 General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Macro Archive. When you make and # distribute a modified version of the Autoconf Macro, you may extend this # special exception to the GPL to apply to your modified version as well. AC_DEFUN([ACX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_SAVE AC_LANG_C acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) AC_MSG_RESULT($acx_pthread_ok) if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # ... -mt is also the pthreads flag for HP/aCC # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthreads/-mt/ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; -*) AC_MSG_CHECKING([whether pthreads work with $flag]) PTHREAD_CFLAGS="$flag" ;; pthread-config) AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) if test x"$acx_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) AC_MSG_CHECKING([for the pthreads library -l$flag]) PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. AC_TRY_LINK([#include ], [pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], [acx_pthread_ok=yes]) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" AC_MSG_RESULT($acx_pthread_ok) if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. AC_MSG_CHECKING([for joinable pthread attribute]) attr_name=unknown for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do AC_TRY_LINK([#include ], [int attr=$attr; return attr;], [attr_name=$attr; break]) done AC_MSG_RESULT($attr_name) if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, [Define to necessary symbol if this constant uses a non-standard name on your system.]) fi AC_MSG_CHECKING([if more special flags are required for pthreads]) flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac AC_MSG_RESULT(${flag}) if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with xlc_r or cc_r if test x"$GCC" != xyes; then AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) else PTHREAD_CC=$CC fi else PTHREAD_CC="$CC" fi AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(PTHREAD_CC) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) : else acx_pthread_ok=no $2 fi AC_LANG_RESTORE ])dnl ACX_PTHREAD hamlib-1.2.15.3/include/0000755000175000017500000000000012044564777011641 500000000000000hamlib-1.2.15.3/include/hamlib/0000755000175000017500000000000012044564777013075 500000000000000hamlib-1.2.15.3/include/hamlib/rig.h0000644000175000017500000020457212044564477013756 00000000000000/* * Hamlib Interface - API header * Copyright (c) 2000-2003 by Frank Singleton * Copyright (c) 2000-2012 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _RIG_H #define _RIG_H 1 #include #include #include /* list in another file to not mess up w/ this one */ /** * \addtogroup rig * @{ */ /*! \file rig.h * \brief Hamlib rig data structures. * * This file contains the data structures and definitions for the Hamlib rig API. * see the rig.c file for more details on the rig API. */ /* __BEGIN_DECLS should be used at the beginning of your declarations, * so that C++ compilers don't mangle their names. Use __END_DECLS at * the end of C declarations. */ #undef __BEGIN_DECLS #undef __END_DECLS #ifdef __cplusplus # define __BEGIN_DECLS extern "C" { # define __END_DECLS } #else # define __BEGIN_DECLS /* empty */ # define __END_DECLS /* empty */ #endif /* HAMLIB_PARAMS is a macro used to wrap function prototypes, so that compilers * that don't understand ANSI C prototypes still work, and ANSI C * compilers can issue warnings about type mismatches. */ #undef HAMLIB_PARAMS #if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(__CYGWIN__) || defined(_WIN32) || defined(__cplusplus) # define HAMLIB_PARAMS(protos) protos # define rig_ptr_t void* #else # define HAMLIB_PARAMS(protos) () # define rig_ptr_t char* #endif #include __BEGIN_DECLS extern HAMLIB_EXPORT_VAR(const char) hamlib_version[]; extern HAMLIB_EXPORT_VAR(const char) hamlib_copyright[]; /** * \brief Hamlib error codes * Error code definition that can be returned by the Hamlib functions. * Unless stated otherwise, Hamlib functions return the negative value * of rig_errcode_e definitions in case of error, or 0 when successful. */ enum rig_errcode_e { RIG_OK=0, /*!< No error, operation completed successfully */ RIG_EINVAL, /*!< invalid parameter */ RIG_ECONF, /*!< invalid configuration (serial,..) */ RIG_ENOMEM, /*!< memory shortage */ RIG_ENIMPL, /*!< function not implemented, but will be */ RIG_ETIMEOUT, /*!< communication timed out */ RIG_EIO, /*!< IO error, including open failed */ RIG_EINTERNAL, /*!< Internal Hamlib error, huh! */ RIG_EPROTO, /*!< Protocol error */ RIG_ERJCTED, /*!< Command rejected by the rig */ RIG_ETRUNC, /*!< Command performed, but arg truncated */ RIG_ENAVAIL, /*!< function not available */ RIG_ENTARGET, /*!< VFO not targetable */ RIG_BUSERROR, /*!< Error talking on the bus */ RIG_BUSBUSY, /*!< Collision on the bus */ RIG_EARG, /*!< NULL RIG handle or any invalid pointer parameter in get arg */ RIG_EVFO, /*!< Invalid VFO */ RIG_EDOM /*!< Argument out of domain of func */ }; /** \brief Token in the netrigctl protocol for returning error code */ #define NETRIGCTL_RET "RPRT " /** *\brief Hamlib debug levels * * REM: Numeric order matters for debug level * * \sa rig_set_debug */ enum rig_debug_level_e { RIG_DEBUG_NONE = 0, /*!< no bug reporting */ RIG_DEBUG_BUG, /*!< serious bug */ RIG_DEBUG_ERR, /*!< error case (e.g. protocol, memory allocation) */ RIG_DEBUG_WARN, /*!< warning */ RIG_DEBUG_VERBOSE, /*!< verbose */ RIG_DEBUG_TRACE /*!< tracing */ }; /* --------------- Rig capabilities -----------------*/ /* Forward struct references */ struct rig; struct rig_state; /*! * \brief Rig structure definition (see rig for details). */ typedef struct rig RIG; #define RIGNAMSIZ 30 #define RIGVERSIZ 8 #define FILPATHLEN 100 #define FRQRANGESIZ 30 #define MAXCHANDESC 30 /* describe channel eg: "WWV 5Mhz" */ #define TSLSTSIZ 20 /* max tuning step list size, zero ended */ #define FLTLSTSIZ 42 /* max mode/filter list size, zero ended */ #define MAXDBLSTSIZ 8 /* max preamp/att levels supported, zero ended */ #define CHANLSTSIZ 16 /* max mem_list size, zero ended */ #define MAX_CAL_LENGTH 32 /* max calibration plots in cal_table_t */ /** * \brief CTCSS and DCS type definition. * * Continuous Tone Controlled Squelch System (CTCSS) * sub-audible tone frequency are expressed in \em tenth of Hz. * For example, the subaudible tone of 88.5 Hz is represented within * Hamlib by 885. * * Digitally-Coded Squelch codes are simple direct integers. */ typedef unsigned int tone_t; /** * \brief Port type */ typedef enum rig_port_e { RIG_PORT_NONE = 0, /*!< No port */ RIG_PORT_SERIAL, /*!< Serial */ RIG_PORT_NETWORK, /*!< Network socket type */ RIG_PORT_DEVICE, /*!< Device driver, like the WiNRADiO */ RIG_PORT_PACKET, /*!< AX.25 network type, e.g. SV8CS protocol */ RIG_PORT_DTMF, /*!< DTMF protocol bridge via another rig, eg. Kenwood Sky Cmd System */ RIG_PORT_ULTRA, /*!< IrDA Ultra protocol! */ RIG_PORT_RPC, /*!< RPC wrapper */ RIG_PORT_PARALLEL, /*!< Parallel port */ RIG_PORT_USB, /*!< USB port */ RIG_PORT_UDP_NETWORK, /*!< UDP Network socket type */ RIG_PORT_CM108 /*!< CM108 GPIO */ } rig_port_t; /** * \brief Serial parity */ enum serial_parity_e { RIG_PARITY_NONE = 0, /*!< No parity */ RIG_PARITY_ODD, /*!< Odd */ RIG_PARITY_EVEN, /*!< Even */ RIG_PARITY_MARK, /*!< Mark */ RIG_PARITY_SPACE /*!< Space */ }; /** * \brief Serial handshake */ enum serial_handshake_e { RIG_HANDSHAKE_NONE = 0, /*!< No handshake */ RIG_HANDSHAKE_XONXOFF, /*!< Software XON/XOFF */ RIG_HANDSHAKE_HARDWARE /*!< Hardware CTS/RTS */ }; /** * \brief Serial control state */ enum serial_control_state_e { RIG_SIGNAL_UNSET = 0, /*!< Unset or tri-state */ RIG_SIGNAL_ON, /*!< ON */ RIG_SIGNAL_OFF /*!< OFF */ }; /** \brief Rig type flags */ typedef enum { RIG_FLAG_RECEIVER = (1<<1), /*!< Receiver */ RIG_FLAG_TRANSMITTER = (1<<2), /*!< Transmitter */ RIG_FLAG_SCANNER = (1<<3), /*!< Scanner */ RIG_FLAG_MOBILE = (1<<4), /*!< mobile sized */ RIG_FLAG_HANDHELD = (1<<5), /*!< handheld sized */ RIG_FLAG_COMPUTER = (1<<6), /*!< "Computer" rig */ RIG_FLAG_TRUNKING = (1<<7), /*!< has trunking */ RIG_FLAG_APRS = (1<<8), /*!< has APRS */ RIG_FLAG_TNC = (1<<9), /*!< has TNC */ RIG_FLAG_DXCLUSTER = (1<<10), /*!< has DXCluster */ RIG_FLAG_TUNER = (1<<11) /*!< dumb tuner */ } rig_type_t; #define RIG_FLAG_TRANSCEIVER (RIG_FLAG_RECEIVER|RIG_FLAG_TRANSMITTER) #define RIG_TYPE_MASK (RIG_FLAG_TRANSCEIVER|RIG_FLAG_SCANNER|RIG_FLAG_MOBILE|RIG_FLAG_HANDHELD|RIG_FLAG_COMPUTER|RIG_FLAG_TRUNKING|RIG_FLAG_TUNER) #define RIG_TYPE_OTHER 0 #define RIG_TYPE_TRANSCEIVER RIG_FLAG_TRANSCEIVER #define RIG_TYPE_HANDHELD (RIG_FLAG_TRANSCEIVER|RIG_FLAG_HANDHELD) #define RIG_TYPE_MOBILE (RIG_FLAG_TRANSCEIVER|RIG_FLAG_MOBILE) #define RIG_TYPE_RECEIVER RIG_FLAG_RECEIVER #define RIG_TYPE_PCRECEIVER (RIG_FLAG_COMPUTER|RIG_FLAG_RECEIVER) #define RIG_TYPE_SCANNER (RIG_FLAG_SCANNER|RIG_FLAG_RECEIVER) #define RIG_TYPE_TRUNKSCANNER (RIG_TYPE_SCANNER|RIG_FLAG_TRUNKING) #define RIG_TYPE_COMPUTER (RIG_FLAG_TRANSCEIVER|RIG_FLAG_COMPUTER) #define RIG_TYPE_TUNER RIG_FLAG_TUNER /** * \brief Development status of the backend */ enum rig_status_e { RIG_STATUS_ALPHA = 0, /*!< Alpha quality, i.e. development */ RIG_STATUS_UNTESTED, /*!< Written from available specs, rig unavailable for test, feedback wanted! */ RIG_STATUS_BETA, /*!< Beta quality */ RIG_STATUS_STABLE, /*!< Stable */ RIG_STATUS_BUGGY /*!< Was stable, but something broke it! */ /* RIG_STATUS_NEW * *!< Initial release of code * !! Use of RIG_STATUS_NEW is deprecated. Do not use it anymore */ }; /** \brief Map all deprecated RIG_STATUS_NEW references to RIG_STATUS_UNTESTED for backward compatibility */ #define RIG_STATUS_NEW RIG_STATUS_UNTESTED /** * \brief Repeater shift type */ typedef enum { RIG_RPT_SHIFT_NONE = 0, /*!< No repeater shift */ RIG_RPT_SHIFT_MINUS, /*!< "-" shift */ RIG_RPT_SHIFT_PLUS /*!< "+" shift */ } rptr_shift_t; /** * \brief Split mode */ typedef enum { RIG_SPLIT_OFF = 0, /*!< Split mode disabled */ RIG_SPLIT_ON /*!< Split mode enabled */ } split_t; /** * \brief Frequency type, * Frequency type unit in Hz, able to hold SHF frequencies. */ typedef double freq_t; /** \brief printf(3) format to be used for freq_t type */ #define PRIfreq "f" /** \brief scanf(3) format to be used for freq_t type */ #define SCNfreq "lf" #define FREQFMT SCNfreq /** * \brief Short frequency type * Frequency in Hz restricted to 31bits, suitable for offsets, shifts, etc.. */ typedef signed long shortfreq_t; #define Hz(f) ((freq_t)(f)) #define kHz(f) ((freq_t)((f)*(freq_t)1000)) #define MHz(f) ((freq_t)((f)*(freq_t)1000000)) #define GHz(f) ((freq_t)((f)*(freq_t)1000000000)) #define s_Hz(f) ((shortfreq_t)(f)) #define s_kHz(f) ((shortfreq_t)((f)*(shortfreq_t)1000)) #define s_MHz(f) ((shortfreq_t)((f)*(shortfreq_t)1000000)) #define s_GHz(f) ((shortfreq_t)((f)*(shortfreq_t)1000000000)) #define RIG_FREQ_NONE Hz(0) /** * \brief VFO definition * * There are several ways of using a vfo_t. For most cases, using RIG_VFO_A, * RIG_VFO_B, RIG_VFO_CURR, etc., as opaque macros should suffice. * * Strictly speaking a VFO is Variable Frequency Oscillator. * Here, it is referred as a tunable channel, from the radio operator's * point of view. The channel can be designated individually by its real * number, or by using an alias. * * Aliases may or may not be honored by a backend and are defined using * high significant bits, i.e. RIG_VFO_MEM, RIG_VFO_MAIN, etc. * */ typedef int vfo_t; /** \brief '' -- used in caps */ #define RIG_VFO_NONE 0 #define RIG_VFO_TX_FLAG (1<<30) /** \brief \c currVFO -- current "tunable channel"/VFO */ #define RIG_VFO_CURR (1<<29) /** \brief \c MEM -- means Memory mode, to be used with set_vfo */ #define RIG_VFO_MEM (1<<28) /** \brief \c VFO -- means (last or any)VFO mode, with set_vfo */ #define RIG_VFO_VFO (1<<27) #define RIG_VFO_TX_VFO(v) ((v)|RIG_VFO_TX_FLAG) /** \brief \c TX -- alias for split tx or uplink, of VFO_CURR */ #define RIG_VFO_TX RIG_VFO_TX_VFO(RIG_VFO_CURR) /** \brief \c RX -- alias for split rx or downlink */ #define RIG_VFO_RX RIG_VFO_CURR /** \brief \c Main -- alias for MAIN */ #define RIG_VFO_MAIN (1<<26) /** \brief \c Sub -- alias for SUB */ #define RIG_VFO_SUB (1<<25) #define RIG_VFO_N(n) (1<<(n)) /** \brief \c VFOA -- VFO A */ #define RIG_VFO_A RIG_VFO_N(0) /** \brief \c VFOB -- VFO B */ #define RIG_VFO_B RIG_VFO_N(1) /** \brief \c VFOC -- VFO C */ #define RIG_VFO_C RIG_VFO_N(2) /* * targetable bitfields, for internal use. * RIG_TARGETABLE_PURE means a pure targetable radio on every command */ #define RIG_TARGETABLE_NONE 0 #define RIG_TARGETABLE_FREQ (1<<0) #define RIG_TARGETABLE_MODE (1<<1) #define RIG_TARGETABLE_PURE (1<<2) #define RIG_TARGETABLE_TONE (1<<3) #define RIG_TARGETABLE_FUNC (1<<4) #define RIG_TARGETABLE_ALL 0x7fffffff #define RIG_PASSBAND_NORMAL s_Hz(0) /** * \brief Passband width, in Hz * \sa rig_passband_normal, rig_passband_narrow, rig_passband_wide */ typedef shortfreq_t pbwidth_t; /** * \brief DCD status */ typedef enum dcd_e { RIG_DCD_OFF = 0, /*!< Squelch closed */ RIG_DCD_ON /*!< Squelch open */ } dcd_t; /** * \brief DCD type * \sa rig_get_dcd */ typedef enum { RIG_DCD_NONE = 0, /*!< No DCD available */ RIG_DCD_RIG, /*!< Rig has DCD status support, i.e. rig has get_dcd cap */ RIG_DCD_SERIAL_DSR, /*!< DCD status from serial DSR signal */ RIG_DCD_SERIAL_CTS, /*!< DCD status from serial CTS signal */ RIG_DCD_SERIAL_CAR, /*!< DCD status from serial CD signal */ RIG_DCD_PARALLEL, /*!< DCD status from parallel port pin */ RIG_DCD_CM108 /*!< DCD status from CM108 vol dn pin */ } dcd_type_t; /** * \brief PTT status */ typedef enum { RIG_PTT_OFF = 0, /*!< PTT desactivated */ RIG_PTT_ON, /*!< PTT activated */ RIG_PTT_ON_MIC, /*!< PTT Mic only, fallbacks on RIG_PTT_ON if unavailable */ RIG_PTT_ON_DATA /*!< PTT Data (Mic-muted), fallbacks on RIG_PTT_ON if unavailable */ } ptt_t; /** * \brief PTT type * \sa rig_get_ptt */ typedef enum { RIG_PTT_NONE = 0, /*!< No PTT available */ RIG_PTT_RIG, /*!< Legacy PTT */ RIG_PTT_SERIAL_DTR, /*!< PTT control through serial DTR signal */ RIG_PTT_SERIAL_RTS, /*!< PTT control through serial RTS signal */ RIG_PTT_PARALLEL, /*!< PTT control through parallel port */ RIG_PTT_RIG_MICDATA, /*!< Legacy PTT, supports RIG_PTT_ON_MIC/RIG_PTT_ON_DATA */ RIG_PTT_CM108 /*!< PTT control through CM108 GPIO pin */ } ptt_type_t; /** * \brief Radio power state */ typedef enum { RIG_POWER_OFF = 0, /*!< Power off */ RIG_POWER_ON = (1<<0), /*!< Power on */ RIG_POWER_STANDBY = (1<<1) /*!< Standby */ } powerstat_t; /** * \brief Reset operation */ typedef enum { RIG_RESET_NONE = 0, /*!< No reset */ RIG_RESET_SOFT = (1<<0), /*!< Software reset */ RIG_RESET_VFO = (1<<1), /*!< VFO reset */ RIG_RESET_MCALL = (1<<2), /*!< Memory clear */ RIG_RESET_MASTER = (1<<3) /*!< Master reset */ } reset_t; /** * \brief VFO operation * * A VFO operation is an action on a VFO (or tunable memory). * The difference with a function is that an action has no on/off * status, it is performed at once. * * Note: the vfo argument for some vfo operation may be irrelevant, * and thus will be ignored. * * The VFO/MEM "mode" is set by rig_set_vfo.\n * \c STRING used in rigctl * * \sa rig_parse_vfo_op() rig_strvfop() */ typedef enum { RIG_OP_NONE = 0, /*!< '' No VFO_OP */ RIG_OP_CPY = (1<<0), /*!< \c CPY -- VFO A = VFO B */ RIG_OP_XCHG = (1<<1), /*!< \c XCHG -- Exchange VFO A/B */ RIG_OP_FROM_VFO = (1<<2), /*!< \c FROM_VFO -- VFO->MEM */ RIG_OP_TO_VFO = (1<<3), /*!< \c TO_VFO -- MEM->VFO */ RIG_OP_MCL = (1<<4), /*!< \c MCL -- Memory clear */ RIG_OP_UP = (1<<5), /*!< \c UP -- UP increment VFO freq by tuning step*/ RIG_OP_DOWN = (1<<6), /*!< \c DOWN -- DOWN decrement VFO freq by tuning step*/ RIG_OP_BAND_UP = (1<<7), /*!< \c BAND_UP -- Band UP */ RIG_OP_BAND_DOWN = (1<<8), /*!< \c BAND_DOWN -- Band DOWN */ RIG_OP_LEFT = (1<<9), /*!< \c LEFT -- LEFT */ RIG_OP_RIGHT = (1<<10),/*!< \c RIGHT -- RIGHT */ RIG_OP_TUNE = (1<<11),/*!< \c TUNE -- Start tune */ RIG_OP_TOGGLE = (1<<12) /*!< \c TOGGLE -- Toggle VFOA and VFOB */ } vfo_op_t; /** * \brief Rig Scan operation * * Various scan operations supported by a rig.\n * \c STRING used in rigctl * * \sa rig_parse_scan() rig_strscan() */ typedef enum { RIG_SCAN_NONE = 0, /*!< '' No Scan */ RIG_SCAN_STOP = RIG_SCAN_NONE, /*!< \c STOP -- Stop scanning */ RIG_SCAN_MEM = (1<<0), /*!< \c MEM -- Scan all memory channels */ RIG_SCAN_SLCT = (1<<1), /*!< \c SLCT -- Scan all selected memory channels */ RIG_SCAN_PRIO = (1<<2), /*!< \c PRIO -- Priority watch (mem or call channel) */ RIG_SCAN_PROG = (1<<3), /*!< \c PROG -- Programmed(edge) scan */ RIG_SCAN_DELTA = (1<<4), /*!< \c DELTA -- delta-f scan */ RIG_SCAN_VFO = (1<<5), /*!< \c VFO -- most basic scan */ RIG_SCAN_PLT = (1<<6) /*!< \c PLT -- Scan using pipelined tuning */ } scan_t; /** * \brief configuration token */ typedef long token_t; #define RIG_CONF_END 0 /** * \brief parameter types * * Used with configuration, parameter and extra-parm tables. * * Current internal implementation * NUMERIC: val.f or val.i * COMBO: val.i, starting from 0. Points to a table of strings or asci stored values. * STRING: val.s or val.cs * CHECKBUTTON: val.i 0/1 */ /* strongly inspired from soundmodem. Thanks Thomas! */ enum rig_conf_e { RIG_CONF_STRING, /*!< String type */ RIG_CONF_COMBO, /*!< Combo type */ RIG_CONF_NUMERIC, /*!< Numeric type integer or real */ RIG_CONF_CHECKBUTTON, /*!< on/off type */ RIG_CONF_BUTTON /*!< Button type */ }; #define RIG_COMBO_MAX 8 /** * \brief Configuration parameter structure. */ struct confparams { token_t token; /*!< Conf param token ID */ const char *name; /*!< Param name, no spaces allowed */ const char *label; /*!< Human readable label */ const char *tooltip; /*!< Hint on the parameter */ const char *dflt; /*!< Default value */ enum rig_conf_e type; /*!< Type of the parameter */ union { /*!< */ struct { /*!< */ float min; /*!< Minimum value */ float max; /*!< Maximum value */ float step; /*!< Step */ } n; /*!< Numeric type */ struct { /*!< */ const char *combostr[RIG_COMBO_MAX]; /*!< Combo list */ } c; /*!< Combo type */ } u; /*!< Type union */ }; /** \brief Announce * * Designate optional speech synthesizer. */ typedef enum { RIG_ANN_NONE = 0, /*!< None */ RIG_ANN_OFF = RIG_ANN_NONE, /*!< disable announces */ RIG_ANN_FREQ = (1<<0), /*!< Announce frequency */ RIG_ANN_RXMODE = (1<<1), /*!< Announce receive mode */ RIG_ANN_CW = (1<<2), /*!< CW */ RIG_ANN_ENG = (1<<3), /*!< English */ RIG_ANN_JAP = (1<<4) /*!< Japan */ } ann_t; /** * \brief Antenna number */ typedef int ant_t; #define RIG_ANT_NONE 0 #define RIG_ANT_N(n) ((ant_t)1<<(n)) #define RIG_ANT_1 RIG_ANT_N(0) #define RIG_ANT_2 RIG_ANT_N(1) #define RIG_ANT_3 RIG_ANT_N(2) #define RIG_ANT_4 RIG_ANT_N(3) #define RIG_ANT_5 RIG_ANT_N(4) /** * \brief AGC delay settings */ /* TODO: kill me, and replace by real AGC delay */ enum agc_level_e { RIG_AGC_OFF = 0, RIG_AGC_SUPERFAST, RIG_AGC_FAST, RIG_AGC_SLOW, RIG_AGC_USER, /*!< user selectable */ RIG_AGC_MEDIUM, RIG_AGC_AUTO }; /** * \brief Level display meters */ enum meter_level_e { RIG_METER_NONE = 0, /*< No display meter */ RIG_METER_SWR = (1<<0), /*< Stationary Wave Ratio */ RIG_METER_COMP = (1<<1), /*< Compression level */ RIG_METER_ALC = (1<<2), /*< ALC */ RIG_METER_IC = (1<<3), /*< IC */ RIG_METER_DB = (1<<4), /*< DB */ RIG_METER_PO = (1<<5), /*< Power Out */ RIG_METER_VDD = (1<<6) /*< Final Amp Voltage */ }; /** * \brief Universal approach for passing values * \sa rig_set_level, rig_get_level, rig_set_parm, rig_get_parm */ typedef union { signed int i; /*!< Signed integer */ float f; /*!< Single precision float */ char *s; /*!< Pointer to char string */ const char *cs; /*!< Pointer to constant char string */ } value_t; /** \brief Rig Level Settings * * Various operating levels supported by a rig.\n * \c STRING used in rigctl * * \sa rig_parse_level() rig_strlevel() */ enum rig_level_e { RIG_LEVEL_NONE = 0, /*!< '' -- No Level */ RIG_LEVEL_PREAMP = (1<<0), /*!< \c PREAMP -- Preamp, arg int (dB) */ RIG_LEVEL_ATT = (1<<1), /*!< \c ATT -- Attenuator, arg int (dB) */ RIG_LEVEL_VOX = (1<<2), /*!< \c VOX -- VOX delay, arg int (tenth of seconds) */ RIG_LEVEL_AF = (1<<3), /*!< \c AF -- Volume, arg float [0.0 ... 1.0] */ RIG_LEVEL_RF = (1<<4), /*!< \c RF -- RF gain (not TX power), arg float [0.0 ... 1.0] */ RIG_LEVEL_SQL = (1<<5), /*!< \c SQL -- Squelch, arg float [0.0 ... 1.0] */ RIG_LEVEL_IF = (1<<6), /*!< \c IF -- IF, arg int (Hz) */ RIG_LEVEL_APF = (1<<7), /*!< \c APF -- Audio Peak Filter, arg float [0.0 ... 1.0] */ RIG_LEVEL_NR = (1<<8), /*!< \c NR -- Noise Reduction, arg float [0.0 ... 1.0] */ RIG_LEVEL_PBT_IN = (1<<9), /*!< \c PBT_IN -- Twin PBT (inside), arg float [0.0 ... 1.0] */ RIG_LEVEL_PBT_OUT = (1<<10),/*!< \c PBT_OUT -- Twin PBT (outside), arg float [0.0 ... 1.0] */ RIG_LEVEL_CWPITCH = (1<<11),/*!< \c CWPITCH -- CW pitch, arg int (Hz) */ RIG_LEVEL_RFPOWER = (1<<12),/*!< \c RFPOWER -- RF Power, arg float [0.0 ... 1.0] */ RIG_LEVEL_MICGAIN = (1<<13),/*!< \c MICGAIN -- MIC Gain, arg float [0.0 ... 1.0] */ RIG_LEVEL_KEYSPD = (1<<14),/*!< \c KEYSPD -- Key Speed, arg int (WPM) */ RIG_LEVEL_NOTCHF = (1<<15),/*!< \c NOTCHF -- Notch Freq., arg int (Hz) */ RIG_LEVEL_COMP = (1<<16),/*!< \c COMP -- Compressor, arg float [0.0 ... 1.0] */ RIG_LEVEL_AGC = (1<<17),/*!< \c AGC -- AGC, arg int (see enum agc_level_e) */ RIG_LEVEL_BKINDL = (1<<18),/*!< \c BKINDL -- BKin Delay, arg int (tenth of dots) */ RIG_LEVEL_BALANCE = (1<<19),/*!< \c BAL -- Balance (Dual Watch), arg float [0.0 ... 1.0] */ RIG_LEVEL_METER = (1<<20),/*!< \c METER -- Display meter, arg int (see enum meter_level_e) */ RIG_LEVEL_VOXGAIN = (1<<21),/*!< \c VOXGAIN -- VOX gain level, arg float [0.0 ... 1.0] */ RIG_LEVEL_VOXDELAY = RIG_LEVEL_VOX, /*!< Synonym of RIG_LEVEL_VOX */ RIG_LEVEL_ANTIVOX = (1<<22),/*!< \c ANTIVOX -- anti-VOX level, arg float [0.0 ... 1.0] */ RIG_LEVEL_SLOPE_LOW = (1<<23),/*!< \c SLOPE_LOW -- Slope tune, low frequency cut, */ RIG_LEVEL_SLOPE_HIGH = (1<<24),/*!< \c SLOPE_HIGH -- Slope tune, high frequency cut, */ RIG_LEVEL_BKIN_DLYMS = (1<<25),/*!< \c BKIN_DLYMS -- BKin Delay, arg int Milliseconds */ /*!< These ones are not settable */ RIG_LEVEL_RAWSTR = (1<<26),/*!< \c RAWSTR -- Raw (A/D) value for signal strength, specific to each rig, arg int */ RIG_LEVEL_SQLSTAT = (1<<27),/*!< \c SQLSTAT -- SQL status, arg int (open=1/closed=0). Deprecated, use get_dcd instead */ RIG_LEVEL_SWR = (1<<28),/*!< \c SWR -- SWR, arg float [0.0 ... infinite] */ RIG_LEVEL_ALC = (1<<29),/*!< \c ALC -- ALC, arg float */ RIG_LEVEL_STRENGTH =(1<<30) /*!< \c STRENGTH -- Effective (calibrated) signal strength relative to S9, arg int (dB) */ /*RIG_LEVEL_BWC = (1<<31)*/ /*!< Bandwidth Control, arg int (Hz) */ }; #define RIG_LEVEL_FLOAT_LIST (RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_APF|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_COMP|RIG_LEVEL_BALANCE|RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_VOXGAIN|RIG_LEVEL_ANTIVOX) #define RIG_LEVEL_READONLY_LIST (RIG_LEVEL_SQLSTAT|RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_STRENGTH|RIG_LEVEL_RAWSTR) #define RIG_LEVEL_IS_FLOAT(l) ((l)&RIG_LEVEL_FLOAT_LIST) #define RIG_LEVEL_SET(l) ((l)&~RIG_LEVEL_READONLY_LIST) /** * \brief Rig Parameters * * Parameters are settings that are not VFO specific.\n * \c STRING used in rigctl * * \sa rig_parse_parm() rig_strparm() */ enum rig_parm_e { RIG_PARM_NONE = 0, /*!< '' -- No Parm */ RIG_PARM_ANN = (1<<0), /*!< \c ANN -- "Announce" level, see ann_t */ RIG_PARM_APO = (1<<1), /*!< \c APO -- Auto power off, int in minute */ RIG_PARM_BACKLIGHT = (1<<2), /*!< \c BACKLIGHT -- LCD light, float [0.0 ... 1.0] */ RIG_PARM_BEEP = (1<<4), /*!< \c BEEP -- Beep on keypressed, int (0,1) */ RIG_PARM_TIME = (1<<5), /*!< \c TIME -- hh:mm:ss, int in seconds from 00:00:00 */ RIG_PARM_BAT = (1<<6), /*!< \c BAT -- battery level, float [0.0 ... 1.0] */ RIG_PARM_KEYLIGHT = (1<<7) /*!< \c KEYLIGHT -- Button backlight, on/off */ }; #define RIG_PARM_FLOAT_LIST (RIG_PARM_BACKLIGHT|RIG_PARM_BAT) #define RIG_PARM_READONLY_LIST (RIG_PARM_BAT) #define RIG_PARM_IS_FLOAT(l) ((l)&RIG_PARM_FLOAT_LIST) #define RIG_PARM_SET(l) ((l)&~RIG_PARM_READONLY_LIST) #define RIG_SETTING_MAX 32 /** * \brief Setting * * This can be a func, a level or a parm. * Each bit designates one of them. */ typedef unsigned long setting_t; /* * tranceive mode, ie. the rig notify the host of any event, * like freq changed, mode changed, etc. */ #define RIG_TRN_OFF 0 #define RIG_TRN_RIG 1 #define RIG_TRN_POLL 2 /** * \brief Rig Function Settings * * Various operating functions supported by a rig.\n * \c STRING used in rigctl * * \sa rig_parse_func() rig_strfunc() */ enum rig_func_e { RIG_FUNC_NONE = 0, /*!< '' -- No Function */ RIG_FUNC_FAGC = (1<<0), /*!< \c FAGC -- Fast AGC */ RIG_FUNC_NB = (1<<1), /*!< \c NB -- Noise Blanker */ RIG_FUNC_COMP = (1<<2), /*!< \c COMP -- Speech Compression */ RIG_FUNC_VOX = (1<<3), /*!< \c VOX -- Voice Operated Relay */ RIG_FUNC_TONE = (1<<4), /*!< \c TONE -- CTCSS Tone */ RIG_FUNC_TSQL = (1<<5), /*!< \c TSQL -- CTCSS Activate/De-activate */ RIG_FUNC_SBKIN = (1<<6), /*!< \c SBKIN -- Semi Break-in (CW mode) */ RIG_FUNC_FBKIN = (1<<7), /*!< \c FBKIN -- Full Break-in (CW mode) */ RIG_FUNC_ANF = (1<<8), /*!< \c ANF -- Automatic Notch Filter (DSP) */ RIG_FUNC_NR = (1<<9), /*!< \c NR -- Noise Reduction (DSP) */ RIG_FUNC_AIP = (1<<10),/*!< \c AIP -- RF pre-amp (AIP on Kenwood, IPO on Yaesu, etc.) */ RIG_FUNC_APF = (1<<11),/*!< \c APF -- Auto Passband/Audio Peak Filter */ RIG_FUNC_MON = (1<<12),/*!< \c MON -- Monitor transmitted signal */ RIG_FUNC_MN = (1<<13),/*!< \c MN -- Manual Notch */ RIG_FUNC_RF = (1<<14),/*!< \c RF -- RTTY Filter */ RIG_FUNC_ARO = (1<<15),/*!< \c ARO -- Auto Repeater Offset */ RIG_FUNC_LOCK = (1<<16),/*!< \c LOCK -- Lock */ RIG_FUNC_MUTE = (1<<17),/*!< \c MUTE -- Mute */ RIG_FUNC_VSC = (1<<18),/*!< \c VSC -- Voice Scan Control */ RIG_FUNC_REV = (1<<19),/*!< \c REV -- Reverse transmit and receive frequencies */ RIG_FUNC_SQL = (1<<20),/*!< \c SQL -- Turn Squelch Monitor on/off */ RIG_FUNC_ABM = (1<<21),/*!< \c ABM -- Auto Band Mode */ RIG_FUNC_BC = (1<<22),/*!< \c BC -- Beat Canceller */ RIG_FUNC_MBC = (1<<23),/*!< \c MBC -- Manual Beat Canceller */ /* (1<<24), used to be RIG_FUNC_LMP, see RIG_PARM_BACKLIGHT instead) */ RIG_FUNC_AFC = (1<<25),/*!< \c AFC -- Auto Frequency Control ON/OFF */ RIG_FUNC_SATMODE = (1<<26),/*!< \c SATMODE -- Satellite mode ON/OFF */ RIG_FUNC_SCOPE = (1<<27),/*!< \c SCOPE -- Simple bandscope ON/OFF */ RIG_FUNC_RESUME = (1<<28),/*!< \c RESUME -- Scan auto-resume */ RIG_FUNC_TBURST = (1<<29),/*!< \c TBURST -- 1750 Hz tone burst */ RIG_FUNC_TUNER = (1<<30) /*!< \c TUNER -- Enable automatic tuner */ }; /* * power unit macros, converts to mW * This is limited to 2MW on 32 bits systems. */ #define mW(p) ((int)(p)) #define Watts(p) ((int)((p)*1000)) #define W(p) Watts(p) #define kW(p) ((int)((p)*1000000L)) /** * \brief Radio mode * * Various modes supported by a rig.\n * \c STRING used in rigctl * * \sa rig_parse_mode() rig_strrmode() */ typedef enum { RIG_MODE_NONE = 0, /*!< '' -- None */ RIG_MODE_AM = (1<<0), /*!< \c AM -- Amplitude Modulation */ RIG_MODE_CW = (1<<1), /*!< \c CW -- CW "normal" sideband */ RIG_MODE_USB = (1<<2), /*!< \c USB -- Upper Side Band */ RIG_MODE_LSB = (1<<3), /*!< \c LSB -- Lower Side Band */ RIG_MODE_RTTY = (1<<4), /*!< \c RTTY -- Radio Teletype */ RIG_MODE_FM = (1<<5), /*!< \c FM -- "narrow" band FM */ RIG_MODE_WFM = (1<<6), /*!< \c WFM -- broadcast wide FM */ RIG_MODE_CWR = (1<<7), /*!< \c CWR -- CW "reverse" sideband */ RIG_MODE_RTTYR = (1<<8), /*!< \c RTTYR -- RTTY "reverse" sideband */ RIG_MODE_AMS = (1<<9), /*!< \c AMS -- Amplitude Modulation Synchronous */ RIG_MODE_PKTLSB = (1<<10),/*!< \c PKTLSB -- Packet/Digital LSB mode (dedicated port) */ RIG_MODE_PKTUSB = (1<<11),/*!< \c PKTUSB -- Packet/Digital USB mode (dedicated port) */ RIG_MODE_PKTFM = (1<<12),/*!< \c PKTFM -- Packet/Digital FM mode (dedicated port) */ RIG_MODE_ECSSUSB = (1<<13),/*!< \c ECSSUSB -- Exalted Carrier Single Sideband USB */ RIG_MODE_ECSSLSB = (1<<14),/*!< \c ECSSLSB -- Exalted Carrier Single Sideband LSB */ RIG_MODE_FAX = (1<<15),/*!< \c FAX -- Facsimile Mode */ RIG_MODE_SAM = (1<<16),/*!< \c SAM -- Synchronous AM double sideband */ RIG_MODE_SAL = (1<<17),/*!< \c SAL -- Synchronous AM lower sideband */ RIG_MODE_SAH = (1<<18),/*!< \c SAH -- Synchronous AM upper (higher) sideband */ RIG_MODE_DSB = (1<<19), /*!< \c DSB -- Double sideband suppressed carrier */ RIG_MODE_TESTS_MAX /*!< \c MUST ALWAYS BE LAST, Max Count for dumpcaps.c */ } rmode_t; /** \brief macro for backends, not to be used by rig_set_mode et al. */ #define RIG_MODE_SSB (RIG_MODE_USB|RIG_MODE_LSB) /** \brief macro for backends, not to be used by rig_set_mode et al. */ #define RIG_MODE_ECSS (RIG_MODE_ECSSUSB|RIG_MODE_ECSSLSB) #define RIG_DBLST_END 0 /* end marker in a preamp/att level list */ #define RIG_IS_DBLST_END(d) ((d)==0) /** * \brief Frequency range * * Put together a group of this struct in an array to define * what frequencies your rig has access to. */ typedef struct freq_range_list { freq_t start; /*!< Start frequency */ freq_t end; /*!< End frequency */ rmode_t modes; /*!< Bit field of RIG_MODE's */ int low_power; /*!< Lower RF power in mW, -1 for no power (ie. rx list) */ int high_power; /*!< Higher RF power in mW, -1 for no power (ie. rx list) */ vfo_t vfo; /*!< VFO list equipped with this range */ ant_t ant; /*!< Antenna list equipped with this range, 0 means all */ } freq_range_t; #define RIG_FRNG_END {Hz(0),Hz(0),RIG_MODE_NONE,0,0,RIG_VFO_NONE} #define RIG_IS_FRNG_END(r) ((r).start == Hz(0) && (r).end == Hz(0)) #define RIG_ITU_REGION1 1 #define RIG_ITU_REGION2 2 #define RIG_ITU_REGION3 3 /** * \brief Tuning step definition * * Lists the tuning steps available for each mode. * * If a ts field in the list has RIG_TS_ANY value, * this means the rig allows its tuning step to be * set to any value ranging from the lowest to the * highest (if any) value in the list for that mode. * The tuning step must be sorted in the ascending * order, and the RIG_TS_ANY value, if present, must * be the last one in the list. * * Note also that the minimum frequency resolution * of the rig is determined by the lowest value * in the Tuning step list. * * \sa rig_set_ts, rig_get_resolution */ struct tuning_step_list { rmode_t modes; /*!< Bit field of RIG_MODE's */ shortfreq_t ts; /*!< Tuning step in Hz */ }; #define RIG_TS_ANY 0 #define RIG_TS_END {RIG_MODE_NONE,0} #define RIG_IS_TS_END(t) ((t).modes == RIG_MODE_NONE && (t).ts == 0) /** * \brief Filter definition * * Lists the filters available for each mode. * * If more than one filter is available for a given mode, * the first entry in the array will be the default * filter to use for the normal passband of this mode. * The first entry in the array below the default normal passband * is the default narrow passband and the first entry in the array * above the default normal passband is the default wide passband. * Note: if there's no lower width or upper width, then narrow or * respectively wide passband is equal to the default normal passband. * * If a width field in the list has RIG_FLT_ANY value, * this means the rig allows its passband width to be * set to any value ranging from the lowest to the * highest value (if any) in the list for that mode. * The RIG_FLT_ANY value, if present, must * be the last one in the list. * * The width field is the narrowest passband in a transmit/receive chain * with regard to different IF. * * \sa rig_set_mode, rig_passband_normal, rig_passband_narrow, rig_passband_wide */ struct filter_list { rmode_t modes; /*!< Bit field of RIG_MODE's */ pbwidth_t width; /*!< Passband width in Hz */ }; #define RIG_FLT_ANY 0 #define RIG_FLT_END {RIG_MODE_NONE,0} #define RIG_IS_FLT_END(f) ((f).modes == RIG_MODE_NONE) /** \brief Empty channel_t.flags field */ #define RIG_CHFLAG_NONE 0 /** \brief skip memory channel during scan (lock out), channel_t.flags */ #define RIG_CHFLAG_SKIP (1<<0) /** \brief DATA port mode flag */ #define RIG_CHFLAG_DATA (1<<1) /** * \brief Extension attribute definition * */ struct ext_list { token_t token; /*!< Token ID */ value_t val; /*!< Value */ }; #define RIG_EXT_END {0, {.i=0}} #define RIG_IS_EXT_END(x) ((x).token == 0) /** * \brief Channel structure * * The channel struct stores all the attributes peculiar to a VFO. * * \sa rig_set_channel, rig_get_channel */ struct channel { int channel_num; /*!< Channel number */ int bank_num; /*!< Bank number */ vfo_t vfo; /*!< VFO */ int ant; /*!< Selected antenna */ freq_t freq; /*!< Receive frequency */ rmode_t mode; /*!< Receive mode */ pbwidth_t width; /*!< Receive passband width associated with mode */ freq_t tx_freq; /*!< Transmit frequency */ rmode_t tx_mode; /*!< Transmit mode */ pbwidth_t tx_width; /*!< Transmit passband width associated with mode */ split_t split; /*!< Split mode */ vfo_t tx_vfo; /*!< Split transmit VFO */ rptr_shift_t rptr_shift; /*!< Repeater shift */ shortfreq_t rptr_offs; /*!< Repeater offset */ shortfreq_t tuning_step; /*!< Tuning step */ shortfreq_t rit; /*!< RIT */ shortfreq_t xit; /*!< XIT */ setting_t funcs; /*!< Function status */ value_t levels[RIG_SETTING_MAX]; /*!< Level values */ tone_t ctcss_tone; /*!< CTCSS tone */ tone_t ctcss_sql; /*!< CTCSS squelch tone */ tone_t dcs_code; /*!< DCS code */ tone_t dcs_sql; /*!< DCS squelch code */ int scan_group; /*!< Scan group */ int flags; /*!< Channel flags, see RIG_CHFLAG's */ char channel_desc[MAXCHANDESC]; /*!< Name */ struct ext_list *ext_levels; /*!< Extension level value list, NULL ended. ext_levels can be NULL */ }; /** \brief Channel structure typedef */ typedef struct channel channel_t; /** * \brief Channel capability definition * * Definition of the attributes that can be stored/retrieved in/from memory */ struct channel_cap { unsigned bank_num:1; /*!< Bank number */ unsigned vfo:1; /*!< VFO */ unsigned ant:1; /*!< Selected antenna */ unsigned freq:1; /*!< Receive frequency */ unsigned mode:1; /*!< Receive mode */ unsigned width:1; /*!< Receive passband width associated with mode */ unsigned tx_freq:1; /*!< Transmit frequency */ unsigned tx_mode:1; /*!< Transmit mode */ unsigned tx_width:1; /*!< Transmit passband width associated with mode */ unsigned split:1; /*!< Split mode */ unsigned tx_vfo:1; /*!< Split transmit VFO */ unsigned rptr_shift:1; /*!< Repeater shift */ unsigned rptr_offs:1; /*!< Repeater offset */ unsigned tuning_step:1; /*!< Tuning step */ unsigned rit:1; /*!< RIT */ unsigned xit:1; /*!< XIT */ setting_t funcs; /*!< Function status */ setting_t levels; /*!< Level values */ unsigned ctcss_tone:1; /*!< CTCSS tone */ unsigned ctcss_sql:1; /*!< CTCSS squelch tone */ unsigned dcs_code:1; /*!< DCS code */ unsigned dcs_sql:1; /*!< DCS squelch code */ unsigned scan_group:1; /*!< Scan group */ unsigned flags:1; /*!< Channel flags */ unsigned channel_desc:1; /*!< Name */ unsigned ext_levels:1; /*!< Extension level value list */ }; /** \brief Channel cap */ typedef struct channel_cap channel_cap_t; /** * \brief Memory channel type definition * * Definition of memory types. Depending on the type, the content * of the memory channel has to be interpreted accordingly. * For instance, a RIG_MTYPE_EDGE channel_t will hold only a start * or stop frequency. * * \sa chan_list */ typedef enum { RIG_MTYPE_NONE=0, /*!< None */ RIG_MTYPE_MEM, /*!< Regular */ RIG_MTYPE_EDGE, /*!< Scan edge */ RIG_MTYPE_CALL, /*!< Call channel */ RIG_MTYPE_MEMOPAD, /*!< Memory pad */ RIG_MTYPE_SAT, /*!< Satellite */ RIG_MTYPE_BAND, /*!< VFO/Band channel */ RIG_MTYPE_PRIO /*!< Priority channel */ } chan_type_t; /** * \brief Memory channel list definition * * Example for the Ic706MkIIG (99 memory channels, 2 scan edges, 2 call chans): \code chan_t chan_list[] = { { 1, 99, RIG_MTYPE_MEM }, { 100, 103, RIG_MTYPE_EDGE }, { 104, 105, RIG_MTYPE_CALL }, RIG_CHAN_END } \endcode */ struct chan_list { int start; /*!< Starting memory channel \b number */ int end; /*!< Ending memory channel \b number */ chan_type_t type; /*!< Memory type. see chan_type_t */ channel_cap_t mem_caps; /*!< Definition of attributes that can be stored/retrieved */ }; #define RIG_CHAN_END {0,0,RIG_MTYPE_NONE} #define RIG_IS_CHAN_END(c) ((c).type == RIG_MTYPE_NONE) /** \brief Special memory channel value to tell rig_lookup_mem_caps() to retrieve all the ranges */ #define RIG_MEM_CAPS_ALL -1 /** \brief chan_t type */ typedef struct chan_list chan_t; /** * \brief level/parm granularity definition * * The granularity is undefined if min=0, max=0, and step=0. * * For float settings, if min.f=0 and max.f=0 (and step.f!=0), * max.f is assumed to be actually equal to 1.0. * * If step=0 (and min and/or max are not null), then this means step * can have maximum resolution, depending on type (int or float). */ struct gran { value_t min; /*!< Minimum value */ value_t max; /*!< Maximum value */ value_t step; /*!< Step */ }; /** \brief gran_t type */ typedef struct gran gran_t; /** \brief Calibration table struct */ struct cal_table { int size; /*!< number of plots in the table */ struct { int raw; /*!< raw (A/D) value, as returned by \a RIG_LEVEL_RAWSTR */ int val; /*!< associated value, basically the measured dB value */ } table[MAX_CAL_LENGTH]; /*!< table of plots */ }; /** * \brief calibration table type * * cal_table_t is a data type suited to hold linear calibration. * cal_table_t.size tells the number of plots cal_table_t.table contains. * * If a value is below or equal to cal_table_t.table[0].raw, * rig_raw2val() will return cal_table_t.table[0].val. * * If a value is greater or equal to cal_table_t.table[cal_table_t.size-1].raw, * rig_raw2val() will return cal_table_t.table[cal_table_t.size-1].val. */ typedef struct cal_table cal_table_t; #define EMPTY_STR_CAL { 0, { { 0, 0 }, } } typedef int (*chan_cb_t) (RIG *, channel_t**, int, const chan_t*, rig_ptr_t); typedef int (*confval_cb_t) (RIG *, const struct confparams *, value_t *, rig_ptr_t); /** * \brief Rig data structure. * * Basic rig type, can store some useful info about different radios. * Each lib must be able to populate this structure, so we can make * useful inquiries about capabilities. * * The main idea of this struct is that it will be defined by the backend * rig driver, and will remain readonly for the application. * Fields that need to be modifiable by the application are * copied into the struct rig_state, which is a kind of private * of the RIG instance. * This way, you can have several rigs running within the same application, * sharing the struct rig_caps of the backend, while keeping their own * customized data. * NB: don't move fields around, as backend depends on it when initializing * their caps. */ struct rig_caps { rig_model_t rig_model; /*!< Rig model. */ const char *model_name; /*!< Model name. */ const char *mfg_name; /*!< Manufacturer. */ const char *version; /*!< Driver version. */ const char *copyright; /*!< Copyright info. */ enum rig_status_e status; /*!< Driver status. */ int rig_type; /*!< Rig type. */ ptt_type_t ptt_type; /*!< Type of the PTT port. */ dcd_type_t dcd_type; /*!< Type of the DCD port. */ rig_port_t port_type; /*!< Type of communication port. */ int serial_rate_min; /*!< Minimum serial speed. */ int serial_rate_max; /*!< Maximum serial speed. */ int serial_data_bits; /*!< Number of data bits. */ int serial_stop_bits; /*!< Number of stop bits. */ enum serial_parity_e serial_parity; /*!< Parity. */ enum serial_handshake_e serial_handshake; /*!< Handshake. */ int write_delay; /*!< Delay between each byte sent out, in mS */ int post_write_delay; /*!< Delay between each commands send out, in mS */ int timeout; /*!< Timeout, in mS */ int retry; /*!< Maximum number of retries if command fails, 0 to disable */ setting_t has_get_func; /*!< List of get functions */ setting_t has_set_func; /*!< List of set functions */ setting_t has_get_level; /*!< List of get level */ setting_t has_set_level; /*!< List of set level */ setting_t has_get_parm; /*!< List of get parm */ setting_t has_set_parm; /*!< List of set parm */ gran_t level_gran[RIG_SETTING_MAX]; /*!< level granularity (i.e. steps) */ gran_t parm_gran[RIG_SETTING_MAX]; /*!< parm granularity (i.e. steps) */ const struct confparams *extparms; /*!< Extension parm list, \sa ext.c */ const struct confparams *extlevels; /*!< Extension level list, \sa ext.c */ const tone_t *ctcss_list; /*!< CTCSS tones list, zero ended */ const tone_t *dcs_list; /*!< DCS code list, zero ended */ int preamp[MAXDBLSTSIZ]; /*!< Preamp list in dB, 0 terminated */ int attenuator[MAXDBLSTSIZ]; /*!< Preamp list in dB, 0 terminated */ shortfreq_t max_rit; /*!< max absolute RIT */ shortfreq_t max_xit; /*!< max absolute XIT */ shortfreq_t max_ifshift; /*!< max absolute IF-SHIFT */ ann_t announces; /*!< Announces bit field list */ vfo_op_t vfo_ops; /*!< VFO op bit field list */ scan_t scan_ops; /*!< Scan bit field list */ int targetable_vfo; /*!< Bit field list of direct VFO access commands */ int transceive; /*!< Supported transceive mode */ int bank_qty; /*!< Number of banks */ int chan_desc_sz; /*!< Max length of memory channel name */ chan_t chan_list[CHANLSTSIZ]; /*!< Channel list, zero ended */ freq_range_t rx_range_list1[FRQRANGESIZ]; /*!< Receive frequency range list for ITU region 1 */ freq_range_t tx_range_list1[FRQRANGESIZ]; /*!< Transmit frequency range list for ITU region 1 */ freq_range_t rx_range_list2[FRQRANGESIZ]; /*!< Receive frequency range list for ITU region 2 */ freq_range_t tx_range_list2[FRQRANGESIZ]; /*!< Transmit frequency range list for ITU region 2 */ struct tuning_step_list tuning_steps[TSLSTSIZ]; /*!< Tuning step list */ struct filter_list filters[FLTLSTSIZ]; /*!< mode/filter table, at -6dB */ cal_table_t str_cal; /*!< S-meter calibration table */ const struct confparams *cfgparams; /*!< Configuration parametres. */ const rig_ptr_t priv; /*!< Private data. */ /* * Rig API * */ int (*rig_init) (RIG * rig); int (*rig_cleanup) (RIG * rig); int (*rig_open) (RIG * rig); int (*rig_close) (RIG * rig); /* * General API commands, from most primitive to least.. :() * List Set/Get functions pairs */ int (*set_freq) (RIG * rig, vfo_t vfo, freq_t freq); int (*get_freq) (RIG * rig, vfo_t vfo, freq_t * freq); int (*set_mode) (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int (*get_mode) (RIG * rig, vfo_t vfo, rmode_t * mode, pbwidth_t * width); int (*set_vfo) (RIG * rig, vfo_t vfo); int (*get_vfo) (RIG * rig, vfo_t * vfo); int (*set_ptt) (RIG * rig, vfo_t vfo, ptt_t ptt); int (*get_ptt) (RIG * rig, vfo_t vfo, ptt_t * ptt); int (*get_dcd) (RIG * rig, vfo_t vfo, dcd_t * dcd); int (*set_rptr_shift) (RIG * rig, vfo_t vfo, rptr_shift_t rptr_shift); int (*get_rptr_shift) (RIG * rig, vfo_t vfo, rptr_shift_t * rptr_shift); int (*set_rptr_offs) (RIG * rig, vfo_t vfo, shortfreq_t offs); int (*get_rptr_offs) (RIG * rig, vfo_t vfo, shortfreq_t * offs); int (*set_split_freq) (RIG * rig, vfo_t vfo, freq_t tx_freq); int (*get_split_freq) (RIG * rig, vfo_t vfo, freq_t * tx_freq); int (*set_split_mode) (RIG * rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width); int (*get_split_mode) (RIG * rig, vfo_t vfo, rmode_t * tx_mode, pbwidth_t * tx_width); int (*set_split_vfo) (RIG * rig, vfo_t vfo, split_t split, vfo_t tx_vfo); int (*get_split_vfo) (RIG * rig, vfo_t vfo, split_t * split, vfo_t *tx_vfo); int (*set_rit) (RIG * rig, vfo_t vfo, shortfreq_t rit); int (*get_rit) (RIG * rig, vfo_t vfo, shortfreq_t * rit); int (*set_xit) (RIG * rig, vfo_t vfo, shortfreq_t xit); int (*get_xit) (RIG * rig, vfo_t vfo, shortfreq_t * xit); int (*set_ts) (RIG * rig, vfo_t vfo, shortfreq_t ts); int (*get_ts) (RIG * rig, vfo_t vfo, shortfreq_t * ts); int (*set_dcs_code) (RIG * rig, vfo_t vfo, tone_t code); int (*get_dcs_code) (RIG * rig, vfo_t vfo, tone_t * code); int (*set_tone) (RIG * rig, vfo_t vfo, tone_t tone); int (*get_tone) (RIG * rig, vfo_t vfo, tone_t * tone); int (*set_ctcss_tone) (RIG * rig, vfo_t vfo, tone_t tone); int (*get_ctcss_tone) (RIG * rig, vfo_t vfo, tone_t * tone); int (*set_dcs_sql) (RIG * rig, vfo_t vfo, tone_t code); int (*get_dcs_sql) (RIG * rig, vfo_t vfo, tone_t * code); int (*set_tone_sql) (RIG * rig, vfo_t vfo, tone_t tone); int (*get_tone_sql) (RIG * rig, vfo_t vfo, tone_t * tone); int (*set_ctcss_sql) (RIG * rig, vfo_t vfo, tone_t tone); int (*get_ctcss_sql) (RIG * rig, vfo_t vfo, tone_t * tone); int (*power2mW) (RIG * rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode); int (*mW2power) (RIG * rig, float *power, unsigned int mwpower, freq_t freq, rmode_t mode); int (*set_powerstat) (RIG * rig, powerstat_t status); int (*get_powerstat) (RIG * rig, powerstat_t * status); int (*reset) (RIG * rig, reset_t reset); int (*set_ant) (RIG * rig, vfo_t vfo, ant_t ant); int (*get_ant) (RIG * rig, vfo_t vfo, ant_t * ant); int (*set_level) (RIG * rig, vfo_t vfo, setting_t level, value_t val); int (*get_level) (RIG * rig, vfo_t vfo, setting_t level, value_t * val); int (*set_func) (RIG * rig, vfo_t vfo, setting_t func, int status); int (*get_func) (RIG * rig, vfo_t vfo, setting_t func, int *status); int (*set_parm) (RIG * rig, setting_t parm, value_t val); int (*get_parm) (RIG * rig, setting_t parm, value_t * val); int (*set_ext_level)(RIG *rig, vfo_t vfo, token_t token, value_t val); int (*get_ext_level)(RIG *rig, vfo_t vfo, token_t token, value_t *val); int (*set_ext_parm)(RIG *rig, token_t token, value_t val); int (*get_ext_parm)(RIG *rig, token_t token, value_t *val); int (*set_conf) (RIG * rig, token_t token, const char *val); int (*get_conf) (RIG * rig, token_t token, char *val); int (*send_dtmf) (RIG * rig, vfo_t vfo, const char *digits); int (*recv_dtmf) (RIG * rig, vfo_t vfo, char *digits, int *length); int (*send_morse) (RIG * rig, vfo_t vfo, const char *msg); int (*set_bank) (RIG * rig, vfo_t vfo, int bank); int (*set_mem) (RIG * rig, vfo_t vfo, int ch); int (*get_mem) (RIG * rig, vfo_t vfo, int *ch); int (*vfo_op) (RIG * rig, vfo_t vfo, vfo_op_t op); int (*scan) (RIG * rig, vfo_t vfo, scan_t scan, int ch); int (*set_trn) (RIG * rig, int trn); int (*get_trn) (RIG * rig, int *trn); int (*decode_event) (RIG * rig); int (*set_channel) (RIG * rig, const channel_t * chan); int (*get_channel) (RIG * rig, channel_t * chan); const char *(*get_info) (RIG * rig); int (*set_chan_all_cb) (RIG * rig, chan_cb_t chan_cb, rig_ptr_t); int (*get_chan_all_cb) (RIG * rig, chan_cb_t chan_cb, rig_ptr_t); int (*set_mem_all_cb) (RIG * rig, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t); int (*get_mem_all_cb) (RIG * rig, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t); const char *clone_combo_set; /*!< String describing key combination to enter load cloning mode */ const char *clone_combo_get; /*!< String describing key combination to enter save cloning mode */ }; /** * \brief Port definition * * Of course, looks like OO painstakingly programmed in C, sigh. */ typedef struct { union { rig_port_t rig; /*!< Communication port type */ ptt_type_t ptt; /*!< PTT port type */ dcd_type_t dcd; /*!< DCD port type */ } type; int fd; /*!< File descriptor */ void* handle; /*!< handle for USB */ int write_delay; /*!< Delay between each byte sent out, in mS */ int post_write_delay; /*!< Delay between each commands send out, in mS */ struct { int tv_sec,tv_usec; } post_write_date; /*!< hamlib internal use */ int timeout; /*!< Timeout, in mS */ int retry; /*!< Maximum number of retries, 0 to disable */ char pathname[FILPATHLEN]; /*!< Port pathname */ union { struct { int rate; /*!< Serial baud rate */ int data_bits; /*!< Number of data bits */ int stop_bits; /*!< Number of stop bits */ enum serial_parity_e parity; /*!< Serial parity */ enum serial_handshake_e handshake; /*!< Serial handshake */ enum serial_control_state_e rts_state; /*!< RTS set state */ enum serial_control_state_e dtr_state; /*!< DTR set state */ } serial; /*!< serial attributes */ struct { int pin; /*!< Parallel port pin number */ } parallel; /*!< parallel attributes */ struct { int ptt_bitnum; /*< Bit number for CM108 GPIO PTT */ } cm108; /*!< CM108 attributes */ struct { int vid; /*!< Vendor ID */ int pid; /*!< Product ID */ int conf; /*!< Configuration */ int iface; /*!< interface */ int alt; /*!< alternate */ char *vendor_name; /*!< Vendor name (opt.) */ char *product; /*!< Product (opt.) */ } usb; /*!< USB attributes */ } parm; /*!< Port parameter union */ } hamlib_port_t; #if !defined(__APPLE__) || !defined(__cplusplus) typedef hamlib_port_t port_t; #endif /** * \brief Rig state containing live data and customized fields. * * This struct contains live data, as well as a copy of capability fields * that may be updated (ie. customized) * * It is fine to move fields around, as this kind of struct should * not be initialized like caps are. */ struct rig_state { /* * overridable fields */ hamlib_port_t rigport; /*!< Rig port (internal use). */ hamlib_port_t pttport; /*!< PTT port (internal use). */ hamlib_port_t dcdport; /*!< DCD port (internal use). */ double vfo_comp; /*!< VFO compensation in PPM, 0.0 to disable */ int itu_region; /*!< ITU region to select among freq_range_t */ freq_range_t rx_range_list[FRQRANGESIZ]; /*!< Receive frequency range list */ freq_range_t tx_range_list[FRQRANGESIZ]; /*!< Transmit frequency range list */ struct tuning_step_list tuning_steps[TSLSTSIZ]; /*!< Tuning step list */ struct filter_list filters[FLTLSTSIZ]; /*!< Mode/filter table, at -6dB */ cal_table_t str_cal; /*!< S-meter calibration table */ chan_t chan_list[CHANLSTSIZ]; /*!< Channel list, zero ended */ shortfreq_t max_rit; /*!< max absolute RIT */ shortfreq_t max_xit; /*!< max absolute XIT */ shortfreq_t max_ifshift; /*!< max absolute IF-SHIFT */ ann_t announces; /*!< Announces bit field list */ int preamp[MAXDBLSTSIZ]; /*!< Preamp list in dB, 0 terminated */ int attenuator[MAXDBLSTSIZ]; /*!< Preamp list in dB, 0 terminated */ setting_t has_get_func; /*!< List of get functions */ setting_t has_set_func; /*!< List of set functions */ setting_t has_get_level; /*!< List of get level */ setting_t has_set_level; /*!< List of set level */ setting_t has_get_parm; /*!< List of get parm */ setting_t has_set_parm; /*!< List of set parm */ gran_t level_gran[RIG_SETTING_MAX]; /*!< level granularity */ gran_t parm_gran[RIG_SETTING_MAX]; /*!< parm granularity */ /* * non overridable fields, internal use */ int hold_decode; /*!< set to 1 to hold the event decoder (async) otherwise 0 */ vfo_t current_vfo; /*!< VFO currently set */ int vfo_list; /*!< Complete list of VFO for this rig */ int comm_state; /*!< Comm port state, opened/closed. */ rig_ptr_t priv; /*!< Pointer to private rig state data. */ rig_ptr_t obj; /*!< Internal use by hamlib++ for event handling. */ int transceive; /*!< Whether the transceive mode is on */ int poll_interval; /*!< Event notification polling period in milliseconds */ freq_t current_freq; /*!< Frequency currently set */ rmode_t current_mode; /*!< Mode currently set */ pbwidth_t current_width; /*!< Passband width currently set */ vfo_t tx_vfo; /*!< Tx VFO currently set */ int mode_list; /*!< Complete list of modes for this rig */ }; typedef int (*vprintf_cb_t) (enum rig_debug_level_e, rig_ptr_t, const char *, va_list); typedef int (*freq_cb_t) (RIG *, vfo_t, freq_t, rig_ptr_t); typedef int (*mode_cb_t) (RIG *, vfo_t, rmode_t, pbwidth_t, rig_ptr_t); typedef int (*vfo_cb_t) (RIG *, vfo_t, rig_ptr_t); typedef int (*ptt_cb_t) (RIG *, vfo_t, ptt_t, rig_ptr_t); typedef int (*dcd_cb_t) (RIG *, vfo_t, dcd_t, rig_ptr_t); typedef int (*pltune_cb_t) (RIG *, vfo_t, freq_t *, rmode_t *, pbwidth_t *, rig_ptr_t); /** * \brief Callback functions and args for rig event. * * Some rigs are able to notify the host computer the operator changed * the freq/mode from the front panel, depressed a button, etc. * * Events from the rig are received through async io, * so callback functions will be called from the SIGIO sighandler context. * * Don't set these fields directly, use rig_set_freq_callback et. al. instead. * * Callbacks suit event based programming very well, * really appropriate in a GUI. * * \sa rig_set_freq_callback, rig_set_mode_callback, rig_set_vfo_callback, * rig_set_ptt_callback, rig_set_dcd_callback */ struct rig_callbacks { freq_cb_t freq_event; /*!< Frequency change event */ rig_ptr_t freq_arg; /*!< Frequency change argument */ mode_cb_t mode_event; /*!< Mode change event */ rig_ptr_t mode_arg; /*!< Mode change argument */ vfo_cb_t vfo_event; /*!< VFO change event */ rig_ptr_t vfo_arg; /*!< VFO change argument */ ptt_cb_t ptt_event; /*!< PTT change event */ rig_ptr_t ptt_arg; /*!< PTT change argument */ dcd_cb_t dcd_event; /*!< DCD change event */ rig_ptr_t dcd_arg; /*!< DCD change argument */ pltune_cb_t pltune; /*!< Pipeline tuning module freq/mode/width callback */ rig_ptr_t pltune_arg; /*!< Pipeline tuning argument */ /* etc.. */ }; /** * \brief The Rig structure * * This is the master data structure, acting as a handle for the controlled * rig. A pointer to this structure is returned by the rig_init() API * function and is passed as a parameter to every rig specific API call. * * \sa rig_init(), rig_caps, rig_state */ struct rig { struct rig_caps *caps; /*!< Pointer to rig capabilities (read only) */ struct rig_state state; /*!< Rig state */ struct rig_callbacks callbacks; /*!< registered event callbacks */ }; /* --------------- API function prototypes -----------------*/ extern HAMLIB_EXPORT(RIG *) rig_init HAMLIB_PARAMS((rig_model_t rig_model)); extern HAMLIB_EXPORT(int) rig_open HAMLIB_PARAMS((RIG *rig)); /* * General API commands, from most primitive to least.. :() * List Set/Get functions pairs */ extern HAMLIB_EXPORT(int) rig_set_freq HAMLIB_PARAMS((RIG *rig, vfo_t vfo, freq_t freq)); extern HAMLIB_EXPORT(int) rig_get_freq HAMLIB_PARAMS((RIG *rig, vfo_t vfo, freq_t *freq)); extern HAMLIB_EXPORT(int) rig_set_mode HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)); extern HAMLIB_EXPORT(int) rig_get_mode HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)); extern HAMLIB_EXPORT(int) rig_set_vfo HAMLIB_PARAMS((RIG *rig, vfo_t vfo)); extern HAMLIB_EXPORT(int) rig_get_vfo HAMLIB_PARAMS((RIG *rig, vfo_t *vfo)); extern HAMLIB_EXPORT(int) rig_set_ptt HAMLIB_PARAMS((RIG *rig, vfo_t vfo, ptt_t ptt)); extern HAMLIB_EXPORT(int) rig_get_ptt HAMLIB_PARAMS((RIG *rig, vfo_t vfo, ptt_t *ptt)); extern HAMLIB_EXPORT(int) rig_get_dcd HAMLIB_PARAMS((RIG *rig, vfo_t vfo, dcd_t *dcd)); extern HAMLIB_EXPORT(int) rig_set_rptr_shift HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift)); extern HAMLIB_EXPORT(int) rig_get_rptr_shift HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift)); extern HAMLIB_EXPORT(int) rig_set_rptr_offs HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t rptr_offs)); extern HAMLIB_EXPORT(int) rig_get_rptr_offs HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs)); extern HAMLIB_EXPORT(int) rig_set_ctcss_tone HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t tone)); extern HAMLIB_EXPORT(int) rig_get_ctcss_tone HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t *tone)); extern HAMLIB_EXPORT(int) rig_set_dcs_code HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t code)); extern HAMLIB_EXPORT(int) rig_get_dcs_code HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t *code)); extern HAMLIB_EXPORT(int) rig_set_ctcss_sql HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t tone)); extern HAMLIB_EXPORT(int) rig_get_ctcss_sql HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t *tone)); extern HAMLIB_EXPORT(int) rig_set_dcs_sql HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t code)); extern HAMLIB_EXPORT(int) rig_get_dcs_sql HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t *code)); extern HAMLIB_EXPORT(int) rig_set_split_freq HAMLIB_PARAMS((RIG *rig, vfo_t vfo, freq_t tx_freq)); extern HAMLIB_EXPORT(int) rig_get_split_freq HAMLIB_PARAMS((RIG *rig, vfo_t vfo, freq_t *tx_freq)); extern HAMLIB_EXPORT(int) rig_set_split_mode HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width)); extern HAMLIB_EXPORT(int) rig_get_split_mode HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width)); extern HAMLIB_EXPORT(int) rig_set_split_vfo HAMLIB_PARAMS((RIG*, vfo_t rx_vfo, split_t split, vfo_t tx_vfo)); extern HAMLIB_EXPORT(int) rig_get_split_vfo HAMLIB_PARAMS((RIG*, vfo_t rx_vfo, split_t *split, vfo_t *tx_vfo)); #define rig_set_split(r,v,s) rig_set_split_vfo((r),(v),(s),RIG_VFO_CURR) #define rig_get_split(r,v,s) ({ vfo_t _tx_vfo; rig_get_split_vfo((r),(v),(s),&_tx_vfo); }) extern HAMLIB_EXPORT(int) rig_set_rit HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t rit)); extern HAMLIB_EXPORT(int) rig_get_rit HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t *rit)); extern HAMLIB_EXPORT(int) rig_set_xit HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t xit)); extern HAMLIB_EXPORT(int) rig_get_xit HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t *xit)); extern HAMLIB_EXPORT(int) rig_set_ts HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t ts)); extern HAMLIB_EXPORT(int) rig_get_ts HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t *ts)); extern HAMLIB_EXPORT(int) rig_power2mW HAMLIB_PARAMS((RIG *rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode)); extern HAMLIB_EXPORT(int) rig_mW2power HAMLIB_PARAMS((RIG *rig, float *power, unsigned int mwpower, freq_t freq, rmode_t mode)); extern HAMLIB_EXPORT(shortfreq_t) rig_get_resolution HAMLIB_PARAMS((RIG *rig, rmode_t mode)); extern HAMLIB_EXPORT(int) rig_set_level HAMLIB_PARAMS((RIG *rig, vfo_t vfo, setting_t level, value_t val)); extern HAMLIB_EXPORT(int) rig_get_level HAMLIB_PARAMS((RIG *rig, vfo_t vfo, setting_t level, value_t *val)); #define rig_get_strength(r,v,s) rig_get_level((r),(v),RIG_LEVEL_STRENGTH, (value_t*)(s)) extern HAMLIB_EXPORT(int) rig_set_parm HAMLIB_PARAMS((RIG *rig, setting_t parm, value_t val)); extern HAMLIB_EXPORT(int) rig_get_parm HAMLIB_PARAMS((RIG *rig, setting_t parm, value_t *val)); extern HAMLIB_EXPORT(int) rig_set_conf HAMLIB_PARAMS((RIG *rig, token_t token, const char *val)); extern HAMLIB_EXPORT(int) rig_get_conf HAMLIB_PARAMS((RIG *rig, token_t token, char *val)); extern HAMLIB_EXPORT(int) rig_set_powerstat HAMLIB_PARAMS((RIG *rig, powerstat_t status)); extern HAMLIB_EXPORT(int) rig_get_powerstat HAMLIB_PARAMS((RIG *rig, powerstat_t *status)); extern HAMLIB_EXPORT(int) rig_reset HAMLIB_PARAMS((RIG *rig, reset_t reset)); /* dangerous! */ extern HAMLIB_EXPORT(int) rig_set_ext_level HAMLIB_PARAMS((RIG *rig, vfo_t vfo, token_t token, value_t val)); extern HAMLIB_EXPORT(int) rig_get_ext_level HAMLIB_PARAMS((RIG *rig, vfo_t vfo, token_t token, value_t *val)); extern HAMLIB_EXPORT(int) rig_set_ext_parm HAMLIB_PARAMS((RIG *rig, token_t token, value_t val)); extern HAMLIB_EXPORT(int) rig_get_ext_parm HAMLIB_PARAMS((RIG *rig, token_t token, value_t *val)); extern HAMLIB_EXPORT(int) rig_ext_level_foreach HAMLIB_PARAMS((RIG *rig, int (*cfunc)(RIG*, const struct confparams *, rig_ptr_t), rig_ptr_t data)); extern HAMLIB_EXPORT(int) rig_ext_parm_foreach HAMLIB_PARAMS((RIG *rig, int (*cfunc)(RIG*, const struct confparams *, rig_ptr_t), rig_ptr_t data)); extern HAMLIB_EXPORT(const struct confparams*) rig_ext_lookup HAMLIB_PARAMS((RIG *rig, const char *name)); extern HAMLIB_EXPORT(const struct confparams *) rig_ext_lookup_tok HAMLIB_PARAMS((RIG *rig, token_t token)); extern HAMLIB_EXPORT(token_t) rig_ext_token_lookup HAMLIB_PARAMS((RIG *rig, const char *name)); extern HAMLIB_EXPORT(int) rig_token_foreach HAMLIB_PARAMS((RIG *rig, int (*cfunc)(const struct confparams *, rig_ptr_t), rig_ptr_t data)); extern HAMLIB_EXPORT(const struct confparams*) rig_confparam_lookup HAMLIB_PARAMS((RIG *rig, const char *name)); extern HAMLIB_EXPORT(token_t) rig_token_lookup HAMLIB_PARAMS((RIG *rig, const char *name)); extern HAMLIB_EXPORT(int) rig_close HAMLIB_PARAMS((RIG *rig)); extern HAMLIB_EXPORT(int) rig_cleanup HAMLIB_PARAMS((RIG *rig)); extern HAMLIB_EXPORT(int) rig_set_ant HAMLIB_PARAMS((RIG *rig, vfo_t vfo, ant_t ant)); /* antenna */ extern HAMLIB_EXPORT(int) rig_get_ant HAMLIB_PARAMS((RIG *rig, vfo_t vfo, ant_t *ant)); extern HAMLIB_EXPORT(setting_t) rig_has_get_level HAMLIB_PARAMS((RIG *rig, setting_t level)); extern HAMLIB_EXPORT(setting_t) rig_has_set_level HAMLIB_PARAMS((RIG *rig, setting_t level)); extern HAMLIB_EXPORT(setting_t) rig_has_get_parm HAMLIB_PARAMS((RIG *rig, setting_t parm)); extern HAMLIB_EXPORT(setting_t) rig_has_set_parm HAMLIB_PARAMS((RIG *rig, setting_t parm)); extern HAMLIB_EXPORT(setting_t) rig_has_get_func HAMLIB_PARAMS((RIG *rig, setting_t func)); extern HAMLIB_EXPORT(setting_t) rig_has_set_func HAMLIB_PARAMS((RIG *rig, setting_t func)); extern HAMLIB_EXPORT(int) rig_set_func HAMLIB_PARAMS((RIG *rig, vfo_t vfo, setting_t func, int status)); extern HAMLIB_EXPORT(int) rig_get_func HAMLIB_PARAMS((RIG *rig, vfo_t vfo, setting_t func, int *status)); extern HAMLIB_EXPORT(int) rig_send_dtmf HAMLIB_PARAMS((RIG *rig, vfo_t vfo, const char *digits)); extern HAMLIB_EXPORT(int) rig_recv_dtmf HAMLIB_PARAMS((RIG *rig, vfo_t vfo, char *digits, int *length)); extern HAMLIB_EXPORT(int) rig_send_morse HAMLIB_PARAMS((RIG *rig, vfo_t vfo, const char *msg)); extern HAMLIB_EXPORT(int) rig_set_bank HAMLIB_PARAMS((RIG *rig, vfo_t vfo, int bank)); extern HAMLIB_EXPORT(int) rig_set_mem HAMLIB_PARAMS((RIG *rig, vfo_t vfo, int ch)); extern HAMLIB_EXPORT(int) rig_get_mem HAMLIB_PARAMS((RIG *rig, vfo_t vfo, int *ch)); extern HAMLIB_EXPORT(int) rig_vfo_op HAMLIB_PARAMS((RIG *rig, vfo_t vfo, vfo_op_t op)); extern HAMLIB_EXPORT(vfo_op_t) rig_has_vfo_op HAMLIB_PARAMS((RIG *rig, vfo_op_t op)); extern HAMLIB_EXPORT(int) rig_scan HAMLIB_PARAMS((RIG *rig, vfo_t vfo, scan_t scan, int ch)); extern HAMLIB_EXPORT(scan_t) rig_has_scan HAMLIB_PARAMS((RIG *rig, scan_t scan)); extern HAMLIB_EXPORT(int) rig_set_channel HAMLIB_PARAMS((RIG *rig, const channel_t *chan)); /* mem */ extern HAMLIB_EXPORT(int) rig_get_channel HAMLIB_PARAMS((RIG *rig, channel_t *chan)); extern HAMLIB_EXPORT(int) rig_set_chan_all HAMLIB_PARAMS((RIG *rig, const channel_t chans[])); extern HAMLIB_EXPORT(int) rig_get_chan_all HAMLIB_PARAMS((RIG *rig, channel_t chans[])); extern HAMLIB_EXPORT(int) rig_set_chan_all_cb HAMLIB_PARAMS((RIG *rig, chan_cb_t chan_cb, rig_ptr_t)); extern HAMLIB_EXPORT(int) rig_get_chan_all_cb HAMLIB_PARAMS((RIG *rig, chan_cb_t chan_cb, rig_ptr_t)); extern HAMLIB_EXPORT(int) rig_set_mem_all_cb HAMLIB_PARAMS((RIG *rig, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t)); extern HAMLIB_EXPORT(int) rig_get_mem_all_cb HAMLIB_PARAMS((RIG *rig, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t)); extern HAMLIB_EXPORT(int) rig_set_mem_all HAMLIB_PARAMS((RIG *rig, const channel_t *chan, const struct confparams *, const value_t *)); extern HAMLIB_EXPORT(int) rig_get_mem_all HAMLIB_PARAMS((RIG *rig, channel_t *chan, const struct confparams *, value_t *)); extern HAMLIB_EXPORT(const chan_t *) rig_lookup_mem_caps HAMLIB_PARAMS((RIG *rig, int ch)); extern HAMLIB_EXPORT(int) rig_mem_count HAMLIB_PARAMS((RIG *rig)); extern HAMLIB_EXPORT(int) rig_set_trn HAMLIB_PARAMS((RIG *rig, int trn)); extern HAMLIB_EXPORT(int) rig_get_trn HAMLIB_PARAMS((RIG *rig, int *trn)); extern HAMLIB_EXPORT(int) rig_set_freq_callback HAMLIB_PARAMS((RIG *, freq_cb_t, rig_ptr_t)); extern HAMLIB_EXPORT(int) rig_set_mode_callback HAMLIB_PARAMS((RIG *, mode_cb_t, rig_ptr_t)); extern HAMLIB_EXPORT(int) rig_set_vfo_callback HAMLIB_PARAMS((RIG *, vfo_cb_t, rig_ptr_t)); extern HAMLIB_EXPORT(int) rig_set_ptt_callback HAMLIB_PARAMS((RIG *, ptt_cb_t, rig_ptr_t)); extern HAMLIB_EXPORT(int) rig_set_dcd_callback HAMLIB_PARAMS((RIG *, dcd_cb_t, rig_ptr_t)); extern HAMLIB_EXPORT(int) rig_set_pltune_callback HAMLIB_PARAMS((RIG *, pltune_cb_t, rig_ptr_t)); extern HAMLIB_EXPORT(const char *) rig_get_info HAMLIB_PARAMS((RIG *rig)); extern HAMLIB_EXPORT(const struct rig_caps *) rig_get_caps HAMLIB_PARAMS((rig_model_t rig_model)); extern HAMLIB_EXPORT(const freq_range_t *) rig_get_range HAMLIB_PARAMS((const freq_range_t range_list[], freq_t freq, rmode_t mode)); extern HAMLIB_EXPORT(pbwidth_t) rig_passband_normal HAMLIB_PARAMS((RIG *rig, rmode_t mode)); extern HAMLIB_EXPORT(pbwidth_t) rig_passband_narrow HAMLIB_PARAMS((RIG *rig, rmode_t mode)); extern HAMLIB_EXPORT(pbwidth_t) rig_passband_wide HAMLIB_PARAMS((RIG *rig, rmode_t mode)); extern HAMLIB_EXPORT(const char *) rigerror HAMLIB_PARAMS((int errnum)); extern HAMLIB_EXPORT(int) rig_setting2idx HAMLIB_PARAMS((setting_t s)); #define rig_idx2setting(i) (1UL<<(i)) /* * Even if these functions are prefixed with "rig_", they are not rig specific * Maybe "hamlib_" would have been better. Let me know. --SF */ extern HAMLIB_EXPORT(void) rig_set_debug HAMLIB_PARAMS((enum rig_debug_level_e debug_level)); #define rig_set_debug_level(level) rig_set_debug(level) extern HAMLIB_EXPORT(int) rig_need_debug HAMLIB_PARAMS((enum rig_debug_level_e debug_level)); extern HAMLIB_EXPORT(void) rig_debug HAMLIB_PARAMS((enum rig_debug_level_e debug_level, const char *fmt, ...)); extern HAMLIB_EXPORT(vprintf_cb_t) rig_set_debug_callback HAMLIB_PARAMS((vprintf_cb_t cb, rig_ptr_t arg)); extern HAMLIB_EXPORT(FILE*) rig_set_debug_file HAMLIB_PARAMS((FILE *stream)); extern HAMLIB_EXPORT(int) rig_register HAMLIB_PARAMS((const struct rig_caps *caps)); extern HAMLIB_EXPORT(int) rig_unregister HAMLIB_PARAMS((rig_model_t rig_model)); extern HAMLIB_EXPORT(int) rig_list_foreach HAMLIB_PARAMS((int (*cfunc)(const struct rig_caps*, rig_ptr_t), rig_ptr_t data)); extern HAMLIB_EXPORT(int) rig_load_backend HAMLIB_PARAMS((const char *be_name)); extern HAMLIB_EXPORT(int) rig_check_backend HAMLIB_PARAMS((rig_model_t rig_model)); extern HAMLIB_EXPORT(int) rig_load_all_backends HAMLIB_PARAMS((void)); typedef int (*rig_probe_func_t)(const hamlib_port_t *, rig_model_t, rig_ptr_t); extern HAMLIB_EXPORT(int) rig_probe_all HAMLIB_PARAMS((hamlib_port_t *p, rig_probe_func_t, rig_ptr_t)); extern HAMLIB_EXPORT(rig_model_t) rig_probe HAMLIB_PARAMS((hamlib_port_t *p)); /* Misc calls */ extern HAMLIB_EXPORT(const char *) rig_strrmode(rmode_t mode); extern HAMLIB_EXPORT(const char *) rig_strvfo(vfo_t vfo); extern HAMLIB_EXPORT(const char *) rig_strfunc(setting_t); extern HAMLIB_EXPORT(const char *) rig_strlevel(setting_t); extern HAMLIB_EXPORT(const char *) rig_strparm(setting_t); extern HAMLIB_EXPORT(const char *) rig_strptrshift(rptr_shift_t); extern HAMLIB_EXPORT(const char *) rig_strvfop(vfo_op_t op); extern HAMLIB_EXPORT(const char *) rig_strscan(scan_t scan); extern HAMLIB_EXPORT(const char *) rig_strstatus(enum rig_status_e status); extern HAMLIB_EXPORT(const char *) rig_strmtype(chan_type_t mtype); extern HAMLIB_EXPORT(rmode_t) rig_parse_mode(const char *s); extern HAMLIB_EXPORT(vfo_t) rig_parse_vfo(const char *s); extern HAMLIB_EXPORT(setting_t) rig_parse_func(const char *s); extern HAMLIB_EXPORT(setting_t) rig_parse_level(const char *s); extern HAMLIB_EXPORT(setting_t) rig_parse_parm(const char *s); extern HAMLIB_EXPORT(vfo_op_t) rig_parse_vfo_op(const char *s); extern HAMLIB_EXPORT(scan_t) rig_parse_scan(const char *s); extern HAMLIB_EXPORT(rptr_shift_t) rig_parse_rptr_shift(const char *s); extern HAMLIB_EXPORT(chan_type_t) rig_parse_mtype(const char *s); __END_DECLS #endif /* _RIG_H */ /*! @} */ hamlib-1.2.15.3/include/hamlib/rotlist.h0000644000175000017500000002524212044564477014670 00000000000000/* * Hamlib Interface - list of known rotators * Copyright (c) 2000-2011 by Stephane Fillod * Copyright (c) 2000-2002 by Frank Singleton * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROTLIST_H #define _ROTLIST_H 1 #define ROT_MAKE_MODEL(a,b) ((a)*100+(b)) #define ROT_BACKEND_NUM(a) ((a)/100) /** * \addtogroup rotator * @{ */ /*! \file rotlist.h * \brief Hamlib rotator model definitions. * * This file contains rotator model definitions for the Hamlib rotator API. * Each distinct rotator type has a unique model number (ID) and is used * by hamlib to identify and distinguish between the different hardware drivers. * The exact model numbers can be acquired using the macros in this * file. To obtain a list of supported rotator branches, one can use the statically * defined ROT_BACKEND_LIST macro. To obtain a full list of supported rotators (including * each model in every branch), the foreach_opened_rot() API function can be used. * * The model number, or ID, is used to tell hamlib, which rotator the client whishes to * use. It is done with the rot_init() API call. */ #define ROT_MODEL_NONE 0 /*! \def ROT_MODEL_DUMMY * \brief A macro that returns the model number for the dummy backend. * * The dummy backend, as the name suggests, is a backend which performs * no hardware operations and always behaves as one would expect. It can * be thought of as a hardware simulator and is very usefull for testing * client applications. */ /*! \def ROT_MODEL_NETROTCTL * \brief A macro that returns the model number for the Network backend. * * This backend allows use of the rotctld daemon through the normal * Hamlib API. */ #define ROT_DUMMY 0 #define ROT_BACKEND_DUMMY "dummy" #define ROT_MODEL_DUMMY ROT_MAKE_MODEL(ROT_DUMMY, 1) #define ROT_MODEL_NETROTCTL ROT_MAKE_MODEL(ROT_DUMMY, 2) /* * RPC Network pseudo-backend */ /*! \def ROT_MODEL_RPC * \brief A macro that returns the model number of the RPC Network pseudo-backend. * * The RPC backend can be used to connect and send commands to a rotator server, * \c rpc.rotd, running on a remote machine. Using this client/server scheme, * several clients can control and monitor the same rotator hardware. */ #define ROT_RPC 1 #define ROT_BACKEND_RPC "rpcrot" #define ROT_MODEL_RPC ROT_MAKE_MODEL(ROT_RPC, 1) /* * Easycomm */ /*! \def ROT_MODEL_EASYCOMM1 * \brief A macro that returns the model number of the EasyComm 1 backend. * * The EasyComm 1 backend can be used with rotators that support the * EASYCOMM I Standard. */ /*! \def ROT_MODEL_EASYCOMM2 * \brief A macro that returns the model number of the EasyComm 2 backend. * * The EasyComm 2 backend can be used with rotators that support the * EASYCOMM II Standard. */ #define ROT_EASYCOMM 2 #define ROT_BACKEND_EASYCOMM "easycomm" #define ROT_MODEL_EASYCOMM1 ROT_MAKE_MODEL(ROT_EASYCOMM, 1) #define ROT_MODEL_EASYCOMM2 ROT_MAKE_MODEL(ROT_EASYCOMM, 2) #define ROT_MODEL_TRAKBOX ROT_MAKE_MODEL(ROT_EASYCOMM, 3) /*! \def ROT_MODEL_FODTRACK * \brief A macro that returns the model number of the Fodtrack backend. * * The Fodtrack backend can be used with rotators that support the * FODTRACK Standard. */ #define ROT_FODTRACK 3 #define ROT_BACKEND_FODTRACK "fodtrack" #define ROT_MODEL_FODTRACK ROT_MAKE_MODEL(ROT_FODTRACK, 1) /*! \def ROT_MODEL_ROTOREZ * \brief A macro that returns the model number of the Rotor-EZ backend. * * The Rotor-EZ backend can be used with Hy-Gain rotators that support * the extended DCU command set by Idiom Press Rotor-EZ board. */ /*! \def ROT_MODEL_ROTORCARD * \brief A macro that returns the model number of the Rotor Card backend. * * The Rotor-EZ backend can be used with Yaesu rotators that support the * extended DCU command set by Idiom Press Rotor Card board. */ /*! \def ROT_MODEL_DCU * \brief A macro that returns the model number of the DCU backend. * * The Rotor-EZ backend can be used with rotators that support the * DCU command set by Hy-Gain (currently the DCU-1). */ /*! \def ROT_MODEL_ERC * \brief A macro that returns the model number of the ERC backend. * * The Rotor-EZ backend can be used with rotators that support the * DCU command set by DF9GR (currently the ERC). */ #define ROT_ROTOREZ 4 #define ROT_BACKEND_ROTOREZ "rotorez" #define ROT_MODEL_ROTOREZ ROT_MAKE_MODEL(ROT_ROTOREZ, 1) #define ROT_MODEL_ROTORCARD ROT_MAKE_MODEL(ROT_ROTOREZ, 2) #define ROT_MODEL_DCU ROT_MAKE_MODEL(ROT_ROTOREZ, 3) #define ROT_MODEL_ERC ROT_MAKE_MODEL(ROT_ROTOREZ, 4) /*! \def ROT_MODEL_SARTEK1 * \brief A macro that returns the model number of the SARtek-1 backend. * * The sartek backend can be used with rotators that support the * SARtek protocol. */ #define ROT_SARTEK 5 #define ROT_BACKEND_SARTEK "sartek" #define ROT_MODEL_SARTEK1 ROT_MAKE_MODEL(ROT_SARTEK, 1) /*! \def ROT_MODEL_GS232A * \brief A macro that returns the model number of the GS-232A backend. * * The GS-232A backend can be used with rotators that support the * GS-232A protocol. */ /*! \def ROT_MODEL_GS232 * \brief A macro that returns the model number of the GS-232 backend. * * The GS-232 backend can be used with rotators that support the * GS-232 protocol. */ /*! \def ROT_MODEL_GS232B * \brief A macro that returns the model number of the GS-232B backend. * * The GS-232B backend can be used with rotators that support the * GS-232B protocol. */ /*! \def ROT_MODEL_F1TETRACKER * \brief A macro that returns the model number of the F1TETRACKER backend. * * The F1TETRACKER backend can be used with rotators that support the * F1TETRACKER protocol. */ #define ROT_GS232A 6 #define ROT_BACKEND_GS232A "gs232a" #define ROT_MODEL_GS232A ROT_MAKE_MODEL(ROT_GS232A, 1) #define ROT_MODEL_GS232 ROT_MAKE_MODEL(ROT_GS232A, 2) /* Not A or B */ #define ROT_MODEL_GS232B ROT_MAKE_MODEL(ROT_GS232A, 3) #define ROT_MODEL_F1TETRACKER ROT_MAKE_MODEL(ROT_GS232A, 4) /*! \def ROT_MODEL_PCROTOR * \brief A macro that returns the model number of the PcRotor/WA6UFQ backend. * * The kit backend can be used with home brewed rotators. */ #define ROT_KIT 7 #define ROT_BACKEND_KIT "kit" #define ROT_MODEL_PCROTOR ROT_MAKE_MODEL(ROT_KIT, 1) /*! \def ROT_MODEL_HD1780 * \brief A macro that returns the model number of the HD 1780 backend. */ #define ROT_HEATHKIT 8 #define ROT_BACKEND_HEATHKIT "heathkit" #define ROT_MODEL_HD1780 ROT_MAKE_MODEL(ROT_HEATHKIT, 1) /*! \def ROT_MODEL_SPID_ROT2PROG * \brief A macro that returns the model number of the ROT2PROG backend. * * The SPID backend can be used with rotators that support the SPID * protocol. */ /*! \def ROT_MODEL_SPID_ROT1PROG * \brief A macro that returns the model number of the ROT1PROG backend. * * The SPID backend can be used with rotators that support the SPID * protocol. */ #define ROT_SPID 9 #define ROT_BACKEND_SPID "spid" #define ROT_MODEL_SPID_ROT2PROG ROT_MAKE_MODEL(ROT_SPID, 1) #define ROT_MODEL_SPID_ROT1PROG ROT_MAKE_MODEL(ROT_SPID, 2) /*! \def ROT_MODEL_RC2800 * \brief A macro that returns the model number of the RC2800 backend. * * The M2 backend can be used with rotators that support the RC2800 * protocol and alike. */ #define ROT_M2 10 #define ROT_BACKEND_M2 "m2" #define ROT_MODEL_RC2800 ROT_MAKE_MODEL(ROT_M2, 1) /*! \def ROT_MODEL_RCI_AZEL * \brief A macro that returns the model number of the RCI_AZEL backend. * * The ARS backend can be used with rotators that support the ARS * protocol. */ /*! \def ROT_MODEL_RCI_AZ * \brief A macro that returns the model number of the RCI_AZ backend. * * The ARS backend can be used with rotators that support the ARS * protocol. */ #define ROT_ARS 11 #define ROT_BACKEND_ARS "ars" #define ROT_MODEL_RCI_AZEL ROT_MAKE_MODEL(ROT_ARS, 1) #define ROT_MODEL_RCI_AZ ROT_MAKE_MODEL(ROT_ARS, 2) /*! \def ROT_MODEL_IF100 * \brief A macro that returns the model number of the IF-100 backend. * * The AMSAT backend can be used with rotators that support, * among other, the IF-100 interface. */ #define ROT_AMSAT 12 #define ROT_BACKEND_AMSAT "amsat" #define ROT_MODEL_IF100 ROT_MAKE_MODEL(ROT_AMSAT, 1) /*! \def ROT_MODEL_TS7400 * \brief A macro that returns the model number of the TS7400 backend. * * The TS-7400 backend supports and embedded ARM board using the TS-7400 * Linux board. More information is at http://www.embeddedarm.com */ #define ROT_TS7400 13 #define ROT_BACKEND_TS7400 "ts7400" #define ROT_MODEL_TS7400 ROT_MAKE_MODEL(ROT_TS7400, 1) /*! \def ROT_MODEL_NEXSTAR * \brief A macro that returns the model number of the NEXSTAR backend. * * The CELESTRON backend can be used with rotators that support the Celestron * protocol and alike. */ #define ROT_CELESTRON 14 #define ROT_BACKEND_CELESTRON "celestron" #define ROT_MODEL_NEXSTAR ROT_MAKE_MODEL(ROT_CELESTRON, 1) /*! \typedef typedef int rot_model_t \brief Convenience type definition for rotator model. */ typedef int rot_model_t; /*! \def ROT_BACKEND_LIST * \brief Static list of rotator models. * * This is a NULL terminated list of available rotator backends. Each entry * in the list consists of two fields: The branch number, which is an integer, * and the branch name, which is a character string. */ #define ROT_BACKEND_LIST { \ { ROT_DUMMY, ROT_BACKEND_DUMMY }, \ { ROT_RPC, ROT_BACKEND_RPC }, \ { ROT_EASYCOMM, ROT_BACKEND_EASYCOMM }, \ { ROT_FODTRACK, ROT_BACKEND_FODTRACK }, \ { ROT_ROTOREZ, ROT_BACKEND_ROTOREZ }, \ { ROT_SARTEK, ROT_BACKEND_SARTEK }, \ { ROT_GS232A, ROT_BACKEND_GS232A }, \ { ROT_KIT, ROT_BACKEND_KIT }, \ { ROT_HEATHKIT, ROT_BACKEND_HEATHKIT }, \ { ROT_SPID, ROT_BACKEND_SPID }, \ { ROT_M2, ROT_BACKEND_M2 }, \ { ROT_ARS, ROT_BACKEND_ARS }, \ { ROT_AMSAT, ROT_BACKEND_AMSAT }, \ { ROT_TS7400, ROT_BACKEND_TS7400 }, \ { ROT_CELESTRON, ROT_BACKEND_CELESTRON }, \ { 0, NULL }, /* end */ \ } /* * struct rot_backend_list { * rot_model_t model; * const char *backend; * } rot_backend_list[] = ROT_LIST; * */ #endif /* _ROTLIST_H */ /** @} */ hamlib-1.2.15.3/include/hamlib/rotclass.h0000644000175000017500000000332512044564477015020 00000000000000/* * Hamlib C++ bindings - rotator API header * Copyright (c) 2002 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROTCLASS_H #define _ROTCLASS_H 1 #include class BACKEND_IMPEXP Rotator { private: ROT* theRot; // Global ref. to the rot protected: public: Rotator(rot_model_t rot_model); virtual ~Rotator(); const struct rot_caps *caps; // This method open the communication port to the rot void open(void); // This method close the communication port to the rot void close(void); void setConf(token_t token, const char *val); void setConf(const char *name, const char *val); void getConf(token_t token, char *val); void getConf(const char *name, char *val); token_t tokenLookup(const char *name); void setPosition(azimuth_t az, elevation_t el); void getPosition(azimuth_t& az, elevation_t& el); void stop(); void park(); void reset (rot_reset_t reset); void move(int direction, int speed); }; #endif // _ROTCLASS_H hamlib-1.2.15.3/include/hamlib/rotator.h0000644000175000017500000003275412044564477014670 00000000000000/* * Hamlib Interface - Rotator API header * Copyright (c) 2000-2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROTATOR_H #define _ROTATOR_H 1 #include #include /** * \addtogroup rotator * @{ */ /*! \file rotator.h * \brief Hamlib rotator data structures. * * This file contains the data structures and definitions for the Hamlib rotator API. * see the rotator.c file for more details on the rotator API. */ __BEGIN_DECLS /* Forward struct references */ struct rot; struct rot_state; /*! \typedef typedef struct rot ROT * \brief Rotator structure definition (see rot for details). */ typedef struct rot ROT; /*! \typedef typedef float elevation_t * \brief Type definition for elevation. * * The elevation_t type is used as parameter for the * rot_set_position() and rot_get_position() functions. * * Unless specified otherwise, the unit of elevation_t is decimal degrees. */ /*! \typedef typedef float azimuth_t * \brief Type definition for azimuth. * * The azimuth_t type is used as parameter for the * rot_set_position() and rot_get_position() functions. * * Unless specified otherwise, the unit of azimuth_t is decimal degrees. */ typedef float elevation_t; typedef float azimuth_t; /** \brief Token in the netrotctl protocol for returning error code */ #define NETROTCTL_RET "RPRT " /*! \def ROT_RESET_ALL * \brief A macro that returns the flag for the \b reset operation. * \sa rot_reset(), rot_reset_t */ #define ROT_RESET_ALL 1 /*! \typedef typedef int rot_reset_t * \brief Type definition for rotator reset. * * The rot_reset_t type is used as parameter for * the rot_reset() API function. */ typedef int rot_reset_t; /** \brief Rotator type flags */ typedef enum { ROT_FLAG_AZIMUTH = (1<<1), /*!< Azimuth */ ROT_FLAG_ELEVATION = (1<<2) /*!< Elevation */ } rot_type_t; #define ROT_TYPE_MASK (ROT_FLAG_AZIMUTH|ROT_FLAG_ELEVATION) #define ROT_TYPE_OTHER 0 #define ROT_TYPE_AZIMUTH ROT_FLAG_AZIMUTH #define ROT_TYPE_ELEVATION ROT_FLAG_ELEVATION #define ROT_TYPE_AZEL (ROT_FLAG_AZIMUTH|ROT_FLAG_ELEVATION) /*! \def ROT_MOVE_UP * \brief A macro that returns the flag for the \b UP direction. * * This macro defines the value of the \b UP direction which can be * used with the rot_move() function. * * \sa rot_move(), ROT_MOVE_DOWN, ROT_MOVE_LEFT, ROT_MOVE_CCW, ROT_MOVE_RIGHT, ROT_MOVE_CW */ /*! \def ROT_MOVE_DOWN * \brief A macro that returns the flag for the \b DOWN direction. * * This macro defines the value of the \b DOWN direction which can be * used with the rot_move() function. * * \sa rot_move(), ROT_MOVE_UP, ROT_MOVE_LEFT, ROT_MOVE_CCW, ROT_MOVE_RIGHT, ROT_MOVE_CW */ /*! \def ROT_MOVE_LEFT * \brief A macro that returns the flag for the \b LEFT direction. * * This macro defines the value of the \b LEFT direction which can be * used with the rot_move function. * * \sa rot_move(), ROT_MOVE_UP, ROT_MOVE_DOWN, ROT_MOVE_CCW, ROT_MOVE_RIGHT, ROT_MOVE_CW */ /*! \def ROT_MOVE_CCW * \brief A macro that returns the flag for the \b counterclockwise direction. * * This macro defines the value of the \b counterclockwise direction which * can be used with the rot_move() function. This value is equivalent to * ROT_MOVE_LEFT . * * \sa rot_move(), ROT_MOVE_UP, ROT_MOVE_DOWN, ROT_MOVE_LEFT, ROT_MOVE_RIGHT, ROT_MOVE_CW */ /*! \def ROT_MOVE_RIGHT * \brief A macro that returns the flag for the \b RIGHT direction. * * This macro defines the value of the \b RIGHT direction which can be used * with the rot_move() function. * * \sa rot_move(), ROT_MOVE_UP, ROT_MOVE_DOWN, ROT_MOVE_LEFT, ROT_MOVE_CCW, ROT_MOVE_CW */ /*! \def ROT_MOVE_CW * \brief A macro that returns the flag for the \b clockwise direction. * * This macro defines the value of the \b clockwise direction wich can be * used with the rot_move() function. This value is equivalent to * ROT_MOVE_RIGHT . * * \sa rot_move(), ROT_MOVE_UP, ROT_MOVE_DOWN, ROT_MOVE_LEFT, ROT_MOVE_CCW, ROT_MOVE_RIGHT */ #define ROT_MOVE_UP (1<<1) #define ROT_MOVE_DOWN (1<<2) #define ROT_MOVE_LEFT (1<<3) #define ROT_MOVE_CCW ROT_MOVE_LEFT #define ROT_MOVE_RIGHT (1<<4) #define ROT_MOVE_CW ROT_MOVE_RIGHT /* Basic rot type, can store some useful * info about different rotators. Each lib must * be able to populate this structure, so we can make * useful enquiries about capablilities. */ /*! * Rotator Caps * \struct rot_caps * \brief Rotator data structure. * * The main idea of this struct is that it will be defined by the backend * rotator driver, and will remain readonly for the application. * Fields that need to be modifiable by the application are * copied into the struct rot_state, which is a kind of private * of the ROT instance. * This way, you can have several rigs running within the same application, * sharing the struct rot_caps of the backend, while keeping their own * customized data. * NB: don't move fields around, as backend depends on it when initializing * their caps. */ struct rot_caps { rot_model_t rot_model; /*!< Rotator model. */ const char *model_name; /*!< Model name. */ const char *mfg_name; /*!< Manufacturer. */ const char *version; /*!< Driver version. */ const char *copyright; /*!< Copyright info. */ enum rig_status_e status; /*!< Driver status. */ int rot_type; /*!< Rotator type. */ enum rig_port_e port_type; /*!< Type of communication port. */ int serial_rate_min; /*!< Minimal serial speed. */ int serial_rate_max; /*!< Maximal serial speed. */ int serial_data_bits; /*!< Number of data bits. */ int serial_stop_bits; /*!< Number of stop bits. */ enum serial_parity_e serial_parity; /*!< Parity. */ enum serial_handshake_e serial_handshake; /*!< Handshake. */ int write_delay; /*!< Write delay. */ int post_write_delay; /*!< Post-write delay. */ int timeout; /*!< Timeout. */ int retry; /*!< Number of retry if command fails. */ /* * Movement range, az is relative to North * negative values allowed for overlap */ azimuth_t min_az; /*!< Lower limit for azimuth (relative to North). */ azimuth_t max_az; /*!< Upper limit for azimuth (relative to North). */ elevation_t min_el; /*!< Lower limit for elevation. */ elevation_t max_el; /*!< Upper limit for elevation. */ const struct confparams *cfgparams; /*!< Configuration parametres. */ const rig_ptr_t priv; /*!< Private data. */ /* * Rot Admin API * */ int (*rot_init)(ROT *rot); int (*rot_cleanup)(ROT *rot); int (*rot_open)(ROT *rot); int (*rot_close)(ROT *rot); int (*set_conf)(ROT *rot, token_t token, const char *val); int (*get_conf)(ROT *rot, token_t token, char *val); /* * General API commands, from most primitive to least.. :() * List Set/Get functions pairs */ int (*set_position)(ROT *rot, azimuth_t azimuth, elevation_t elevation); int (*get_position)(ROT *rot, azimuth_t *azimuth, elevation_t *elevation); int (*stop)(ROT *rot); int (*park)(ROT *rot); int (*reset)(ROT *rot, rot_reset_t reset); int (*move)(ROT *rot, int direction, int speed); /* get firmware info, etc. */ const char* (*get_info)(ROT *rot); /* more to come... */ }; /*! * Rotator state * \struct rot_state * \brief Live data and customized fields. * * This struct contains live data, as well as a copy of capability fields * that may be updated (ie. customized) * * It is fine to move fields around, as this kind of struct should * not be initialized like caps are. */ struct rot_state { /* * overridable fields */ azimuth_t min_az; /*!< Lower limit for azimuth (overridable). */ azimuth_t max_az; /*!< Upper limit for azimuth (overridable). */ elevation_t min_el; /*!< Lower limit for elevation (overridable). */ elevation_t max_el; /*!< Upper limit for elevation (overridable). */ /* * non overridable fields, internal use */ hamlib_port_t rotport; /*!< Rotator port (internal use). */ int comm_state; /*!< Comm port state, opened/closed. */ rig_ptr_t priv; /*!< Pointer to private rotator state data. */ rig_ptr_t obj; /*!< Internal use by hamlib++ for event handling. */ /* etc... */ }; /** * Rotator structure * \struct rot * \brief This is the master data structure, * acting as a handle for the controlled rotator. * * This is the master data structure, acting as a handle for the controlled * rotator. A pointer to this structure is returned by the rot_init() API * function and is passed as a parameter to every rotator specific API call. * * \sa rot_init(), rot_caps, rot_state */ struct rot { struct rot_caps *caps; /*!< Rotator caps. */ struct rot_state state; /*!< Rotator state. */ }; /* --------------- API function prototypes -----------------*/ extern HAMLIB_EXPORT(ROT *) rot_init HAMLIB_PARAMS((rot_model_t rot_model)); extern HAMLIB_EXPORT(int) rot_open HAMLIB_PARAMS((ROT *rot)); extern HAMLIB_EXPORT(int) rot_close HAMLIB_PARAMS((ROT *rot)); extern HAMLIB_EXPORT(int) rot_cleanup HAMLIB_PARAMS((ROT *rot)); extern HAMLIB_EXPORT(int) rot_set_conf HAMLIB_PARAMS((ROT *rot, token_t token, const char *val)); extern HAMLIB_EXPORT(int) rot_get_conf HAMLIB_PARAMS((ROT *rot, token_t token, char *val)); /* * General API commands, from most primitive to least.. ) * List Set/Get functions pairs */ extern HAMLIB_EXPORT(int) rot_set_position HAMLIB_PARAMS((ROT *rot, azimuth_t azimuth, elevation_t elevation)); extern HAMLIB_EXPORT(int) rot_get_position HAMLIB_PARAMS((ROT *rot, azimuth_t *azimuth, elevation_t *elevation)); extern HAMLIB_EXPORT(int) rot_stop HAMLIB_PARAMS((ROT *rot)); extern HAMLIB_EXPORT(int) rot_park HAMLIB_PARAMS((ROT *rot)); extern HAMLIB_EXPORT(int) rot_reset HAMLIB_PARAMS((ROT *rot, rot_reset_t reset)); extern HAMLIB_EXPORT(int) rot_move HAMLIB_PARAMS((ROT *rot, int direction, int speed)); extern HAMLIB_EXPORT(const char*) rot_get_info HAMLIB_PARAMS((ROT *rot)); extern HAMLIB_EXPORT(int) rot_register HAMLIB_PARAMS((const struct rot_caps *caps)); extern HAMLIB_EXPORT(int) rot_unregister HAMLIB_PARAMS((rot_model_t rot_model)); extern HAMLIB_EXPORT(int) rot_list_foreach HAMLIB_PARAMS((int (*cfunc)(const struct rot_caps*, rig_ptr_t), rig_ptr_t data)); extern HAMLIB_EXPORT(int) rot_load_backend HAMLIB_PARAMS((const char *be_name)); extern HAMLIB_EXPORT(int) rot_check_backend HAMLIB_PARAMS((rot_model_t rot_model)); extern HAMLIB_EXPORT(int) rot_load_all_backends HAMLIB_PARAMS((void)); extern HAMLIB_EXPORT(rot_model_t) rot_probe_all HAMLIB_PARAMS((hamlib_port_t *p)); extern HAMLIB_EXPORT(int) rot_token_foreach HAMLIB_PARAMS((ROT *rot, int (*cfunc)(const struct confparams *, rig_ptr_t), rig_ptr_t data)); extern HAMLIB_EXPORT(const struct confparams*) rot_confparam_lookup HAMLIB_PARAMS((ROT *rot, const char *name)); extern HAMLIB_EXPORT(token_t) rot_token_lookup HAMLIB_PARAMS((ROT *rot, const char *name)); extern HAMLIB_EXPORT(const struct rot_caps *) rot_get_caps HAMLIB_PARAMS((rot_model_t rot_model)); extern HAMLIB_EXPORT(int) qrb HAMLIB_PARAMS((double lon1, double lat1, double lon2, double lat2, double *distance, double *azimuth)); extern HAMLIB_EXPORT(double) distance_long_path HAMLIB_PARAMS((double distance)); extern HAMLIB_EXPORT(double) azimuth_long_path HAMLIB_PARAMS((double azimuth)); extern HAMLIB_EXPORT(int) longlat2locator HAMLIB_PARAMS((double longitude, double latitude, char *locator_res, int pair_count)); extern HAMLIB_EXPORT(int) locator2longlat HAMLIB_PARAMS((double *longitude, double *latitude, const char *locator)); extern HAMLIB_EXPORT(double) dms2dec HAMLIB_PARAMS((int degrees, int minutes, double seconds, int sw)); extern HAMLIB_EXPORT(int) dec2dms HAMLIB_PARAMS((double dec, int *degrees, int *minutes, double *seconds, int *sw)); extern HAMLIB_EXPORT(int) dec2dmmm HAMLIB_PARAMS((double dec, int *degrees, double *minutes, int *sw)); extern HAMLIB_EXPORT(double) dmmm2dec HAMLIB_PARAMS((int degrees, double minutes, int sw)); /*! \def rot_debug * \brief Convenience definition for debug level. * * This is just as convenience definition of the rotator debug level, * and is the same as for the rig debug level. * * \sa rig_debug */ #define rot_debug rig_debug __END_DECLS #endif /* _ROTATOR_H */ /** @} */ hamlib-1.2.15.3/include/hamlib/riglist.h0000644000175000017500000005350712044564477014652 00000000000000/* * Hamlib Interface - list of known rigs * Copyright (c) 2000-2003 by Frank Singleton * Copyright (c) 2000-2012 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _RIGLIST_H #define _RIGLIST_H 1 #define RIG_MAKE_MODEL(a,b) ((a)*100+(b)) #define RIG_BACKEND_NUM(a) ((a)/100) /*! \file riglist.h * \brief Hamlib rig(radio) model definitions. * * This file contains rig model definitions for the Hamlib rig API. * Each distinct rig type has a unique model number (ID) and is used * by hamlib to identify and distinguish between the different hardware drivers. * The exact model numbers can be acquired using the macros in this * file. To obtain a list of supported rig branches, one can use the statically * defined RIG_BACKEND_LIST macro. To obtain a full list of supported rig (including * each model in every branch), the foreach_opened_rig() API function can be used. * * The model number, or ID, is used to tell hamlib, which rig the client whishes to * use. It is done with the rig_init() API call. */ #define RIG_MODEL_NONE 0 /*! \def RIG_MODEL_DUMMY * \brief A macro that returns the model number for the dummy backend. * * The dummy backend, as the name suggests, is a backend which performs * no hardware operations and always behaves as one would expect. It can * be thought of as a hardware simulator and is very usefull for testing * client applications. */ #define RIG_DUMMY 0 #define RIG_BACKEND_DUMMY "dummy" #define RIG_MODEL_DUMMY RIG_MAKE_MODEL(RIG_DUMMY, 1) #define RIG_MODEL_NETRIGCTL RIG_MAKE_MODEL(RIG_DUMMY, 2) #define RIG_MODEL_ARMSTRONG RIG_MAKE_MODEL(RIG_DUMMY, 3) /* * Yaesu */ #define RIG_YAESU 1 #define RIG_BACKEND_YAESU "yaesu" #define RIG_MODEL_FT847 RIG_MAKE_MODEL(RIG_YAESU, 1) #define RIG_MODEL_FT1000 RIG_MAKE_MODEL(RIG_YAESU, 2) #define RIG_MODEL_FT1000D RIG_MAKE_MODEL(RIG_YAESU, 3) #define RIG_MODEL_FT1000MPMKV RIG_MAKE_MODEL(RIG_YAESU, 4) #define RIG_MODEL_FT747 RIG_MAKE_MODEL(RIG_YAESU, 5) #define RIG_MODEL_FT757 RIG_MAKE_MODEL(RIG_YAESU, 6) #define RIG_MODEL_FT757GXII RIG_MAKE_MODEL(RIG_YAESU, 7) #define RIG_MODEL_FT575 RIG_MAKE_MODEL(RIG_YAESU, 8) #define RIG_MODEL_FT767 RIG_MAKE_MODEL(RIG_YAESU, 9) #define RIG_MODEL_FT736R RIG_MAKE_MODEL(RIG_YAESU, 10) #define RIG_MODEL_FT840 RIG_MAKE_MODEL(RIG_YAESU, 11) #define RIG_MODEL_FT820 RIG_MAKE_MODEL(RIG_YAESU, 12) #define RIG_MODEL_FT900 RIG_MAKE_MODEL(RIG_YAESU, 13) #define RIG_MODEL_FT920 RIG_MAKE_MODEL(RIG_YAESU, 14) #define RIG_MODEL_FT890 RIG_MAKE_MODEL(RIG_YAESU, 15) #define RIG_MODEL_FT990 RIG_MAKE_MODEL(RIG_YAESU, 16) #define RIG_MODEL_FRG100 RIG_MAKE_MODEL(RIG_YAESU, 17) #define RIG_MODEL_FRG9600 RIG_MAKE_MODEL(RIG_YAESU, 18) #define RIG_MODEL_FRG8800 RIG_MAKE_MODEL(RIG_YAESU, 19) #define RIG_MODEL_FT817 RIG_MAKE_MODEL(RIG_YAESU, 20) #define RIG_MODEL_FT100 RIG_MAKE_MODEL(RIG_YAESU, 21) #define RIG_MODEL_FT857 RIG_MAKE_MODEL(RIG_YAESU, 22) #define RIG_MODEL_FT897 RIG_MAKE_MODEL(RIG_YAESU, 23) #define RIG_MODEL_FT1000MP RIG_MAKE_MODEL(RIG_YAESU, 24) #define RIG_MODEL_FT1000MPMKVFLD RIG_MAKE_MODEL(RIG_YAESU, 25) #define RIG_MODEL_VR5000 RIG_MAKE_MODEL(RIG_YAESU, 26) #define RIG_MODEL_FT450 RIG_MAKE_MODEL(RIG_YAESU, 27) #define RIG_MODEL_FT950 RIG_MAKE_MODEL(RIG_YAESU, 28) #define RIG_MODEL_FT2000 RIG_MAKE_MODEL(RIG_YAESU, 29) #define RIG_MODEL_FT9000 RIG_MAKE_MODEL(RIG_YAESU, 30) #define RIG_MODEL_FT980 RIG_MAKE_MODEL(RIG_YAESU, 31) #define RIG_MODEL_FTDX5000 RIG_MAKE_MODEL(RIG_YAESU, 32) #define RIG_MODEL_VX1700 RIG_MAKE_MODEL(RIG_YAESU, 33) /* * Kenwood */ #define RIG_KENWOOD 2 #define RIG_BACKEND_KENWOOD "kenwood" #define RIG_MODEL_TS50 RIG_MAKE_MODEL(RIG_KENWOOD, 1) #define RIG_MODEL_TS440 RIG_MAKE_MODEL(RIG_KENWOOD, 2) #define RIG_MODEL_TS450S RIG_MAKE_MODEL(RIG_KENWOOD, 3) #define RIG_MODEL_TS570D RIG_MAKE_MODEL(RIG_KENWOOD, 4) #define RIG_MODEL_TS690S RIG_MAKE_MODEL(RIG_KENWOOD, 5) #define RIG_MODEL_TS711 RIG_MAKE_MODEL(RIG_KENWOOD, 6) #define RIG_MODEL_TS790 RIG_MAKE_MODEL(RIG_KENWOOD, 7) #define RIG_MODEL_TS811 RIG_MAKE_MODEL(RIG_KENWOOD, 8) #define RIG_MODEL_TS850 RIG_MAKE_MODEL(RIG_KENWOOD, 9) #define RIG_MODEL_TS870S RIG_MAKE_MODEL(RIG_KENWOOD, 10) #define RIG_MODEL_TS940 RIG_MAKE_MODEL(RIG_KENWOOD, 11) #define RIG_MODEL_TS950 RIG_MAKE_MODEL(RIG_KENWOOD, 12) #define RIG_MODEL_TS950SDX RIG_MAKE_MODEL(RIG_KENWOOD, 13) #define RIG_MODEL_TS2000 RIG_MAKE_MODEL(RIG_KENWOOD, 14) #define RIG_MODEL_R5000 RIG_MAKE_MODEL(RIG_KENWOOD, 15) #define RIG_MODEL_TS570S RIG_MAKE_MODEL(RIG_KENWOOD, 16) #define RIG_MODEL_THD7A RIG_MAKE_MODEL(RIG_KENWOOD, 17) #define RIG_MODEL_THD7AG RIG_MAKE_MODEL(RIG_KENWOOD, 18) #define RIG_MODEL_THF6A RIG_MAKE_MODEL(RIG_KENWOOD, 19) #define RIG_MODEL_THF7E RIG_MAKE_MODEL(RIG_KENWOOD, 20) #define RIG_MODEL_K2 RIG_MAKE_MODEL(RIG_KENWOOD, 21) #define RIG_MODEL_TS930 RIG_MAKE_MODEL(RIG_KENWOOD, 22) #define RIG_MODEL_THG71 RIG_MAKE_MODEL(RIG_KENWOOD, 23) #define RIG_MODEL_TS680S RIG_MAKE_MODEL(RIG_KENWOOD, 24) #define RIG_MODEL_TS140S RIG_MAKE_MODEL(RIG_KENWOOD, 25) #define RIG_MODEL_TMD700 RIG_MAKE_MODEL(RIG_KENWOOD, 26) #define RIG_MODEL_TMV7 RIG_MAKE_MODEL(RIG_KENWOOD, 27) #define RIG_MODEL_TS480 RIG_MAKE_MODEL(RIG_KENWOOD, 28) #define RIG_MODEL_K3 RIG_MAKE_MODEL(RIG_KENWOOD, 29) #define RIG_MODEL_TRC80 RIG_MAKE_MODEL(RIG_KENWOOD, 30) #define RIG_MODEL_TS590S RIG_MAKE_MODEL(RIG_KENWOOD, 31) #define RIG_MODEL_TRANSFOX RIG_MAKE_MODEL(RIG_KENWOOD, 32) /* SigFox Transfox */ #define RIG_MODEL_THD72A RIG_MAKE_MODEL(RIG_KENWOOD, 33) #define RIG_MODEL_TMD710 RIG_MAKE_MODEL(RIG_KENWOOD, 34) #define RIG_MODEL_TMV71 RIG_MAKE_MODEL(RIG_KENWOOD, 35) /* * Icom */ #define RIG_ICOM 3 #define RIG_BACKEND_ICOM "icom" #define RIG_MODEL_IC1271 RIG_MAKE_MODEL(RIG_ICOM, 1) #define RIG_MODEL_IC1275 RIG_MAKE_MODEL(RIG_ICOM, 2) #define RIG_MODEL_IC271 RIG_MAKE_MODEL(RIG_ICOM, 3) #define RIG_MODEL_IC275 RIG_MAKE_MODEL(RIG_ICOM, 4) #define RIG_MODEL_IC375 RIG_MAKE_MODEL(RIG_ICOM, 5) #define RIG_MODEL_IC471 RIG_MAKE_MODEL(RIG_ICOM, 6) #define RIG_MODEL_IC475 RIG_MAKE_MODEL(RIG_ICOM, 7) #define RIG_MODEL_IC575 RIG_MAKE_MODEL(RIG_ICOM, 8) #define RIG_MODEL_IC706 RIG_MAKE_MODEL(RIG_ICOM, 9) #define RIG_MODEL_IC706MKII RIG_MAKE_MODEL(RIG_ICOM, 10) #define RIG_MODEL_IC706MKIIG RIG_MAKE_MODEL(RIG_ICOM, 11) #define RIG_MODEL_IC707 RIG_MAKE_MODEL(RIG_ICOM, 12) #define RIG_MODEL_IC718 RIG_MAKE_MODEL(RIG_ICOM, 13) #define RIG_MODEL_IC725 RIG_MAKE_MODEL(RIG_ICOM, 14) #define RIG_MODEL_IC726 RIG_MAKE_MODEL(RIG_ICOM, 15) #define RIG_MODEL_IC728 RIG_MAKE_MODEL(RIG_ICOM, 16) #define RIG_MODEL_IC729 RIG_MAKE_MODEL(RIG_ICOM, 17) #define RIG_MODEL_IC731 RIG_MAKE_MODEL(RIG_ICOM, 18) #define RIG_MODEL_IC735 RIG_MAKE_MODEL(RIG_ICOM, 19) #define RIG_MODEL_IC736 RIG_MAKE_MODEL(RIG_ICOM, 20) #define RIG_MODEL_IC737 RIG_MAKE_MODEL(RIG_ICOM, 21) #define RIG_MODEL_IC738 RIG_MAKE_MODEL(RIG_ICOM, 22) #define RIG_MODEL_IC746 RIG_MAKE_MODEL(RIG_ICOM, 23) #define RIG_MODEL_IC751 RIG_MAKE_MODEL(RIG_ICOM, 24) #define RIG_MODEL_IC751A RIG_MAKE_MODEL(RIG_ICOM, 25) #define RIG_MODEL_IC756 RIG_MAKE_MODEL(RIG_ICOM, 26) #define RIG_MODEL_IC756PRO RIG_MAKE_MODEL(RIG_ICOM, 27) #define RIG_MODEL_IC761 RIG_MAKE_MODEL(RIG_ICOM, 28) #define RIG_MODEL_IC765 RIG_MAKE_MODEL(RIG_ICOM, 29) #define RIG_MODEL_IC775 RIG_MAKE_MODEL(RIG_ICOM, 30) #define RIG_MODEL_IC781 RIG_MAKE_MODEL(RIG_ICOM, 31) #define RIG_MODEL_IC820 RIG_MAKE_MODEL(RIG_ICOM, 32) #define RIG_MODEL_IC821 RIG_MAKE_MODEL(RIG_ICOM, 33) #define RIG_MODEL_IC821H RIG_MAKE_MODEL(RIG_ICOM, 34) #define RIG_MODEL_IC970 RIG_MAKE_MODEL(RIG_ICOM, 35) #define RIG_MODEL_ICR10 RIG_MAKE_MODEL(RIG_ICOM, 36) #define RIG_MODEL_ICR71 RIG_MAKE_MODEL(RIG_ICOM, 37) #define RIG_MODEL_ICR72 RIG_MAKE_MODEL(RIG_ICOM, 38) #define RIG_MODEL_ICR75 RIG_MAKE_MODEL(RIG_ICOM, 39) #define RIG_MODEL_ICR7000 RIG_MAKE_MODEL(RIG_ICOM, 40) #define RIG_MODEL_ICR7100 RIG_MAKE_MODEL(RIG_ICOM, 41) #define RIG_MODEL_ICR8500 RIG_MAKE_MODEL(RIG_ICOM, 42) #define RIG_MODEL_ICR9000 RIG_MAKE_MODEL(RIG_ICOM, 43) #define RIG_MODEL_IC910 RIG_MAKE_MODEL(RIG_ICOM, 44) #define RIG_MODEL_IC78 RIG_MAKE_MODEL(RIG_ICOM, 45) #define RIG_MODEL_IC746PRO RIG_MAKE_MODEL(RIG_ICOM, 46) #define RIG_MODEL_IC756PROII RIG_MAKE_MODEL(RIG_ICOM, 47) #define RIG_MODEL_ICID1 RIG_MAKE_MODEL(RIG_ICOM, 54) #define RIG_MODEL_IC703 RIG_MAKE_MODEL(RIG_ICOM, 55) #define RIG_MODEL_IC7800 RIG_MAKE_MODEL(RIG_ICOM, 56) #define RIG_MODEL_IC756PROIII RIG_MAKE_MODEL(RIG_ICOM, 57) #define RIG_MODEL_ICR20 RIG_MAKE_MODEL(RIG_ICOM, 58) #define RIG_MODEL_IC7000 RIG_MAKE_MODEL(RIG_ICOM, 60) #define RIG_MODEL_IC7200 RIG_MAKE_MODEL(RIG_ICOM, 61) #define RIG_MODEL_IC7700 RIG_MAKE_MODEL(RIG_ICOM, 62) #define RIG_MODEL_IC7600 RIG_MAKE_MODEL(RIG_ICOM, 63) #define RIG_MODEL_IC92D RIG_MAKE_MODEL(RIG_ICOM, 65) #define RIG_MODEL_ICR9500 RIG_MAKE_MODEL(RIG_ICOM, 66) #define RIG_MODEL_IC7410 RIG_MAKE_MODEL(RIG_ICOM, 67) #define RIG_MODEL_IC9100 RIG_MAKE_MODEL(RIG_ICOM, 68) #define RIG_MODEL_ICRX7 RIG_MAKE_MODEL(RIG_ICOM, 69) /* next one is 70 */ /* * Optoelectronics (CI-V) */ #define RIG_MODEL_MINISCOUT RIG_MAKE_MODEL(RIG_ICOM, 48) #define RIG_MODEL_XPLORER RIG_MAKE_MODEL(RIG_ICOM, 49) #define RIG_MODEL_OS535 RIG_MAKE_MODEL(RIG_ICOM, 52) #define RIG_MODEL_OS456 RIG_MAKE_MODEL(RIG_ICOM, 53) /* * TenTec (CI-V) */ #define RIG_MODEL_OMNIVI RIG_MAKE_MODEL(RIG_ICOM, 50) #define RIG_MODEL_OMNIVIP RIG_MAKE_MODEL(RIG_ICOM, 51) /* OMNI-VI+ */ #define RIG_MODEL_PARAGON2 RIG_MAKE_MODEL(RIG_ICOM, 59) #define RIG_MODEL_DELTAII RIG_MAKE_MODEL(RIG_ICOM, 64) /* * Icom PCR */ #define RIG_PCR 4 #define RIG_BACKEND_PCR "pcr" #define RIG_MODEL_PCR1000 RIG_MAKE_MODEL(RIG_PCR, 1) #define RIG_MODEL_PCR100 RIG_MAKE_MODEL(RIG_PCR, 2) #define RIG_MODEL_PCR1500 RIG_MAKE_MODEL(RIG_PCR, 3) #define RIG_MODEL_PCR2500 RIG_MAKE_MODEL(RIG_PCR, 4) /* * AOR */ #define RIG_AOR 5 #define RIG_BACKEND_AOR "aor" #define RIG_MODEL_AR8200 RIG_MAKE_MODEL(RIG_AOR, 1) #define RIG_MODEL_AR8000 RIG_MAKE_MODEL(RIG_AOR, 2) #define RIG_MODEL_AR7030 RIG_MAKE_MODEL(RIG_AOR, 3) #define RIG_MODEL_AR5000 RIG_MAKE_MODEL(RIG_AOR, 4) #define RIG_MODEL_AR3030 RIG_MAKE_MODEL(RIG_AOR, 5) #define RIG_MODEL_AR3000A RIG_MAKE_MODEL(RIG_AOR, 6) #define RIG_MODEL_AR3000 RIG_MAKE_MODEL(RIG_AOR, 7) #define RIG_MODEL_AR2700 RIG_MAKE_MODEL(RIG_AOR, 8) #define RIG_MODEL_AR2500 RIG_MAKE_MODEL(RIG_AOR, 9) #define RIG_MODEL_AR16 RIG_MAKE_MODEL(RIG_AOR, 10) #define RIG_MODEL_SDU5500 RIG_MAKE_MODEL(RIG_AOR, 11) #define RIG_MODEL_SDU5000 RIG_MAKE_MODEL(RIG_AOR, 12) #define RIG_MODEL_AR8600 RIG_MAKE_MODEL(RIG_AOR, 13) #define RIG_MODEL_AR5000A RIG_MAKE_MODEL(RIG_AOR, 14) #define RIG_MODEL_AR7030P RIG_MAKE_MODEL(RIG_AOR, 15) #define RIG_MODEL_SR2200 RIG_MAKE_MODEL(RIG_AOR, 16) /* * JRC */ #define RIG_JRC 6 #define RIG_BACKEND_JRC "jrc" #define RIG_MODEL_JST145 RIG_MAKE_MODEL(RIG_JRC, 1) #define RIG_MODEL_JST245 RIG_MAKE_MODEL(RIG_JRC, 2) #define RIG_MODEL_CMH530 RIG_MAKE_MODEL(RIG_JRC, 3) #define RIG_MODEL_NRD345 RIG_MAKE_MODEL(RIG_JRC, 4) #define RIG_MODEL_NRD525 RIG_MAKE_MODEL(RIG_JRC, 5) #define RIG_MODEL_NRD535 RIG_MAKE_MODEL(RIG_JRC, 6) #define RIG_MODEL_NRD545 RIG_MAKE_MODEL(RIG_JRC, 7) /* * Radio Shack * Actualy, they might be either Icom or Uniden. TBC --SF */ #define RIG_RADIOSHACK 7 #define RIG_BACKEND_RADIOSHACK "radioshack" #define RIG_MODEL_RS64 RIG_MAKE_MODEL(RIG_RADIOSHACK, 1) /* PRO-64 */ #define RIG_MODEL_RS2005 RIG_MAKE_MODEL(RIG_RADIOSHACK, 2) /* w/ OptoElectronics OS456 Board */ #define RIG_MODEL_RS2006 RIG_MAKE_MODEL(RIG_RADIOSHACK, 3) /* w/ OptoElectronics OS456 Board */ #define RIG_MODEL_RS2035 RIG_MAKE_MODEL(RIG_RADIOSHACK, 4) /* w/ OptoElectronics OS435 Board */ #define RIG_MODEL_RS2042 RIG_MAKE_MODEL(RIG_RADIOSHACK, 5) /* w/ OptoElectronics OS435 Board */ #define RIG_MODEL_RS2041 RIG_MAKE_MODEL(RIG_RADIOSHACK, 6) /* PRO-2041 */ /* * Uniden */ #define RIG_UNIDEN 8 #define RIG_BACKEND_UNIDEN "uniden" #define RIG_MODEL_BC780 RIG_MAKE_MODEL(RIG_UNIDEN, 1) /* Uniden BC780 - Trunk Tracker "Desktop Radio" */ #define RIG_MODEL_BC245 RIG_MAKE_MODEL(RIG_UNIDEN, 2) #define RIG_MODEL_BC895 RIG_MAKE_MODEL(RIG_UNIDEN, 3) #define RIG_MODEL_PRO2052 RIG_MAKE_MODEL(RIG_UNIDEN, 4) /* Radio Shack PRO-2052 */ #define RIG_MODEL_BC235 RIG_MAKE_MODEL(RIG_UNIDEN, 5) #define RIG_MODEL_BC250 RIG_MAKE_MODEL(RIG_UNIDEN, 6) #define RIG_MODEL_BC785 RIG_MAKE_MODEL(RIG_UNIDEN, 7) #define RIG_MODEL_BC786 RIG_MAKE_MODEL(RIG_UNIDEN, 8) #define RIG_MODEL_BCT8 RIG_MAKE_MODEL(RIG_UNIDEN, 9) #define RIG_MODEL_BCD396T RIG_MAKE_MODEL(RIG_UNIDEN, 10) #define RIG_MODEL_BCD996T RIG_MAKE_MODEL(RIG_UNIDEN, 11) #define RIG_MODEL_BC898 RIG_MAKE_MODEL(RIG_UNIDEN, 12) /* * Drake */ #define RIG_DRAKE 9 #define RIG_BACKEND_DRAKE "drake" #define RIG_MODEL_DKR8 RIG_MAKE_MODEL(RIG_DRAKE, 1) #define RIG_MODEL_DKR8A RIG_MAKE_MODEL(RIG_DRAKE, 2) #define RIG_MODEL_DKR8B RIG_MAKE_MODEL(RIG_DRAKE, 3) /* * Lowe */ #define RIG_LOWE 10 #define RIG_BACKEND_LOWE "lowe" #define RIG_MODEL_HF150 RIG_MAKE_MODEL(RIG_LOWE, 1) #define RIG_MODEL_HF225 RIG_MAKE_MODEL(RIG_LOWE, 2) #define RIG_MODEL_HF250 RIG_MAKE_MODEL(RIG_LOWE, 3) #define RIG_MODEL_HF235 RIG_MAKE_MODEL(RIG_LOWE, 4) /* * Racal */ #define RIG_RACAL 11 #define RIG_BACKEND_RACAL "racal" #define RIG_MODEL_RA3790 RIG_MAKE_MODEL(RIG_RACAL, 1) #define RIG_MODEL_RA3720 RIG_MAKE_MODEL(RIG_RACAL, 2) #define RIG_MODEL_RA6790 RIG_MAKE_MODEL(RIG_RACAL, 3) #define RIG_MODEL_RA3710 RIG_MAKE_MODEL(RIG_RACAL, 4) #define RIG_MODEL_RA3702 RIG_MAKE_MODEL(RIG_RACAL, 5) /* * Watkins-Johnson */ #define RIG_WJ 12 #define RIG_BACKEND_WJ "wj" #define RIG_MODEL_HF1000 RIG_MAKE_MODEL(RIG_WJ, 1) #define RIG_MODEL_HF1000A RIG_MAKE_MODEL(RIG_WJ, 2) #define RIG_MODEL_WJ8711 RIG_MAKE_MODEL(RIG_WJ, 3) #define RIG_MODEL_WJ8888 RIG_MAKE_MODEL(RIG_WJ, 4) /* * Rohde & Schwarz */ #define RIG_EK 13 #define RIG_BACKEND_EK "ek" #define RIG_MODEL_ESM500 RIG_MAKE_MODEL(RIG_EK, 1) #define RIG_MODEL_EK890 RIG_MAKE_MODEL(RIG_EK, 2) #define RIG_MODEL_EK891 RIG_MAKE_MODEL(RIG_EK, 3) #define RIG_MODEL_EK895 RIG_MAKE_MODEL(RIG_EK, 4) #define RIG_MODEL_EK070 RIG_MAKE_MODEL(RIG_EK, 5) /* * Skanti */ #define RIG_SKANTI 14 #define RIG_BACKEND_SKANTI "skanti" #define RIG_MODEL_TRP7000 RIG_MAKE_MODEL(RIG_SKANTI, 1) #define RIG_MODEL_TRP8000 RIG_MAKE_MODEL(RIG_SKANTI, 2) #define RIG_MODEL_TRP9000 RIG_MAKE_MODEL(RIG_SKANTI, 3) #define RIG_MODEL_TRP8255 RIG_MAKE_MODEL(RIG_SKANTI, 4) /* * WiNRADiO/LinRADiO */ #define RIG_WINRADIO 15 #define RIG_BACKEND_WINRADIO "winradio" #define RIG_MODEL_WR1000 RIG_MAKE_MODEL(RIG_WINRADIO, 1) #define RIG_MODEL_WR1500 RIG_MAKE_MODEL(RIG_WINRADIO, 2) #define RIG_MODEL_WR1550 RIG_MAKE_MODEL(RIG_WINRADIO, 3) #define RIG_MODEL_WR3100 RIG_MAKE_MODEL(RIG_WINRADIO, 4) #define RIG_MODEL_WR3150 RIG_MAKE_MODEL(RIG_WINRADIO, 5) #define RIG_MODEL_WR3500 RIG_MAKE_MODEL(RIG_WINRADIO, 6) #define RIG_MODEL_WR3700 RIG_MAKE_MODEL(RIG_WINRADIO, 7) #define RIG_MODEL_G303 RIG_MAKE_MODEL(RIG_WINRADIO, 8) #define RIG_MODEL_G313 RIG_MAKE_MODEL(RIG_WINRADIO, 9) #define RIG_MODEL_G305 RIG_MAKE_MODEL(RIG_WINRADIO, 10) #define RIG_MODEL_G315 RIG_MAKE_MODEL(RIG_WINRADIO, 11) /* * Ten Tec */ #define RIG_TENTEC 16 #define RIG_BACKEND_TENTEC "tentec" #define RIG_MODEL_TT550 RIG_MAKE_MODEL(RIG_TENTEC, 1) /* Pegasus */ #define RIG_MODEL_TT538 RIG_MAKE_MODEL(RIG_TENTEC, 2) /* Jupiter */ #define RIG_MODEL_RX320 RIG_MAKE_MODEL(RIG_TENTEC, 3) #define RIG_MODEL_RX340 RIG_MAKE_MODEL(RIG_TENTEC, 4) #define RIG_MODEL_RX350 RIG_MAKE_MODEL(RIG_TENTEC, 5) #define RIG_MODEL_TT526 RIG_MAKE_MODEL(RIG_TENTEC, 6) /* 6N2 */ #define RIG_MODEL_TT516 RIG_MAKE_MODEL(RIG_TENTEC, 7) /* Argonaut V */ #define RIG_MODEL_TT565 RIG_MAKE_MODEL(RIG_TENTEC, 8) /* Orion */ #define RIG_MODEL_TT585 RIG_MAKE_MODEL(RIG_TENTEC, 9) /* Paragon */ #define RIG_MODEL_TT588 RIG_MAKE_MODEL(RIG_TENTEC, 11) /* Omni-VII */ #define RIG_MODEL_RX331 RIG_MAKE_MODEL(RIG_TENTEC, 12) #define RIG_MODEL_TT599 RIG_MAKE_MODEL(RIG_TENTEC, 13) /* Eagle */ /* * Alinco */ #define RIG_ALINCO 17 #define RIG_BACKEND_ALINCO "alinco" #define RIG_MODEL_DX77 RIG_MAKE_MODEL(RIG_ALINCO, 1) /* * Kachina */ #define RIG_KACHINA 18 #define RIG_BACKEND_KACHINA "kachina" #define RIG_MODEL_505DSP RIG_MAKE_MODEL(RIG_KACHINA, 1) /*! \def RIG_MODEL_RPC * \brief A macro that returns the model number of the RPC Network pseudo-backend. * * The RPC backend can be used to connect and send commands to a rig server, * \c rpc.rigd, running on a remote machine. Using this client/server scheme, * several clients can control and monitor the same rig hardware. */ #define RIG_RPC 19 #define RIG_BACKEND_RPC "rpcrig" #define RIG_MODEL_RPC RIG_MAKE_MODEL(RIG_RPC, 1) /* * Gnuradio backend */ #define RIG_GNURADIO 20 #define RIG_BACKEND_GNURADIO "gnuradio" #define RIG_MODEL_GNURADIO RIG_MAKE_MODEL(RIG_GNURADIO, 1) /* dev model, Chirp source */ #define RIG_MODEL_MC4020 RIG_MAKE_MODEL(RIG_GNURADIO, 2) /* MC4020 */ #define RIG_MODEL_GRAUDIO RIG_MAKE_MODEL(RIG_GNURADIO, 3) /* Sound card source */ #define RIG_MODEL_GRAUDIOIQ RIG_MAKE_MODEL(RIG_GNURADIO, 4) /* I&Q stereo sound card source */ #define RIG_MODEL_USRP_G RIG_MAKE_MODEL(RIG_GNURADIO, 5) /* Universal Software Radio Peripheral */ /* * Microtune tuners */ #define RIG_MICROTUNE 21 #define RIG_BACKEND_MICROTUNE "microtune" #define RIG_MODEL_MICROTUNE_4937 RIG_MAKE_MODEL(RIG_MICROTUNE, 1) /* eval board */ #define RIG_MODEL_MICROTUNE_4702 RIG_MAKE_MODEL(RIG_MICROTUNE, 2) /* Alan's */ #define RIG_MODEL_MICROTUNE_4707 RIG_MAKE_MODEL(RIG_MICROTUNE, 3) /* * TAPR */ #define RIG_TAPR 22 #define RIG_BACKEND_TAPR "tapr" #define RIG_MODEL_DSP10 RIG_MAKE_MODEL(RIG_TAPR, 1) /* * Flex-radio */ #define RIG_FLEXRADIO 23 #define RIG_BACKEND_FLEXRADIO "flexradio" #define RIG_MODEL_SDR1000 RIG_MAKE_MODEL(RIG_FLEXRADIO, 1) #define RIG_MODEL_SDR1000RFE RIG_MAKE_MODEL(RIG_FLEXRADIO, 2) #define RIG_MODEL_DTTSP RIG_MAKE_MODEL(RIG_FLEXRADIO, 3) #define RIG_MODEL_DTTSP_UDP RIG_MAKE_MODEL(RIG_FLEXRADIO, 4) /* * VEB Funkwerk Köpenick RFT */ #define RIG_RFT 24 #define RIG_BACKEND_RFT "rft" #define RIG_MODEL_EKD500 RIG_MAKE_MODEL(RIG_RFT, 1) /* * Various kits */ #define RIG_KIT 25 #define RIG_BACKEND_KIT "kit" #define RIG_MODEL_ELEKTOR304 RIG_MAKE_MODEL(RIG_KIT, 1) #define RIG_MODEL_DRT1 RIG_MAKE_MODEL(RIG_KIT, 2) #define RIG_MODEL_DWT RIG_MAKE_MODEL(RIG_KIT, 3) #define RIG_MODEL_USRP0 RIG_MAKE_MODEL(RIG_KIT, 4) /* prototype */ #define RIG_MODEL_USRP RIG_MAKE_MODEL(RIG_KIT, 5) #define RIG_MODEL_DDS60 RIG_MAKE_MODEL(RIG_KIT, 6) #define RIG_MODEL_ELEKTOR507 RIG_MAKE_MODEL(RIG_KIT, 7) /* Elektor SDR USB */ #define RIG_MODEL_MINIVNA RIG_MAKE_MODEL(RIG_KIT, 8) #define RIG_MODEL_SI570AVRUSB RIG_MAKE_MODEL(RIG_KIT, 9) /* SoftRock Si570 AVR */ #define RIG_MODEL_PMSDR RIG_MAKE_MODEL(RIG_KIT, 10) #define RIG_MODEL_SI570PICUSB RIG_MAKE_MODEL(RIG_KIT, 11) /* SoftRock Si570 PIC */ #define RIG_MODEL_FIFISDR RIG_MAKE_MODEL(RIG_KIT, 12) /* FiFi-SDR USB */ #define RIG_MODEL_FUNCUBEDONGLE RIG_MAKE_MODEL(RIG_KIT, 13) /* FunCUBE Dongle */ #define RIG_MODEL_HIQSDR RIG_MAKE_MODEL(RIG_KIT, 14) /* HiQSDR */ /* * SW/FM/TV tuner cards supported by Video4Linux,*BSD, .. */ #define RIG_TUNER 26 #define RIG_BACKEND_TUNER "tuner" #define RIG_MODEL_V4L RIG_MAKE_MODEL(RIG_TUNER, 1) #define RIG_MODEL_V4L2 RIG_MAKE_MODEL(RIG_TUNER, 2) /* * Rohde&Schwarz */ #define RIG_RS 27 #define RIG_BACKEND_RS "rs" #define RIG_MODEL_ESMC RIG_MAKE_MODEL(RIG_RS, 1) #define RIG_MODEL_EB200 RIG_MAKE_MODEL(RIG_RS, 2) /* * Phillips/Simoco PRM80 */ #define RIG_PRM80 28 #define RIG_BACKEND_PRM80 "prm80" #define RIG_MODEL_PRM8060 RIG_MAKE_MODEL(RIG_PRM80, 1) #define RIG_MODEL_PRM8070 RIG_MAKE_MODEL(RIG_PRM80, 2) /* * ADAT by HB9CBU * * ADDED: frgo (DG1SBG), 2012-01-01 */ #define RIG_ADAT 29 #define RIG_BACKEND_ADAT "adat" #define RIG_MODEL_ADT_200A RIG_MAKE_MODEL(RIG_ADAT, 1) /* * TODO: RIG_MODEL_KWZ30, KNEISNER +DOERING RIG_MODEL_E1800, DASA-Telefunken etc. */ /*! \typedef typedef int rig_model_t \brief Convenience type definition for rig model. */ typedef int rig_model_t; /*! \def RIG_BACKEND_LIST * \brief Static list of rig models. * * This is a NULL terminated list of available rig backends. Each entry * in the list consists of two fields: The branch number, which is an integer, * and the branch name, which is a character string. */ #define RIG_BACKEND_LIST { \ { RIG_DUMMY, RIG_BACKEND_DUMMY }, \ { RIG_YAESU, RIG_BACKEND_YAESU }, \ { RIG_KENWOOD, RIG_BACKEND_KENWOOD }, \ { RIG_ICOM, RIG_BACKEND_ICOM }, \ { RIG_PCR, RIG_BACKEND_PCR }, \ { RIG_AOR, RIG_BACKEND_AOR }, \ { RIG_JRC, RIG_BACKEND_JRC }, \ { RIG_UNIDEN, RIG_BACKEND_UNIDEN }, \ { RIG_DRAKE, RIG_BACKEND_DRAKE }, \ { RIG_LOWE, RIG_BACKEND_LOWE }, \ { RIG_RACAL, RIG_BACKEND_RACAL }, \ { RIG_WJ, RIG_BACKEND_WJ }, \ { RIG_SKANTI, RIG_BACKEND_SKANTI }, \ { RIG_WINRADIO, RIG_BACKEND_WINRADIO }, \ { RIG_TENTEC, RIG_BACKEND_TENTEC }, \ { RIG_ALINCO, RIG_BACKEND_ALINCO }, \ { RIG_KACHINA, RIG_BACKEND_KACHINA }, \ { RIG_RPC, RIG_BACKEND_RPC }, \ { RIG_TAPR, RIG_BACKEND_TAPR }, \ { RIG_FLEXRADIO, RIG_BACKEND_FLEXRADIO }, \ { RIG_RFT, RIG_BACKEND_RFT }, \ { RIG_KIT, RIG_BACKEND_KIT }, \ { RIG_TUNER, RIG_BACKEND_TUNER }, \ { RIG_RS, RIG_BACKEND_RS }, \ { RIG_PRM80, RIG_BACKEND_PRM80 }, \ { RIG_ADAT, RIG_BACKEND_ADAT }, \ { 0, NULL }, /* end */ \ } /* * struct rig_backend_list { * rig_model_t model; * const char *backend; * } rig_backend_list[] = RIG_LIST; * * TODO: * { RIG_RADIOSHACK, RIG_BACKEND_RADIOSHACK }, \ */ #endif /* _RIGLIST_H */ hamlib-1.2.15.3/include/hamlib/rig_dll.h0000644000175000017500000000524012044564477014600 00000000000000/* * Hamlib Win32 DLL build definitions * Copyright (c) 2001-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * Provide definitions to compile in Windows * using C-friendly options, e.g. * * HAMLIB_API -> __cdecl * HAMLIB_EXPORT, HAMLIB_EXPORT_VAR -> __declspec(dllexport) * BACKEND_EXPORT, BACKEND_EXPORT_VAR -> __declspec(dllexport) * * No effect in non-Windows environments. */ #if defined(_WIN32) && !defined(__CYGWIN__) # undef HAMLIB_IMPEXP # undef BACKEND_IMPEXP # undef HAMLIB_API # undef HAMLIB_EXPORT # undef HAMLIB_EXPORT_VAR # undef BACKEND_EXPORT # undef BACKEND_EXPORT_VAR # undef HAMLIB_DLL_IMPORT # undef HAMLIB_DLL_EXPORT # if defined (__BORLANDC__) # define HAMLIB_DLL_IMPORT __import # define HAMLIB_DLL_EXPORT __export # else # define HAMLIB_DLL_IMPORT __declspec(dllimport) # define HAMLIB_DLL_EXPORT __declspec(dllexport) # endif # ifdef DLL_EXPORT /* HAMLIB_API may be set to __stdcall for VB, .. */ # define HAMLIB_API __cdecl # ifdef IN_HAMLIB # define BACKEND_IMPEXP HAMLIB_DLL_EXPORT # define HAMLIB_IMPEXP HAMLIB_DLL_EXPORT # else # define BACKEND_IMPEXP HAMLIB_DLL_EXPORT # define HAMLIB_IMPEXP HAMLIB_DLL_IMPORT # endif # else /* static build, only export the backend entry points for lt_dlsym */ # define BACKEND_IMPEXP HAMLIB_DLL_EXPORT # endif #endif /* Take care of non-cygwin platforms */ #if !defined(HAMLIB_IMPEXP) # define HAMLIB_IMPEXP #endif #if !defined(BACKEND_IMPEXP) # define BACKEND_IMPEXP #endif #if !defined(HAMLIB_API) # define HAMLIB_API #endif #if !defined(HAMLIB_EXPORT) # define HAMLIB_EXPORT(type) HAMLIB_IMPEXP type HAMLIB_API #endif #if !defined(HAMLIB_EXPORT_VAR) # define HAMLIB_EXPORT_VAR(type) HAMLIB_IMPEXP type #endif #if !defined(BACKEND_EXPORT) # define BACKEND_EXPORT(type) BACKEND_IMPEXP type HAMLIB_API #endif #if !defined(BACKEND_EXPORT_VAR) # define BACKEND_EXPORT_VAR(type) BACKEND_IMPEXP type #endif hamlib-1.2.15.3/include/hamlib/rigclass.h0000644000175000017500000001747412044564477015007 00000000000000/* * Hamlib C++ bindings - API header * Copyright (c) 2001-2002 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _RIGCLASS_H #define _RIGCLASS_H 1 #include #include class BACKEND_IMPEXP Rig { private: RIG* theRig; // Global ref. to the rig protected: public: Rig(rig_model_t rig_model); virtual ~Rig(); const struct rig_caps *caps; // This method open the communication port to the rig void open(void); // This method close the communication port to the rig void close(void); void setConf(token_t token, const char *val); void setConf(const char *name, const char *val); void getConf(token_t token, char *val); void getConf(const char *name, char *val); token_t tokenLookup(const char *name); void setFreq(freq_t freq, vfo_t vfo = RIG_VFO_CURR); freq_t getFreq(vfo_t vfo = RIG_VFO_CURR); void setMode(rmode_t, pbwidth_t width = RIG_PASSBAND_NORMAL, vfo_t vfo = RIG_VFO_CURR); rmode_t getMode(pbwidth_t&, vfo_t vfo = RIG_VFO_CURR); void setVFO(vfo_t); vfo_t getVFO(); void setPTT (ptt_t ptt, vfo_t vfo = RIG_VFO_CURR); ptt_t getPTT (vfo_t vfo = RIG_VFO_CURR); dcd_t getDCD (vfo_t vfo = RIG_VFO_CURR); void setLevel(setting_t level, int vali, vfo_t vfo = RIG_VFO_CURR); void setLevel(setting_t level, float valf, vfo_t vfo = RIG_VFO_CURR); void getLevel(setting_t level, int& vali, vfo_t vfo = RIG_VFO_CURR); void getLevel(setting_t level, float& valf, vfo_t vfo = RIG_VFO_CURR); int getLevelI(setting_t level, vfo_t vfo = RIG_VFO_CURR); float getLevelF(setting_t level, vfo_t vfo = RIG_VFO_CURR); bool hasGetLevel (setting_t level); bool hasSetLevel (setting_t level); void setParm(setting_t parm, int vali); void setParm(setting_t parm, float valf); void getParm(setting_t parm, int& vali); void getParm(setting_t parm, float& valf); int getParmI(setting_t parm); float getParmF(setting_t parm); bool hasGetParm (setting_t parm); bool hasSetParm (setting_t parm); void setFunc (setting_t func, bool status, vfo_t vfo = RIG_VFO_CURR); bool getFunc (setting_t func, vfo_t vfo = RIG_VFO_CURR); bool hasGetFunc (setting_t func); bool hasSetFunc (setting_t func); void VFOop(vfo_op_t op, vfo_t vfo = RIG_VFO_CURR); bool hasVFOop (vfo_op_t op); void scan(scan_t scan, int ch, vfo_t vfo = RIG_VFO_CURR); bool hasScan (scan_t scan); const char *getInfo (void); pbwidth_t passbandNormal (rmode_t); pbwidth_t passbandNarrow (rmode_t); pbwidth_t passbandWide (rmode_t); void setRptrShift (rptr_shift_t rptr_shift, vfo_t vfo = RIG_VFO_CURR); rptr_shift_t getRptrShift (vfo_t vfo = RIG_VFO_CURR); void setRptrOffs (shortfreq_t rptr_offs, vfo_t vfo = RIG_VFO_CURR); shortfreq_t getRptrOffs (vfo_t vfo = RIG_VFO_CURR); void setTs (shortfreq_t ts, vfo_t vfo = RIG_VFO_CURR); shortfreq_t getTs (vfo_t vfo = RIG_VFO_CURR); void setCTCSS (tone_t tone, vfo_t vfo = RIG_VFO_CURR); tone_t getCTCSS (vfo_t vfo = RIG_VFO_CURR); void setDCS (tone_t code, vfo_t vfo = RIG_VFO_CURR); tone_t getDCS (vfo_t vfo = RIG_VFO_CURR); void setCTCSSsql (tone_t tone, vfo_t vfo = RIG_VFO_CURR); tone_t getCTCSSsql (vfo_t vfo = RIG_VFO_CURR); void setDCSsql (tone_t tone, vfo_t vfo = RIG_VFO_CURR); tone_t getDCSsql (vfo_t vfo = RIG_VFO_CURR); unsigned int power2mW (float power, freq_t freq, rmode_t mode); float mW2power (unsigned int mwpower, freq_t freq, rmode_t mode); void setTrn (int trn); int getTrn (void); void setBank (int bank, vfo_t vfo = RIG_VFO_CURR); void setMem (int ch, vfo_t vfo = RIG_VFO_CURR); int getMem (vfo_t vfo = RIG_VFO_CURR); void setChannel (const channel_t *chan); void getChannel (channel_t *chan); void setPowerStat (powerstat_t status); powerstat_t getPowerStat (void); rmode_t RngRxModes (freq_t freq); rmode_t RngTxModes (freq_t freq); void setSplitFreq (freq_t tx_freq, vfo_t vfo = RIG_VFO_CURR); freq_t getSplitFreq (vfo_t vfo = RIG_VFO_CURR); void setSplitMode(rmode_t, pbwidth_t width = RIG_PASSBAND_NORMAL, vfo_t vfo = RIG_VFO_CURR); rmode_t getSplitMode(pbwidth_t&, vfo_t vfo = RIG_VFO_CURR); void setSplitVFO(split_t split, vfo_t vfo = RIG_VFO_CURR, vfo_t tx_vfo = RIG_VFO_CURR); split_t getSplitVFO(vfo_t &tx_vfo, vfo_t vfo = RIG_VFO_CURR); void setRit (shortfreq_t rit, vfo_t vfo = RIG_VFO_CURR); shortfreq_t getRit (vfo_t vfo = RIG_VFO_CURR); void setXit (shortfreq_t xit, vfo_t vfo = RIG_VFO_CURR); shortfreq_t getXit (vfo_t vfo = RIG_VFO_CURR); void setAnt (ant_t ant, vfo_t vfo = RIG_VFO_CURR); ant_t getAnt (vfo_t vfo = RIG_VFO_CURR); void sendDtmf (const char *digits, vfo_t vfo = RIG_VFO_CURR); int recvDtmf (char *digits, vfo_t vfo = RIG_VFO_CURR); void sendMorse (const char *msg, vfo_t vfo = RIG_VFO_CURR); shortfreq_t getResolution (rmode_t mode); void reset (reset_t reset); // callbacks available in your derived object virtual int FreqEvent(vfo_t, freq_t, rig_ptr_t) const { return RIG_OK; } virtual int ModeEvent(vfo_t, rmode_t, pbwidth_t, rig_ptr_t) const { return RIG_OK; } virtual int VFOEvent(vfo_t, rig_ptr_t) const { return RIG_OK; } virtual int PTTEvent(vfo_t, ptt_t, rig_ptr_t) const { return RIG_OK; } virtual int DCDEvent(vfo_t, dcd_t, rig_ptr_t) const { return RIG_OK; } }; #ifdef __GNUG__ # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) # if HAVE_TYPEINFO # include # endif # endif #endif #if defined(__GNUG__) # if HAVE_BUILTIN_H || HAVE_GXX_BUILTIN_H || HAVE_GPP_BUILTIN_H # if ETIP_NEEDS_MATH_H # if ETIP_NEEDS_MATH_EXCEPTION # undef exception # define exception math_exception # endif # include # endif # undef exception # define exception builtin_exception # if HAVE_GPP_BUILTIN_H # include # elif HAVE_GXX_BUILTIN_H # include # else # include # endif # undef exception # endif #elif defined (__SUNPRO_CC) # include # include #else # include #endif extern "C" { #if HAVE_VALUES_H # include #endif #include #include } #include #if !(defined(__GNUG__)||defined(__SUNPRO_CC)) extern "C" void exit(int); #endif // Forward Declarations class BACKEND_IMPEXP RigException { public: const char *message; int errorno; RigException (const char* msg, int err) : message(msg), errorno (err) {}; RigException (int err) : message(rigerror(err)), errorno (err) {}; RigException (const char* msg) : message(msg), errorno (-RIG_EINTERNAL) {}; virtual ~RigException() {}; void print() const { std::cerr << "Rig exception: " << message << std::endl; } virtual const char *classname() const { return "Rig"; } }; inline void THROW(const RigException *e) { #if defined(__GNUG__) # if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8)) (*lib_error_handler)(e?e->classname():"",e?e->message:""); #else throw *e; #endif #elif defined(__SUNPRO_CC) genericerror(1, ((e != 0) ? (char *)(e->message) : "")); #else if (e) std::cerr << e->message << endl; exit(0); #endif } #define THROWS(s) #endif // _RIGCLASS_H hamlib-1.2.15.3/include/num_stdio.h0000644000175000017500000000360012044564477013727 00000000000000/* * Hamlib Interface - numeric locale wrapping helpers * Copyright (c) 2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _NUM_STDIO_H #define _NUM_STDIO_H 1 #include /* * This header file is internal to Hamlib and its backends, * thus not part of the API. */ /* * Wrapper for sscanf to workaround some locales where the decimal * separator (float, ...) is not the dot. */ #define num_sscanf(a...) \ ({ int __ret; char *__savedlocale; \ __savedlocale = setlocale(LC_NUMERIC, NULL); \ setlocale(LC_NUMERIC, "C"); \ __ret = sscanf(a); \ setlocale(LC_NUMERIC, __savedlocale); \ __ret; \ }) #define num_sprintf(s, a...) \ ({ int __ret; char *__savedlocale; \ __savedlocale = setlocale(LC_NUMERIC, NULL); \ setlocale(LC_NUMERIC, "C"); \ __ret = sprintf(s, a); \ setlocale(LC_NUMERIC, __savedlocale); \ __ret; \ }) #define num_snprintf(s, n, a...) \ ({ int __ret; char *__savedlocale; \ __savedlocale = setlocale(LC_NUMERIC, NULL); \ setlocale(LC_NUMERIC, "C"); \ __ret = snprintf(s, n, a); \ setlocale(LC_NUMERIC, __savedlocale); \ __ret; \ }) #endif /* _NUM_STDIO_H */ hamlib-1.2.15.3/include/Makefile.in0000644000175000017500000004161412044564553013624 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = include DIST_COMMON = $(nobase_include_HEADERS) $(noinst_HEADERS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/config.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(includedir)" HEADERS = $(nobase_include_HEADERS) $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_HEADERS = config.h bandplan.h num_stdio.h nobase_include_HEADERS = hamlib/rig.h hamlib/riglist.h hamlib/rig_dll.h \ hamlib/rotator.h hamlib/rotlist.h hamlib/rigclass.h hamlib/rotclass.h all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu include/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status include/config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-nobase_includeHEADERS: $(nobase_include_HEADERS) @$(NORMAL_INSTALL) test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \ $(am__nobase_list) | while read dir files; do \ xfiles=; for file in $$files; do \ if test -f "$$file"; then xfiles="$$xfiles $$file"; \ else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ test -z "$$xfiles" || { \ test "x$$dir" = x. || { \ echo "$(MKDIR_P) '$(DESTDIR)$(includedir)/$$dir'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)/$$dir"; }; \ echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(includedir)/$$dir'"; \ $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(includedir)/$$dir" || exit $$?; }; \ done uninstall-nobase_includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \ $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(includedir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(HEADERS) config.h installdirs: for dir in "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-nobase_includeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-nobase_includeHEADERS .MAKE: all install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool ctags distclean distclean-generic distclean-hdr \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-nobase_includeHEADERS \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-nobase_includeHEADERS # 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: hamlib-1.2.15.3/include/bandplan.h0000644000175000017500000001573112044564477013515 00000000000000/* * Hamlib Interface - definition of radioamateur frequency band plan. * Copyright (c) 2002 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _BANDPLAN_H #define _BANDPLAN_H 1 #include /* * This header file is internal to Hamlib and its backends, * thus not part of the API. * * Note: don't change this file if ITU band plan changes. A lot of existing * rigs are built this way, so leave them alone. * * As a reminder: * struct freq_range_list { * freq_t start; * freq_t end; * rmode_t modes; * int low_power; * int high_power; * vfo_t vfo; * ant_t ant; * }; */ /* * ITU Region 1: Europe, Africa and Northern Asia */ /* MF: 300 kHz - 3 MHz */ #define FRQ_RNG_160m_REGION1(md,lp,hp,v,a) \ { kHz(1810), MHz(2), (md), (lp), (hp), (v), (a) } /* HF: 3 MHz - 30 MHz */ #define FRQ_RNG_80m_REGION1(md,lp,hp,v,a) \ { kHz(3500),kHz(3800), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_40m_REGION1(md,lp,hp,v,a) \ { MHz(7),kHz(7100), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_30m_REGION1(md,lp,hp,v,a) \ { kHz(10100),kHz(10150), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_20m_REGION1(md,lp,hp,v,a) \ { MHz(14),kHz(14350), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_17m_REGION1(md,lp,hp,v,a) \ { kHz(18068),kHz(18168), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_15m_REGION1(md,lp,hp,v,a) \ { MHz(21),kHz(21450), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_12m_REGION1(md,lp,hp,v,a) \ { kHz(24890),kHz(24990), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_10m_REGION1(md,lp,hp,v,a) \ { MHz(28),kHz(29700), (md), (lp), (hp), (v), (a) } /* VHF: 30 MHz - 300 MHz */ #define FRQ_RNG_6m_REGION1(md,lp,hp,v,a) \ { kHz(50200),kHz(51200), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_2m_REGION1(md,lp,hp,v,a) \ { MHz(144),MHz(146), (md), (lp), (hp), (v), (a) } /* UHF: 300 MHz - 3 GHz */ #define FRQ_RNG_70cm_REGION1(md,lp,hp,v,a) \ { MHz(430),MHz(440), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_23cm_REGION1(md,lp,hp,v,a) \ { MHz(1240),MHz(1300), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_13cm_REGION1(md,lp,hp,v,a) \ { MHz(2300),MHz(2450), (md), (lp), (hp), (v), (a) } /* * ITU Region 2: North America, South America and Greenland */ /* MF: 300 kHz - 3 MHz */ #define FRQ_RNG_160m_REGION2(md,lp,hp,v,a) \ { kHz(1800),MHz(2), (md), (lp), (hp), (v), (a) } /* HF: 3 MHz - 30 MHz */ #define FRQ_RNG_80m_REGION2(md,lp,hp,v,a) \ { kHz(3500),MHz(4), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_40m_REGION2(md,lp,hp,v,a) \ { MHz(7),kHz(7300), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_30m_REGION2(md,lp,hp,v,a) \ { kHz(10100),kHz(10150), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_20m_REGION2(md,lp,hp,v,a) \ { MHz(14),kHz(14350), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_17m_REGION2(md,lp,hp,v,a) \ { kHz(18068),kHz(18168), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_15m_REGION2(md,lp,hp,v,a) \ { MHz(21),kHz(21450), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_12m_REGION2(md,lp,hp,v,a) \ { kHz(24890),kHz(24990), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_10m_REGION2(md,lp,hp,v,a) \ { MHz(28),kHz(29700), (md), (lp), (hp), (v), (a) } /* VHF: 30 MHz - 300 MHz */ #define FRQ_RNG_6m_REGION2(md,lp,hp,v,a) \ { MHz(50),MHz(54), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_2m_REGION2(md,lp,hp,v,a) \ { MHz(144),MHz(148), (md), (lp), (hp), (v), (a) } /* UHF: 300 MHz - 3 GHz */ #define FRQ_RNG_70cm_REGION2(md,lp,hp,v,a) \ { MHz(430),MHz(440), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_23cm_REGION2(md,lp,hp,v,a) \ { MHz(1240),MHz(1300), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_13cm_REGION2(md,lp,hp,v,a) \ { MHz(2320),MHz(2450), (md), (lp), (hp), (v), (a) } /* * ITU Region 3: South Pacific and Southern Asia */ /* MF: 300 kHz - 3 MHz */ #define FRQ_RNG_160m_REGION3(md,lp,hp,v,a) \ { kHz(1810),MHz(2), (md), (lp), (hp), (v), (a) } /* HF: 3 MHz - 30 MHz */ #define FRQ_RNG_80m_REGION3(md,lp,hp,v,a) \ { kHz(3500),kHz(3900), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_40m_REGION3(md,lp,hp,v,a) \ { MHz(7),kHz(7100), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_30m_REGION3(md,lp,hp,v,a) \ { kHz(10100),kHz(10150), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_20m_REGION3(md,lp,hp,v,a) \ { MHz(14),kHz(14350), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_17m_REGION3(md,lp,hp,v,a) \ { kHz(18068),kHz(18168), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_15m_REGION3(md,lp,hp,v,a) \ { MHz(21),kHz(21450), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_12m_REGION3(md,lp,hp,v,a) \ { kHz(24890),kHz(24990), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_10m_REGION3(md,lp,hp,v,a) \ { MHz(28),kHz(29700), (md), (lp), (hp), (v), (a) } /* VHF: 30 MHz - 300 MHz */ #define FRQ_RNG_6m_REGION3(md,lp,hp,v,a) \ { MHz(50),MHz(54), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_2m_REGION3(md,lp,hp,v,a) \ { MHz(144),MHz(148), (md), (lp), (hp), (v), (a) } /* UHF: 300 MHz - 3 GHz */ #define FRQ_RNG_70cm_REGION3(md,lp,hp,v,a) \ { MHz(430),MHz(440), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_23cm_REGION3(md,lp,hp,v,a) \ { MHz(1240),MHz(1300), (md), (lp), (hp), (v), (a) } #define FRQ_RNG_13cm_REGION3(md,lp,hp,v,a) \ { MHz(2320),MHz(2450), (md), (lp), (hp), (v), (a) } /* * Now we're done with boring definition * Let's define FRQ_RNG_HF for REGION1, FRQ_RNG_HF_REGION2, * and FRQ_RNG_HF_REGION3 all at once! * NB: FRQ_RNG_HF defines non-AM/AM freq_range for all HF bands, * plus 160m which is not an HF band strictly speaking. */ #define FRQ_RNG_HF(r,m,lp,hp,v,a) \ FRQ_RNG_160m_REGION##r((m), (lp), (hp), (v), (a)), \ FRQ_RNG_80m_REGION##r((m), (lp), (hp), (v), (a)), \ FRQ_RNG_40m_REGION##r((m), (lp), (hp), (v), (a)), \ FRQ_RNG_30m_REGION##r((m), (lp), (hp), (v), (a)), \ FRQ_RNG_20m_REGION##r((m), (lp), (hp), (v), (a)), \ FRQ_RNG_17m_REGION##r((m), (lp), (hp), (v), (a)), \ FRQ_RNG_15m_REGION##r((m), (lp), (hp), (v), (a)), \ FRQ_RNG_12m_REGION##r((m), (lp), (hp), (v), (a)), \ FRQ_RNG_10m_REGION##r((m), (lp), (hp), (v), (a)) \ #define FRQ_RNG_6m(r,m,lp,hp,v,a) \ FRQ_RNG_6m_REGION##r((m), (lp), (hp), (v), (a)) \ #define FRQ_RNG_2m(r,m,lp,hp,v,a) \ FRQ_RNG_2m_REGION##r((m), (lp), (hp), (v), (a)) \ #define FRQ_RNG_70cm(r,m,lp,hp,v,a) \ FRQ_RNG_70cm_REGION##r((m), (lp), (hp), (v), (a)) \ #endif /* _BANDPLAN_H */ hamlib-1.2.15.3/include/config.h.in0000644000175000017500000002672412044564544013607 00000000000000/* include/config.h.in. Generated from configure.ac by autoheader. */ /* Frontend ABI version */ #undef ABI_VERSION /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #undef CRAY_STACKSEG_END /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA /* Define to 1 if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the header file. */ #undef HAVE_ARGZ_H /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the `atexit' function. */ #undef HAVE_ATEXIT /* Define to 1 if you have the `cfmakeraw' function. */ #undef HAVE_CFMAKERAW /* Define to 1 if you have the declaration of `gai_strerror', and to 0 if you don't. */ #undef HAVE_DECL_GAI_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_DEV_PPBUS_PPBCONF_H /* Define to 1 if you have the header file. */ #undef HAVE_DEV_PPBUS_PPI_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the header file. */ #undef HAVE_GD_H /* Define to 1 if you have the `getaddrinfo' function. */ #undef HAVE_GETADDRINFO /* Define to 1 if you have the `getopt' function. */ #undef HAVE_GETOPT /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H /* Define to 1 if you have the `getopt_long' function. */ #undef HAVE_GETOPT_LONG /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `ioctl' function. */ #undef HAVE_IOCTL /* Define to 1 if you have the `syslog' library (-lsyslog). */ #undef HAVE_LIBSYSLOG /* Define if libusb is available */ #undef HAVE_LIBUSB /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_HIDRAW_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_PARPORT_H /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_PPDEV_H /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if you have the header file. */ #undef HAVE_NET_ERRNO_H /* Define if you have POSIX threads libraries and header files. */ #undef HAVE_PTHREAD /* If available, contains the Python version number currently in use. */ #undef HAVE_PYTHON /* Define to 1 if you have the header file. */ #undef HAVE_RPC_RPCENT_H /* Define to 1 if you have the header file. */ #undef HAVE_RPC_RPC_H /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the `setitimer' function. */ #undef HAVE_SETITIMER /* Define to 1 if you have the header file. */ #undef HAVE_SGTTY_H /* Define to 1 if you have the `sigaction' function. */ #undef HAVE_SIGACTION /* Define to 1 if the system has the type `siginfo_t'. */ #undef HAVE_SIGINFO_T /* Define to 1 if you have the `sleep' function. */ #undef HAVE_SLEEP /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF /* Define to 1 if the system has the type `ssize_t'. */ #undef HAVE_SSIZE_T /* Define to 1 if you have win32 Sleep */ #undef HAVE_SSLEEP /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if the system has the type `struct addrinfo'. */ #undef HAVE_STRUCT_ADDRINFO /* Define to 1 if the system has the type `struct timezone'. */ #undef HAVE_STRUCT_TIMEZONE /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCCOM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_TCL_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIO_H /* Define to 1 if you have the header file. */ #undef HAVE_TERM_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the header file. */ #undef HAVE_USB_H /* Define to 1 if you have the `usleep' function. */ #undef HAVE_USLEEP /* Define if usrp is available */ #undef HAVE_USRP /* Define to 1 if you have the header file. */ #undef HAVE_VALUES_H /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* Define to 1 if you have the header file. */ #undef HAVE_WINBASE_H /* Define to 1 if you have the header file. */ #undef HAVE_WINDOWS_H /* Define to 1 if you have the header file. */ #undef HAVE_WINIOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_WS2TCPIP_H /* Define if libxml2 is available */ #undef HAVE_XML2 /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `unsigned int' if does not define. */ #undef size_t /* Define missing prototypes, implemented in replacement lib */ #ifdef __cplusplus extern "C" { #endif #ifndef HAVE_GETOPT int getopt (int argc, char * const argv[], const char * optstring); extern char * optarg; extern int optind, opterr, optopt; #endif #ifndef HAVE_GETOPT_LONG struct option; int getopt_long (int argc, char * const argv[], const char * optstring, const struct option * longopts, int * longindex); #endif #ifndef HAVE_USLEEP int usleep(unsigned long usec); /* SUSv2 */ #endif #if defined(HAVE_SSLEEP) && !defined(HAVE_SLEEP) #ifdef HAVE_WINBASE_H #include #include #endif /* TODO: what about SleepEx? */ static inline unsigned int sleep (unsigned int nb_sec) { Sleep(nb_sec*1000); return 0; } #endif #ifndef HAVE_GETTIMEOFDAY #ifdef HAVE_SYS_TIME_H #include #endif #ifndef HAVE_STRUCT_TIMEZONE struct timezone { int tz_minuteswest; int tz_dsttime; }; #endif int gettimeofday(struct timeval *tv, struct timezone *tz); #endif #ifndef timersub # define timersub(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ if ((result)->tv_usec < 0) { \ --(result)->tv_sec; \ (result)->tv_usec += 1000000; \ } \ } while (0) #endif #ifndef HAVE_SSIZE_T typedef size_t ssize_t; #endif #ifdef __cplusplus } #endif /* Define missing prototypes, implemented in replacement lib */ #ifdef __cplusplus extern "C" { #endif #ifndef HAVE_STRUCT_ADDRINFO #ifdef HAVE_NETINET_IN_H #include #endif #if HAVE_NETDB_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #elif HAVE_WS2TCPIP_H #include #endif struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; socklen_t ai_addrlen; struct sockaddr *ai_addr; }; #endif #ifndef HAVE_GETADDRINFO #ifdef HAVE_NETINET_IN_H #include #endif #if HAVE_NETDB_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #elif HAVE_WS2TCPIP_H #include #endif #ifndef AI_PASSIVE #define AI_PASSIVE 0x0001 #endif int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res); void freeaddrinfo(struct addrinfo *res); #endif #if !defined(HAVE_DECL_GAI_STRERROR) && !defined(gai_strerror) const char *gai_strerror(int errcode); #endif /* !HAVE_DECL_GAI_STRERROR */ #ifdef __cplusplus } #endif hamlib-1.2.15.3/include/config.h0000644000175000017500000003001612044564744013171 00000000000000/* include/config.h. Generated from config.h.in by configure. */ /* include/config.h.in. Generated from configure.ac by autoheader. */ /* Frontend ABI version */ #define ABI_VERSION 2 /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ /* #undef CRAY_STACKSEG_END */ /* Define to 1 if using `alloca.c'. */ /* #undef C_ALLOCA */ /* Define to 1 if you have `alloca', as a function or macro. */ #define HAVE_ALLOCA 1 /* Define to 1 if you have and it should be used (not on Ultrix). */ #define HAVE_ALLOCA_H 1 /* Define to 1 if you have the header file. */ #define HAVE_ARGZ_H 1 /* Define to 1 if you have the header file. */ #define HAVE_ARPA_INET_H 1 /* Define to 1 if you have the `atexit' function. */ #define HAVE_ATEXIT 1 /* Define to 1 if you have the `cfmakeraw' function. */ #define HAVE_CFMAKERAW 1 /* Define to 1 if you have the declaration of `gai_strerror', and to 0 if you don't. */ #define HAVE_DECL_GAI_STRERROR 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_DEV_PPBUS_PPBCONF_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_DEV_PPBUS_PPI_H */ /* Define to 1 if you have the header file, and it defines `DIR'. */ #define HAVE_DIRENT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_DLFCN_H 1 /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ /* #undef HAVE_DOPRNT */ /* Define to 1 if you have the header file. */ #define HAVE_ERRNO_H 1 /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_GD_H */ /* Define to 1 if you have the `getaddrinfo' function. */ #define HAVE_GETADDRINFO 1 /* Define to 1 if you have the `getopt' function. */ #define HAVE_GETOPT 1 /* Define to 1 if you have the header file. */ #define HAVE_GETOPT_H 1 /* Define to 1 if you have the `getopt_long' function. */ #define HAVE_GETOPT_LONG 1 /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the `ioctl' function. */ #define HAVE_IOCTL 1 /* Define to 1 if you have the `syslog' library (-lsyslog). */ /* #undef HAVE_LIBSYSLOG */ /* Define if libusb is available */ #define HAVE_LIBUSB 1 /* Define to 1 if you have the header file. */ #define HAVE_LINUX_HIDRAW_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LINUX_IOCTL_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LINUX_PARPORT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LINUX_PPDEV_H 1 /* Define to 1 if you have the header file. */ #define HAVE_MALLOC_H 1 /* Define to 1 if you have the `memmove' function. */ #define HAVE_MEMMOVE 1 /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `memset' function. */ #define HAVE_MEMSET 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_NDIR_H */ /* Define to 1 if you have the header file. */ #define HAVE_NETDB_H 1 /* Define to 1 if you have the header file. */ #define HAVE_NETINET_IN_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_NET_ERRNO_H */ /* Define if you have POSIX threads libraries and header files. */ #define HAVE_PTHREAD 1 /* If available, contains the Python version number currently in use. */ /* #undef HAVE_PYTHON */ /* Define to 1 if you have the header file. */ /* #undef HAVE_RPC_RPCENT_H */ /* Define to 1 if you have the header file. */ #define HAVE_RPC_RPC_H 1 /* Define to 1 if you have the `select' function. */ #define HAVE_SELECT 1 /* Define to 1 if you have the `setitimer' function. */ #define HAVE_SETITIMER 1 /* Define to 1 if you have the header file. */ #define HAVE_SGTTY_H 1 /* Define to 1 if you have the `sigaction' function. */ #define HAVE_SIGACTION 1 /* Define to 1 if the system has the type `siginfo_t'. */ #define HAVE_SIGINFO_T 1 /* Define to 1 if you have the `sleep' function. */ #define HAVE_SLEEP 1 /* Define to 1 if you have the `snprintf' function. */ #define HAVE_SNPRINTF 1 /* Define to 1 if the system has the type `ssize_t'. */ #define HAVE_SSIZE_T 1 /* Define to 1 if you have win32 Sleep */ /* #undef HAVE_SSLEEP */ /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strcasecmp' function. */ #define HAVE_STRCASECMP 1 /* Define to 1 if you have the `strchr' function. */ #define HAVE_STRCHR 1 /* Define to 1 if you have the `strdup' function. */ #define HAVE_STRDUP 1 /* Define to 1 if you have the `strerror' function. */ #define HAVE_STRERROR 1 /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strrchr' function. */ #define HAVE_STRRCHR 1 /* Define to 1 if you have the `strstr' function. */ #define HAVE_STRSTR 1 /* Define to 1 if you have the `strtol' function. */ #define HAVE_STRTOL 1 /* Define to 1 if the system has the type `struct addrinfo'. */ #define HAVE_STRUCT_ADDRINFO 1 /* Define to 1 if the system has the type `struct timezone'. */ #define HAVE_STRUCT_TIMEZONE 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_DIR_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_IOCCOM_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the header file, and it defines `DIR'. */ /* #undef HAVE_SYS_NDIR_H */ /* Define to 1 if you have the header file. */ #define HAVE_SYS_PARAM_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_SOCKET_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_TCL_H */ /* Define to 1 if you have the header file. */ #define HAVE_TERMIOS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_TERMIO_H 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_TERM_H */ /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the header file. */ #define HAVE_USB_H 1 /* Define to 1 if you have the `usleep' function. */ #define HAVE_USLEEP 1 /* Define if usrp is available */ /* #undef HAVE_USRP */ /* Define to 1 if you have the header file. */ #define HAVE_VALUES_H 1 /* Define to 1 if you have the `vprintf' function. */ #define HAVE_VPRINTF 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_WINBASE_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_WINDOWS_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_WINIOCTL_H */ /* Define to 1 if you have the header file. */ /* #undef HAVE_WS2TCPIP_H */ /* Define if libxml2 is available */ #define HAVE_XML2 1 /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" /* Define to 1 if your C compiler doesn't accept -c and -o together. */ /* #undef NO_MINUS_C_MINUS_O */ /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "hamlib-developer@lists.sourceforge.net" /* Define to the full name of this package. */ #define PACKAGE_NAME "Hamlib" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "Hamlib 1.2.15.3" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "hamlib" /* Define to the home page for this package. */ #define PACKAGE_URL "http://www.hamlib.org" /* Define to the version of this package. */ #define PACKAGE_VERSION "1.2.15.3" /* Define to necessary symbol if this constant uses a non-standard name on your system. */ /* #undef PTHREAD_CREATE_JOINABLE */ /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ /* #undef STACK_DIRECTION */ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Define to 1 if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus /* #undef inline */ #endif /* Define to `unsigned int' if does not define. */ /* #undef size_t */ /* Define missing prototypes, implemented in replacement lib */ #ifdef __cplusplus extern "C" { #endif #ifndef HAVE_GETOPT int getopt (int argc, char * const argv[], const char * optstring); extern char * optarg; extern int optind, opterr, optopt; #endif #ifndef HAVE_GETOPT_LONG struct option; int getopt_long (int argc, char * const argv[], const char * optstring, const struct option * longopts, int * longindex); #endif #ifndef HAVE_USLEEP int usleep(unsigned long usec); /* SUSv2 */ #endif #if defined(HAVE_SSLEEP) && !defined(HAVE_SLEEP) #ifdef HAVE_WINBASE_H #include #include #endif /* TODO: what about SleepEx? */ static inline unsigned int sleep (unsigned int nb_sec) { Sleep(nb_sec*1000); return 0; } #endif #ifndef HAVE_GETTIMEOFDAY #ifdef HAVE_SYS_TIME_H #include #endif #ifndef HAVE_STRUCT_TIMEZONE struct timezone { int tz_minuteswest; int tz_dsttime; }; #endif int gettimeofday(struct timeval *tv, struct timezone *tz); #endif #ifndef timersub # define timersub(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ if ((result)->tv_usec < 0) { \ --(result)->tv_sec; \ (result)->tv_usec += 1000000; \ } \ } while (0) #endif #ifndef HAVE_SSIZE_T typedef size_t ssize_t; #endif #ifdef __cplusplus } #endif /* Define missing prototypes, implemented in replacement lib */ #ifdef __cplusplus extern "C" { #endif #ifndef HAVE_STRUCT_ADDRINFO #ifdef HAVE_NETINET_IN_H #include #endif #if HAVE_NETDB_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #elif HAVE_WS2TCPIP_H #include #endif struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; socklen_t ai_addrlen; struct sockaddr *ai_addr; }; #endif #ifndef HAVE_GETADDRINFO #ifdef HAVE_NETINET_IN_H #include #endif #if HAVE_NETDB_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #elif HAVE_WS2TCPIP_H #include #endif #ifndef AI_PASSIVE #define AI_PASSIVE 0x0001 #endif int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res); void freeaddrinfo(struct addrinfo *res); #endif #if !defined(HAVE_DECL_GAI_STRERROR) && !defined(gai_strerror) const char *gai_strerror(int errcode); #endif /* !HAVE_DECL_GAI_STRERROR */ #ifdef __cplusplus } #endif hamlib-1.2.15.3/include/Makefile.am0000644000175000017500000000030512044564477013610 00000000000000noinst_HEADERS = config.h bandplan.h num_stdio.h nobase_include_HEADERS = hamlib/rig.h hamlib/riglist.h hamlib/rig_dll.h \ hamlib/rotator.h hamlib/rotlist.h hamlib/rigclass.h hamlib/rotclass.h hamlib-1.2.15.3/adat/0000755000175000017500000000000012044565024011111 500000000000000hamlib-1.2.15.3/adat/adat.h0000644000175000017500000004167412044564477012142 00000000000000// --------------------------------------------------------------------------- // ADAT // --------------------------------------------------------------------------- // // adat.h // // Created by Frank Goenninger DG1SBG. // Copyright © 2011, 2012 Frank Goenninger. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library 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 // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #if !defined( __ADAT_INCLUDED__ ) #define __ADAT_INCLUDED__ // --------------------------------------------------------------------------- // SYSTEM INCLUDES // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // HAMLIB INCLUDES // --------------------------------------------------------------------------- #include "hamlib/rig.h" // --------------------------------------------------------------------------- // GLOBAL DEFINITIONS // --------------------------------------------------------------------------- #define ADAT_BUFSZ 256 #define ADAT_RESPSZ 256 #define ADAT_CR "\x0d" #define ADAT_EOL "\x0a" #define ADAT_BOM "$" // Begin of message #define ADAT_EOM ADAT_CR // End of message #define ADAT_ON 1 #define ADAT_OFF 0 #define ADAT_TOGGLE_ON ADAT_ON #define ADAT_TOGGLE_OFF ADAT_OFF #define ADAT_FREQ_UNIT_HZ "Hz" #define ADAT_FREQ_UNIT_HZ_LEN 2 #define ADAT_FREQ_UNIT_KHZ "kHz" #define ADAT_FREQ_UNIT_KHZ_LEN 3 #define ADAT_FREQ_UNIT_MHZ "MHz" #define ADAT_FREQ_UNIT_MHZ_LEN 3 #define ADAT_FREQ_UNIT_GHZ "GHz" #define ADAT_FREQ_UNIT_GHZ_LEN 3 #define TOKEN_ADAT_PRODUCT_NAME TOKEN_BACKEND(1) #define ADAT_SLEEP_MICROSECONDS_BETWEEN_CMDS (11*1000) // = 11 ms #define ADAT_SLEEP_AFTER_RIG_CLOSE 2 // unit: seconds #define ADAT_SLEEP_AFTER_RIG_OPEN 2 // unit: seconds // ADAT VFO SET/GET DEFINITIONS #define ADAT_NR_VFOS 3 // Each mode is defined by three values: // ADAT_VFO_STR_... -> The string as given back by TRX when asked by // $VFO? // ADAT_VFO_RNR_... -> The Hamlib number of the mode: RIG_VFO_... // ADAT_VFO_ANR_... -> The ADAT Nr representing the VFO when setting it #define ADAT_VFO_STR_A "A" #define ADAT_VFO_RNR_A RIG_VFO_A #define ADAT_VFO_ANR_A 1 #define ADAT_VFO_STR_B "B" #define ADAT_VFO_RNR_B RIG_VFO_B #define ADAT_VFO_ANR_B 2 #define ADAT_VFO_STR_C "C" #define ADAT_VFO_RNR_C RIG_VFO_C #define ADAT_VFO_ANR_C 3 // ADAT MODE DEFINITIONS #define ADAT_MODE_LENGTH 5 #define ADAT_NR_MODES 8 // Each mode is defined by three values: // ADAT_MODE_STR_... -> The string as given back by TRX when asked by // $MOD? // ADAT_MODE_RNR_... -> The Hamlib number of the mode: RIG_MODE_... // ADAT_MODE_ANR_... -> The ADAT Nr representing the mode when setting it #define ADAT_MODE_STR_CW_R "CW-R" #define ADAT_MODE_RNR_CW_R RIG_MODE_CWR #define ADAT_MODE_ANR_CW_R 0 #define ADAT_MODE_STR_CW "CW" #define ADAT_MODE_RNR_CW RIG_MODE_CW #define ADAT_MODE_ANR_CW 1 #define ADAT_MODE_STR_LSB "LSB" #define ADAT_MODE_RNR_LSB RIG_MODE_LSB #define ADAT_MODE_ANR_LSB 2 #define ADAT_MODE_STR_USB "USB" #define ADAT_MODE_RNR_USB RIG_MODE_USB #define ADAT_MODE_ANR_USB 3 #define ADAT_MODE_STR_AM "AM" #define ADAT_MODE_RNR_AM RIG_MODE_AM #define ADAT_MODE_ANR_AM 5 #define ADAT_MODE_STR_AM_SL "AM-SL" #define ADAT_MODE_RNR_AM_SL RIG_MODE_SAL #define ADAT_MODE_ANR_AM_SL 6 #define ADAT_MODE_STR_AM_SU "AM-SU" #define ADAT_MODE_RNR_AM_SU RIG_MODE_SAH #define ADAT_MODE_ANR_AM_SU 7 #define ADAT_MODE_STR_FM "FM" #define ADAT_MODE_RNR_FM RIG_MODE_FM #define ADAT_MODE_ANR_FM 8 // ADAT PTT DEFINITIONS #define ADAT_PTT_STATUS_ANR_ON ADAT_ON #define ADAT_PTT_STATUS_RNR_ON RIG_PTT_ON #define ADAT_PTT_STATUS_ANR_OFF ADAT_OFF #define ADAT_PTT_STATUS_RNR_OFF RIG_PTT_OFF // ADAT POWER LEVEL DEFINITIONS #define ADAT_PWR_LVL_ANR_00 0 #define ADAT_PWR_LVL_RNR_00 100 // 100 mW #define ADAT_PWR_LVL_ANR_01 1 #define ADAT_PWR_LVL_RNR_01 300 // 300 mW #define ADAT_PWR_LVL_ANR_02 2 #define ADAT_PWR_LVL_RNR_02 1000 // ... #define ADAT_PWR_LVL_ANR_03 3 #define ADAT_PWR_LVL_RNR_03 2000 #define ADAT_PWR_LVL_ANR_04 4 #define ADAT_PWR_LVL_RNR_04 3000 #define ADAT_PWR_LVL_ANR_05 5 #define ADAT_PWR_LVL_RNR_05 5000 #define ADAT_PWR_LVL_ANR_06 6 #define ADAT_PWR_LVL_RNR_06 7000 #define ADAT_PWR_LVL_ANR_07 7 #define ADAT_PWR_LVL_RNR_07 10000 #define ADAT_PWR_LVL_ANR_08 8 #define ADAT_PWR_LVL_RNR_08 15000 #define ADAT_PWR_LVL_ANR_09 9 #define ADAT_PWR_LVL_RNR_09 20000 #define ADAT_PWR_LVL_ANR_10 10 #define ADAT_PWR_LVL_RNR_10 25000 #define ADAT_PWR_LVL_ANR_11 11 #define ADAT_PWR_LVL_RNR_11 30000 #define ADAT_PWR_LVL_ANR_12 12 #define ADAT_PWR_LVL_RNR_12 35000 #define ADAT_PWR_LVL_ANR_13 13 #define ADAT_PWR_LVL_RNR_13 40000 #define ADAT_PWR_LVL_ANR_14 14 // Default value after reset #define ADAT_PWR_LVL_RNR_14 45000 #define ADAT_PWR_LVL_ANR_15 15 #define ADAT_PWR_LVL_RNR_15 50000 // 50 W #define ADAT_MAX_POWER_IN_mW ADAT_PWR_LVL_RNR_15 // ADAT CHANNEL CAPS #define ADAT_MEM_CAPS \ { \ .vfo = 1, \ .ant = 1, \ .freq = 1, \ .mode = 1, \ .width = 1, \ .tx_freq = 1, \ .tx_mode = 1, \ .tx_width = 1, \ .tx_vfo = 1, \ .rit = 1, \ .xit = 1, \ .tuning_step = 1, \ .channel_desc = 1 \ } #define ADAT_MEM_DESC_SIZE 64 // ADAT OPCODES - Kind of an internal command within ADAT Hamlib Backend #define ADAT_OPCODE_BASE_PTT 110000 #define ADAT_OPCODE_PTT_SWITCH_ON (ADAT_OPCODE_BASE_PTT + 1) #define ADAT_OPCODE_PTT_SWITCH_OFF (ADAT_OPCODE_BASE_PTT + 2) // --------------------------------------------------------------------------- // Individual ADAT CAT commands // --------------------------------------------------------------------------- #define ADAT_CMD_DEF_ADAT_SPECIAL (1<<30) // -- NIL -- (Marks the end of a cmd list) #define ADAT_CMD_DEF_NIL 0 // -- ADAT SPECIAL: DISPLAY OFF -- #define ADAT_CMD_DEF_STRING_DISPLAY_OFF "$VRU>"ADAT_CR // -- ADAT SPECIAL: DISPLAY ON -- #define ADAT_CMD_DEF_STRING_DISPLAY_ON "$VRU<"ADAT_CR // -- ADAT SPECIAL: GET SERIAL NR -- #define ADAT_CMD_DEF_STRING_GET_SERIAL_NR "$CIS?"ADAT_CR // -- ADAT SPECIAL: GET FIRMWARE VERSION -- #define ADAT_CMD_DEF_STRING_GET_FW_VERSION "$CIF?"ADAT_CR // -- ADAT SPECIAL: GET HARDWARE VERSION -- #define ADAT_CMD_DEF_STRING_GET_HW_VERSION "$CIH?"ADAT_CR // -- ADAT SPECIAL: GET FIRMWARE VERSION -- #define ADAT_CMD_DEF_STRING_GET_ID_CODE "$CID?"ADAT_CR // -- ADAT SPECIAL: GET GUI FIRMWARE VERSION -- #define ADAT_CMD_DEF_STRING_GET_GUI_FW_VERSION "$CIG?"ADAT_CR // -- ADAT SPECIAL: GET OPTIONS -- #define ADAT_CMD_DEF_STRING_GET_OPTIONS "$CIO?"ADAT_CR // -- ADAT SPECIAL: GET CALLSIGN -- #define ADAT_CMD_DEF_STRING_GET_CALLSIGN "$CAL?"ADAT_CR // -- ADAT SPECIAL: SET CALLSIGN -- #define ADAT_CMD_DEF_STRING_SET_CALLSIGN "$CAL:" // -- HAMLIB DEFINED COMMANDS -- // -- GET FREQ -- #define ADAT_CMD_DEF_GET_FREQ (1<<0) #define ADAT_CMD_DEF_STRING_GET_FREQ "$FRA?"ADAT_CR // -- SET FREQ -- #define ADAT_CMD_DEF_SET_FREQ (1<<1) #define ADAT_CMD_DEF_STRING_SET_FREQ "$FR1:" // -- GET VFO -- // -- GET MODE -- #define ADAT_CMD_DEF_GET_MODE (1<<2) #define ADAT_CMD_DEF_STRING_GET_MODE "$MOD?"ADAT_CR // -- SET VFO -- #define ADAT_CMD_DEF_SET_VFO (1<<3) #define ADAT_CMD_DEF_STRING_SWITCH_ON_VFO "$VO%1d>%s" #define ADAT_CMD_DEF_STRING_SET_VFO_AS_MAIN_VFO "$VO%1d%%%s" // -- SET MODE -- #define ADAT_CMD_DEF_SET_MODE (1<<4) #define ADAT_CMD_DEF_STRING_SET_MODE "$MOD:" // -- SET PTT -- #define ADAT_CMD_DEF_SET_PTT (1<<5) #define ADAT_CMD_DEF_STRING_SET_PTT "$MOX%s%s" #define ADAT_CMD_PTT_STR_OFF "<" #define ADAT_CMD_PTT_STR_ON ">" // -- GET PTT -- #define ADAT_CMD_DEF_GET_PTT (1<<6) #define ADAT_CMD_DEF_STRING_GET_PTT "$MTR?"ADAT_CR // -- GET POWER STATUS -- // -- GET INFO -- // -- OPEN ADAT -- // -- ADAT SPECIAL: RECOVER FROM ERROR -- // --------------------------------------------------------------------------- // ADAT PRIVATE DATA // --------------------------------------------------------------------------- typedef struct _adat_priv_data { int nOpCode; char *pcProductName; // Future use (USB direct I/O) // ADAT device info char *pcSerialNr; char *pcIDCode; char *pcOptions; char *pcFWVersion; char *pcHWVersion; char *pcGUIFWVersion; char *pcCallsign; // ADAT Operational Settings: will change during TRX use int nCurrentVFO; vfo_t nRIGVFONr; freq_t nFreq; char acRXFreq[ ADAT_BUFSZ ]; char acTXFreq[ ADAT_BUFSZ ]; rmode_t nRIGMode; char acADATMode[ ADAT_MODE_LENGTH + 1 ]; int nADATMode; pbwidth_t nWidth; int nADATPTTStatus; ptt_t nRIGPTTStatus; value_t mNB1; value_t mNB2; value_t mAGC; value_t mRFGain; value_t mIFShift; value_t mRawStr; // ADAT Command-related Values char *pcCmd; int nCmdKind; char *pcResult; int nRC; } adat_priv_data_t, * adat_priv_data_ptr; // --------------------------------------------------------------------------- // ADAT CAT COMMAND DATA TYPE DECLARATIONS // --------------------------------------------------------------------------- typedef unsigned long long adat_cmd_id_t; // Bit mask for commands. Each command // is represented by 1 bit. // adat_cmd_def : ADAT COMMAND DEFINITION. // Basic idea: Each command can be made of several strings to be sent // to the ADAT device. Therefore it is possible to build aggregated // commands which will be executed as a set of individual commands // executed by adat_transaction(). The last value as returned by the // commands will be set as overall command result. typedef enum { ADAT_CMD_KIND_WITH_RESULT = 0, // After sending a command to the ADAT, // a result has to be read. ADAT_CMD_KIND_WITHOUT_RESULT = 1 } adat_cmd_kind_t; typedef struct _adat_cmd_def_t { adat_cmd_id_t nCmdId; // Bit indicating this cmd adat_cmd_kind_t nCmdKind; // Defines if result expected int (*pfCmdFn)( RIG *pRig ); // Fn to be called to execute this cmd int nNrCmdStrs; // Oh my, C as a language ... I'd love to // switch to Common Lisp ... What a hack here ... char *pacCmdStrs[]; // Commands to be executed if no CmdFn given } adat_cmd_def_t, * adat_cmd_def_ptr; typedef struct _adat_cmd_table_t { int nNrCmds; adat_cmd_def_ptr adat_cmds[]; } adat_cmd_table_t, * adat_cmd_table_ptr; typedef struct _adat_cmd_list_t { int nNrCmds; adat_cmd_def_ptr adat_cmds[]; } adat_cmd_list_t, * adat_cmd_list_ptr; // --------------------------------------------------------------------------- // OTHER ADAT DATA TYPES // --------------------------------------------------------------------------- typedef enum { ADAT_FREQ_PARSE_MODE_WITH_VFO = 0, ADAT_FREQ_PARSE_MODE_WITHOUT_VFO = 1 } adat_freq_parse_mode_t; // ADAT MODE DEFINITION typedef struct _adat_mode_def { char *pcADATModeStr; rmode_t nRIGMode; int nADATMode; } adat_mode_def_t, * adat_mode_def_ptr; typedef struct _adat_mode_list { int nNrModes; adat_mode_def_t adat_modes[ ADAT_NR_MODES ]; } adat_mode_list_t, * adat_mode_list_ptr; // ADAT VFO DEFINITION typedef struct _adat_vfo_def { char *pcADATVFOStr; vfo_t nRIGVFONr; int nADATVFONr; } adat_vfo_def_t, * adat_vfo_def_ptr; typedef struct _adat_vfo_list { int nNrVFOs; adat_vfo_def_t adat_vfos[ ADAT_NR_VFOS ]; } adat_vfo_list_t, * adat_vfo_list_ptr; // --------------------------------------------------------------------------- // ADAT INTERNAL FUNCTION DECLARATIONS // --------------------------------------------------------------------------- // Helper functions size_t trimwhitespace( char *, size_t, const char * ); int adat_print_cmd( adat_cmd_def_ptr ); int adat_parse_freq( char *, adat_freq_parse_mode_t, int *, freq_t * ); int adat_parse_mode( char *, rmode_t *, char * ); int adat_mode_rnr2anr( rmode_t, int * ); int adat_mode_anr2rnr( int, rmode_t * ); int adat_parse_vfo( char *, vfo_t *, int * ); int adat_vfo_rnr2anr( vfo_t, int * ); int adat_vfo_anr2rnr( int, vfo_t * ); int adat_parse_ptt( char *, int * ); int adat_ptt_rnr2anr( ptt_t, int * ); int adat_ptt_anr2rnr( int, ptt_t * ); int adat_send( RIG *, char * ); int adat_receive( RIG *, char * ); int adat_priv_set_cmd( RIG *, char *, int ); int adat_priv_set_result( RIG *, char * ); int adat_priv_clear_result( RIG * ); int adat_get_single_cmd_result( RIG * ); int adat_cmd_recover_from_error( RIG *, int ); int adat_transaction( RIG *, adat_cmd_list_ptr ); adat_priv_data_ptr adat_new_priv_data( RIG * ); void adat_del_priv_data( adat_priv_data_t ** ); // Command implementation int adat_cmd_fn_get_serial_nr( RIG * ); int adat_cmd_fn_get_fw_version( RIG * ); int adat_cmd_fn_get_hw_version( RIG * ); int adat_cmd_fn_get_gui_fw_version( RIG * ); int adat_cmd_fn_get_id_code( RIG * ); int adat_cmd_fn_get_options( RIG * ); int adat_cmd_fn_set_callsign( RIG * ); int adat_cmd_fn_get_callsign( RIG * ); int adat_cmd_fn_set_freq( RIG * ); int adat_cmd_fn_get_freq( RIG * ); int adat_cmd_fn_get_mode( RIG * ); int adat_cmd_fn_set_mode( RIG * ); int adat_cmd_fn_get_vfo( RIG * ); int adat_cmd_fn_set_vfo( RIG * ); int adat_cmd_fn_get_ptt( RIG * ); int adat_cmd_fn_set_ptt( RIG * ); // --------------------------------------------------------------------------- // ADAT FUNCTION DECLARATIONS // --------------------------------------------------------------------------- int adat_init( RIG * ); int adat_cleanup( RIG * ); int adat_reset( RIG *, reset_t ); int adat_open( RIG * ); int adat_close( RIG * ); int adat_set_conf( RIG *, token_t, const char *val ); int adat_get_conf( RIG *, token_t, char *val ); int adat_set_freq( RIG *, vfo_t, freq_t ); int adat_get_freq( RIG *, vfo_t, freq_t * ); int adat_set_vfo( RIG *, vfo_t ); int adat_get_vfo( RIG *, vfo_t * ); int adat_set_ptt( RIG *, vfo_t, ptt_t ); int adat_get_ptt( RIG *, vfo_t, ptt_t * ); int adat_set_mode( RIG *, vfo_t, rmode_t, pbwidth_t ); int adat_get_mode( RIG *, vfo_t, rmode_t *, pbwidth_t * ); int adat_set_func( RIG *, vfo_t, setting_t func, int ); int adat_get_func( RIG *, vfo_t, setting_t func, int * ); int adat_set_level( RIG *, vfo_t, setting_t level, value_t ); int adat_get_level( RIG *, vfo_t, setting_t level, value_t * ); int adat_handle_event( RIG * ); const char * adat_get_info( RIG * ); int adat_mW2power( RIG *, float *, unsigned int, freq_t, rmode_t ); int adat_power2mW( RIG *, unsigned int *, float, freq_t, rmode_t ); int adat_get_powerstat( RIG *, powerstat_t * ); extern const struct rig_caps adt_200a_caps; // --------------------------------------------------------------------------- // END OF FILE // --------------------------------------------------------------------------- #endif hamlib-1.2.15.3/adat/adat.c0000644000175000017500000027170112044564477012131 00000000000000// --------------------------------------------------------------------------- // ADAT Hamlib Backend // --------------------------------------------------------------------------- // // adat.c // // Created by Frank Goenninger DG1SBG. // Copyright © 2011, 2012 Frank Goenninger. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library 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 // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #ifdef HAVE_CONFIG_H #include "config.h" #endif // --------------------------------------------------------------------------- // SYSTEM INCLUDES // --------------------------------------------------------------------------- #include #include #include #include #include #include #include // --------------------------------------------------------------------------- // HAMLIB INCLUDES // --------------------------------------------------------------------------- #include "hamlib/rig.h" #include "token.h" #include "serial.h" #include "misc.h" #include "register.h" #include "num_stdio.h" // --------------------------------------------------------------------------- // ADAT INCLUDES // --------------------------------------------------------------------------- #include "adat.h" // --------------------------------------------------------------------------- // GLOBAL DEFINITIONS // --------------------------------------------------------------------------- #if !defined( NDEDBUG ) #define ADAT_DEBUG 1 #endif #undef ADAT_DEBUG // manual override ... // --------------------------------------------------------------------------- // ADAT GLOBAL VARIABLES // --------------------------------------------------------------------------- // DEBUG STUFF static int gFnLevel = 0; // ADAT MODES static adat_mode_list_t the_adat_mode_list = { ADAT_NR_MODES, { { ADAT_MODE_STR_CW_R, ADAT_MODE_RNR_CW_R, ADAT_MODE_ANR_CW_R }, { ADAT_MODE_STR_CW, ADAT_MODE_RNR_CW, ADAT_MODE_ANR_CW }, { ADAT_MODE_STR_LSB, ADAT_MODE_RNR_LSB, ADAT_MODE_ANR_LSB }, { ADAT_MODE_STR_USB, ADAT_MODE_RNR_USB, ADAT_MODE_ANR_USB }, { ADAT_MODE_STR_AM, ADAT_MODE_RNR_AM, ADAT_MODE_ANR_AM }, { ADAT_MODE_STR_AM_SL, ADAT_MODE_RNR_AM_SL, ADAT_MODE_ANR_AM_SL }, { ADAT_MODE_STR_AM_SU, ADAT_MODE_RNR_AM_SU, ADAT_MODE_ANR_AM_SU }, { ADAT_MODE_STR_FM, ADAT_MODE_RNR_FM, ADAT_MODE_ANR_FM } } }; // ADAT VFOS static adat_vfo_list_t the_adat_vfo_list = { ADAT_NR_VFOS, { { ADAT_VFO_STR_A, ADAT_VFO_RNR_A, ADAT_VFO_ANR_A }, { ADAT_VFO_STR_B, ADAT_VFO_RNR_B, ADAT_VFO_ANR_B }, { ADAT_VFO_STR_C, ADAT_VFO_RNR_C, ADAT_VFO_ANR_C } } }; // --------------------------------------------------------------------------- // Individual ADAT CAT commands // --------------------------------------------------------------------------- // -- NIL -- (Marks the end of a cmd list) #if 0 static adat_cmd_def_t adat_cmd_nil = { ADAT_CMD_DEF_NIL, ADAT_CMD_KIND_WITHOUT_RESULT, NULL, 0, { NULL } }; #endif // -- ADAT SPECIAL: DISPLAY OFF -- static adat_cmd_def_t adat_cmd_display_off = { ADAT_CMD_DEF_ADAT_SPECIAL, ADAT_CMD_KIND_WITHOUT_RESULT, NULL, 1, { ADAT_CMD_DEF_STRING_DISPLAY_OFF } }; // -- ADAT SPECIAL: DISPLAY ON -- static adat_cmd_def_t adat_cmd_display_on = { ADAT_CMD_DEF_ADAT_SPECIAL, ADAT_CMD_KIND_WITHOUT_RESULT, NULL, 1, { ADAT_CMD_DEF_STRING_DISPLAY_ON } }; // -- ADAT SPECIAL: SELECT VFO -- // -- ADAT SPECIAL: GET SERIAL NR -- static adat_cmd_def_t adat_cmd_get_serial_nr = { ADAT_CMD_DEF_ADAT_SPECIAL, ADAT_CMD_KIND_WITH_RESULT, adat_cmd_fn_get_serial_nr, 1, { ADAT_CMD_DEF_STRING_GET_SERIAL_NR } }; // -- ADAT SPECIAL: GET FIRMWARE VERSION -- static adat_cmd_def_t adat_cmd_get_fw_version = { ADAT_CMD_DEF_ADAT_SPECIAL, ADAT_CMD_KIND_WITH_RESULT, adat_cmd_fn_get_fw_version, 1, { ADAT_CMD_DEF_STRING_GET_FW_VERSION } }; // -- ADAT SPECIAL: GET HARDWARE VERSION -- static adat_cmd_def_t adat_cmd_get_hw_version = { ADAT_CMD_DEF_ADAT_SPECIAL, ADAT_CMD_KIND_WITH_RESULT, adat_cmd_fn_get_hw_version, 1, { ADAT_CMD_DEF_STRING_GET_HW_VERSION } }; // -- ADAT SPECIAL: GET FIRMWARE VERSION -- static adat_cmd_def_t adat_cmd_get_id_code = { ADAT_CMD_DEF_ADAT_SPECIAL, ADAT_CMD_KIND_WITH_RESULT, adat_cmd_fn_get_id_code, 1, { ADAT_CMD_DEF_STRING_GET_ID_CODE } }; // -- ADAT SPECIAL: GET GUI FIRMWARE VERSION -- static adat_cmd_def_t adat_cmd_get_gui_fw_version = { ADAT_CMD_DEF_ADAT_SPECIAL, ADAT_CMD_KIND_WITH_RESULT, adat_cmd_fn_get_gui_fw_version, 1, { ADAT_CMD_DEF_STRING_GET_GUI_FW_VERSION } }; // -- ADAT SPECIAL: GET OPTIONS -- static adat_cmd_def_t adat_cmd_get_options = { ADAT_CMD_DEF_ADAT_SPECIAL, ADAT_CMD_KIND_WITH_RESULT, adat_cmd_fn_get_options, 1, { ADAT_CMD_DEF_STRING_GET_OPTIONS } }; // -- ADAT SPECIAL: GET CALLSIGN -- static adat_cmd_def_t adat_cmd_get_callsign = { ADAT_CMD_DEF_ADAT_SPECIAL, ADAT_CMD_KIND_WITH_RESULT, adat_cmd_fn_get_callsign, 1, { ADAT_CMD_DEF_STRING_GET_CALLSIGN } }; // -- ADAT SPECIAL: SET CALLSIGN -- static adat_cmd_def_t adat_cmd_set_callsign = { ADAT_CMD_DEF_ADAT_SPECIAL, ADAT_CMD_KIND_WITHOUT_RESULT, adat_cmd_fn_set_callsign, 1, { ADAT_CMD_DEF_STRING_SET_CALLSIGN } }; // -- HAMLIB DEFINED COMMANDS -- // -- GET FREQ -- static adat_cmd_def_t adat_cmd_get_freq = { ADAT_CMD_DEF_GET_FREQ, ADAT_CMD_KIND_WITH_RESULT, adat_cmd_fn_get_freq, 1, { ADAT_CMD_DEF_STRING_GET_FREQ } }; static adat_cmd_list_t adat_cmd_list_get_freq = { 2, { &adat_cmd_display_off, &adat_cmd_get_freq } }; // -- SET FREQ -- static adat_cmd_def_t adat_cmd_set_freq = { ADAT_CMD_DEF_SET_FREQ, ADAT_CMD_KIND_WITHOUT_RESULT, adat_cmd_fn_set_freq, 1, { ADAT_CMD_DEF_STRING_SET_FREQ } }; static adat_cmd_list_t adat_cmd_list_set_freq = { 3, { &adat_cmd_display_off, &adat_cmd_set_freq, &adat_cmd_get_freq, } }; // -- GET VFO -- static adat_cmd_list_t adat_cmd_list_get_vfo = { 2, { &adat_cmd_display_off, &adat_cmd_get_freq, } }; // -- GET MODE -- static adat_cmd_def_t adat_cmd_get_mode = { ADAT_CMD_DEF_GET_MODE, ADAT_CMD_KIND_WITH_RESULT, adat_cmd_fn_get_mode, 1, { ADAT_CMD_DEF_STRING_GET_MODE } }; static adat_cmd_list_t adat_cmd_list_get_mode = { 2, { &adat_cmd_display_off, &adat_cmd_get_mode } }; // -- SET VFO -- static adat_cmd_def_t adat_cmd_set_vfo = { ADAT_CMD_DEF_SET_VFO, ADAT_CMD_KIND_WITHOUT_RESULT, adat_cmd_fn_set_vfo, 2, { ADAT_CMD_DEF_STRING_SWITCH_ON_VFO, ADAT_CMD_DEF_STRING_SET_VFO_AS_MAIN_VFO } }; static adat_cmd_list_t adat_cmd_list_set_vfo = { 2, { &adat_cmd_display_off, &adat_cmd_set_vfo } }; // -- SET MODE -- static adat_cmd_def_t adat_cmd_set_mode = { ADAT_CMD_DEF_SET_MODE, ADAT_CMD_KIND_WITHOUT_RESULT, adat_cmd_fn_set_mode, 1, { ADAT_CMD_DEF_STRING_SET_MODE } }; static adat_cmd_list_t adat_cmd_list_set_mode = { 3, { &adat_cmd_display_off, &adat_cmd_set_vfo, &adat_cmd_set_mode, } }; // -- SET PTT -- static adat_cmd_def_t adat_cmd_set_ptt = { ADAT_CMD_DEF_SET_PTT, ADAT_CMD_KIND_WITHOUT_RESULT, adat_cmd_fn_set_ptt, 1, { ADAT_CMD_DEF_STRING_SET_PTT } }; static adat_cmd_list_t adat_cmd_list_set_ptt = { 2, { &adat_cmd_set_ptt, &adat_cmd_display_off } }; // -- GET PTT -- static adat_cmd_def_t adat_cmd_get_ptt = { ADAT_CMD_DEF_GET_PTT, ADAT_CMD_KIND_WITH_RESULT, adat_cmd_fn_get_ptt, 1, { ADAT_CMD_DEF_STRING_GET_PTT } }; static adat_cmd_list_t adat_cmd_list_get_ptt = { 2, { &adat_cmd_display_off, &adat_cmd_get_ptt } }; // -- GET POWER STATUS -- static adat_cmd_list_t adat_cmd_list_get_powerstatus = { 1, { &adat_cmd_get_id_code } }; // -- GET INFO -- static adat_cmd_list_t adat_cmd_list_get_info = { 7, { &adat_cmd_get_serial_nr, &adat_cmd_get_id_code, &adat_cmd_get_fw_version, &adat_cmd_get_gui_fw_version, &adat_cmd_get_hw_version, &adat_cmd_get_options, &adat_cmd_get_callsign } }; // -- OPEN ADAT -- static adat_cmd_list_t adat_cmd_list_open_adat = { 8, { &adat_cmd_display_off, &adat_cmd_get_serial_nr, &adat_cmd_get_id_code, &adat_cmd_get_fw_version, &adat_cmd_get_gui_fw_version, &adat_cmd_get_hw_version, &adat_cmd_get_options, &adat_cmd_set_callsign } }; // -- CLOSE ADAT -- static adat_cmd_list_t adat_cmd_list_close_adat = { 1, { &adat_cmd_display_on } }; // -- ADAT SPECIAL: RECOVER FROM ERROR -- static adat_cmd_list_t adat_cmd_list_recover_from_error = { 1, { &adat_cmd_display_on } }; // --------------------------------------------------------------------------- // IMPLEMEMTATION // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // trimwhitespace - taken from Stackoverflow // http://stackoverflow.com/questions/122616/how-do-i-trim-leading-trailing-whitespace-in-a-standard-way // --------------------------------------------------------------------------- // Status: RELEASED size_t trimwhitespace( char *out, size_t len, const char *str ) { char *end = NULL; size_t out_size = 0; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. In -> \"%s\", %d.\n", gFnLevel, __func__, __FILE__, __LINE__, str, len ); if(len == 0) { gFnLevel--; return 0; } // Trim leading space while(isspace(*str)) str++; if(*str == 0) // All spaces? { out = NULL; gFnLevel--; return 1; } // Trim trailing space end = (char *)(str + strlen(str) - 1); while(end > str && isspace(*end)) { *end = '\0'; end--; } end++; // Set output size to minimum of trimmed string length and buffer size minus 1 //out_size = (end - str) < len-1 ? (end - str) : len - 1; out_size = strlen( str ); // Copy trimmed string and add null terminator memcpy(out, str, out_size); out[out_size] = 0; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Out -> \"%s\", %d.\n", gFnLevel, __func__, __FILE__, __LINE__, out, out_size ); gFnLevel--; return out_size; } // --------------------------------------------------------------------------- // adat_print_cmd // --------------------------------------------------------------------------- // Status: RELEASED int adat_print_cmd( adat_cmd_def_ptr pCmd ) { int nRC = RIG_OK; int nI = 0; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %s (%s:%d): ENTRY.\n", __func__, __FILE__, __LINE__ ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT COMMAND:\n"); rig_debug( RIG_DEBUG_TRACE, "*** -> Command ID = %lld\n", pCmd->nCmdId ); rig_debug( RIG_DEBUG_TRACE, "*** -> Command kind = %d\n", pCmd->nCmdKind ); rig_debug( RIG_DEBUG_TRACE, "*** -> Command FN Ptr = 0x%08x\n", pCmd->pfCmdFn ); while ( nI < pCmd->nNrCmdStrs ) { rig_debug( RIG_DEBUG_TRACE, "*** -> Command String %d = \"%s\"\n", nI, pCmd->pacCmdStrs[ nI ] ); nI++; } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %s (%s:%d): EXIT. Return Code = %d\n", __func__, __FILE__, __LINE__, nRC ); return nRC; } // --------------------------------------------------------------------------- // adat_parse_freq // --------------------------------------------------------------------------- // Status: RELEASED // Can be used to parse strings with VFO nr and without VFO nr in it: // "1 123.456kHz" => nMode = ADAT_FREQ_PARSE_MODE_WITH_VFO // "800Hz" => nMode = ADAT_FREQ_PARSE_MODE_WITHOUT_VFO int adat_parse_freq( char *pcStr, adat_freq_parse_mode_t nMode, int *nVFO, freq_t *nFreq ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pcStr = \"%s\"\n", gFnLevel, __func__, __FILE__, __LINE__, pcStr ); if( pcStr != NULL ) { int _nVFO = 0; freq_t _nFreq = 0; char *pcEnd = NULL; if( nMode == ADAT_FREQ_PARSE_MODE_WITH_VFO ) { // Get VFO from response string _nVFO = strtol( pcStr, &pcEnd, 10 ); // Save VFO *nVFO = _nVFO; } else { pcEnd = pcStr; } if(( _nVFO != 0 ) || // VFO = 0 -> Current VFO not active. ( nMode == ADAT_FREQ_PARSE_MODE_WITHOUT_VFO )) { char acValueBuf[ ADAT_BUFSZ + 1 ]; char acUnitBuf[ ADAT_BUFSZ + 1 ]; int nI = 0; double dTmpFreq = 0.0; memset( acValueBuf, 0, ADAT_BUFSZ + 1 ); memset( acUnitBuf, 0, ADAT_BUFSZ + 1 ); // Get Freq Value from response string while(( isalpha( *pcEnd ) == 0 ) || ( *pcEnd == '.' )) { acValueBuf[ nI++ ] = *pcEnd; pcEnd += sizeof( char ); } dTmpFreq = strtod( acValueBuf, (char**) NULL ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d acValueBuf = \"%s\", dTmpFreq = %f, *pcEnd = %c\n", gFnLevel, acValueBuf, dTmpFreq, *pcEnd ); // Get Freq Unit from response string nI = 0; while( isalpha( *pcEnd ) != 0 ) { acUnitBuf[ nI++ ] = *pcEnd; pcEnd += sizeof( char ); } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d acUnitBuf = \"%s\"\n", gFnLevel, acUnitBuf ); // Normalize to Hz if( !strncmp( acUnitBuf, ADAT_FREQ_UNIT_HZ, ADAT_FREQ_UNIT_HZ_LEN )) { _nFreq = Hz( dTmpFreq ); } else { if( !strncmp( acUnitBuf, ADAT_FREQ_UNIT_KHZ, ADAT_FREQ_UNIT_KHZ_LEN )) { _nFreq = kHz( dTmpFreq ); } else { if( !strncmp( acUnitBuf, ADAT_FREQ_UNIT_MHZ, ADAT_FREQ_UNIT_MHZ_LEN )) { _nFreq = MHz( dTmpFreq ); } else { if( !strncmp( acUnitBuf, ADAT_FREQ_UNIT_GHZ, ADAT_FREQ_UNIT_GHZ_LEN )) { _nFreq = GHz( dTmpFreq ); } else { _nFreq = 0; nRC = -RIG_EINVAL; } } } } // Save Freq *nFreq = _nFreq; } } else { // If input string is NULL set Freq and VFO also to NULL *nFreq = 0; *nVFO = 0; } // Done rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d, nVFO = %d, nFreq = %f\n", gFnLevel, __func__, __FILE__, __LINE__, nRC, *nVFO, *nFreq ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_parse_mode // --------------------------------------------------------------------------- // Status: RELEASED int adat_parse_mode( char *pcStr, rmode_t *nRIGMode, char *pcADATMode ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pcStr = \"%s\"\n", gFnLevel, __func__, __FILE__, __LINE__, pcStr ); if( pcStr != NULL ) { int nI = 0; int nFini = 0; while(( nI < the_adat_mode_list.nNrModes ) && ( nFini == 0 )) { if( !strcmp( pcStr, the_adat_mode_list.adat_modes[ nI ].pcADATModeStr )) { *nRIGMode = the_adat_mode_list.adat_modes[ nI ].nRIGMode; nFini = 1; // Done. } else { nI++; } } } else { // If input string is NULL ... *nRIGMode = RIG_MODE_NONE; pcADATMode = NULL; } // Done rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d, Mode = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC, *nRIGMode ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_mode_rnr2anr // --------------------------------------------------------------------------- // Status: RELEASED int adat_mode_rnr2anr( rmode_t nRIGMode, int *nADATMode ) { int nRC = RIG_OK; int nI = 0; int nFini = 0; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: nRIGMode = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRIGMode ); while(( nI < the_adat_mode_list.nNrModes ) && ( nFini == 0 )) { if( the_adat_mode_list.adat_modes[ nI ].nRIGMode == nRIGMode ) { *nADATMode = the_adat_mode_list.adat_modes[ nI ].nADATMode; nFini = 1; // Done. } else { nI++; } } if( nFini == 0 ) { // No valid Mode given nRC = -RIG_EINVAL; } // Done rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d, ADAT Mode = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC, *nADATMode ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_mode_anr2rnr // --------------------------------------------------------------------------- // Status: RELEASED int adat_mode_anr2rnr( int nADATMode, rmode_t *nRIGMode ) { int nRC = RIG_OK; int nI = 0; int nFini = 0; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: nRIGMode = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRIGMode ); while(( nI < the_adat_mode_list.nNrModes ) && ( nFini == 0 )) { if( the_adat_mode_list.adat_modes[ nI ].nADATMode == nADATMode ) { *nRIGMode = the_adat_mode_list.adat_modes[ nI ].nRIGMode; nFini = 1; // Done. } else { nI++; } } if( nFini == 0 ) { // No valid Mode given nRC = -RIG_EINVAL; } // Done rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d, RIG Mode = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC, *nRIGMode ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_parse_vfo // --------------------------------------------------------------------------- // Status: RELEASED int adat_parse_vfo( char *pcStr, vfo_t *nRIGVFONr, int *nADATVFONr ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pcStr = \"%s\"\n", gFnLevel, __func__, __FILE__, __LINE__, pcStr ); if( pcStr != NULL ) { int nI = 0; int nFini = 0; while(( nI < the_adat_vfo_list.nNrVFOs ) && ( nFini == 0 )) { if( !strcmp( pcStr, the_adat_vfo_list.adat_vfos[ nI ].pcADATVFOStr )) { *nRIGVFONr = the_adat_vfo_list.adat_vfos[ nI ].nRIGVFONr; *nADATVFONr = the_adat_vfo_list.adat_vfos[ nI ].nADATVFONr; nFini = 1; // Done. } else { nI++; } } if( nFini == 0 ) { nRC = -RIG_EINVAL; } } else { // If input string is NULL ... *nRIGVFONr = RIG_VFO_NONE; *nADATVFONr = 0; } // Done rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d, RIG VFO Nr = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC, *nRIGVFONr ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_vfo_rnr2anr // --------------------------------------------------------------------------- // Status: RELEASED int adat_vfo_rnr2anr( vfo_t nRIGVFONr, int *nADATVFONr ) { int nRC = RIG_OK; int nI = 0; int nFini = 0; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: nRIGVFONr = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRIGVFONr ); while(( nI < the_adat_vfo_list.nNrVFOs ) && ( nFini == 0 )) { if( the_adat_vfo_list.adat_vfos[ nI ].nRIGVFONr == nRIGVFONr ) { *nADATVFONr = the_adat_vfo_list.adat_vfos[ nI ].nADATVFONr; nFini = 1; // Done. } else { nI++; } } if( nFini == 0 ) { // No valid Mode given nRC = -RIG_EINVAL; } // Done rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d, ADAT VFO Nr = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC, *nADATVFONr ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_vfo_anr2rnr // --------------------------------------------------------------------------- // Status: RELEASED int adat_vfo_anr2rnr( int nADATVFONr, vfo_t *nRIGVFONr ) { int nRC = RIG_OK; int nI = 0; int nFini = 0; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: nADATVFONr = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nADATVFONr ); while(( nI < the_adat_vfo_list.nNrVFOs ) && ( nFini == 0 )) { if( the_adat_vfo_list.adat_vfos[ nI ].nADATVFONr == nADATVFONr ) { *nRIGVFONr = the_adat_vfo_list.adat_vfos[ nI ].nRIGVFONr; nFini = 1; // Done. } else { nI++; } } if( nFini == 0 ) { // No valid ADAT VFO Nr given nRC = -RIG_EINVAL; } // Done rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d, RIG VFO Nr = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC, *nRIGVFONr ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_parse_ptt // --------------------------------------------------------------------------- // Status: RELEASED int adat_parse_ptt( char *pcStr, int *nADATPTTStatus ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pcStr = \"%s\"\n", gFnLevel, __func__, __FILE__, __LINE__, pcStr ); if(( pcStr != NULL ) && ( strlen( pcStr ) > 0 )) { *nADATPTTStatus = strtol( pcStr, NULL, 10 ); } else { // If input string is NULL ... *nADATPTTStatus = ADAT_PTT_STATUS_ANR_OFF; nRC = -RIG_EINVAL; } // Done rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_ptt_rnr2anr // --------------------------------------------------------------------------- // Status: RELEASED int adat_ptt_rnr2anr( ptt_t nRIGPTTStatus, int *nADATPTTStatus ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: nRIGPTTStatus = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRIGPTTStatus ); switch( nRIGPTTStatus ) { case ADAT_PTT_STATUS_RNR_ON: *nADATPTTStatus = ADAT_PTT_STATUS_ANR_ON; break; case ADAT_PTT_STATUS_RNR_OFF: *nADATPTTStatus = ADAT_PTT_STATUS_ANR_OFF; break; default: nRC = -RIG_EINVAL; break; } // Done rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d, ADAT PTT Status = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC, *nADATPTTStatus ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_ptt_anr2rnr // --------------------------------------------------------------------------- // Status: RELEASED int adat_ptt_anr2rnr( int nADATPTTStatus, ptt_t *nRIGPTTStatus ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: nADATPTTStatus = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nADATPTTStatus ); switch( nADATPTTStatus ) { case ADAT_PTT_STATUS_ANR_ON: *nRIGPTTStatus = ADAT_PTT_STATUS_RNR_ON; break; case ADAT_PTT_STATUS_ANR_OFF: *nRIGPTTStatus = ADAT_PTT_STATUS_RNR_OFF; break; default: nRC = -RIG_EINVAL; break; } // Done rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d, RIG PTT Status = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC, *nRIGPTTStatus ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_send // --------------------------------------------------------------------------- // Status: RELEASED int adat_send( RIG *pRig, char *pcData ) { int nRC = RIG_OK; struct rig_state *pRigState = &pRig->state; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x, pcData = %s\n", gFnLevel, __func__, __FILE__, __LINE__, pRig, pcData ); serial_flush( &pRigState->rigport ); nRC = write_block( &pRigState->rigport, pcData, strlen( pcData )); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_receive // --------------------------------------------------------------------------- // Status: RELEASED int adat_receive( RIG *pRig, char *pcData ) { int nRC = RIG_OK; struct rig_state *pRigState = &pRig->state; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); nRC = read_string( &pRigState->rigport, pcData, ADAT_RESPSZ, ADAT_EOL, 1 ); if( nRC > 0 ) { nRC = RIG_OK; } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_priv_set_cmd // --------------------------------------------------------------------------- // Status: RELEASED int adat_priv_set_cmd( RIG *pRig, char *pcCmd, int nCmdKind ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x, pcCmd = \"%s\"\n", gFnLevel, __func__, __FILE__, __LINE__, pRig, pcCmd ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; if( pPriv->pcCmd != NULL ) free( pPriv->pcCmd ); pPriv->pcCmd = strdup( pcCmd ); pPriv->nCmdKind = nCmdKind; } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_priv_set_result // --------------------------------------------------------------------------- // Status: RELEASED int adat_priv_set_result( RIG *pRig, char *pcResult ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x, pcResult = \"%s\"\n", gFnLevel, __func__, __FILE__, __LINE__, pRig, pcResult ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; if( pPriv->pcResult != NULL ) free( pPriv->pcResult ); pPriv->pcResult = strdup( pcResult ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d pPriv->pcResult = \"%s\"\n", gFnLevel, pPriv->pcResult ); } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_priv_clear_result // --------------------------------------------------------------------------- // Status: RELEASED int adat_priv_clear_result( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; if( pPriv->pcResult != NULL ) free( pPriv->pcResult ); pPriv->pcResult = NULL; } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_get_single_cmd_result // --------------------------------------------------------------------------- // Status: RELEASED int adat_get_single_cmd_result( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; struct rig_state *pRigState = &pRig->state; nRC = adat_send( pRig, pPriv->pcCmd ); if(( nRC == RIG_OK ) && ( pPriv->nCmdKind == ADAT_CMD_KIND_WITH_RESULT )) { char acBuf[ ADAT_RESPSZ + 1 ]; char acBuf2[ ADAT_RESPSZ + 1 ]; int nBufLength = 0; char *pcBufEnd = NULL; char *pcPos = NULL; char *pcResult = NULL; memset( acBuf, 0, ADAT_RESPSZ + 1 ); memset( acBuf2, 0, ADAT_RESPSZ + 1 ); nRC = adat_receive( pRig, acBuf ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d acBuf ........ = 0x%08x\n", gFnLevel, acBuf ); pcPos = acBuf; if(( nRC == RIG_OK ) && ( pcPos != NULL )) { int nLength = 0; if( *pcPos == '\0' ) // Adjust for 00 byte at beginning ... pcPos++; // No, please don't ask me why this // happens ... ;-) nBufLength = strlen( pcPos ); pcBufEnd = pcPos + nBufLength - 1; pcResult = pcPos; // Save position if( pcPos < pcBufEnd ) { nLength = strlen( pcPos ); if( nLength > 0 ) { char *pcPos2 = strchr( pcPos, (char) 0x0d ); if( pcPos2 != NULL ) *pcPos2 = '\0'; // Truncate \0d\0a pcPos = strchr( pcPos, ' ' ); if(( pcPos != NULL ) && ( pcPos < pcBufEnd )) { pcPos += sizeof( char ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d pcPos ........ = 0x%08x\n", gFnLevel, pcPos ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d pcBufEnd ..... = 0x%08x\n", gFnLevel, pcBufEnd ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d nBufLength ... = %d\n", gFnLevel, nBufLength ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d pcPos2 ....... = 0x%08x\n", gFnLevel, pcPos2 ); trimwhitespace( acBuf2, strlen( pcPos ), pcPos ); pcResult = acBuf2; } } else { nRC = -RIG_EINVAL; } } else { nRC = -RIG_EINVAL; } if( nRC == RIG_OK ) { adat_priv_set_result( pRig, pcResult ); } else { adat_priv_clear_result( pRig ); } } } serial_flush( &pRigState->rigport ); pPriv->nRC = nRC; } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_recover_from_error // --------------------------------------------------------------------------- // Status: RELEASED int adat_cmd_recover_from_error( RIG *pRig, int nError ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; // Recover from communication error if(( nError == RIG_ETIMEOUT ) || ( nError == RIG_EPROTO ) || ( nError == RIG_EIO )) { rig_close( pRig ); sleep( ADAT_SLEEP_AFTER_RIG_CLOSE ); rig_open( pRig ); } // Reset critical Priv values pPriv->nRC = RIG_OK; // Execute recovery commands (void) adat_transaction( pRig, &adat_cmd_list_recover_from_error ); } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_fn_get_callsign // --------------------------------------------------------------------------- // Status: RELEASED int adat_cmd_fn_get_callsign( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_priv_set_cmd( pRig, ADAT_CMD_DEF_STRING_GET_CALLSIGN, ADAT_CMD_KIND_WITH_RESULT ); if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); if( nRC == RIG_OK ) { pPriv->pcCallsign = strdup( pPriv->pcResult ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d pPriv->pcCallsign = \"%s\"\n", gFnLevel, pPriv->pcCallsign ); } } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_fn_set_callsign // --------------------------------------------------------------------------- // Status: IN WORK int adat_cmd_fn_set_callsign( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { char acBuf[ ADAT_BUFSZ + 1 ]; memset( acBuf, 0, ADAT_BUFSZ + 1 ); strcpy( acBuf, ADAT_CMD_DEF_STRING_SET_CALLSIGN ); strcat( acBuf, "DG1SBG"ADAT_CR ); nRC = adat_priv_set_cmd( pRig, acBuf, ADAT_CMD_KIND_WITHOUT_RESULT); if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_fn_get_serial_nr // --------------------------------------------------------------------------- // Status: RELEASED int adat_cmd_fn_get_serial_nr( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_priv_set_cmd( pRig, ADAT_CMD_DEF_STRING_GET_SERIAL_NR, ADAT_CMD_KIND_WITH_RESULT ); if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); if( nRC == RIG_OK ) { pPriv->pcSerialNr = strdup( pPriv->pcResult ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d pPriv->pcSerialNr = \"%s\"\n", gFnLevel, pPriv->pcSerialNr ); } } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_fn_get_fw_version // --------------------------------------------------------------------------- // Status: RELEASED int adat_cmd_fn_get_fw_version( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_priv_set_cmd( pRig, ADAT_CMD_DEF_STRING_GET_FW_VERSION, ADAT_CMD_KIND_WITH_RESULT ); if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); if( nRC == RIG_OK ) { pPriv->pcFWVersion = strdup( pPriv->pcResult ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d pPriv->pcFWVersion = \"%s\"\n", gFnLevel, pPriv->pcFWVersion ); } } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_fn_get_hw_version // --------------------------------------------------------------------------- // Status: RELEASED int adat_cmd_fn_get_hw_version( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_priv_set_cmd( pRig, ADAT_CMD_DEF_STRING_GET_HW_VERSION, ADAT_CMD_KIND_WITH_RESULT ); if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); if( nRC == RIG_OK ) { pPriv->pcHWVersion = strdup( pPriv->pcResult ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d pPriv->pcHWVersion = \"%s\"\n", gFnLevel, pPriv->pcHWVersion ); } } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_fn_get_gui_fw_version // --------------------------------------------------------------------------- // Status: RELEASED int adat_cmd_fn_get_gui_fw_version( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_priv_set_cmd( pRig, ADAT_CMD_DEF_STRING_GET_GUI_FW_VERSION, ADAT_CMD_KIND_WITH_RESULT ); if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); if( nRC == RIG_OK ) { pPriv->pcGUIFWVersion = strdup( pPriv->pcResult ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d pPriv->pcGUIFWVersion = \"%s\"\n", gFnLevel, pPriv->pcGUIFWVersion ); } } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_fn_get_id_code // --------------------------------------------------------------------------- // Status: RELEASED int adat_cmd_fn_get_id_code( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_priv_set_cmd( pRig, ADAT_CMD_DEF_STRING_GET_ID_CODE, ADAT_CMD_KIND_WITH_RESULT ); if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); if( nRC == RIG_OK ) { pPriv->pcIDCode = strdup( pPriv->pcResult ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d pPriv->pcIDCode = \"%s\"\n", gFnLevel, pPriv->pcIDCode ); } } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_fn_get_options // --------------------------------------------------------------------------- // Status: RELEASED int adat_cmd_fn_get_options( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_priv_set_cmd( pRig, ADAT_CMD_DEF_STRING_GET_OPTIONS, ADAT_CMD_KIND_WITH_RESULT ); if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); if( nRC == RIG_OK ) { pPriv->pcOptions = strdup( pPriv->pcResult ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d pPriv->pcOptions = \"%s\"\n", gFnLevel, pPriv->pcOptions ); } } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_fn_get_mode // --------------------------------------------------------------------------- // Status: RELEASED int adat_cmd_fn_get_mode( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_priv_set_cmd( pRig, ADAT_CMD_DEF_STRING_GET_MODE, ADAT_CMD_KIND_WITH_RESULT ); if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); if( nRC == RIG_OK ) { nRC = adat_parse_mode( pPriv->pcResult, &(pPriv->nRIGMode), pPriv->acADATMode ); } } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_fn_set_mode // --------------------------------------------------------------------------- // Status: RELEASED int adat_cmd_fn_set_mode( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; // Translate Mode from RIG Mode Nr to ADAT Mode Nr nRC = adat_mode_rnr2anr( pPriv->nRIGMode, &(pPriv->nADATMode) ); if( nRC == RIG_OK ) { // Prepare Command char acBuf[ ADAT_BUFSZ + 1 ]; memset( acBuf, 0, ADAT_BUFSZ + 1 ); snprintf( acBuf, ADAT_BUFSZ, "%s%02d%s", ADAT_CMD_DEF_STRING_SET_MODE, (int) pPriv->nADATMode, ADAT_EOM ); nRC = adat_priv_set_cmd( pRig, acBuf, ADAT_CMD_KIND_WITHOUT_RESULT ); // Execute Command if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); } } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_fn_get_freq // --------------------------------------------------------------------------- // Status: RELEASED int adat_cmd_fn_get_freq( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_priv_set_cmd( pRig, ADAT_CMD_DEF_STRING_GET_FREQ, ADAT_CMD_KIND_WITH_RESULT ); if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); if( nRC == RIG_OK ) { nRC = adat_parse_freq( pPriv->pcResult, ADAT_FREQ_PARSE_MODE_WITH_VFO, &(pPriv->nCurrentVFO), &(pPriv->nFreq) ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d pPriv->nCurrentVFO = %d, Freq [Hz] = %f\n", gFnLevel, pPriv->nCurrentVFO, pPriv->nFreq ); if( nRC == RIG_OK ) { nRC = adat_vfo_anr2rnr( pPriv->nCurrentVFO, &(pPriv->nRIGVFONr) ); } } } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_fn_set_freq // --------------------------------------------------------------------------- // Status: RELEASED int adat_cmd_fn_set_freq( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; char acBuf[ ADAT_BUFSZ + 1 ]; // Get frequency of selected VFO memset( acBuf, 0, ADAT_BUFSZ + 1 ); snprintf( acBuf, ADAT_BUFSZ, "%s%d%s", ADAT_CMD_DEF_STRING_SET_FREQ, (int) pPriv->nFreq, ADAT_EOM ); nRC = adat_priv_set_cmd( pRig, acBuf, ADAT_CMD_KIND_WITHOUT_RESULT ); if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_fn_set_vfo // --------------------------------------------------------------------------- // Status: RELEASED // Setting a VFO on an ADAT is actually two steps: // 1. Switching on that VFO // 2. Setting this VFO as the main VFO int adat_cmd_fn_set_vfo( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; char acBuf[ ADAT_BUFSZ + 1 ]; // Switch on VFO memset( acBuf, 0, ADAT_BUFSZ + 1 ); snprintf( acBuf, ADAT_BUFSZ, ADAT_CMD_DEF_STRING_SWITCH_ON_VFO, (int) pPriv->nCurrentVFO, ADAT_EOM ); nRC = adat_priv_set_cmd( pRig, acBuf, ADAT_CMD_KIND_WITHOUT_RESULT ); if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); if( nRC == RIG_OK ) { memset( acBuf, 0, ADAT_BUFSZ + 1 ); snprintf( acBuf, ADAT_BUFSZ, ADAT_CMD_DEF_STRING_SET_VFO_AS_MAIN_VFO, (int) pPriv->nCurrentVFO, ADAT_EOM ); nRC = adat_priv_set_cmd( pRig, acBuf, ADAT_CMD_KIND_WITHOUT_RESULT ); if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); } } } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_fn_get_ptt // --------------------------------------------------------------------------- // Status: RELEASED int adat_cmd_fn_get_ptt( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_priv_set_cmd( pRig, ADAT_CMD_DEF_STRING_GET_PTT, ADAT_CMD_KIND_WITH_RESULT ); if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); if( nRC == RIG_OK ) { nRC = adat_parse_ptt( pPriv->pcResult, &(pPriv->nADATPTTStatus) ); if( nRC == RIG_OK ) { nRC = adat_ptt_anr2rnr( pPriv->nADATPTTStatus, &(pPriv->nRIGPTTStatus) ); } } } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_cmd_fn_set_ptt // --------------------------------------------------------------------------- // Status: RELEASED int adat_cmd_fn_set_ptt( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; char acBuf[ ADAT_BUFSZ + 1 ]; char *pcPTTStr = NULL; memset( acBuf, 0, ADAT_BUFSZ + 1 ); // Switch PTT switch( pPriv->nOpCode ) { case ADAT_OPCODE_PTT_SWITCH_ON: pPriv->nADATPTTStatus = ADAT_PTT_STATUS_ANR_ON; nRC = adat_ptt_anr2rnr( ADAT_PTT_STATUS_ANR_ON, &(pPriv->nRIGPTTStatus) ); pcPTTStr = ADAT_CMD_PTT_STR_ON; break; case ADAT_OPCODE_PTT_SWITCH_OFF: pPriv->nADATPTTStatus = ADAT_PTT_STATUS_ANR_OFF; nRC = adat_ptt_anr2rnr( ADAT_PTT_STATUS_ANR_OFF, &(pPriv->nRIGPTTStatus) ); pcPTTStr = ADAT_CMD_PTT_STR_OFF; break; default: nRC = -RIG_EINVAL; break; } if( nRC == RIG_OK ) { snprintf( acBuf, ADAT_BUFSZ, ADAT_CMD_DEF_STRING_SET_PTT, pcPTTStr, ADAT_EOM ); nRC = adat_priv_set_cmd( pRig, acBuf, ADAT_CMD_KIND_WITHOUT_RESULT ); if( nRC == RIG_OK ) { nRC = adat_get_single_cmd_result( pRig ); } } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_transaction // --------------------------------------------------------------------------- // Status: RELEASED // adat_transaction is a generalized command processor able to execute // commands of type adat_cmd_def_t . int adat_transaction( RIG *pRig, adat_cmd_list_ptr pCmdList ) { int nRC = RIG_OK; int nFini = 0; // = 1 -> Stop executing commands gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if(( pRig == NULL )) { nRC = -RIG_EARG; } else { int nI = 0; adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): Nr of commands = %d\n", gFnLevel, __func__, __FILE__, __LINE__, pCmdList->nNrCmds ); while(( nRC == RIG_OK ) && ( nFini == 0 ) && ( nI < pCmdList->nNrCmds )) { adat_cmd_def_ptr pCmd = NULL; pCmd = pCmdList->adat_cmds[ nI ]; if(( pCmd != NULL ) && ( pCmd->nCmdId != ADAT_CMD_DEF_NIL )) { rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d About to execute ADAT Command ... \n", gFnLevel, __func__, __FILE__, __LINE__); adat_print_cmd( pCmd ); // Execute Command if( pCmd->pfCmdFn != NULL ) { rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d Calling function via fn ptr ... \n", gFnLevel ); nRC = pCmd->pfCmdFn( pRig ); } else { rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d Sending command string ... \n", gFnLevel ); if( pCmd->pacCmdStrs != NULL ) { int nJ = 0; if( pCmd->nNrCmdStrs > 0 ) { rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d pacCmdStrs[%d] = %s\n", gFnLevel, nJ, pCmd->pacCmdStrs[ nJ ] ); while(( nJ < pCmd->nNrCmdStrs ) && ( nRC == RIG_OK ) && ( pCmd->pacCmdStrs[ nJ ] != NULL )) { nRC = adat_send( pRig, pCmd->pacCmdStrs[ nJ ] ); if( nRC == RIG_OK ) { if( pCmd->nCmdKind == ADAT_CMD_KIND_WITH_RESULT ) { char acBuf[ ADAT_RESPSZ + 1 ]; memset( acBuf, 0, ADAT_RESPSZ + 1 ); nRC = adat_receive( pRig, acBuf ); while(( nRC == RIG_OK ) && ( strncmp( acBuf, ADAT_BOM, strlen( ADAT_BOM )) != 0)) { nRC = adat_receive( pRig, acBuf ); } pPriv->pcResult = strdup( acBuf ); } } nJ++; } } } } if( nRC != RIG_OK ) { (void) adat_cmd_recover_from_error( pRig, nRC ); } nI++; } else { nFini = 1; } // sleep between cmds - ADAT needs time to act upoon cmds usleep( ADAT_SLEEP_MICROSECONDS_BETWEEN_CMDS ); } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // adat_new_priv_data // --------------------------------------------------------------------------- // Status: RELEASED adat_priv_data_ptr adat_new_priv_data( RIG *pRig ) { int nRC = 0; adat_priv_data_ptr pPriv = NULL; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if( pRig != NULL ) { // Init Priv Data pPriv = (adat_priv_data_ptr) calloc( sizeof( adat_priv_data_t ), 1 ); if ( pPriv != NULL ) { char acBuf[ ADAT_BUFSZ + 1 ]; memset( acBuf, 0, ADAT_BUFSZ + 1 ); // FIXME: pointless code at init time #if 0 nRC = adat_get_conf( pRig, TOKEN_ADAT_PRODUCT_NAME, acBuf ); if( nRC == 0) { pPriv->pcProductName = strdup( acBuf ); pRig->state.priv = (void *) pPriv; } #else pRig->state.priv = (void *) pPriv; #endif } else { nRC = -RIG_ENOMEM; } } else { nRC = -RIG_EARG; } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. RC = %d, pPriv = 0x%x\n", gFnLevel, __func__, __FILE__, __LINE__, nRC, pPriv ); gFnLevel--; return pPriv; } // --------------------------------------------------------------------------- // adat_del_priv_data // --------------------------------------------------------------------------- // Status: RELEASED void adat_del_priv_data( adat_priv_data_t **ppPriv ) { int nRC = 0; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: ppPrivData = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, ppPriv ); if(( ppPriv != NULL ) && ( *ppPriv != NULL )) { // Delete / Free Priv Data if( (*ppPriv)->pcProductName != NULL ) { free( (*ppPriv)->pcProductName ); } if( (*ppPriv)->pcSerialNr != NULL ) { free( (*ppPriv)->pcSerialNr ); } if( (*ppPriv)->pcHWVersion != NULL ) { free( (*ppPriv)->pcHWVersion ); } if( (*ppPriv)->pcFWVersion != NULL ) { free( (*ppPriv)->pcFWVersion ); } if( (*ppPriv)->pcGUIFWVersion != NULL ) { free( (*ppPriv)->pcGUIFWVersion ); } if( (*ppPriv)->pcOptions != NULL ) { free( (*ppPriv)->pcOptions ); } if( (*ppPriv)->pcIDCode != NULL ) { free( (*ppPriv)->pcIDCode ); } if( (*ppPriv)->pcCallsign != NULL ) { free( (*ppPriv)->pcCallsign ); } // Free priv struct itself free( (*ppPriv) ); *ppPriv = NULL; } else { nRC = -RIG_EARG; } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. RC = %d.\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return; }; // --------------------------------------------------------------------------- // Function adat_init // --------------------------------------------------------------------------- // Status: RELEASED int adat_init( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = NULL; // Get new Priv Data pPriv = adat_new_priv_data( pRig ); if( pPriv == NULL ) { nRC = -RIG_ENOMEM; } } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_cleanup // --------------------------------------------------------------------------- // Status: RELEASED int adat_cleanup( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); if( pRig == NULL ) { nRC = -RIG_EARG; } else { if( pRig->state.priv != NULL ) { adat_del_priv_data( (adat_priv_data_t **)&(pRig->state.priv) ); pRig->state.priv = NULL; } } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_open // --------------------------------------------------------------------------- // Status: RELEASED int adat_open( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { // grace period for the radio to be there sleep( ADAT_SLEEP_AFTER_RIG_OPEN ); // Now get basic info from ADAT TRX nRC = adat_transaction( pRig, &adat_cmd_list_open_adat ); } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_close // --------------------------------------------------------------------------- // Status: RELEASED int adat_close( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { // Now switch to interactive mode nRC = adat_transaction( pRig, &adat_cmd_list_close_adat ); } // Done ! rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_get_info // --------------------------------------------------------------------------- // Status: RELEASED const char * adat_get_info( RIG *pRig ) { int nRC = RIG_OK; static char acBuf[ 512 ]; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); memset( acBuf, 0, 512 ); if( pRig != NULL ) { nRC = adat_transaction( pRig, &adat_cmd_list_get_info ); if( nRC == RIG_OK ) { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; snprintf( acBuf, 512, "ADAT ADT-200A, Callsign: %s, S/N: %s, ID Code: %s, Options: %s, FW: %s, GUI FW: %s, HW: %s", pPriv->pcCallsign, pPriv->pcSerialNr, pPriv->pcIDCode, pPriv->pcOptions, pPriv->pcFWVersion, pPriv->pcGUIFWVersion, pPriv->pcHWVersion ); } } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Value ='%s'\n", gFnLevel, __func__, __FILE__, __LINE__, acBuf ); gFnLevel--; return acBuf; } // --------------------------------------------------------------------------- // Function adat_set_freq // --------------------------------------------------------------------------- // Status: RELEASED int adat_set_freq( RIG *pRig, vfo_t vfo, freq_t freq ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; pPriv->nFreq = freq; nRC = adat_transaction( pRig, &adat_cmd_list_set_freq ); } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_get_freq // --------------------------------------------------------------------------- // Status: RELEASED int adat_get_freq( RIG *pRig, vfo_t vfo, freq_t *freq ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_transaction( pRig, &adat_cmd_list_get_freq ); *freq = pPriv->nFreq; } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_set_level // --------------------------------------------------------------------------- // Status: IN WORK int adat_set_level( RIG *pRig, vfo_t vfo, setting_t level, value_t val ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { //adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_get_level // --------------------------------------------------------------------------- // Status: IN WORK int adat_get_level( RIG *pRig, vfo_t vfo, setting_t level, value_t *val ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { //adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_set_mode // --------------------------------------------------------------------------- // Status: RELEASED int adat_set_mode(RIG *pRig, vfo_t vfo, rmode_t mode, pbwidth_t width ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; pPriv->nRIGMode = mode; nRC = adat_vfo_rnr2anr( vfo, &(pPriv->nCurrentVFO) ); if( width == RIG_PASSBAND_NORMAL ) width = rig_passband_normal( pRig, mode ); pPriv->nWidth = width; nRC = adat_transaction( pRig, &adat_cmd_list_set_mode ); } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_get_mode // --------------------------------------------------------------------------- // Status: RELEASED int adat_get_mode( RIG *pRig, vfo_t vfo, rmode_t *mode, pbwidth_t *width ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_transaction( pRig, &adat_cmd_list_get_mode ); if( nRC == RIG_OK ) { *mode = pPriv->nRIGMode; *width = pPriv->nWidth; } } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_get_vfo // --------------------------------------------------------------------------- // Status: RELEASED int adat_get_vfo( RIG *pRig, vfo_t *vfo ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_transaction( pRig, &adat_cmd_list_get_vfo ); *vfo = pPriv->nRIGVFONr; } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_set_vfo // --------------------------------------------------------------------------- // Status: RELEASED int adat_set_vfo( RIG *pRig, vfo_t vfo ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_vfo_rnr2anr( vfo, &(pPriv->nCurrentVFO) ); if( nRC == RIG_OK ) { nRC = adat_transaction( pRig, &adat_cmd_list_set_vfo ); } } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_get_ptt // --------------------------------------------------------------------------- // Status: RELEASED int adat_get_ptt( RIG *pRig, vfo_t vfo, ptt_t *ptt ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_transaction( pRig, &adat_cmd_list_get_ptt ); *ptt = pPriv->nRIGPTTStatus; } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_set_ptt // --------------------------------------------------------------------------- // Status: RELEASED int adat_set_ptt( RIG *pRig, vfo_t vfo, ptt_t ptt ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; switch( ptt ) { case RIG_PTT_ON: pPriv->nOpCode = ADAT_OPCODE_PTT_SWITCH_ON; break; case RIG_PTT_OFF: pPriv->nOpCode = ADAT_OPCODE_PTT_SWITCH_OFF; break; default: nRC = -RIG_EINVAL; break; } if( nRC == RIG_OK ) { nRC = adat_transaction( pRig, &adat_cmd_list_set_ptt ); } } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_power2mW // --------------------------------------------------------------------------- // Status: RELEASED int adat_power2mW( RIG * pRig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if(( pRig == NULL ) || ( mwpower == NULL )) { nRC = -RIG_EARG; } else { *mwpower = power * ADAT_MAX_POWER_IN_mW; } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_mW2power // --------------------------------------------------------------------------- // Status: RELEASED int adat_mW2power( RIG * pRig, float *power, unsigned int mwpower, freq_t freq, rmode_t mode ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if(( pRig == NULL ) || ( power == NULL )) { nRC = -RIG_EARG; } else { *power = mwpower / ((float)ADAT_MAX_POWER_IN_mW); } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_get_powerstat // --------------------------------------------------------------------------- // Status: RELEASED int adat_get_powerstat( RIG *pRig, powerstat_t *status ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { //adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; nRC = adat_transaction( pRig, &adat_cmd_list_get_powerstatus ); // nRC < 0 -> Power is off. if( nRC == RIG_OK ) { *status = RIG_POWER_ON; } else { *status = RIG_POWER_OFF; nRC = RIG_OK; } } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_set_conf // --------------------------------------------------------------------------- // Status: IN WORK int adat_set_conf( RIG *pRig, token_t token, const char *val ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; switch( token ) { case TOKEN_ADAT_PRODUCT_NAME: pPriv->pcProductName = strdup( val ); break; default: nRC = -RIG_EINVAL; } } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_get_conf // --------------------------------------------------------------------------- // Status: IN WORK int adat_get_conf(RIG *pRig, token_t token, char *val) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; switch( token ) { case TOKEN_ADAT_PRODUCT_NAME: val = pPriv->pcProductName; break; default: nRC = -RIG_EINVAL; } } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_reset // --------------------------------------------------------------------------- // Status: IN WORK int adat_reset( RIG *pRig, reset_t reset ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { //adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // Function adat_handle_event // --------------------------------------------------------------------------- // Status: IN WORK int adat_handle_event( RIG *pRig ) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = 0x%08x\n", gFnLevel, __func__, __FILE__, __LINE__, pRig ); // Check Params if( pRig == NULL ) { nRC = -RIG_EARG; } else { //adat_priv_data_ptr pPriv = (adat_priv_data_ptr) pRig->state.priv; char acBuf[ ADAT_RESPSZ + 1 ]; memset( acBuf, 0, ADAT_RESPSZ + 1 ); adat_receive( pRig, acBuf ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d Event data = \"%s\"\n", gFnLevel, acBuf ); } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // initrigs_adat is called by rig_backend_load // --------------------------------------------------------------------------- // Status: RELEASED DECLARE_INITRIG_BACKEND(adat) { int nRC = RIG_OK; gFnLevel++; #if 0 rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY.\n", gFnLevel, __func__, __FILE__, __LINE__ ); #endif rig_register( &adt_200a_caps ); #if 0 rig_debug( RIG_DEBUG_VERBOSE, "ADAT: Rig ADT-200A registered.\n" ); rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); #endif gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // proberig_adat // --------------------------------------------------------------------------- // Status: UNTESTED DECLARE_PROBERIG_BACKEND(adat) { int nRC = RIG_OK; gFnLevel++; rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): ENTRY.\n", gFnLevel, __func__, __FILE__, __LINE__ ); if (!port) return RIG_MODEL_NONE; if (port->type.rig != RIG_PORT_SERIAL) return RIG_MODEL_NONE; port->write_delay = port->post_write_delay = 10; port->parm.serial.stop_bits = 0; port->retry = 1; nRC = serial_open(port); if( nRC != RIG_OK) { nRC = RIG_MODEL_NONE; } else { char acBuf[ ADAT_RESPSZ + 1 ]; int nRead = 0; memset( acBuf, 0, ADAT_RESPSZ + 1 ); nRC = write_block( port, ADAT_CMD_DEF_STRING_GET_ID_CODE, strlen( ADAT_CMD_DEF_STRING_GET_ID_CODE ) ); nRead = read_string(port, acBuf, ADAT_RESPSZ, ADAT_EOM, 1); close( port->fd ); if(( nRC != RIG_OK || nRead < 0 )) { nRC = RIG_MODEL_NONE; } else { rig_debug( RIG_DEBUG_VERBOSE, "ADAT: %d Received ID = %s.", gFnLevel, acBuf ); nRC = RIG_MODEL_ADT_200A; } } rig_debug( RIG_DEBUG_TRACE, "*** ADAT: %d %s (%s:%d): EXIT. Return Code = %d\n", gFnLevel, __func__, __FILE__, __LINE__, nRC ); gFnLevel--; return nRC; } // --------------------------------------------------------------------------- // END OF FILE // --------------------------------------------------------------------------- hamlib-1.2.15.3/adat/adt_200a.c0000644000175000017500000001636112044564477012511 00000000000000// --------------------------------------------------------------------------- // ADT-200A HAMLIB BACKEND // --------------------------------------------------------------------------- // // adt_200a.c // // Created by Frank Goenninger DG1SBG. // Copyright © 2011, 2012 Frank Goenninger. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library 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 // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #ifdef HAVE_CONFIG_H #include "config.h" #endif // --------------------------------------------------------------------------- // ADT-200A INCLUDES // --------------------------------------------------------------------------- #include "adt_200a.h" // --------------------------------------------------------------------------- // GLOBAL DEFINITIONS // --------------------------------------------------------------------------- // GLOBAL VARS // static const struct confparams adt_200a_cfg_params[] = // { // { TOKEN_PRODUCT_NAME, "usb_product_name", "USB Product Name", "USB Product Name (DSP Bo // Model + ' Serial '+ ID Code, e.g. 'TRX3C Serial C945D5B' )", // ADT_200A_PRODUCT_NAME, RIG_CONF_STRING, { .n = { 0,0,0 } } // }, // // { RIG_CONF_END, NULL, } //}; // --------------------------------------------------------------------------- // ADT-200A HAMLIB CAPS / DESCRIPTION // --------------------------------------------------------------------------- const struct rig_caps adt_200a_caps = { .rig_model = RIG_MODEL_ADT_200A, .model_name = "ADT-200A", .mfg_name = "ADAT www.adat.ch", .version = "1.36", .copyright = "Frank Goenninger, DG1SBG. License: Creative Commons", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 115200, .serial_rate_max = 115200, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 20, .timeout = 250, .retry = 3, .has_get_func = ADT_200A_FUNCS, .has_set_func = ADT_200A_FUNCS, .has_get_level = ADT_200A_GET_LEVEL, .has_set_level = RIG_LEVEL_SET(ADT_200A_SET_LEVEL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { 5, 10, RIG_DBLST_END, }, .attenuator = { 5, 10, 15, 20, 25, RIG_DBLST_END, }, .max_rit = ADT_200A_RIT, .max_xit = ADT_200A_XIT, .max_ifshift = Hz(500), .targetable_vfo = RIG_TARGETABLE_NONE, .transceive = 0, .bank_qty = 1, .chan_desc_sz = ADAT_MEM_DESC_SIZE, .chan_list = { { 0, 99, RIG_MTYPE_MEM, ADAT_MEM_CAPS }, RIG_CHAN_END, }, .rx_range_list1 = { { kHz(10), MHz(30), ADT_200A_MODES, -1, -1, ADT_200A_VFO }, RIG_FRNG_END, }, .tx_range_list1 = { { kHz(10), MHz(30), ADT_200A_MODES, mW(100), W(50), ADT_200A_VFO }, RIG_FRNG_END, }, .rx_range_list2 = { { kHz(10), MHz(30), ADT_200A_MODES, -1, -1, ADT_200A_VFO }, RIG_FRNG_END, }, .tx_range_list2 = { { kHz(10), MHz(30), ADT_200A_MODES, mW(100), W(50), ADT_200A_VFO }, RIG_FRNG_END, }, .tuning_steps = { { ADT_200A_MODES, RIG_TS_ANY }, // TODO: get actual list here RIG_TS_END, }, .filters = { { RIG_MODE_CW|RIG_MODE_CWR, Hz(50) }, { RIG_MODE_CW|RIG_MODE_CWR, Hz(75) }, { RIG_MODE_CW|RIG_MODE_CWR, Hz(100) }, { RIG_MODE_CW|RIG_MODE_CWR, Hz(150) }, { RIG_MODE_CW|RIG_MODE_CWR, Hz(200) }, { RIG_MODE_CW|RIG_MODE_CWR, Hz(300) }, { RIG_MODE_CW|RIG_MODE_CWR, Hz(750) }, { RIG_MODE_CW|RIG_MODE_CWR, Hz(1000) }, { RIG_MODE_CW|RIG_MODE_CWR, Hz(1200) }, { RIG_MODE_LSB|RIG_MODE_USB, Hz(300) }, { RIG_MODE_LSB|RIG_MODE_USB, Hz(500) }, { RIG_MODE_LSB|RIG_MODE_USB, Hz(750) }, { RIG_MODE_LSB|RIG_MODE_USB, Hz(1000) }, { RIG_MODE_LSB|RIG_MODE_USB, Hz(1200) }, { RIG_MODE_LSB|RIG_MODE_USB, Hz(1500) }, { RIG_MODE_LSB|RIG_MODE_USB, Hz(1800) }, { RIG_MODE_LSB|RIG_MODE_USB, Hz(2000) }, { RIG_MODE_LSB|RIG_MODE_USB, Hz(2200) }, { RIG_MODE_LSB|RIG_MODE_USB, Hz(2400) }, { RIG_MODE_LSB|RIG_MODE_USB, Hz(2700) }, { RIG_MODE_LSB|RIG_MODE_USB, Hz(3500) }, { RIG_MODE_AM|RIG_MODE_SAL|RIG_MODE_SAH, Hz(3000) }, { RIG_MODE_AM|RIG_MODE_SAL|RIG_MODE_SAH, Hz(3500) }, { RIG_MODE_AM|RIG_MODE_SAL|RIG_MODE_SAH, Hz(4000) }, { RIG_MODE_AM|RIG_MODE_SAL|RIG_MODE_SAH, Hz(4500) }, { RIG_MODE_AM|RIG_MODE_SAL|RIG_MODE_SAH, Hz(5000) }, { RIG_MODE_AM|RIG_MODE_SAL|RIG_MODE_SAH, Hz(6000) }, { RIG_MODE_AM|RIG_MODE_SAL|RIG_MODE_SAH, Hz(7000) }, { RIG_MODE_AM|RIG_MODE_SAL|RIG_MODE_SAH, Hz(8000) }, { RIG_MODE_FM, Hz(6000) }, { RIG_MODE_FM, Hz(7000) }, { RIG_MODE_FM, Hz(8000) }, { RIG_MODE_FM, Hz(9000) }, { RIG_MODE_FM, Hz(10000) }, { RIG_MODE_FM, Hz(11000) }, { RIG_MODE_FM, Hz(12000) }, RIG_FLT_END, }, // .cfgparams = adt_200a_cfg_params, .rig_init = adat_init, .rig_cleanup = adat_cleanup, .rig_open = adat_open, .reset = adat_reset, .rig_close = adat_close, .set_conf = adat_set_conf, .get_conf = adat_get_conf, .set_freq = adat_set_freq, .get_freq = adat_get_freq, .get_level = adat_get_level, .set_level = adat_set_level, .set_mode = adat_set_mode, .get_mode = adat_get_mode, .get_vfo = adat_get_vfo, .set_vfo = adat_set_vfo, .get_ptt = adat_get_ptt, .set_ptt = adat_set_ptt, .decode_event = adat_handle_event, .get_info = adat_get_info, .power2mW = adat_power2mW, .mW2power = adat_mW2power, .get_powerstat = adat_get_powerstat }; // --------------------------------------------------------------------------- // END OF FILE // --------------------------------------------------------------------------- hamlib-1.2.15.3/adat/Makefile.in0000644000175000017500000004755412044564550013120 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = adat DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_adat_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = adt_200a.lo adat.lo am_hamlib_adat_la_OBJECTS = $(am__objects_1) hamlib_adat_la_OBJECTS = $(am_hamlib_adat_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_adat_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_adat_la_LDFLAGS) $(LDFLAGS) -o \ $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_adat_la_SOURCES) DIST_SOURCES = $(hamlib_adat_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ADATSRC = adt_200a.c adat.c pkglib_LTLIBRARIES = hamlib-adat.la hamlib_adat_la_SOURCES = $(ADATSRC) hamlib_adat_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_adat_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = adat.h adt_200a.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu adat/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu adat/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-adat.la: $(hamlib_adat_la_OBJECTS) $(hamlib_adat_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_adat_la_LINK) -rpath $(pkglibdir) $(hamlib_adat_la_OBJECTS) $(hamlib_adat_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adt_200a.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/adat/Makefile.am0000644000175000017500000000040012044564477013072 00000000000000ADATSRC = adt_200a.c adat.c pkglib_LTLIBRARIES = hamlib-adat.la hamlib_adat_la_SOURCES = $(ADATSRC) hamlib_adat_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_adat_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = adat.h adt_200a.h hamlib-1.2.15.3/adat/adt_200a.h0000644000175000017500000000706312044564477012515 00000000000000// --------------------------------------------------------------------------- // ADT-200A // --------------------------------------------------------------------------- // // adt_200a.h // // Created by Frank Goenninger DG1SBG. // Copyright © 2011, 2012 Frank Goenninger. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library 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 // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #if !defined( __ADT_200A_INCLUDED__ ) #define __ADT_200A_INCLUDED__ // --------------------------------------------------------------------------- // ADAT INCLUDES // --------------------------------------------------------------------------- #include "adat.h" // --------------------------------------------------------------------------- // ADT-200A USB DEFINITIONS // --------------------------------------------------------------------------- #define ADT_200A_VENDOR_ID 0x0403 #define ADT_200A_PRODUCT_ID 0x6001 #define ADT_200A_VENDOR_NAME "FTDI" #define ADT_200A_PRODUCT_NAME "TRX3C Serial C945D5B" #define ADT_200A_USB_INTERFACE_NR 0x00 #define ADT_200A_USB_CONFIGURATION_VALUE 0x01 #define ADT_200A_ALTERNATE_SETTIMG 0x00 #define ADT_200A_USB_INPUT_ENDPOINT 0x81 #define ADT_200A_USB_INPUT_MAX_PACKET_SIZE 64 #define ADT_200A_USB_OUTPUT_ENDPOINT b0x02 #define ADT_200A_USB_OUTPUT_MAX_PACKET_SIZE 64 // --------------------------------------------------------------------------- // ADT-200A CAPS DEFINITIONS // --------------------------------------------------------------------------- #define ADT_200A_GET_LEVEL \ ( \ RIG_LEVEL_PREAMP | \ RIG_LEVEL_ATT | \ RIG_LEVEL_AF | \ RIG_LEVEL_NR | \ RIG_LEVEL_CWPITCH | \ RIG_LEVEL_RFPOWER | \ RIG_LEVEL_MICGAIN | \ RIG_LEVEL_KEYSPD | \ RIG_LEVEL_METER | \ RIG_LEVEL_BKIN_DLYMS | \ RIG_LEVEL_RAWSTR | \ RIG_LEVEL_SWR | \ RIG_LEVEL_ALC ) #define ADT_200A_SET_LEVEL \ ( \ RIG_LEVEL_PREAMP | \ RIG_LEVEL_ATT | \ RIG_LEVEL_AF | \ RIG_LEVEL_NR | \ RIG_LEVEL_CWPITCH | \ RIG_LEVEL_RFPOWER | \ RIG_LEVEL_MICGAIN | \ RIG_LEVEL_KEYSPD | \ RIG_LEVEL_METER | \ RIG_LEVEL_BKIN_DLYMS | \ RIG_LEVEL_ALC ) #define ADT_200A_MODES \ ( \ RIG_MODE_AM | \ RIG_MODE_CW | \ RIG_MODE_USB | \ RIG_MODE_LSB | \ RIG_MODE_FM | \ RIG_MODE_CWR | \ RIG_MODE_SAL | \ RIG_MODE_SAH ) // ADT-200A VFO #defines #define ADT_200A_FRA RIG_VFO_N(0) #define ADT_200A_FRB RIG_VFO_N(1) #define ADT_200A_FRC RIG_VFO_N(2) #define ADT_200A_VFO (ADT_200A_FRA|ADT_200A_FRB|ADT_200A_FRC) #define ADT_200A_RIT 9999 #define ADT_200A_XIT 9999 // ADT-200A FUNCs #define ADT_200A_FUNCS (RIG_FUNC_VOX|RIG_FUNC_NB|RIG_FUNC_NR) // --------------------------------------------------------------------------- // END OF FILE // --------------------------------------------------------------------------- #endif hamlib-1.2.15.3/COPYING.LIB0000644000175000017500000006364212044564477011606 00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! hamlib-1.2.15.3/rpcrig/0000755000175000017500000000000012044565023011465 500000000000000hamlib-1.2.15.3/rpcrig/rpcrig_backend.c0000644000175000017500000006006612044564477014532 00000000000000/* * Hamlib RPC backend - main file * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "token.h" #include "register.h" #include #ifdef HAVE_RPC_RPCENT_H #include #endif #include "rpcrig.h" #include "rpcrig_backend.h" #define RIGPROTO "udp" /* * Borrowed from stringify.h * Indirect stringification. Doing two levels allows the parameter to be a * macro itself. For example, compile with -DFOO=bar, __stringify(FOO) * converts to "bar". */ #define r_stringify_1(x) #x #define r_stringify(x) r_stringify_1(x) struct rpcrig_priv_data { CLIENT *cl; unsigned long prognum; }; #define SETBODY1(f, rpc_type, rig_arg) \ struct rpcrig_priv_data *priv; \ int *result; \ rpc_type##_x arg; \ \ priv = (struct rpcrig_priv_data*)rig->state.priv; \ \ arg = rig_arg; \ result = f##_1(&arg, priv->cl); \ if (result == NULL) { \ clnt_perror(priv->cl, "##f##_1"); \ return -RIG_EPROTO; \ } \ \ return *result; #define GETBODY1(f, rpc_type, rig_arg) \ struct rpcrig_priv_data *priv; \ rpc_type##_x arg; \ rpc_type##_res *res; \ \ priv = (struct rpcrig_priv_data*)rig->state.priv; \ \ arg = *rig_arg; \ res = f##_1(&arg, priv->cl); \ if (res == NULL) { \ clnt_perror(priv->cl, "##f##_1"); \ return -RIG_EPROTO; \ } \ if (res->rigstatus == RIG_OK) \ *rig_arg = res->rpc_type##_res_u.rpc_type; \ \ return res->rigstatus; #define SETBODYVFO1(f, rpc_type, rig_arg) \ struct rpcrig_priv_data *priv; \ int *result; \ rpc_type##_arg arg; \ \ priv = (struct rpcrig_priv_data*)rig->state.priv; \ \ arg.vfo = vfo; \ arg.rpc_type = rig_arg; \ result = f##_1(&arg, priv->cl); \ if (result == NULL) { \ clnt_perror(priv->cl, "##f##_1"); \ return -RIG_EPROTO; \ } \ \ return *result; #define GETBODYVFO1(f, rpc_type, rig_arg) \ struct rpcrig_priv_data *priv; \ rpc_type##_res *res; \ vfo_x v; \ \ priv = (struct rpcrig_priv_data*)rig->state.priv; \ \ v = vfo; \ res = f##_1(&v, priv->cl); \ if (res == NULL) { \ clnt_perror(priv->cl, "##f##_1"); \ return -RIG_EPROTO; \ } \ if (res->rigstatus == RIG_OK) \ *rig_arg = res->rpc_type##_res_u.rpc_type; \ \ return res->rigstatus; static unsigned long extract_prognum(const char val[]) { if (val[0] == '+') { return RIGPROG + atol(val+1); } else if (val[0] < '0' || val[0] > '9') { struct rpcent *ent; ent = getrpcbyname (val); if (ent) return ent->r_number; else return 0; } else return atol(val); } static int rpcrig_init(RIG *rig) { struct rpcrig_priv_data *priv; if (!rig || !rig->caps) return -RIG_EINVAL; rig->state.priv = malloc(sizeof(struct rpcrig_priv_data)); if (!rig->state.priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } priv = (struct rpcrig_priv_data*)rig->state.priv; rig->state.rigport.type.rig = RIG_PORT_RPC; rig->state.pttport.type.ptt = RIG_PTT_RIG; rig->state.dcdport.type.dcd = RIG_DCD_RIG; strcpy(rig->state.rigport.pathname, "localhost"); priv->prognum = RIGPROG; return RIG_OK; } static int rpcrig_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * assumes rig!=NULL, rs->priv != NULL */ static int rpcrig_open(RIG *rig) { struct rpcrig_priv_data *priv; struct rig_state *rs; model_x *mdl_res; rigstate_res *rs_res; rig_model_t model; // const struct rig_caps *caps; char *server, *s; int i; rs = &rig->state; priv = (struct rpcrig_priv_data*)rs->priv; server = strdup(rs->rigport.pathname); s = strchr(server, ':'); if (s) { unsigned long prognum; *s = '\0'; prognum = extract_prognum(s+1); if (prognum == 0) { free(server); return -RIG_ECONF; } priv->prognum = prognum; } priv->cl = clnt_create(server, priv->prognum, RIGVERS, RIGPROTO); if (priv->cl == NULL) { clnt_pcreateerror(server); free(server); return -RIG_ECONF; } mdl_res = getmodel_1(NULL, priv->cl); if (mdl_res == NULL) { clnt_perror(priv->cl, server); clnt_destroy(priv->cl); free(server); priv->cl = NULL; return -RIG_EPROTO; } model = *mdl_res; rig_debug(RIG_DEBUG_VERBOSE,"%s: model %d\n", __FUNCTION__, model); /* * autoload if necessary */ rig_check_backend(model); // caps = rig_get_caps(model); /* * TODO: decide if it's the way to go. * This for example breaks reentrancy */ //memcpy(&rpcrig_caps, caps, sizeof(struct rig_caps)); /* * TODO: get these from RPC instead */ rs_res = getrigstate_1(NULL, priv->cl); if (rs_res == NULL) { clnt_perror(priv->cl, server); clnt_destroy(priv->cl); free(server); priv->cl = NULL; return -RIG_EPROTO; } free(server); rs->has_get_func = rs_res->rigstate_res_u.state.has_get_func; rs->has_set_func = rs_res->rigstate_res_u.state.has_set_func; rs->has_get_level = rs_res->rigstate_res_u.state.has_get_level; rs->has_set_level = rs_res->rigstate_res_u.state.has_set_level; rs->has_get_parm = rs_res->rigstate_res_u.state.has_get_parm; rs->has_set_parm = rs_res->rigstate_res_u.state.has_set_parm; rs->max_rit = rs_res->rigstate_res_u.state.max_rit; rs->max_xit = rs_res->rigstate_res_u.state.max_xit; rs->max_ifshift = rs_res->rigstate_res_u.state.max_ifshift; rs->announces = rs_res->rigstate_res_u.state.announces; memcpy(rs->preamp, rs_res->rigstate_res_u.state.preamp, sizeof(int)*MAXDBLSTSIZ); memcpy(rs->attenuator, rs_res->rigstate_res_u.state.attenuator, sizeof(int)*MAXDBLSTSIZ); memcpy(rs->tuning_steps, rs_res->rigstate_res_u.state.tuning_steps, sizeof(struct tuning_step_list)*TSLSTSIZ); memcpy(rs->filters, rs_res->rigstate_res_u.state.filters, sizeof(struct filter_list)*FLTLSTSIZ); memcpy(rs->chan_list, rs_res->rigstate_res_u.state.chan_list, sizeof(chan_t)*CHANLSTSIZ); memcpy(rs->rx_range_list, rs_res->rigstate_res_u.state.rx_range_list, sizeof(freq_range_t)*FRQRANGESIZ); memcpy(rs->tx_range_list, rs_res->rigstate_res_u.state.tx_range_list, sizeof(freq_range_t)*FRQRANGESIZ); for (i=0; irx_range_list[i]); i++) { rs->vfo_list |= rs->rx_range_list[i].vfo; } for (i=0; itx_range_list[i]); i++) { rs->vfo_list |= rs->tx_range_list[i].vfo; } return RIG_OK; } static int rpcrig_close(RIG *rig) { struct rpcrig_priv_data *priv; priv = (struct rpcrig_priv_data*)rig->state.priv; if (priv->cl) clnt_destroy(priv->cl); return RIG_OK; } static int rpcrig_set_vfo(RIG *rig, vfo_t vfo) { SETBODY1(setvfo, vfo, vfo); } static int rpcrig_get_vfo(RIG *rig, vfo_t *vfo) { GETBODY1(getvfo, vfo, vfo); } static int rpcrig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct rpcrig_priv_data *priv; struct rig_state *rs; int *result; freq_arg farg; rs = &rig->state; priv = (struct rpcrig_priv_data*)rs->priv; farg.vfo = vfo; freq_t2x(freq, &farg.freq); result = setfreq_1(&farg, priv->cl); if (result == NULL) { clnt_perror(priv->cl, "setfreq_1"); return -RIG_EPROTO; } return *result; } static int rpcrig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct rpcrig_priv_data *priv; struct rig_state *rs; freq_res *fres; vfo_x v; rs = &rig->state; priv = (struct rpcrig_priv_data*)rs->priv; v = vfo; fres = getfreq_1(&v, priv->cl); if (fres == NULL) { clnt_perror(priv->cl, "getfreq_1"); return -RIG_EPROTO; } if (fres->rigstatus == RIG_OK) *freq = freq_x2t(&fres->freq_res_u.freq); return fres->rigstatus; } static int rpcrig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct rpcrig_priv_data *priv; int *result; mode_arg marg; priv = (struct rpcrig_priv_data*)rig->state.priv; marg.vfo = vfo; mode_t2s(mode, width, &marg.mw); result = setmode_1(&marg, priv->cl); if (result == NULL) { clnt_perror(priv->cl, "setmode_1"); return -RIG_EPROTO; } return *result; } static int rpcrig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct rpcrig_priv_data *priv; mode_res *mres; vfo_x v; priv = (struct rpcrig_priv_data*)rig->state.priv; v = vfo; mres = getmode_1(&v, priv->cl); if (mres == NULL) { clnt_perror(priv->cl, "getmode_1"); return -RIG_EPROTO; } if (mres->rigstatus == RIG_OK) mode_s2t(&mres->mode_res_u.mw, mode, width); return mres->rigstatus; } static int rpcrig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) { struct rpcrig_priv_data *priv; struct rig_state *rs; int *result; freq_arg farg; rs = &rig->state; priv = (struct rpcrig_priv_data*)rs->priv; farg.vfo = vfo; freq_t2x(tx_freq, &farg.freq); result = setsplitfreq_1(&farg, priv->cl); if (result == NULL) { clnt_perror(priv->cl, "setsplitfreq_1"); return -RIG_EPROTO; } return *result; } static int rpcrig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) { struct rpcrig_priv_data *priv; struct rig_state *rs; freq_res *fres; vfo_x v; rs = &rig->state; priv = (struct rpcrig_priv_data*)rs->priv; v = vfo; fres = getsplitfreq_1(&v, priv->cl); if (fres == NULL) { clnt_perror(priv->cl, "getsplitfreq_1"); return -RIG_EPROTO; } if (fres->rigstatus == RIG_OK) *tx_freq = freq_x2t(&fres->freq_res_u.freq); return fres->rigstatus; } static int rpcrig_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width) { struct rpcrig_priv_data *priv; int *result; mode_arg marg; priv = (struct rpcrig_priv_data*)rig->state.priv; marg.vfo = vfo; mode_t2s(tx_mode, tx_width, &marg.mw); result = setsplitmode_1(&marg, priv->cl); if (result == NULL) { clnt_perror(priv->cl, "setsplitmode_1"); return -RIG_EPROTO; } return *result; } static int rpcrig_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width) { struct rpcrig_priv_data *priv; mode_res *mres; vfo_x v; priv = (struct rpcrig_priv_data*)rig->state.priv; v = vfo; mres = getsplitmode_1(&v, priv->cl); if (mres == NULL) { clnt_perror(priv->cl, "getsplitmode_1"); return -RIG_EPROTO; } if (mres->rigstatus == RIG_OK) mode_s2t(&mres->mode_res_u.mw, tx_mode, tx_width); return mres->rigstatus; } static int rpcrig_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { struct rpcrig_priv_data *priv; int *result; split_arg arg; priv = (struct rpcrig_priv_data*)rig->state.priv; arg.vfo = vfo; arg.split = split; arg.tx_vfo = tx_vfo; result = setsplitvfo_1(&arg, priv->cl); if (result == NULL) { clnt_perror(priv->cl, "setsplitvfo_1"); return -RIG_EPROTO; } return *result; } static int rpcrig_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { struct rpcrig_priv_data *priv; split_res *res; vfo_x v; priv = (struct rpcrig_priv_data*)rig->state.priv; v = vfo; res = getsplitvfo_1(&v, priv->cl); if (res == NULL) { clnt_perror(priv->cl, "getsplitvfo_1"); return -RIG_EPROTO; } if (res->rigstatus == RIG_OK) { *split = res->split_res_u.split.split; *tx_vfo = res->split_res_u.split.tx_vfo; } return res->rigstatus; } static int rpcrig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { SETBODYVFO1(setptt, ptt, ptt); } static int rpcrig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { GETBODYVFO1(getptt, ptt, ptt); } static int rpcrig_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { GETBODYVFO1(getdcd, dcd, dcd); } static int rpcrig_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift) { SETBODYVFO1(setrptrshift, rptrshift, rptr_shift); } static int rpcrig_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift) { GETBODYVFO1(getrptrshift, rptrshift, rptr_shift); } static int rpcrig_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs) { SETBODYVFO1(setrptroffs, shortfreq, rptr_offs); } static int rpcrig_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs) { GETBODYVFO1(getrptroffs, shortfreq, rptr_offs); } static int rpcrig_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone) { SETBODYVFO1(setctcsstone, tone, tone); } static int rpcrig_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone) { GETBODYVFO1(getctcsstone, tone, tone); } static int rpcrig_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code) { SETBODYVFO1(setdcscode, tone, code); } static int rpcrig_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code) { GETBODYVFO1(getdcscode, tone, code); } static int rpcrig_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone) { SETBODYVFO1(setctcsssql, tone, tone); } static int rpcrig_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone) { GETBODYVFO1(getctcsssql, tone, tone); } static int rpcrig_set_dcs_sql(RIG *rig, vfo_t vfo, unsigned int code) { SETBODYVFO1(setdcssql, tone, code); } static int rpcrig_get_dcs_sql(RIG *rig, vfo_t vfo, unsigned int *code) { GETBODYVFO1(getdcssql, tone, code); } static int rpcrig_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { SETBODYVFO1(setrit, shortfreq, rit); } static int rpcrig_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { GETBODYVFO1(getrit, shortfreq, rit); } static int rpcrig_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit) { SETBODYVFO1(setxit, shortfreq, xit); } static int rpcrig_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit) { GETBODYVFO1(getxit, shortfreq, xit); } static int rpcrig_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) { SETBODYVFO1(setts, shortfreq, ts); } static int rpcrig_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) { GETBODYVFO1(getts, shortfreq, ts); } static int rpcrig_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { struct rpcrig_priv_data *priv; int *result; setting_arg arg; priv = (struct rpcrig_priv_data*)rig->state.priv; arg.vfo = vfo; setting_t2x(func, &arg.setting); arg.val.i = status; result = setfunc_1(&arg, priv->cl); if (result == NULL) { clnt_perror(priv->cl, "setfunc_1"); return -RIG_EPROTO; } return *result; } static int rpcrig_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { struct rpcrig_priv_data *priv; val_res *res; setting_arg arg; priv = (struct rpcrig_priv_data*)rig->state.priv; arg.vfo = vfo; setting_t2x(func, &arg.setting); arg.val.i = *status; res = getfunc_1(&arg, priv->cl); if (res == NULL) { clnt_perror(priv->cl, "getfunc_1"); return -RIG_EPROTO; } if (res->rigstatus == RIG_OK) *status = res->val_res_u.val.i; return res->rigstatus; } static int rpcrig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct rpcrig_priv_data *priv; int *result; setting_arg arg; priv = (struct rpcrig_priv_data*)rig->state.priv; arg.vfo = vfo; setting_t2x(level, &arg.setting); if (RIG_LEVEL_IS_FLOAT(level)) arg.val.f = val.f; else arg.val.i = val.i; result = setlevel_1(&arg, priv->cl); if (result == NULL) { clnt_perror(priv->cl, "setlevel_1"); return -RIG_EPROTO; } return *result; } static int rpcrig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct rpcrig_priv_data *priv; val_res *res; setting_arg arg; priv = (struct rpcrig_priv_data*)rig->state.priv; arg.vfo = vfo; setting_t2x(level, &arg.setting); if (RIG_LEVEL_IS_FLOAT(level)) arg.val.f = val->f; else arg.val.i = val->i; res = getlevel_1(&arg, priv->cl); if (res == NULL) { clnt_perror(priv->cl, "getlevel_1"); return -RIG_EPROTO; } if (res->rigstatus == RIG_OK) { if (RIG_LEVEL_IS_FLOAT(level)) val->f = res->val_res_u.val.f; else val->i = res->val_res_u.val.i; } return res->rigstatus; } static int rpcrig_set_parm(RIG *rig, setting_t parm, value_t val) { struct rpcrig_priv_data *priv; int *result; setting_arg arg; priv = (struct rpcrig_priv_data*)rig->state.priv; setting_t2x(parm, &arg.setting); if (RIG_PARM_IS_FLOAT(parm)) arg.val.f = val.f; else arg.val.i = val.i; result = setparm_1(&arg, priv->cl); if (result == NULL) { clnt_perror(priv->cl, "setparm_1"); return -RIG_EPROTO; } return *result; } static int rpcrig_get_parm(RIG *rig, setting_t parm, value_t *val) { struct rpcrig_priv_data *priv; val_res *res; setting_arg arg; priv = (struct rpcrig_priv_data*)rig->state.priv; setting_t2x(parm, &arg.setting); if (RIG_LEVEL_IS_FLOAT(parm)) arg.val.f = val->f; else arg.val.i = val->i; res = getparm_1(&arg, priv->cl); if (res == NULL) { clnt_perror(priv->cl, "getparm_1"); return -RIG_EPROTO; } if (res->rigstatus == RIG_OK) { if (RIG_PARM_IS_FLOAT(parm)) val->f = res->val_res_u.val.f; else val->i = res->val_res_u.val.i; } return res->rigstatus; } static int rpcrig_scan(RIG *rig, vfo_t vfo, scan_t rscan, int ch) { struct rpcrig_priv_data *priv; int *result; scan_arg arg; priv = (struct rpcrig_priv_data*)rig->state.priv; arg.vfo = vfo; arg.scan = rscan; arg.ch = ch; result = scan_1(&arg, priv->cl); if (result == NULL) { clnt_perror(priv->cl, "scan_1"); return -RIG_EPROTO; } return *result; } static int rpcrig_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { SETBODYVFO1(vfoop, vfo_op, op); } static int rpcrig_set_ant(RIG *rig, vfo_t vfo, ant_t ant) { SETBODYVFO1(setant, ant, ant); } static int rpcrig_get_ant(RIG *rig, vfo_t vfo, ant_t *ant) { GETBODYVFO1(getant, ant, ant); } static int rpcrig_set_bank(RIG *rig, vfo_t vfo, int bank) { SETBODYVFO1(setbank, ch, bank); } static int rpcrig_set_mem(RIG *rig, vfo_t vfo, int ch) { SETBODYVFO1(setmem, ch, ch); } static int rpcrig_get_mem(RIG *rig, vfo_t vfo, int *ch) { GETBODYVFO1(getmem, ch, ch); } static int rpcrig_set_channel(RIG *rig, const channel_t *chan) { rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); return -RIG_ENIMPL; } static int rpcrig_get_channel(RIG *rig, channel_t *chan) { rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); return -RIG_ENIMPL; } static int rpcrig_reset(RIG *rig, reset_t reset) { SETBODY1(reset, reset, reset); } static int rpcrig_set_powerstat(RIG *rig, powerstat_t status) { SETBODY1(setpowerstat, powerstat, status); } static int rpcrig_get_powerstat(RIG *rig, powerstat_t *status) { GETBODY1(getpowerstat, powerstat, status); } static int rpcrig_set_trn(RIG *rig, int trn) { rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); return -RIG_ENIMPL; } static int rpcrig_get_trn(RIG *rig, int *trn) { rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); return -RIG_ENIMPL; } static const char *rpcrig_get_info(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); return ""; } static int rpcrig_send_dtmf(RIG *rig, vfo_t vfo, const char *digits) { rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); return -RIG_ENIMPL; } static int rpcrig_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length) { rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); return -RIG_ENIMPL; } static int rpcrig_send_morse(RIG *rig, vfo_t vfo, const char *msg) { rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); return -RIG_ENIMPL; } #define TOK_PROGNUM TOKEN_BACKEND(1) static const struct confparams rpcrig_cfg_params[] = { { TOK_PROGNUM, "prognum", "Program number", "RPC program number", r_stringify(RIGPROG), RIG_CONF_NUMERIC, { .n = { 100000, ULONG_MAX, 1 } } }, { RIG_CONF_END, NULL, } }; /* * Assumes rig!=NULL, rig->state.priv!=NULL */ int rpcrig_set_conf(RIG *rig, token_t token, const char *val) { struct rpcrig_priv_data *priv; struct rig_state *rs; rs = &rig->state; priv = (struct rpcrig_priv_data*)rs->priv; switch(token) { case TOK_PROGNUM: { unsigned long prognum; prognum = extract_prognum(val); if (prognum == 0) return -RIG_EINVAL; priv->prognum = prognum; break; } default: return -RIG_EINVAL; } return RIG_OK; } /* * assumes rig!=NULL, * Assumes rig!=NULL, rig->state.priv!=NULL * and val points to a buffer big enough to hold the conf value. */ int rpcrig_get_conf(RIG *rig, token_t token, char *val) { struct rpcrig_priv_data *priv; struct rig_state *rs; rs = &rig->state; priv = (struct rpcrig_priv_data*)rs->priv; switch(token) { case TOK_PROGNUM: sprintf(val, "%ld", priv->prognum); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * Dummy rig capabilities. */ struct rig_caps rpcrig_caps = { .rig_model = RIG_MODEL_RPC, .model_name = "RPC rig", .mfg_name = "Hamlib", .version = "0.3", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_OTHER, .targetable_vfo = 0, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_NONE, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .chan_list = { RIG_CHAN_END, }, .transceive = RIG_TRN_OFF, .attenuator = { RIG_DBLST_END, }, .rx_range_list2 = { RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { RIG_TS_END, }, .priv = NULL, .rig_init = rpcrig_init, .rig_cleanup = rpcrig_cleanup, .rig_open = rpcrig_open, .rig_close = rpcrig_close, .cfgparams = rpcrig_cfg_params, .set_conf = rpcrig_set_conf, .get_conf = rpcrig_get_conf, .set_freq = rpcrig_set_freq, .get_freq = rpcrig_get_freq, .set_mode = rpcrig_set_mode, .get_mode = rpcrig_get_mode, .set_vfo = rpcrig_set_vfo, .get_vfo = rpcrig_get_vfo, .set_powerstat = rpcrig_set_powerstat, .get_powerstat = rpcrig_get_powerstat, .set_level = rpcrig_set_level, .get_level = rpcrig_get_level, .set_func = rpcrig_set_func, .get_func = rpcrig_get_func, .set_parm = rpcrig_set_parm, .get_parm = rpcrig_get_parm, .get_info = rpcrig_get_info, .set_ptt = rpcrig_set_ptt, .get_ptt = rpcrig_get_ptt, .get_dcd = rpcrig_get_dcd, .set_rptr_shift = rpcrig_set_rptr_shift, .get_rptr_shift = rpcrig_get_rptr_shift, .set_rptr_offs = rpcrig_set_rptr_offs, .get_rptr_offs = rpcrig_get_rptr_offs, .set_ctcss_tone = rpcrig_set_ctcss_tone, .get_ctcss_tone = rpcrig_get_ctcss_tone, .set_dcs_code = rpcrig_set_dcs_code, .get_dcs_code = rpcrig_get_dcs_code, .set_ctcss_sql = rpcrig_set_ctcss_sql, .get_ctcss_sql = rpcrig_get_ctcss_sql, .set_dcs_sql = rpcrig_set_dcs_sql, .get_dcs_sql = rpcrig_get_dcs_sql, .set_split_freq = rpcrig_set_split_freq, .get_split_freq = rpcrig_get_split_freq, .set_split_mode = rpcrig_set_split_mode, .get_split_mode = rpcrig_get_split_mode, .set_split_vfo = rpcrig_set_split_vfo, .get_split_vfo = rpcrig_get_split_vfo, .set_rit = rpcrig_set_rit, .get_rit = rpcrig_get_rit, .set_xit = rpcrig_set_xit, .get_xit = rpcrig_get_xit, .set_ts = rpcrig_set_ts, .get_ts = rpcrig_get_ts, .set_ant = rpcrig_set_ant, .get_ant = rpcrig_get_ant, .set_bank = rpcrig_set_bank, .set_mem = rpcrig_set_mem, .get_mem = rpcrig_get_mem, .vfo_op = rpcrig_vfo_op, .send_dtmf = rpcrig_send_dtmf, .recv_dtmf = rpcrig_recv_dtmf, .send_morse = rpcrig_send_morse, .set_channel = rpcrig_set_channel, .get_channel = rpcrig_get_channel, .set_trn = rpcrig_set_trn, .get_trn = rpcrig_get_trn, .scan = rpcrig_scan, .reset = rpcrig_reset, }; DECLARE_INITRIG_BACKEND(rpcrig) { rig_debug(RIG_DEBUG_VERBOSE, "rpcrig: _init called\n"); rig_register(&rpcrig_caps); return RIG_OK; } hamlib-1.2.15.3/rpcrig/rpcrig_proc.c0000644000175000017500000002446312044564477014107 00000000000000/* * Hamlib RPC server - procedures * Copyright (c) 2001-2003 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 #include #include "rpcrig.h" #include extern RIG *the_rpc_rig; /* without VFO arg */ #define DECLARESET1(f, rig_f, rpc_type) \ int * f##_1_svc(rpc_type *arg, struct svc_req *svc) \ { \ static int res; \ \ res = rig_f(the_rpc_rig, *arg); \ \ return &res; \ } #define DECLAREGET1(f, rig_f, rpc_type, rig_type) \ rpc_type##_res *f##_1_svc(void *rpc_arg, struct svc_req *svc) \ { \ static rpc_type##_res res; \ rig_type arg; \ \ res.rigstatus = rig_f(the_rpc_rig, &arg); \ res.rpc_type##_res_u.rpc_type = arg; \ \ return &res; \ } /* with VFO arg */ #define DECLARESETV1(f, rig_f, rpc_type) \ int *f##_1_svc(rpc_type##_arg *arg, struct svc_req *svc) \ { \ static int res; \ \ res = rig_f(the_rpc_rig, arg->vfo, arg->rpc_type); \ \ return &res; \ } #define DECLAREGETV1(f, rig_f, rpc_type, rig_type) \ rpc_type##_res *f##_1_svc(vfo_x *vfo, struct svc_req *svc) \ { \ static rpc_type##_res res; \ rig_type arg; \ \ res.rigstatus = rig_f(the_rpc_rig, *vfo, &arg); \ res.rpc_type##_res_u.rpc_type = arg; \ \ return &res; \ } model_x *getmodel_1_svc(void *arg, struct svc_req *svc) { static model_x res; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); /* free previous result */ //xdr_free(xdr_model, &res); res = the_rpc_rig->caps->rig_model; return &res; } rigstate_res *getrigstate_1_svc(void *arg, struct svc_req *svc) { static rigstate_res res; struct rig_state *rs; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); if (!the_rpc_rig->state.comm_state) { res.rigstatus = -RIG_ERJCTED; return &res; } rs = &the_rpc_rig->state; res.rigstate_res_u.state.itu_region = rs->itu_region; res.rigstate_res_u.state.has_set_func = rs->has_set_func; res.rigstate_res_u.state.has_get_func = rs->has_get_func; res.rigstate_res_u.state.has_set_level = rs->has_set_level; res.rigstate_res_u.state.has_get_level = rs->has_get_level; res.rigstate_res_u.state.has_set_parm = rs->has_set_parm; res.rigstate_res_u.state.has_get_parm = rs->has_get_parm; res.rigstate_res_u.state.max_rit = rs->max_rit; res.rigstate_res_u.state.max_xit = rs->max_xit; res.rigstate_res_u.state.max_ifshift = rs->max_ifshift; res.rigstate_res_u.state.announces = rs->announces; memcpy(res.rigstate_res_u.state.preamp, rs->preamp, sizeof(int)*MAXDBLSTSIZ); memcpy(res.rigstate_res_u.state.attenuator, rs->attenuator, sizeof(int)*MAXDBLSTSIZ); memcpy(res.rigstate_res_u.state.tuning_steps, rs->tuning_steps, sizeof(tuning_step_s)*TSLSTSIZ); memcpy(res.rigstate_res_u.state.filters, rs->filters, sizeof(filter_s)*FLTLSTSIZ); memcpy(res.rigstate_res_u.state.chan_list, rs->chan_list, sizeof(chan_s)*CHANLSTSIZ); memcpy(res.rigstate_res_u.state.rx_range_list, rs->rx_range_list, sizeof(freq_range_s)*FRQRANGESIZ); memcpy(res.rigstate_res_u.state.tx_range_list, rs->tx_range_list, sizeof(freq_range_s)*FRQRANGESIZ); res.rigstatus = RIG_OK; return &res; } int *setfreq_1_svc(freq_arg *farg, struct svc_req *svc) { static int res; res = rig_set_freq(the_rpc_rig, farg->vfo, freq_x2t(&farg->freq)); return &res; } freq_res *getfreq_1_svc(vfo_x *vfo, struct svc_req *svc) { static freq_res res; freq_t f; res.rigstatus = rig_get_freq(the_rpc_rig, *vfo, &f); freq_t2x(f, &res.freq_res_u.freq); return &res; } int *setmode_1_svc(mode_arg *marg, struct svc_req *svc) { static int res; rmode_t mode; pbwidth_t width; mode_s2t(&marg->mw, &mode, &width); res = rig_set_mode(the_rpc_rig, marg->vfo, mode, width); return &res; } mode_res *getmode_1_svc(vfo_x *vfo, struct svc_req *svc) { static mode_res res; rmode_t mode; pbwidth_t width; res.rigstatus = rig_get_mode(the_rpc_rig, *vfo, &mode, &width); mode_t2s(mode, width, &res.mode_res_u.mw); return &res; } DECLARESET1(setvfo, rig_set_vfo, vfo_x) vfo_res *getvfo_1_svc(vfo_x *vfo, struct svc_req *svc) { static vfo_res res; vfo_t v; v = *vfo; /* NB: arg vfo is also input argument to get_vfo */ res.rigstatus = rig_get_vfo(the_rpc_rig, &v); res.vfo_res_u.vfo = v; return &res; } int *setsplitfreq_1_svc(freq_arg *farg, struct svc_req *svc) { static int res; res = rig_set_split_freq(the_rpc_rig, farg->vfo, freq_x2t(&farg->freq)); return &res; } freq_res *getsplitfreq_1_svc(vfo_x *vfo, struct svc_req *svc) { static freq_res res; freq_t f; res.rigstatus = rig_get_split_freq(the_rpc_rig, *vfo, &f); freq_t2x(f, &res.freq_res_u.freq); return &res; } int *setsplitmode_1_svc(mode_arg *marg, struct svc_req *svc) { static int res; rmode_t mode; pbwidth_t width; mode_s2t(&marg->mw, &mode, &width); res = rig_set_split_mode(the_rpc_rig, marg->vfo, mode, width); return &res; } mode_res *getsplitmode_1_svc(vfo_x *vfo, struct svc_req *svc) { static mode_res res; rmode_t mode; pbwidth_t width; res.rigstatus = rig_get_split_mode(the_rpc_rig, *vfo, &mode, &width); mode_t2s(mode, width, &res.mode_res_u.mw); return &res; } int *setsplitvfo_1_svc(split_arg *arg, struct svc_req *svc) { static int res; res = rig_set_split_vfo(the_rpc_rig, arg->vfo, arg->split, arg->tx_vfo); return &res; } split_res *getsplitvfo_1_svc(vfo_x *vfo, struct svc_req *svc) { static split_res res; split_t arg; vfo_t tx_vfo; res.rigstatus = rig_get_split_vfo(the_rpc_rig, *vfo, &arg, &tx_vfo); res.split_res_u.split.split = arg; res.split_res_u.split.tx_vfo = tx_vfo; return &res; } DECLARESETV1(setptt, rig_set_ptt, ptt) DECLAREGETV1(getptt, rig_get_ptt, ptt, ptt_t) DECLAREGETV1(getdcd, rig_get_dcd, dcd, dcd_t) int *setlevel_1_svc(setting_arg *arg, struct svc_req *svc) { static int res; setting_t setting; value_t val; setting = setting_x2t(&arg->setting); if (RIG_LEVEL_IS_FLOAT(setting)) val.f = arg->val.f; else val.i = arg->val.i; res = rig_set_level(the_rpc_rig, arg->vfo, setting, val); return &res; } val_res *getlevel_1_svc(setting_arg *arg, struct svc_req *svc) { static val_res res; setting_t setting; value_t val; setting = setting_x2t(&arg->setting); if (RIG_LEVEL_IS_FLOAT(setting)) val.f = arg->val.f; else val.i = arg->val.i; res.rigstatus = rig_get_level(the_rpc_rig, arg->vfo, setting, &val); if (RIG_LEVEL_IS_FLOAT(setting)) res.val_res_u.val.f = val.f; else res.val_res_u.val.i = val.i; return &res; } int *setparm_1_svc(setting_arg *arg, struct svc_req *svc) { static int res; setting_t setting; value_t val; setting = setting_x2t(&arg->setting); if (RIG_PARM_IS_FLOAT(setting)) val.f = arg->val.f; else val.i = arg->val.i; res = rig_set_parm(the_rpc_rig, setting, val); return &res; } val_res *getparm_1_svc(setting_arg *arg, struct svc_req *svc) { static val_res res; setting_t setting; value_t val; setting = setting_x2t(&arg->setting); if (RIG_PARM_IS_FLOAT(setting)) val.f = arg->val.f; else val.i = arg->val.i; res.rigstatus = rig_get_parm(the_rpc_rig, setting, &val); if (RIG_PARM_IS_FLOAT(setting)) res.val_res_u.val.f = val.f; else res.val_res_u.val.i = val.i; return &res; } int *setfunc_1_svc(setting_arg *arg, struct svc_req *svc) { static int res; setting_t setting; setting = setting_x2t(&arg->setting); res = rig_set_func(the_rpc_rig, arg->vfo, setting, arg->val.i); return &res; } val_res *getfunc_1_svc(setting_arg *arg, struct svc_req *svc) { static val_res res; setting_t setting; value_t val; setting = setting_x2t(&arg->setting); val.i = arg->val.i; res.rigstatus = rig_get_func(the_rpc_rig, arg->vfo, setting, &res.val_res_u.val.i); return &res; /* quell stupid gcc "set but not used" warning */ rig_debug(RIG_DEBUG_TRACE, "val = %d\n", val); } int *scan_1_svc(scan_arg *arg, struct svc_req *svc) { static int res; res = rig_scan(the_rpc_rig, arg->vfo, arg->scan, arg->ch); return &res; } DECLARESETV1(vfoop, rig_vfo_op, vfo_op) DECLARESETV1(setrptrshift, rig_set_rptr_shift, rptrshift) DECLAREGETV1(getrptrshift, rig_get_rptr_shift, rptrshift, rptr_shift_t) DECLARESETV1(setrptroffs, rig_set_rptr_offs, shortfreq) DECLAREGETV1(getrptroffs, rig_get_rptr_offs, shortfreq, shortfreq_t) DECLARESETV1(setctcsstone, rig_set_ctcss_tone, tone) DECLAREGETV1(getctcsstone, rig_get_ctcss_tone, tone, tone_t) DECLARESETV1(setctcsssql, rig_set_ctcss_sql, tone) DECLAREGETV1(getctcsssql, rig_get_ctcss_sql, tone, tone_t) DECLARESETV1(setdcscode, rig_set_dcs_code, tone) DECLAREGETV1(getdcscode, rig_get_dcs_code, tone, tone_t) DECLARESETV1(setdcssql, rig_set_dcs_sql, tone) DECLAREGETV1(getdcssql, rig_get_dcs_sql, tone, tone_t) DECLARESETV1(setrit, rig_set_rit, shortfreq) DECLAREGETV1(getrit, rig_get_rit, shortfreq, shortfreq_t) DECLARESETV1(setxit, rig_set_xit, shortfreq) DECLAREGETV1(getxit, rig_get_xit, shortfreq, shortfreq_t) DECLARESETV1(setts, rig_set_ts, shortfreq) DECLAREGETV1(getts, rig_get_ts, shortfreq, shortfreq_t) DECLARESETV1(setant, rig_set_ant, ant) DECLAREGETV1(getant, rig_get_ant, ant, ant_t) DECLARESETV1(setmem, rig_set_mem, ch) DECLAREGETV1(getmem, rig_get_mem, ch, int) DECLARESETV1(setbank, rig_set_bank, ch) DECLARESET1(reset, rig_reset, reset_x) DECLARESET1(setpowerstat, rig_set_powerstat, powerstat_x) DECLAREGET1(getpowerstat, rig_get_powerstat, powerstat, powerstat_t) hamlib-1.2.15.3/rpcrig/rpcrigd.c0000644000175000017500000002255212044564477013225 00000000000000/* * rpcrigd - (C) Stephane Fillod 2001-2003 * * This program let programs control a radio through * the mean of RPC services using Hamlib. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "rpcrig.h" #include #include #include #include #include #include #include #include #include #ifdef HAVE_RPC_RPCENT_H #include #endif #include #include /* * Prototypes */ void usage(); void version(); void rigd_exit(); void rigprog_1(struct svc_req *rqstp, register SVCXPRT *transp); /* * Reminder: when adding long options, * keep up to date SHORT_OPTIONS, usage()'s output and man page. thanks. * NB: do NOT use -W since it's reserved by POSIX. */ #define SHORT_OPTIONS "m:r:p:P:d:D:c:s:C:t:vhV" static struct option long_options[] = { {"model", 1, 0, 'm'}, {"rig-file", 1, 0, 'r'}, {"ptt-file", 1, 0, 'p'}, {"dcd-file", 1, 0, 'd'}, {"ptt-type", 1, 0, 'P'}, {"dcd-type", 1, 0, 'D'}, {"serial-speed", 1, 0, 's'}, {"civaddr", 1, 0, 'c'}, {"set-conf", 1, 0, 'C'}, {"prog", 1, 0, 't'}, {"verbose", 0, 0, 'v'}, {"help", 0, 0, 'h'}, {"version", 0, 0, 'V'}, {0, 0, 0, 0} }; int set_conf(RIG *my_rig, char *conf_parms) { char *p, *q, *n; int ret; p = conf_parms; while (p && *p != '\0') { /* FIXME: left hand value of = cannot be null */ q = strchr(p, '='); if ( !q ) return RIG_EINVAL; *q++ = '\0'; n = strchr(q, ','); if (n) *n++ = '\0'; ret = rig_set_conf(my_rig, rig_token_lookup(my_rig, p), q); if (ret != RIG_OK) return ret; p = n; } return RIG_OK; } static unsigned long extract_prognum(const char val[]) { if (val[0] == '+') { return RIGPROG + atol(val+1); } else if (val[0] < '0' || val[0] > '9') { struct rpcent *ent; ent = getrpcbyname (val); if (ent) return ent->r_number; else return 0; } else return atol(val); } RIG *the_rpc_rig; #define MAXCONFLEN 128 int main (int argc, char *argv[]) { register SVCXPRT *transp; rig_model_t my_model = RIG_MODEL_DUMMY; int retcode; /* generic return code from functions */ int verbose = 0; const char *rig_file=NULL, *ptt_file=NULL, *dcd_file=NULL; ptt_type_t ptt_type = RIG_PTT_NONE; dcd_type_t dcd_type = RIG_DCD_NONE; char *civaddr = NULL; /* NULL means no need to set conf */ int serial_rate = 0; char conf_parms[MAXCONFLEN] = ""; unsigned long prognum = RIGPROG; /* Arguments parsing */ while(1) { int c; int option_index = 0; c = getopt_long (argc, argv, SHORT_OPTIONS, long_options, &option_index); if (c == -1) break; switch(c) { case 'h': usage(); exit(0); case 'V': version(); exit(0); case 'm': if (!optarg) { usage(); /* wrong arg count */ exit(1); } my_model = atoi(optarg); break; case 'r': if (!optarg) { usage(); /* wrong arg count */ exit(1); } rig_file = optarg; break; case 'p': if (!optarg) { usage(); /* wrong arg count */ exit(1); } ptt_file = optarg; break; case 'd': if (!optarg) { usage(); /* wrong arg count */ exit(1); } dcd_file = optarg; break; case 'P': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (!strcmp(optarg, "RIG")) ptt_type = RIG_PTT_RIG; else if (!strcmp(optarg, "DTR")) ptt_type = RIG_PTT_SERIAL_DTR; else if (!strcmp(optarg, "RTS")) ptt_type = RIG_PTT_SERIAL_RTS; else if (!strcmp(optarg, "PARALLEL")) ptt_type = RIG_PTT_PARALLEL; else if (!strcmp(optarg, "NONE")) ptt_type = RIG_PTT_NONE; else ptt_type = atoi(optarg); break; case 'D': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (!strcmp(optarg, "RIG")) dcd_type = RIG_DCD_RIG; else if (!strcmp(optarg, "DSR")) dcd_type = RIG_DCD_SERIAL_DSR; else if (!strcmp(optarg, "CTS")) dcd_type = RIG_DCD_SERIAL_CTS; else if (!strcmp(optarg, "CD")) dcd_type = RIG_DCD_SERIAL_CAR; else if (!strcmp(optarg, "PARALLEL")) dcd_type = RIG_DCD_PARALLEL; else if (!strcmp(optarg, "NONE")) dcd_type = RIG_DCD_NONE; else dcd_type = atoi(optarg); break; case 'c': if (!optarg) { usage(); /* wrong arg count */ exit(1); } civaddr = optarg; break; case 's': if (!optarg) { usage(); /* wrong arg count */ exit(1); } serial_rate = atoi(optarg); break; case 'C': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (*conf_parms != '\0') strcat(conf_parms, ","); strncat(conf_parms, optarg, MAXCONFLEN-strlen(conf_parms)); break; case 't': if (!optarg) { usage(); /* wrong arg count */ exit(1); } prognum = extract_prognum(optarg); break; case 'v': verbose++; break; default: usage(); /* unknown option? */ exit(1); } } if (verbose < 2) rig_set_debug(RIG_DEBUG_WARN); /* Opening the local rig */ the_rpc_rig = rig_init(my_model); if (!the_rpc_rig) { fprintf(stderr, "Unknown rig num %d, or initialization error.\n", my_model); fprintf(stderr, "Please check with rigctl --list option.\n"); exit(2); } retcode = set_conf(the_rpc_rig, conf_parms); if (retcode != RIG_OK) { fprintf(stderr, "Config parameter error: %s\n", rigerror(retcode)); exit(2); } if (rig_file) strncpy(the_rpc_rig->state.rigport.pathname, rig_file, FILPATHLEN - 1); /* * ex: RIG_PTT_PARALLEL and /dev/parport0 */ if (ptt_type != RIG_PTT_NONE) the_rpc_rig->state.pttport.type.ptt = ptt_type; if (dcd_type != RIG_DCD_NONE) the_rpc_rig->state.dcdport.type.dcd = dcd_type; if (ptt_file) strncpy(the_rpc_rig->state.pttport.pathname, ptt_file, FILPATHLEN - 1); if (dcd_file) strncpy(the_rpc_rig->state.dcdport.pathname, dcd_file, FILPATHLEN - 1); /* FIXME: bound checking and port type == serial */ if (serial_rate != 0) the_rpc_rig->state.rigport.parm.serial.rate = serial_rate; if (civaddr) rig_set_conf(the_rpc_rig, rig_token_lookup(the_rpc_rig, "civaddr"), civaddr); retcode = rig_open(the_rpc_rig); if (retcode != RIG_OK) { fprintf(stderr,"rig_open: error = %s \n", rigerror(retcode)); exit(2); } atexit(rigd_exit); if (verbose > 0) printf("Opened rig model %d, '%s'\n", the_rpc_rig->caps->rig_model, the_rpc_rig->caps->model_name); /* Setup the RPC service and fire it up */ pmap_unset (prognum, RIGVERS); transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { fprintf (stderr, "cannot create udp service."); exit(1); } if (!svc_register(transp, prognum, RIGVERS, rigprog_1, IPPROTO_UDP)) { fprintf (stderr, "unable to register (%lu, %u, udp).", prognum, RIGVERS); exit(1); } transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { fprintf (stderr, "cannot create tcp service."); exit(1); } if (!svc_register(transp, prognum, RIGVERS, rigprog_1, IPPROTO_TCP)) { fprintf (stderr, "unable to register (%lu, %u, tcp).", prognum, RIGVERS); exit(1); } svc_run (); fprintf (stderr, "svc_run returned"); /* the rig gets automatically closed in rigd_exit() */ exit (1); /* NOTREACHED */ } void rigd_exit() { rig_close(the_rpc_rig); rig_cleanup(the_rpc_rig); } void usage() { printf("Usage: rpc.rigd [OPTION]...\n" "Offer RPC services to remotely control a connected radio transceiver or receiver.\n\n"); printf( " -m, --model=ID select radio model number. See model list\n" " -r, --rig-file=DEVICE set device of the radio to operate on\n" " -p, --ptt-file=DEVICE set device of the PTT device to operate on\n" " -d, --dcd-file=DEVICE set device of the DCD device to operate on\n" " -P, --ptt-type=TYPE set type of the PTT device to operate on\n" " -D, --dcd-type=TYPE set type of the DCD device to operate on\n" " -s, --serial-speed=BAUD set serial speed of the serial port\n" " -c, --civaddr=ID set CI-V address (for Icom rigs only)\n" " -C, --set-conf=PARM=VAL set config parameters\n" " -t, --prog=NUMBER set RPC program number\n" " -v, --verbose set verbose mode, cumulative\n" " -h, --help display this help and exit\n" " -V, --version output version information and exit\n\n" ); printf("\nReport bugs to .\n"); } void version() { printf("rpcrigd, %s\n\n", hamlib_version); printf("%s\n", hamlib_copyright); } hamlib-1.2.15.3/rpcrig/rpcrig.x0000644000175000017500000001570712044564477013112 00000000000000%/* % * Hamlib Interface - RPC definitions % * Copyright (c) 2000-2002 by Stephane Fillod and Frank Singleton % * % * % * This library is free software; you can redistribute it and/or % * modify it under the terms of the GNU Lesser General Public % * License as published by the Free Software Foundation; either % * version 2.1 of the License, or (at your option) any later version. % * % * This library 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 % * Lesser General Public License for more details. % * % * You should have received a copy of the GNU Lesser General Public % * License along with this library; if not, write to the Free Software % * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA % * % */ % #if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__ % /* rpcgen produces code containing unused variables. hush that... */ % # pragma GCC diagnostic ignored "-Wunused-variable" % #endif /* This gets stuffed into the source files. */ #if RPC_HDR %#ifdef HAVE_CONFIG_H %#include "config.h" %#endif %#include %#include #endif typedef unsigned int model_x; typedef int vfo_x; typedef double freq_x; typedef unsigned int rmode_x; typedef int pbwidth_x; typedef unsigned long split_x; typedef int ptt_x; typedef int dcd_x; typedef long vfo_op_x; typedef long shortfreq_x; typedef unsigned long setting_x; typedef long ant_x; typedef long ann_x; typedef int rptr_shift_x; typedef int tone_x; typedef long scan_x; typedef long reset_x; typedef long powerstat_x; %#if __APPLE__ %static int _rpcsvcdirty; %#endif struct mode_s { rmode_x mode; pbwidth_x width; }; /* a union would have been better, but struct is simpler */ struct value_s { int i; float f; }; struct freq_arg { vfo_x vfo; freq_x freq; }; union freq_res switch (int rigstatus) { case 0: freq_x freq; default: void; }; struct mode_arg { vfo_x vfo; mode_s mw; }; union mode_res switch (int rigstatus) { case 0: mode_s mw; default: void; }; union vfo_res switch (int rigstatus) { case 0: vfo_x vfo; default: void; }; union powerstat_res switch (int rigstatus) { case 0: powerstat_x powerstat; default: void; }; struct split_arg { vfo_x vfo; split_x split; vfo_x tx_vfo; }; union split_res switch (int rigstatus) { case 0: split_arg split; default: void; }; struct ptt_arg { vfo_x vfo; ptt_x ptt; }; union ptt_res switch (int rigstatus) { case 0: ptt_x ptt; default: void; }; union dcd_res switch (int rigstatus) { case 0: dcd_x dcd; default: void; }; struct setting_arg { vfo_x vfo; setting_x setting; value_s val; }; union val_res switch (int rigstatus) { case 0: value_s val; default: void; }; struct vfo_op_arg { vfo_x vfo; vfo_op_x vfo_op; }; union rptrshift_res switch (int rigstatus) { case 0: rptr_shift_x rptrshift; default: void; }; struct rptrshift_arg { vfo_x vfo; rptr_shift_x rptrshift; }; union shortfreq_res switch (int rigstatus) { case 0: shortfreq_x shortfreq; default: void; }; struct shortfreq_arg { vfo_x vfo; shortfreq_x shortfreq; }; union tone_res switch (int rigstatus) { case 0: tone_x tone; default: void; }; struct tone_arg { vfo_x vfo; tone_x tone; }; union ant_res switch (int rigstatus) { case 0: ant_x ant; default: void; }; struct ant_arg { vfo_x vfo; ant_x ant; }; union ch_res switch (int rigstatus) { case 0: int ch; default: void; }; struct ch_arg { vfo_x vfo; int ch; }; struct scan_s { scan_x scan; int ch; }; union scan_res switch (int rigstatus) { case 0: scan_s scan; default: void; }; struct scan_arg { vfo_x vfo; scan_x scan; int ch; }; struct freq_range_s { freq_x start; freq_x end; rmode_x modes; int low_power; int high_power; vfo_x vfo; ant_x ant; }; struct tuning_step_s { rmode_x modes; shortfreq_x ts; }; struct filter_s { rmode_x modes; pbwidth_x width; }; struct channel_cap_x { unsigned int caps; setting_x funcs; setting_x levels; }; struct chan_s { int start; int end; unsigned int type; channel_cap_x mem_caps; }; struct rigstate_s { int itu_region; shortfreq_x max_rit; shortfreq_x max_xit; shortfreq_x max_ifshift; ann_x announces; setting_x has_get_func; setting_x has_set_func; setting_x has_get_level; setting_x has_set_level; setting_x has_get_parm; setting_x has_set_parm; int preamp[MAXDBLSTSIZ]; int attenuator[MAXDBLSTSIZ]; freq_range_s rx_range_list[FRQRANGESIZ]; freq_range_s tx_range_list[FRQRANGESIZ]; tuning_step_s tuning_steps[TSLSTSIZ]; filter_s filters[FLTLSTSIZ]; chan_s chan_list[CHANLSTSIZ]; }; union rigstate_res switch (int rigstatus) { case 0: rigstate_s state; default: void; }; program RIGPROG { version RIGVERS { model_x GETMODEL(void) = 1; /* string GETLIBVERSION(void) = 2 */ rigstate_res GETRIGSTATE(void) = 3; int SETFREQ(freq_arg) = 10; freq_res GETFREQ(vfo_x) = 11; int SETMODE(mode_arg) = 12; mode_res GETMODE(vfo_x) = 13; int SETVFO(vfo_x) = 14; vfo_res GETVFO(vfo_x) = 15; int SETSPLITFREQ(freq_arg) = 16; freq_res GETSPLITFREQ(vfo_x) = 17; int SETSPLITMODE(mode_arg) = 18; mode_res GETSPLITMODE(vfo_x) = 19; int SETSPLITVFO(split_arg) = 20; split_res GETSPLITVFO(vfo_x) = 21; int SETPTT(ptt_arg) = 22; ptt_res GETPTT(vfo_x) = 23; dcd_res GETDCD(vfo_x) = 24; int SETFUNC(setting_arg) = 25; val_res GETFUNC(setting_arg) = 26; int SETLEVEL(setting_arg) = 27; val_res GETLEVEL(setting_arg) = 28; int SETPARM(setting_arg) = 29; val_res GETPARM(setting_arg) = 30; int VFOOP(vfo_op_arg) = 31; int SETRPTRSHIFT(rptrshift_arg) = 32; rptrshift_res GETRPTRSHIFT(vfo_x) = 33; int SETRPTROFFS(shortfreq_arg) = 34; shortfreq_res GETRPTROFFS(vfo_x) = 35; int SETCTCSSTONE(tone_arg) = 36; tone_res GETCTCSSTONE(vfo_x) = 37; int SETCTCSSSQL(tone_arg) = 38; tone_res GETCTCSSSQL(vfo_x) = 39; int SETDCSCODE(tone_arg) = 40; tone_res GETDCSCODE(vfo_x) = 41; int SETDCSSQL(tone_arg) = 42; tone_res GETDCSSQL(vfo_x) = 43; int SETRIT(shortfreq_arg) = 44; shortfreq_res GETRIT(vfo_x) = 45; int SETXIT(shortfreq_arg) = 46; shortfreq_res GETXIT(vfo_x) = 47; int SETTS(shortfreq_arg) = 48; shortfreq_res GETTS(vfo_x) = 49; int SCAN(scan_arg) = 50; int RESET(reset_x) = 51; int SETMEM(ch_arg) = 52; ch_res GETMEM(vfo_x) = 53; int SETANT(ant_arg) = 54; ant_res GETANT(vfo_x) = 55; int SETBANK(ch_arg) = 56; int SETPOWERSTAT(powerstat_x) = 58; powerstat_res GETPOWERSTAT(void) = 59; } = 1; } = 0x20000099; #ifdef RPC_HDR % %#define freq_t2x(t, x) do { *(x) = (t); } while(0) %#define freq_x2t(x) ((freq_t)*(x)) % %#define setting_t2x(t, x) do { *(x) = (t); } while(0) %#define setting_x2t(x) ((setting_t)*(x)) % %static inline void mode_t2s(rmode_t modet, pbwidth_t widtht, mode_s *modes) %{ % modes->mode = modet; % modes->width = widtht; %} %static inline void mode_s2t(mode_s *modes, rmode_t *modet, pbwidth_t *widtht) %{ % *modet = modes->mode; % *widtht = modes->width; %} #endif /* RPC_HDR */ hamlib-1.2.15.3/rpcrig/Makefile.in0000644000175000017500000006662012044564555013475 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ # rpcrig_xdr.c rpcrig_svc.c rpcrig_clnt.c and rpcrig.h are generated by rpcgen # have to provide: rpcrig_proc.c rpcrigd.c rpcrig_backend.c # # Note: automake complains rpcrig_xdr.c is generated both with and # without libtool, hence the copy rpcrig_xdr_lt.c VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ sbin_PROGRAMS = rpc.rigd$(EXEEXT) subdir = rpcrig DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(sbindir)" \ "$(DESTDIR)$(man8dir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_rpcrig_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am_hamlib_rpcrig_la_OBJECTS = rpcrig_backend.lo nodist_hamlib_rpcrig_la_OBJECTS = rpcrig_clnt.lo rpcrig_xdr_lt.lo hamlib_rpcrig_la_OBJECTS = $(am_hamlib_rpcrig_la_OBJECTS) \ $(nodist_hamlib_rpcrig_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_rpcrig_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_rpcrig_la_LDFLAGS) $(LDFLAGS) \ -o $@ PROGRAMS = $(sbin_PROGRAMS) am_rpc_rigd_OBJECTS = rpcrigd.$(OBJEXT) rpcrig_proc.$(OBJEXT) nodist_rpc_rigd_OBJECTS = rpcrig_svc.$(OBJEXT) rpcrig_xdr.$(OBJEXT) rpc_rigd_OBJECTS = $(am_rpc_rigd_OBJECTS) $(nodist_rpc_rigd_OBJECTS) rpc_rigd_LDADD = $(LDADD) rpc_rigd_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(rpc_rigd_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_rpcrig_la_SOURCES) \ $(nodist_hamlib_rpcrig_la_SOURCES) $(rpc_rigd_SOURCES) \ $(nodist_rpc_rigd_SOURCES) DIST_SOURCES = $(hamlib_rpcrig_la_SOURCES) $(rpc_rigd_SOURCES) man8dir = $(mandir)/man8 NROFF = nroff MANS = $(man_MANS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LDADD = $(top_builddir)/src/libhamlib.la $(top_builddir)/lib/libmisc.la @NET_LIBS@ DEPENDENCIES = $(top_builddir)/src/libhamlib.la BUILT_SOURCES = rpcrig_xdr.c rpcrig_svc.c rpcrig_xdr_lt.c rpcrig_clnt.c rpcrig.h DISTCLEANFILES = $(BUILT_SOURCES) # needed for backward compatibility on Solaris. AM_CFLAGS = $(CFLAGS) -DPORTMAP # The RPC backend pkglib_LTLIBRARIES = hamlib-rpcrig.la hamlib_rpcrig_la_SOURCES = rpcrig_backend.c rpcrig_backend.h nodist_hamlib_rpcrig_la_SOURCES = rpcrig_clnt.c rpcrig_xdr_lt.c rpcrig.h hamlib_rpcrig_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_rpcrig_la_LIBADD = $(top_builddir)/src/libhamlib.la @NET_LIBS@ rpc_rigd_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ hamlib-rpcrig.la rpc_rigd_SOURCES = rpcrigd.c rpcrig_proc.c nodist_rpc_rigd_SOURCES = rpcrig_svc.c rpcrig_xdr.c rpcrig.h rpc_rigd_LDFLAGS = @BACKENDLNK@ man_MANS = rpc.rigd.8 EXTRA_DIST = rpcrig.x $(man_MANS) RPCGEN = rpcgen all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu rpcrig/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu rpcrig/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-rpcrig.la: $(hamlib_rpcrig_la_OBJECTS) $(hamlib_rpcrig_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_rpcrig_la_LINK) -rpath $(pkglibdir) $(hamlib_rpcrig_la_OBJECTS) $(hamlib_rpcrig_la_LIBADD) $(LIBS) install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)" @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files clean-sbinPROGRAMS: @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list rpc.rigd$(EXEEXT): $(rpc_rigd_OBJECTS) $(rpc_rigd_DEPENDENCIES) @rm -f rpc.rigd$(EXEEXT) $(AM_V_CCLD)$(rpc_rigd_LINK) $(rpc_rigd_OBJECTS) $(rpc_rigd_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcrig_backend.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcrig_clnt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcrig_proc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcrig_svc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcrig_xdr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcrig_xdr_lt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcrigd.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man8: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)" @list=''; test -n "$(man8dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ done; } uninstall-man8: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man8dir)" && rm -f $$files; } ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ clean-sbinPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-sbinPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man8 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-pkglibLTLIBRARIES \ uninstall-sbinPROGRAMS uninstall-man: uninstall-man8 .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES clean-sbinPROGRAMS ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-man8 install-pdf \ install-pdf-am install-pkglibLTLIBRARIES install-ps \ install-ps-am install-sbinPROGRAMS install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-man uninstall-man8 \ uninstall-pkglibLTLIBRARIES uninstall-sbinPROGRAMS rpcrig.h: Makefile rpcrig.x rm -f $@ $(RPCGEN) -h -C `test -f rpcrig.x || echo '$(srcdir)/'`rpcrig.x -o $@ # Need to chdir in source dir, otherwise rpcgen hardcodes header path. sigh. rpcrig_clnt.c: Makefile rpcrig.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -l -C rpcrig.x -o $$abs_builddir/$@ rpcrig_svc.c: Makefile rpcrig.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -m -C rpcrig.x -o $$abs_builddir/$@ # note: # we need 2 rpcrig_xdr.c's: one for static rpcrig deamon, one for lt backend rpcrig_xdr.c: Makefile rpcrig.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -c -C rpcrig.x -o $$abs_builddir/$@ rpcrig_xdr_lt.c: Makefile rpcrig.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -c -C rpcrig.x -o $$abs_builddir/$@ # 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: hamlib-1.2.15.3/rpcrig/Makefile.am0000644000175000017500000000377112044564477013465 00000000000000# rpcrig_xdr.c rpcrig_svc.c rpcrig_clnt.c and rpcrig.h are generated by rpcgen # have to provide: rpcrig_proc.c rpcrigd.c rpcrig_backend.c # # Note: automake complains rpcrig_xdr.c is generated both with and # without libtool, hence the copy rpcrig_xdr_lt.c LDADD = $(top_builddir)/src/libhamlib.la $(top_builddir)/lib/libmisc.la @NET_LIBS@ DEPENDENCIES = $(top_builddir)/src/libhamlib.la BUILT_SOURCES = rpcrig_xdr.c rpcrig_svc.c rpcrig_xdr_lt.c rpcrig_clnt.c rpcrig.h DISTCLEANFILES = $(BUILT_SOURCES) # needed for backward compatibility on Solaris. AM_CFLAGS = $(CFLAGS) -DPORTMAP # The RPC backend pkglib_LTLIBRARIES = hamlib-rpcrig.la hamlib_rpcrig_la_SOURCES = rpcrig_backend.c rpcrig_backend.h nodist_hamlib_rpcrig_la_SOURCES = rpcrig_clnt.c rpcrig_xdr_lt.c rpcrig.h hamlib_rpcrig_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_rpcrig_la_LIBADD = $(top_builddir)/src/libhamlib.la @NET_LIBS@ # The RPC server sbin_PROGRAMS = rpc.rigd rpc_rigd_DEPENDENCIES = $(DEPENDENCIES) @BACKENDEPS@ hamlib-rpcrig.la rpc_rigd_SOURCES = rpcrigd.c rpcrig_proc.c nodist_rpc_rigd_SOURCES = rpcrig_svc.c rpcrig_xdr.c rpcrig.h rpc_rigd_LDFLAGS = @BACKENDLNK@ man_MANS = rpc.rigd.8 EXTRA_DIST = rpcrig.x $(man_MANS) RPCGEN = rpcgen rpcrig.h: Makefile rpcrig.x rm -f $@ $(RPCGEN) -h -C `test -f rpcrig.x || echo '$(srcdir)/'`rpcrig.x -o $@ # Need to chdir in source dir, otherwise rpcgen hardcodes header path. sigh. rpcrig_clnt.c: Makefile rpcrig.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -l -C rpcrig.x -o $$abs_builddir/$@ rpcrig_svc.c: Makefile rpcrig.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -m -C rpcrig.x -o $$abs_builddir/$@ # note: # we need 2 rpcrig_xdr.c's: one for static rpcrig deamon, one for lt backend rpcrig_xdr.c: Makefile rpcrig.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -c -C rpcrig.x -o $$abs_builddir/$@ rpcrig_xdr_lt.c: Makefile rpcrig.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -c -C rpcrig.x -o $$abs_builddir/$@ hamlib-1.2.15.3/rpcrig/rpc.rigd.80000644000175000017500000001271612044564477013231 00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH RIGD "8" "February 24, 2007" "Hamlib" "RPC Rig Daemon" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME rigd \- Hamlib rig service daemon .SH SYNOPSIS .B rpc.rigd [\fIOPTION\fR]... .SH DESCRIPTION The \fBrigd\fP program is a \fBHamlib\fP rig daemon that handles RPC client requests. This allows multiple user programs to share one radio. At this time multiple radio support is not available (help needed!). .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invoke bold face and italics, .\" respectively. Keep in mind that \fBHamlib\fP is BETA level software. While a lot of backend libraries lack complete rig support, the basic functions are usually well supported. The API may change without publicized notice, while an advancement of the minor version (e.g. 1.1.x to 1.2.x) indicates such a change. .PP Please report bugs and provide feedback at the e-mail address given in the REPORTING BUGS section. Patches and code enhancements are also welcome. .SH OPTIONS This program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). Here is a summary of the supported options: .TP .B \-m, --model=id Select radio model number. See rig model list (use 'rigctl -l'). .br NB: \fBrigctl\fP (or third party software) will use rig model 1901 when using \fBrigd\fP. .TP .B \-r, --rig-file=device Use \fIdevice\fP as the file name of the port the radio is connected. Often a serial port, but could be a USB to serial adapter. Typically /dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0, etc. .TP .B \-p, --ptt-file=device Use \fIdevice\fP as the file name of the Push-To-Talk device using a device file as described above. .TP .B \-d, --dcd-file=device Use \fIdevice\fP as the file name of the Data Carrier Detect device using a device file as described above. .TP .B \-p, --ptt-type=type Use \fItype\fP of Push-To-Talk device. Supported types are RIG, DTR, RTS, PARALLEL, NONE. .TP .B \-d, --dcd-type=type Use \fItype\fP of Data Carrier Detect device. Supported types are RIG, DSR, CTS, CD, PARALLEL, NONE. .TP .B \-s, --serial-speed=baud Set serial speed to \fIbaud\fP rate. Uses maximum serial speed from rig backend capabilities as the default. .TP .B \-c, --civaddr=id Use \fIid\fP as the CI-V address to communicate with the rig. Only useful for Icom rigs. .br NB: the \fIid\fP is in decimal notation, unless prefixed by \fI0x\fP, in which case it is hexadecimal. .TP .B \-C, --set-conf=parm=val[,parm=val]* Set config parameter. e.g. stop_bits=2 .br Use -L option of \fBrigctl\fP for a list. .TP .B \-t, --prog=number Use \fInumber\fP as the RPC program number. The default is 536871065. .TP .B \-v, --verbose Set verbose mode, cumulative (see DIAGNOSTICS below). .TP .B \-h, --help Show a summary of these options and exit. .TP .B \-V, --version Show the version of \fBrigd\fP and exit. .PP Please note that the backend for the radio to be controlled, or the radio itself may not support some commands. In that case, the operation will fail with a \fBHamlib\fP error code. .SH EXAMPLES Start \fBrigd\fP as root for a Yaesu FT-920 using a USB to serial adapter and backgrounding: .PP # rpc.rigd -m 114 -r /dev/ttyUSB1 & .PP Start \fBrigd\fP as root for a Yaesu FT-920 using COM1 while generating TRACE output: .PP # rpc.rigd -m 114 -r /dev/ttyS0 -vvvvv .PP Start \fBrigd\fP as root for a Yaesu FT-920 using a USB to serial adapter while setting baud rate and stop bits and backgrounding: .PP # rpc.rigd -m 114 -r /dev/ttyUSB1 -s 4800 -C stop_bits=2 & .SH DIAGNOSTICS The \fB-v\fP, \fB--version\fP option allows different levels of diagnostics to be output to \fBstderr\fP and correspond to -v for BUG, -vv for ERR, -vvv for WARN, -vvvv for VERBOSE, or -vvvvv for TRACE. .PP A given verbose level is useful for providing needed debugging information to the email address below. For example, TRACE output shows all of the values sent to and received from the radio which is very useful for radio backend library development and may be requested by the developers. .SH SECURITY No authentication whatsoever; could be done through domain restriction, though. Please ask if stronger security is needed. .SH BUGS Does not support more than one rig that share the same serial port (e.g. Icom radios on a CI-V bus). .PP Does not support more than one communication device for multiple rig control. (e.g. for Single Operator 2 Radio) Help needed! .SH REPORTING BUGS Report bugs to . .br We are already aware of the bugs in the previous section :-) .SH AUTHORS Written by Stephane Fillod and the Hamlib Group .br . .SH COPYRIGHT Copyright \(co 2000-2007 Stephane Fillod and the Hamlib Group. .PP This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .SH SEE ALSO .BR rigctl (1), .BR hamlib (3) hamlib-1.2.15.3/rpcrig/rpcrig_backend.h0000644000175000017500000000170412044564477014531 00000000000000/* * Hamlib RPC backend - main header * Copyright (c) 2001-2003 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _RPCRIG_H #define _RPCRIG_H 1 extern struct rig_caps rpcrig_caps; #endif /* _RPCRIG_H */ hamlib-1.2.15.3/AUTHORS0000644000175000017500000001616712044564477011216 00000000000000This file is licensed to you under the license specified in the included file `COPYING'. Look there for further details. Authors of the Hamlib API, original code: Frank Singleton and Stephane Fillod Contributors: (if any is missing, please email the current maintainer). For any reason, if you prefer not to appear in this list, please let me know. M: Current maintainer C: Contributors W: Web-page with status/info S: Status, one of the following: Supported: Someone is actually bothered to look after this. Maintained: Someone actually looks after it. Odd Fixes: It has a maintainer but they don't have time to do much other than throw the odd patch in. See below.. Orphan: No current maintainer [but maybe you could take the role as you write your new code]. Obsolete: Old code. Something tagged obsolete generally means it has been replaced by a better system and you should be using that. Backends: [adat: ADT-200A] M: Frank Goenninger DG1SBG [alinco: DX77-T] M: Ben Coleman NJ8J [aor] C: testing by John Ronan [aor: AR-7030] M: Friedrich Melchert DC9RP [aor: AR-7030 Plus] M: Larry Gadallah VE6VQ [aor: AR-3030] M: Tristan Mills [aor: AR-8200] M: Rob Walker [drake] M: Mark J. Fine [icom: ic7000] M: Kent Hill, AD7AI [icom: ic7200] M: James Watson, HZ1JW [icom: ic718] M: Chuck Gilkes, WD0FCL/4 [icom: icr7000] M: Chuck Hemker, N2POR [icom: ic735] C: Darren Hatcher, G0WCW [icom: ic751] C: Lars E. Pettersson, SM6RPZ [icom: icr75] M: Mark J. Fine [icom: OptoScan] M: Michael Smith, KE4RJQ [icom] M: Stephane Fillod, F8CFE [jrc] M: Mark J. Fine C: Manual and testing by Bob Parnass, AJ9S [kenwood] M: Joop Stakenborg, PG4I C: Alessandro Zummo, IZ1PRB [kenwood: K2] M: Nate Bargmann, N0NB M: Brian Mury, VE7NGR C: Leigh Klotz, WA5ZNU [kenwood: K3] M: Nate Bargmann, N0NB C: Alexander Sack [kenwood: TS-480SAT] M: Juergen Rinas, DC3BW [kenwood: TS-570] M: Rob Frohne, KL7NA C: Thomas Beierlein, DL1JBE [kenwood: R-5000] M: Mark J. Fine [kenwood: tmd700] M: Charles Suprin, AA1VS [kenwood: thg71,tmv7,tmd700] C: Thierry Leconte, F4DWV [kenwood: thg71,tmv7] M: Andrew McNamara [kenwood: thd7] M: Stephane Fillod, F8CFE [kenwood: ts-850] C: Rob Frohne, KL7NA [kit: Si570 AVR-USB] C: Fabrice, F4AVI [kit: Elektor SDR] C: John Nogatch, AC6SL [kit: HiQSDR] M: Jim Ahlstrom, N2ADR [pcr: pcr100,pcr1000] M: Alessandro Zummo, IZ1PRB C: Darren Hatcher, G0WCW [tentec] M: C: testing by James Chance, N3TKD [tentec: tt516] M: James Nykiel [tentec: tt538] M: Mike Markowski AB3AP [tentec: tt550] M: Ken Koster, N7IPB [tentec: tt565] M: Martin Ewing AA6E [tentec: Argonaut V] C: Dave Freese, W1HKJ [tentec: tt585] C: Bert, KG4BEC [tentec: rx331] M: Berndt Josef Wulf, VK5ABN [uniden: 245xlt] M: Eric Cottrell WB1HBU [winradio] M: C: Pascal Brisset [yeasu: ft1000d] M: Serge Pashenkov [yeasu: ft100] M: Alex V Flinsch, KC2IVL [yaesu: ft736] C: Ron Patterson, W6FM [yaesu: ft747] M: C: Chris Bryant, G3WIE C: Frank Singleton, VK3FCS [yaesu: ft767gx] M: Steve Conklin, AI4QR [yaesu: ft817] M: Chris Karpinsky, AA1VL [yaesu: ft847] M: Jim Jerzycke, KQ6EA C: Frank Singleton, VK3FCS [yaesu: ft920, ft890, ft900] M: Nate Bargmann, N0NB [yaesu: ft980] M: Wolfgang Buesser, DK1BW [yaesu: ft990] M: Berndt Josef Wulf, VK5ABN [yaesu: ft950,newcat] M: Terry Embry, KJ4EED [yaesu: VR-5000] M: Jacob Heder [CM108 GPIO PTT] M: Andrew Errington, ZL3AME Rotators [celestron] M: Stephane Fillod, F8CFE C: Eric/N3KQX [easycomm] M: Luc Langehegermann, LX2GT C: Francois Retief [fodtrack] M: Luc Langehegermann, LX2GT [amsat/if-100] M: Stephane Fillod, F8CFE C: Patrick Strasser, OE6PSE [heathkit:HD 1780 Intellirotor] M: Rob Frohne, KL7NA [rotorez] M: Nate Bargmann, N0NB [spid] M: Norvald H. Ryeng, LA6YKA [m2] M: Magne Mæhre, LA1BFA C: Ron Patterson, W6FM [ars] M: Stephane Fillod, F8CFE C: Chris Bryant, G3WIE [ts7400] M: Øystein HÃ¥rberg, LA7LKA [Frontend] M: Stephane Fillod, F8CFE [src/locator.c] M: Dave Hines, M1CXW C: Stephane Fillod, F8CFE C: Nate Bargmann, N0NB [test utilities] M: Stephane Fillod, F8CFE C: Nate Bargmann, N0NB C: Nirgal Vourgère [platform: FreeBSD] M: Diane Bruce, VA3DB [platform: NetBSD] M: Berndt Josef Wulf, VK5ABN [platform: win32] M: Stephane Fillod, F8CFE C: VB & testing by Darren Hatcher, G0WCW C: VB.NET wrapper by Michael Benz [packaging: debian] M: Kamal Mostafa, KA6MAL M: Jaime Robles, EA4TV C: Joop Stakenborg, PG4I [packaging: RPM] M: Alexandru Csete, OZ9AEC M: Joop Stakenborg, PG4I [Web site: http://www.hamlib.org] M: Joop Stakenborg, PG4I M: Stephane Fillod, F8CFE M: Nate Bargmann, N0NB E-mail addresses: Frank Singleton, VK3FCS, Stephane Fillod, F8CFE, Pascal Brisset Nate Bargmann, N0NB, Chris Karpinsky, AA1VL, Joop Stakenborg, PG4I, Bob Parnass, AJ9S, Francois Retief, James Chance, N3TKD, Chuck Hemker, N2POR, Alex V Flinsch, KC2IVL, Chuck Gilkes, WD0FCL/4, Dale E. Edmons, KD7ENI, Michael Smith, KE4RJQ Berndt Josef Wulf, VK5ABN Mark J. Fine Jim Jerzycke, KQ6EA Alexandru Csete OZ9AEC Diane Bruce, VA3DB Dave Hines, M1CXW, Darren Hatcher, G0WCW, Ben Coleman, NJ8J, Serge Pashenkov Lars E. Pettersson SM6RPZ Thomas Beierlein, DL1JBE, Kent Hill, AD7AI, Dave Freese, W1HKJ, Rob Frohne, KL7NA, Steve Conklin, AI4QR, Martin Ewing, AA6E, Terry Embry, KJ4EED, Alessandro Zummo, IZ1PRB Norvald H. Ryeng, LA6YKA Larry Gadallah, VE6VQ Kamal Mostafa, KA6MAL, Jaime Robles, EA4TV, Wolfgang Buesser, DK1BW, Magne Mæhre, LA1BFA, Charles Suprin, AA1VS, Robert Steinhäußer, DL1NC, James Watson, HZ1JW, Juergen Rinas, DC3BW, Kamal Mostafa, KA6MAL, Roger, Tristan Mills, Terry Dawson, VK2KTJ, Øystein HÃ¥rberg, LA7LKA, Alexander Sack Nirgal Vourgère Andrew Errington hamlib-1.2.15.3/aor/0000755000175000017500000000000012044565014010760 500000000000000hamlib-1.2.15.3/aor/aor.h0000644000175000017500000000557312044564477011660 00000000000000/* * Hamlib AOR backend - main header * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _AOR_H #define _AOR_H 1 #include #define BACKEND_VER "0.6" int format8k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width); int parse8k_aor_mode(RIG *rig, char aormode, char aorwidth, rmode_t *mode, pbwidth_t *width); struct aor_priv_caps { int (*format_mode)(RIG *rig, char *buf, rmode_t mode, pbwidth_t width); int (*parse_aor_mode)(RIG *rig, char aormode, char aorwidth, rmode_t *mode, pbwidth_t *width); char bank_base1; char bank_base2; }; int aor_close(RIG *rig); int aor_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int aor_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int aor_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int aor_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int aor_set_vfo(RIG *rig, vfo_t vfo); int aor_get_vfo(RIG *rig, vfo_t *vfo); int aor_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int aor_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int aor_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); int aor_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts); int aor_set_powerstat(RIG *rig, powerstat_t status); int aor_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); int aor_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch); const char *aor_get_info(RIG *rig); int aor_set_mem(RIG *rig, vfo_t vfo, int ch); int aor_get_mem(RIG *rig, vfo_t vfo, int *ch); int aor_set_bank(RIG *rig, vfo_t vfo, int bank); int aor_get_channel(RIG *rig, channel_t *chan); int aor_set_channel(RIG *rig, const channel_t *chan); int aor_get_chan_all_cb (RIG * rig, chan_cb_t chan_cb, rig_ptr_t); extern const struct rig_caps ar2700_caps; extern const struct rig_caps ar8200_caps; extern const struct rig_caps ar8000_caps; extern const struct rig_caps ar8600_caps; extern const struct rig_caps ar5000_caps; extern const struct rig_caps ar3000a_caps; extern const struct rig_caps ar7030_caps; extern const struct rig_caps ar3030_caps; extern const struct rig_caps ar5000a_caps; extern const struct rig_caps ar7030p_caps; extern const struct rig_caps sr2200_caps; #endif /* _AOR_H */ hamlib-1.2.15.3/aor/ar7030p_utils.c0000644000175000017500000007211512044564477013402 00000000000000 /* * Hamlib AOR backend - AR7030 Plus utility functions * Copyright (c) 2009-2010 by Larry Gadallah (VE6VQ) * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * Version 2009.12.31 Larry Gadallah (VE6VQ) */ #include #include #include #include #include #include "ar7030p.h" #include "serial.h" #include "idx_builtin.h" static enum PAGE_e curPage = NONE; /* Current memory page */ static unsigned int curAddr = 65535; /* Current page address */ static enum LOCK_LVL_e curLock = LOCK_0; /* Current lock level */ static const unsigned int PAGE_SIZE[] = { 256, 256, 512, 4096, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8 }; /* Page size table */ #if 0 /* * Code Ident Operation * 0x NOP No Operation */ int NOP( RIG *rig, unsigned char x ) { int rc = -RIG_OK; unsigned char op = ( ( 0x0f & x ) | op_NOP ); assert( NULL != rig ); rc = write_block( &rig->state.rigport, ( char * ) &op, 1 ); if ( 0 != rc ) { rc = -RIG_EIO; } return ( rc ); } /* * Code Ident Operation * 3x SRH Set H-register x -> H-register (4-bits) */ int SRH( RIG *rig, unsigned char x ) { int rc = -RIG_OK; unsigned char op = ( ( 0x0f & x ) | op_SRH ); assert( NULL != rig ); rc = write_block( &rig->state.rigport, ( char * ) &op, 1 ); if ( 0 != rc ) { rc = -RIG_EIO; } return ( rc ); } /* * Code Ident Operation * 5x PGE Set page x -> Page register (4-bits) */ int PGE( RIG *rig, enum PAGE_e page ) { int rc = -RIG_OK; unsigned char op = ( ( 0x0f & page ) | op_PGE ); assert( NULL != rig ); switch ( page ) { case WORKING: case BBRAM: case EEPROM1: case EEPROM2: case EEPROM3: case ROM: rc = write_block( &rig->state.rigport, ( char * ) &op, 1 ); if ( 0 != rc ) { rc = -RIG_EIO; } break; case NONE: default: rig_debug( RIG_DEBUG_VERBOSE, "PGE: invalid page %d\n", page ); rc = -RIG_EINVAL; break; }; return ( rc ); } /* * Code Ident Operation * 4x ADR Set address 0Hx -> Address register (12-bits) * 0 -> H-register */ int ADR( RIG *rig, unsigned char x ) { int rc = -RIG_OK; unsigned char op = ( ( 0x0f & x ) | op_ADR ); assert( NULL != rig ); rc = write_block( &rig->state.rigport, ( char * ) &op, 1 ); if ( 0 != rc ) { rc = -RIG_EIO; } return ( rc ); } /* * Code Ident Operation * 1x ADH Set address high x -> Address register (high 4-bits) */ int ADH( RIG *rig, unsigned char x ) { int rc = -RIG_OK; unsigned char op = ( ( 0x0f & x ) | op_ADH ); assert( NULL != rig ); rc = write_block( &rig->state.rigport, ( char * ) &op, 1 ); if ( 0 != rc ) { rc = -RIG_EIO; } return ( rc ); } /* * Code Ident Operation * 6x WRD Write data Hx -> [Page, Address] * Address register + 1 -> Address register * 0 -> H-register, 0 -> Mask register */ int WRD( RIG *rig, unsigned char out ) { int rc = -RIG_OK; unsigned char op = ( ( 0x0f & out ) | op_WRD ); assert( NULL != rig ); rc = write_block( &rig->state.rigport, ( char * ) &op, 1 ); if ( 0 != rc ) { rc = -RIG_EIO; } return ( rc ); } /* * Code Ident Operation * 9x MSK Set mask Hx -> Mask register <1> * 0 -> H-register */ int MSK( RIG *rig, unsigned char mask ) { int rc = -RIG_OK; unsigned char op = ( ( 0x0f & mask ) | op_MSK ); assert( NULL != rig ); rc = write_block( &rig->state.rigport, ( char * ) &op, 1 ); if ( 0 != rc ) { rc = -RIG_EIO; } return ( rc ); } /* * Code Ident Operation * 2x EXE Execute routine x */ int EXE( RIG *rig, enum ROUTINE_e routine ) { int rc = -RIG_OK; unsigned char op = ( ( 0x0f & routine ) | op_EXE ); assert( NULL != rig ); switch ( routine ) { case RESET: case SET_FREQ: case SET_MODE: case SET_PASS: case SET_ALL: case SET_AUDIO: case SET_RFIF: case DIR_RX_CTL: case DIR_DDS_CTL: case DISP_MENUS: case DISP_FREQ: case DISP_BUFF: case READ_SIGNAL: case READ_BTNS: rc = write_block( &rig->state.rigport, ( char * ) &op, 1 ); if ( 0 != rc ) { rc = -RIG_EIO; } break; default: rig_debug( RIG_DEBUG_VERBOSE, "EXE: invalid routine %d\n", routine ); rc = -RIG_EINVAL; break; }; return ( rc ); } /* * Code Ident Operation * 7x RDD Read data [Page, Address] -> Serial output * Address register + x -> Address register */ int RDD( RIG *rig, unsigned char len ) { int rc = -RIG_OK; unsigned char inChr = 0; unsigned char op = ( ( 0x0f & len ) | op_RDD ); assert( NULL != rig ); rc = write_block( &rig->state.rigport, ( char * ) &op, 1 ); if ( 0 != rc ) { rc = -RIG_EIO; } else { rc = read_block( &rig->state.rigport, ( char * ) &inChr, len ); if ( 1 != rc ) { rc = -RIG_EIO; } else { rc = (int) inChr; } } return ( rc ); } /* * Code Ident Operation * 8x LOC Set lock level x */ int LOC( RIG *rig, enum LOCK_LVL_e level ) { int rc = -RIG_OK; unsigned char op = ( ( 0x0f & level ) | op_LOC ); assert( NULL != rig ); switch ( level ) { case LOCK_0: case LOCK_1: case LOCK_2: case LOCK_3: rc = write_block( &rig->state.rigport, ( char * ) &op, 1 ); if ( 0 != rc ) { rc = -RIG_EIO; } break; default: rig_debug( RIG_DEBUG_VERBOSE, "LOC: invalid lock level %d\n", level ); rc = -RIG_EINVAL; break; }; return ( rc ); } /* * Code Ident Operation * Ax BUT Operate button x <1> */ int BUT( RIG *rig, enum BUTTON_e button ) { int rc = -RIG_OK; unsigned char op = ( ( 0x0f & button ) | op_BUT ); assert( NULL != rig ); switch ( button ) { case BTN_NONE: break; case BTN_UP: case BTN_DOWN: case BTN_FAST: case BTN_FILTER: case BTN_RFIF: case BTN_MEMORY: case BTN_STAR: case BTN_MENU: case BTN_POWER: rc = write_block( &rig->state.rigport, ( char * ) &op, 1 ); if ( 0 != rc ) { rc = -RIG_EIO; } break; default: rig_debug( RIG_DEBUG_VERBOSE, "BUT: invalid button %d\n", button ); rc = -RIG_EINVAL; break; }; return ( rc ); } #endif // 0 /* * /brief Execute routine * * /param rig Pointer to rig struct * /param rtn Receiver routine to execute * * \return RIG_OK on success, error code on failure * */ int execRoutine( RIG * rig, enum ROUTINE_e rtn ) { int rc = -RIG_EIO; unsigned char v = EXE( (rtn & 0x0f) ); assert( NULL != rig ); if ( 0 == write_block( &rig->state.rigport, (char *) &v, 1 ) ) { rc = -RIG_OK; rig_debug( RIG_DEBUG_VERBOSE, "%s: routine %2d\n", __func__, rtn ); } return( rc ); } /* * /brief Set address for I/O with radio * * /param rig Pointer to rig struct * /param page Memory page number (0-4, 15) * /param addr Address offset within page (0-4095, depending on page) * * \return RIG_OK on success, error code on failure * * Statics curPage and curAddr shadow radio's copies so that * page and address are only set when needed */ static int setAddr( RIG * rig, enum PAGE_e page, unsigned int addr ) { int rc = RIG_OK; unsigned char v; assert( NULL != rig ); if ( ( EEPROM3 >= page ) || ( ROM == page ) ) { if ( PAGE_SIZE[page] > addr ) { if ( curPage != page ) { v = PGE( page ); if ( 0 == write_block( &rig->state.rigport, (char *) &v, 1 ) ) { curPage = page; rc = -RIG_OK; rig_debug( RIG_DEBUG_VERBOSE, "%s: set page %2d\n", __func__, page ); } else { rc = -RIG_EIO; } } if ( curAddr != addr ) { v = SRH( ( 0x0f0 & addr ) >> 4 ); if ( 0 == write_block( &rig->state.rigport, (char *) &v, 1 ) ) { rc = -RIG_OK; } else { rc = -RIG_EIO; } v = ADR( ( 0x00f & addr ) ); if ( 0 == write_block( &rig->state.rigport, (char *) &v, 1 ) ) { if ( 0xff < addr ) { v = ADH( ( 0xf00 & addr ) >> 8 ); if ( 0 == write_block( &rig->state.rigport, (char *) &v, 1 ) ) { curAddr = addr; rc = -RIG_OK; rig_debug( RIG_DEBUG_VERBOSE, "%s: set addr 0x%04x\n", __func__, addr ); } else { rc = -RIG_EIO; } } else { curAddr = addr; rc = -RIG_OK; rig_debug( RIG_DEBUG_VERBOSE, "%s: set addr 0x%04x\n", __func__, addr ); } } else { rc = -RIG_EIO; } } } else { rc = -RIG_EINVAL; /* invalid address */ } } else { rc = -RIG_EINVAL; /* invalid page */ } return( rc ); } /* * /brief Write one byte to the receiver * * /param rig Pointer to rig struct * /param page Memory page number (0-4, 15) * /param addr Address offset within page (0-4095, depending on page) * /param x Value to write to radio * * \return RIG_OK on success, error code on failure * */ int writeByte( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned char x ) { int rc = -RIG_EIO; unsigned char hi = SRH((x & 0xf0 ) >> 4 ); unsigned char lo = WRD( x & 0x0f ); assert( NULL != rig ); rc = setAddr( rig, page, addr ); if ( RIG_OK == rc ) { rc = -RIG_EIO; if ( 0 == write_block( &rig->state.rigport, (char *) &hi, 1 ) ) { if ( 0 == write_block( &rig->state.rigport, (char *) &lo, 1 ) ) { rc = -RIG_OK; curAddr++; rig_debug( RIG_DEBUG_VERBOSE, "%s: wrote byte 0x%02x\n", __func__, x ); } } } return( rc ); } /* * /brief Write two bytes to the receiver * * /param rig Pointer to rig struct * /param page Memory page number (0-4, 15) * /param addr Address offset within page (0-4095, depending on page) * /param x Value to write to radio * * \return Number of bytes written, 0 on error. Get error code with getErrno. * */ int writeShort( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned short x ) { int rc = -RIG_EIO; unsigned char v = (unsigned char) ( ( x & 0xff00 ) >> 8 ); rc = writeByte( rig, page, addr, v ); if ( RIG_OK == rc ) { v = (unsigned char) ( x & 0x00ff ); rc = writeByte( rig, page, addr + 1, v ); } return( rc ); } /* * /brief Write three bytes to the receiver * * /param rig Pointer to rig struct * /param page Memory page number (0-4, 15) * /param addr Address offset within page (0-4095, depending on page) * /param x Value to write to radio * * \return Number of bytes written, 0 on error. Get error code with getErrno. * */ int write3Bytes( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned int x ) { int rc = -RIG_EIO; unsigned char v = (unsigned char) ( ( x & 0xff0000 ) >> 16 ); rc = writeByte( rig, page, addr, v ); if ( RIG_OK == rc ) { v = (unsigned char) ( ( x & 0x00ff00 ) >> 8 ); rc = writeByte( rig, page, addr + 1, v ); if ( RIG_OK == rc ) { v = (unsigned char) ( x & 0x0000ff ); rc = writeByte( rig, page, addr + 2, v ); } } return( rc ); } /* * /brief Write unsigned int (4 bytes) to the receiver * * /param rig Pointer to rig struct * /param page Memory page number (0-4, 15) * /param addr Address offset within page (0-4095, depending on page) * /param x Value to write to radio * * \return Number of bytes written, 0 on error. Get error code with getErrno. * */ int writeInt( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned int x ) { int rc = -RIG_EIO; unsigned char v = (unsigned char) ( ( x & 0xff000000 ) >> 24 ); rc = writeByte( rig, page, addr, v ); if ( RIG_OK == rc ) { v = (unsigned char) ( ( x & 0x00ff0000 ) >> 16 ); rc = writeByte( rig, page, addr + 1, v ); if ( RIG_OK == rc ) { v = (unsigned char) ( ( x & 0x0000ff00 ) >> 8 ); rc = writeByte( rig, page, addr + 2, v ); if ( RIG_OK == rc ) { v = (unsigned char) ( x & 0x000000ff ); rc = writeByte( rig, page, addr + 3, v ); } } } return( rc ); } /* * /brief Read one byte from the receiver * * /param rig Pointer to rig struct * /param page Memory page number (0-4, 15) * /param addr Address offset within page (0-4095, depending on page) * /param x Pointer to value to read from radio * * \return RIG_OK on success, error code on failure * */ int readByte( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned char *x ) { int rc = -RIG_OK; unsigned char v = RDD( 1 ); // Read command assert( NULL != rig ); assert( NULL != x ); rc = setAddr( rig, page, addr ); if ( RIG_OK == rc ) { rc = -RIG_EIO; if ( 0 == write_block( &rig->state.rigport, (char *) &v, 1 ) ) { if ( 1 == read_block( &rig->state.rigport, (char *) x, 1 ) ) { curAddr++; rc = -RIG_OK; rig_debug( RIG_DEBUG_VERBOSE, "%s: read 0x%02x\n", __func__, *x ); } } } return( rc ); } /* * /brief Read an unsigned short (two bytes) from the receiver * * /param rig Pointer to rig struct * /param page Memory page number (0-4, 15) * /param addr Address offset within page (0-4095, depending on page) * /param x Pointer to value to read from radio * * \return RIG_OK on success, error code on failure * */ int readShort( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned short *x ) { int rc = -RIG_OK; unsigned char v; assert( NULL != rig ); assert( NULL != x ); rc = readByte( rig, page, addr, &v ); if ( RIG_OK == rc ) { *x = (unsigned short) v << 8; rc = readByte( rig, page, addr + 1, &v ); if ( RIG_OK == rc ) { *x += (unsigned short) v; rig_debug( RIG_DEBUG_VERBOSE, "%s: read 0x%04x\n", __func__, *x ); } } return( rc ); } /* * /brief Read an unsigned int (three bytes) from the receiver * * /param rig Pointer to rig struct * /param page Memory page number (0-4, 15) * /param addr Address offset within page (0-4095, depending on page) * /param x Pointer to value to read from radio * * \return RIG_OK on success, error code on failure * */ int read3Bytes( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned int *x ) { int rc = -RIG_OK; unsigned char v; assert( NULL != rig ); assert( NULL != x ); rc = readByte( rig, page, addr, &v ); if ( RIG_OK == rc ) { *x = (unsigned int) v << 16; rc = readByte( rig, page, addr + 1, &v ); if ( RIG_OK == rc ) { *x += (unsigned int) v << 8; rc = readByte( rig, page, addr + 2, &v ); if ( RIG_OK == rc ) { *x += (unsigned int) v; rig_debug( RIG_DEBUG_VERBOSE, "%s: read 0x%06x\n", __func__, *x ); } } } return( rc ); } /* * /brief Read an unsigned int (four bytes) from the receiver * * /param rig Pointer to rig struct * /param page Memory page number (0-4, 15) * /param addr Address offset within page (0-4095, depending on page) * /param x Pointer to value to read from radio * * \return RIG_OK on success, error code on failure * */ int readInt( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned int *x ) { int rc = 0; unsigned char v; assert( NULL != rig ); assert( NULL != x ); rc = readByte( rig, page, addr, &v ); if ( RIG_OK == rc ) { *x = (unsigned int) v << 24; rc = readByte( rig, page, addr + 1, &v ); if ( RIG_OK == rc ) { *x += (unsigned int) v << 16; rc = readByte( rig, page, addr + 2, &v ); if ( RIG_OK == rc ) { *x += (unsigned int) v << 8; rc = readByte( rig, page, addr + 3, &v ); { *x += (unsigned int) v; rig_debug( RIG_DEBUG_VERBOSE, "%s: read 0x%08x\n", __func__, *x ); } } } } return( rc ); } /* * /brief Read raw AGC value from the radio * * /param rig Pointer to rig struct * * \return RIG_OK on success, error code on failure */ int readSignal( RIG * rig, unsigned char *x ) { int rc = -RIG_EIO; assert( NULL != rig ); assert( NULL != x ); rc = execRoutine( rig, READ_SIGNAL ); // Read raw AGC value if ( RIG_OK == rc ) { if ( 1 == read_block( &rig->state.rigport, (char *) x, 1 ) ) { rc = -RIG_OK; rig_debug( RIG_DEBUG_VERBOSE, "%s: raw AGC %03d\n", __func__, *x ); } } return( rc ); } /* * /brief Flush I/O with radio * * /param rig Pointer to rig struct * */ int flushBuffer( RIG * rig ) { int rc = -RIG_EIO; char v = '/'; assert( NULL != rig ); if ( 0 == write_block( &rig->state.rigport, &v, 1 ) ) { rc = -RIG_OK; } return( rc ); } /* * /brief Lock receiver for remote operations * * /param rig Pointer to rig struct * /param level Lock level (0-3) * */ int lockRx( RIG * rig, enum LOCK_LVL_e level ) { int rc = -RIG_EIO; unsigned char v; assert( NULL != rig ); if ( LOCK_NONE > level ) /* valid level? */ { if ( curLock != level ) /* need to change level? */ { v = LOC( level ); if ( 0 == write_block( &rig->state.rigport, (char *) &v, 1 ) ) { rc = -RIG_OK; curLock = level; } } else { rc = -RIG_OK; } } else { rc = -RIG_EINVAL; } return( rc ); } /* * \brief Convert one byte BCD value to int * * \param bcd BCD value (0-99) * * \return Integer value of BCD parameter (0-99), -1 on failure */ int bcd2Int( const unsigned char bcd ) { int rc = -1; unsigned char hi = ((bcd & 0xf0) >> 4); unsigned char lo = (bcd & 0x0f); if ( (unsigned char) 0x0a > hi ) { rc = (int) hi * 10; if ( (unsigned char) 0x0a > lo ) { rc += (int) lo; } else { rc = -1; } } return( rc ); } /* * \brief Convert int into 2 digit BCD number * * \param int Integer value (0-99) * * \return 2 digit BCD equvalent (0-99), 0xff on failure */ unsigned char int2BCD( const unsigned int val ) { unsigned char rc = (unsigned char) 0xff; unsigned char tens = (unsigned char) (val / 10); unsigned char ones = (unsigned char) (val % 10); if ( (unsigned char) 10 > tens ) { rc = ( tens << 4 ); if ( (unsigned char) 10 > ones ) { rc = rc | ones; } else { rc = (unsigned char) 0xff; } } return ( rc ); } /* * \brief Convert raw AGC value to calibrated level in dBm * * \param rig Pointer to rig struct * \param rawAgc raw AGC value (0-255) * \param tab Pointer to calibration table struct * \param dbm Pointer to value to hold calibrated level (S9 = 0 dBm) * * \return RIG_OK on success, error code on failure * * To calculate the signal level, table values should be subtracted from * the AGC voltage in turn until a negative value would result. This gives * the rough level from the table position. The accuracy can be improved by * proportioning the remainder into the next table step. See the following * example :- * * A read signal strength operation returns a value of 100 * Subtract cal byte 1 (64) leaves 36 level > -113dBm * Subtract cal byte 2 (10) leaves 26 level > -103dBm * Subtract cal byte 3 (10) leaves 16 level > -93dBm * Subtract cal byte 4 (12) leaves 4 level > -83dBm * Test cal byte 5 (12) - no subtraction * Fine adjustment value = (remainder) / (cal byte 5) * (level step) * = 4 / 12 * 10 = 3dB * Signal level = -83dBm + 3dB = -80dB * * The receiver can operate the RF attenuator automatically if the signal * level is likely to overload the RF stages. Reading the RFAGC byte (page 0, * location 49) gives the attenuation in 10dB steps. This value should be * read and added to the value calculated above. */ int getCalLevel( RIG * rig, unsigned char rawAgc, int *dbm ) { int rc = -RIG_OK; int i; int raw = (int) rawAgc; int step = 10; unsigned char v; assert( NULL != rig ); assert( NULL != dbm ); rig_debug( RIG_DEBUG_VERBOSE, "%s: raw AGC %03d\n", __func__, rawAgc ); for ( i = 0; i < rig->state.str_cal.size; i++ ) { *dbm = rig->state.str_cal.table[ i ].val; rig_debug( RIG_DEBUG_VERBOSE, "%s: got cal table[ %d ] dBm value %d\n", __func__, i, *dbm); /* if the remaining difference in the raw value is negative */ if ( 0 > ( raw - rig->state.str_cal.table[ i ].raw ) ) { /* calculate step size */ if ( 0 < i ) { step = rig->state.str_cal.table[ i ].val - rig->state.str_cal.table[ i - 1 ].val; } else { step = 20; /* HACK - try and fix mimimum AGC readings */ } rig_debug( RIG_DEBUG_VERBOSE, "%s: got step size %d\n", __func__, step); /* interpolate the final value */ *dbm -= step; /* HACK - table seems to be off by one index */ *dbm += (int) ( ( (double) raw / (double) rig->state.str_cal.table[ i ].raw ) * (double) step ); rig_debug( RIG_DEBUG_VERBOSE, "%s: interpolated dBm value %d\n", __func__, *dbm); /* we're done, stop going through the table */ break; } else { /* calculate the remaining raw value */ raw = raw - rig->state.str_cal.table[ i ].raw; rig_debug( RIG_DEBUG_VERBOSE, "%s: residual raw value %d\n", __func__, raw); } } /* Factor in Attenuator/preamp settings */ /* 40 0x028 rxcon 3 bytes Receiver control register mapping */ rc = readByte( rig, WORKING, RXCON, &v ); if ( RIG_OK == rc ) { if ( 0x80 & v ) /* byte 1 bit 7 rx_atn Attenuator enable */ { if ( 0xa0 & v ) { /* HACK - Settings menu on radio says Atten step is 10 dB, not 20 dB */ *dbm += 20; /* byte 1 bit 5 rx_atr Atten : 0 = 20dB / 1 = 40dB */ } else { *dbm += 10; /* byte 1 bit 5 rx_atr Atten : 0 = 20dB / 1 = 40dB */ } } if ( 0x10 & v ) /* byte 1 bit 4 rx_pre Preamplifier enable */ { *dbm -= 10; } rig_debug( RIG_DEBUG_VERBOSE, "%s: RXCON 0x%02x, adjusted dBm value %d\n", __func__, (int) v, *dbm); } /* Adjust to S9 == 0 scale */ *dbm += 73; /* S9 == -73 dBm */ rig_debug( RIG_DEBUG_VERBOSE, "%s: S9 adjusted dBm value %d\n", __func__, *dbm); return ( rc ); } /* * \brief Get bandwidth of given filter * * \param rig Pointer to rig struct * \param filter Filter number (1-6) * * \return Filter bandwidth in Hz, -1 on failure */ int getFilterBW( RIG *rig, enum FILTER_e filter ) { int rc = -1; unsigned char bw; rc = readByte( rig, BBRAM, (FL_BW + ((filter - 1) * 4)), &bw ); if ( RIG_OK == rc ) { rc = bcd2Int( bw ) * 100; } else { rc = -1; } rig_debug( RIG_DEBUG_VERBOSE, "%s: filter %1d BW %5d\n", __func__, filter, rc ); return( rc ); } /* * /brief Convert DDS steps to frequency in Hz * * /param steps DDS count * * /return Frequency in Hz or 0 on failure */ freq_t ddsToHz( const unsigned int steps ) { freq_t rc = 0.0; rc = ( (freq_t) steps * 44545000.0 / 16777216.0 ); return( rc ); } /* * /brief Convert frequency in Hz to DDS steps * * /param freq Frequency in Hz * * /return DDS steps (24 bits) or 0 on failure */ unsigned int hzToDDS( const freq_t freq ) { unsigned int rc = 0; double err[3] = { 0.0, 0.0, 0.0 }; rc = (unsigned int) ( freq * 16777216.0 / 44545000.0 ); /* calculate best DDS count based on bletcherous, irrational tuning step of 2.65508890151977539062 Hz/step (actual ratio is 44545000.0 / 16777216.0) */ err[ 0 ] = fabs( freq - ddsToHz( (rc - 1) ) ); err[ 1 ] = fabs( freq - ddsToHz( rc ) ); err[ 2 ] = fabs( freq - ddsToHz( (rc + 1) ) ); if ( err[ 0 ] < err[ 1 ] && err[ 0 ] < err[ 2 ] ) { rc--; } else if ( err[ 2 ] < err[ 1 ] && err[ 2 ] < err[ 0 ] ) { rc++; } rig_debug( RIG_DEBUG_VERBOSE, "%s: err[0 - 2] = %f %f %f rc 0x%08x\n", __func__, err[ 0 ], err[ 1 ], err[ 2 ], rc ); return( rc ); } /* * /brief Convert PBS/BFO steps to frequency in Hz * * /param steps PBS/BFO offset steps * * /return Frequency in Hz or 0 on failure * * Max +ve offset is 127, max -ve offset is 128 * Min -ve offset is 255 */ float pbsToHz( const unsigned char steps ) { freq_t rc = 0.0; /* treat steps as a 1's complement signed 8-bit number */ if ( 128 > steps ) { rc = ( ( (float) steps * 12.5 * 44545000.0 ) / 16777216.0 ); } else { rc = ( ( (float) (~steps & 0x7f) * -12.5 * 44545000.0 ) / 16777216.0 ); } rig_debug( RIG_DEBUG_VERBOSE, "%s: raw %d hz %f\n", __func__, steps, rc ); return( rc ); } /* * /brief Convert PBS/BFO offset frequency in Hz to steps * * /param freq Offset frequency in Hz * * /return steps (8 bits) or 0 on failure */ unsigned char hzToPBS( const float freq ) { unsigned char rc; int steps; if ( 0 < freq ) { steps = ( ( (freq + 0.5) * 16777216.0 ) / ( 44545000.0 * 12.5 ) ); } else { steps = ( ( (freq - 0.5) * 16777216.0 ) / ( 44545000.0 * 12.5 ) ); } rig_debug( RIG_DEBUG_VERBOSE, "%s: steps %d\n", __func__, steps ); if ( 0 <= steps ) { rc = (unsigned char) (steps & 0x7f); } else if ( -128 < steps ) { rc = (unsigned char) (steps + 255); } else { rc = (unsigned char) 0; } rig_debug( RIG_DEBUG_VERBOSE, "%s: hz %f rc %d\n", __func__, freq, rc ); return( rc ); } /* * /brief Convert native Mode to Hamlib mode * * /param mode Native mode value * * /return Hamlib mode value */ rmode_t modeToHamlib( const unsigned char mode ) { rmode_t rc = RIG_MODE_NONE; switch( mode ) { case AM: rc = RIG_MODE_AM; break; case SAM: rc = RIG_MODE_AMS; break; case FM: rc = RIG_MODE_FM; break; case DATA: rc = RIG_MODE_RTTY; break; case CW: rc = RIG_MODE_CW; break; case LSB: rc = RIG_MODE_LSB; break; case USB: rc = RIG_MODE_USB; break; default: break; }; rig_debug( RIG_DEBUG_VERBOSE, "%s: Native %d, Hamlib %d\n", __func__, mode, rc ); return( rc ); } /* * /brief Convert Hamlib Mode to native mode * * /param mode Hamlib mode value * * /return Native mode value */ unsigned char modeToNative( const rmode_t mode ) { unsigned char rc = (unsigned char) MODE_NONE; switch( mode ) { case RIG_MODE_AM: rc = (unsigned char) AM; break; case RIG_MODE_AMS: rc = (unsigned char) SAM; break; case RIG_MODE_FM: rc = (unsigned char) FM; break; case RIG_MODE_RTTY: rc = (unsigned char) DATA; break; case RIG_MODE_CW: rc = (unsigned char) CW; break; case RIG_MODE_LSB: rc = (unsigned char) LSB; break; case RIG_MODE_USB: rc = (unsigned char) USB; break; default: break; }; rig_debug( RIG_DEBUG_VERBOSE, "%s: Hamlib %d, native %d\n", __func__, mode, rc ); return( rc ); } /* * /brief Convert native AGC speed to Hamlib AGC speed * * /param agc Native AGC speed value * * /return Hamlib AGC speed value */ enum agc_level_e agcToHamlib( const unsigned char agc ) { enum agc_level_e rc = RIG_AGC_AUTO; switch( agc ) { case AGC_FAST: rc = RIG_AGC_FAST; break; case AGC_MED: rc = RIG_AGC_MEDIUM; break; case AGC_SLOW: rc = RIG_AGC_SLOW; break; case AGC_OFF: rc = RIG_AGC_OFF; break; default: break; }; rig_debug( RIG_DEBUG_VERBOSE, "%s: Native %d, Hamlib %d\n", __func__, agc, rc ); return( rc ); } /* * /brief Convert Hamlib AGC speed to native AGC speed * * /param agc Hamlib AGC speed value * * /return Native AGC speed value */ unsigned char agcToNative( const enum agc_level_e agc ) { unsigned char rc = (unsigned char) AGC_NONE; switch( agc ) { case RIG_AGC_OFF: rc = (unsigned char) AGC_OFF; break; case RIG_AGC_FAST: rc = (unsigned char) AGC_FAST; break; case RIG_AGC_SLOW: rc = (unsigned char) AGC_SLOW; break; case RIG_AGC_MEDIUM: rc = (unsigned char) AGC_MED; break; case RIG_AGC_SUPERFAST: case RIG_AGC_USER: case RIG_AGC_AUTO: default: rc = (unsigned char) AGC_NONE; break; }; rig_debug( RIG_DEBUG_VERBOSE, "%s: Hamlib %d, native %d\n", __func__, agc, rc ); return( rc ); } /* * /brief Get page size * * /param page Page to get size of * * /return Page size, -1 on error */ int pageSize( const enum PAGE_e page ) { int rc = -1; if ( ( WORKING <= page ) && ( EEPROM3 >= page ) ) { rc = (int) PAGE_SIZE[ page ]; } else if ( ROM == page ) { rc = (int) PAGE_SIZE[ page ]; } else { rc = -1; } return( rc ); } /* * /brief Set and execute IR controller code * * /param code IR code to execute * * \return RIG_OK on success, error code on failure */ int sendIRCode( RIG *rig, enum IR_CODE_e code ) { int rc = -RIG_EIO; unsigned char v = (unsigned char) code; assert( NULL != rig ); rc = writeByte( rig, WORKING, IRCODE, v ); if ( RIG_OK == rc ) { rc = execRoutine( rig, SET_ALL ); if ( RIG_OK == rc ) { rig_debug( RIG_DEBUG_VERBOSE, "%s: set IR code %d\n", __func__, code ); } } return( rc ); } hamlib-1.2.15.3/aor/ar2700.c0000644000175000017500000001412112044564477011772 00000000000000/* * Hamlib AOR backend - AR2700 description * Copyright (c) 2000-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "aor.h" #define AR2700_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define AR2700_FUNC (RIG_FUNC_ABM) #define AR2700_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR) #define AR2700_PARM (RIG_PARM_APO) #define AR2700_VFO_OPS (RIG_OP_MCL|RIG_OP_UP|RIG_OP_DOWN) #define AR2700_SCAN_OPS (RIG_SCAN_MEM) #define AR2700_VFO_ALL (RIG_VFO_A|RIG_VFO_MEM) /* TODO: measure and report real values */ #define AR2700_STR_CAL { 2, \ { \ { 0x00, -60 }, \ { 0x3f, 60 } \ } } #define AR2700_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .bank_num = 1, \ .tuning_step = 1, \ .flags = 1, \ .levels = RIG_LEVEL_ATT, \ .funcs = RIG_FUNC_ABM, \ } static int format2700_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width); static int parse2700_aor_mode(RIG *rig, char aormode, char aorwidth, rmode_t *mode, pbwidth_t *width); static const struct aor_priv_caps ar2700_priv_caps = { .format_mode = format2700_mode, .parse_aor_mode = parse2700_aor_mode, .bank_base1 = '0', .bank_base2 = '0', }; /* * ar2700 rig capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! * * part of info from http://www.aoruk.com/2700.htm * Interface unit: CU-8232 (or equivalent) */ const struct rig_caps ar2700_caps = { .rig_model = RIG_MODEL_AR2700, .model_name = "AR2700", .mfg_name = "AOR", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_SCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 2400, .serial_rate_max = 9600, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_XONXOFF, .write_delay = 0, .post_write_delay = 0, .timeout = 400, .retry = 3, .has_get_func = AR2700_FUNC, .has_set_func = AR2700_FUNC, .has_get_level = AR2700_LEVEL, .has_set_level = RIG_LEVEL_SET(AR2700_LEVEL), .has_get_parm = AR2700_PARM, .has_set_parm = AR2700_PARM, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, /* FIXME: CTCSS list */ .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { 20, RIG_DBLST_END, }, /* TBC */ .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_RIG, .bank_qty = 10, .chan_desc_sz = 0, .vfo_ops = AR2700_VFO_OPS, .scan_ops = AR2700_SCAN_OPS, .str_cal = AR2700_STR_CAL, .chan_list = { { 0, 499, RIG_MTYPE_MEM, AR2700_MEM_CAP }, /* flat space */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(500),MHz(1300),AR2700_MODES,-1,-1,AR2700_VFO_ALL}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(1300),AR2700_MODES,-1,-1,AR2700_VFO_ALL}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { RIG_FRNG_END, }, /* no tx range, this is a scanner! */ .tuning_steps = { {RIG_MODE_AM|RIG_MODE_FM,kHz(5)}, {RIG_MODE_AM|RIG_MODE_FM,kHz(6.25)}, {RIG_MODE_AM|RIG_MODE_FM,kHz(9)}, {RIG_MODE_AM|RIG_MODE_FM,kHz(10)}, {RIG_MODE_AM|RIG_MODE_FM,12500}, {RIG_MODE_AM|RIG_MODE_FM,kHz(20)}, {RIG_MODE_AM|RIG_MODE_FM,kHz(25)}, {RIG_MODE_AM|RIG_MODE_FM,kHz(30)}, {AR2700_MODES,kHz(50)}, {AR2700_MODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { /* mode/filter list, .remember = order matters! */ {RIG_MODE_AM, kHz(9)}, {RIG_MODE_FM, kHz(12)}, {RIG_MODE_WFM, kHz(230)}, RIG_FLT_END, }, .priv = (void*)&ar2700_priv_caps, .rig_init = NULL, .rig_cleanup = NULL, .rig_open = NULL, .rig_close = aor_close, .set_freq = aor_set_freq, .get_freq = aor_get_freq, .set_vfo = aor_set_vfo, .get_vfo = aor_get_vfo, .set_mode = aor_set_mode, .get_mode = aor_get_mode, .set_level = aor_set_level, .get_level = aor_get_level, .get_dcd = aor_get_dcd, .set_ts = aor_set_ts, .set_powerstat = aor_set_powerstat, .vfo_op = aor_vfo_op, .scan = aor_scan, .get_info = aor_get_info, .set_mem = aor_set_mem, .get_mem = aor_get_mem, .set_bank = aor_set_bank, .set_channel = aor_set_channel, .get_channel = aor_get_channel, .get_chan_all_cb = aor_get_chan_all_cb, }; /* * Function definitions below */ /* * modes in use by the "MD" command of AR2700 */ #define AR2700_WFM '0' #define AR2700_NFM '1' #define AR2700_AM '2' int format2700_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width) { int aormode; switch (mode) { case RIG_MODE_AM: aormode = AR2700_AM; break; case RIG_MODE_WFM: aormode = AR2700_WFM; break; case RIG_MODE_FM: aormode = AR2700_NFM; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n", __FUNCTION__, mode); return -RIG_EINVAL; } return sprintf(buf, "MD%c", aormode); } int parse2700_aor_mode(RIG *rig, char aormode, char aorwidth, rmode_t *mode, pbwidth_t *width) { switch (aormode) { case AR2700_NFM: *mode = RIG_MODE_FM; break; case AR2700_WFM: *mode = RIG_MODE_WFM; break; case AR2700_AM: *mode = RIG_MODE_AM; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode '%c'\n", __FUNCTION__, aormode); return -RIG_EPROTO; } *width = rig_passband_normal(rig, *mode); return RIG_OK; } hamlib-1.2.15.3/aor/aor.c0000644000175000017500000006547212044564477011657 00000000000000/* * Hamlib AOR backend - main file * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "register.h" #include "idx_builtin.h" #include "aor.h" /* * acknowledge is CR * Is \r portable enough? */ #define CR '\r' #define EOM "\r" #define BUFSZ 256 /* * modes in use by the "MD" command of AR8000 and AR8200 */ #define AR8K_WFM '0' #define AR8K_NFM '1' #define AR8K_AM '2' #define AR8K_USB '3' #define AR8K_LSB '4' #define AR8K_CW '5' #define AR8K_SFM '6' #define AR8K_WAM '7' #define AR8K_NAM '8' /* * aor_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! * return value: RIG_OK if everything's fine, negative value otherwise * TODO: error case handling */ static int aor_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval; struct rig_state *rs; char ackbuf[BUFSZ]; int ack_len; rs = &rig->state; serial_flush(&rs->rigport); retval = write_block(&rs->rigport, cmd, cmd_len); if (retval != RIG_OK) return retval; if (!data) data = ackbuf; if (!data_len) data_len = &ack_len; /* * Do wait for a reply */ retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM)); if (retval < 0) return retval; /* chop LF head when present */ if (retval >= 1 && data[0] == '\x0a') { retval--; memmove(data, data+1, retval); } *data_len = retval; if (*data_len < BUFSZ) data[*data_len] = '\0'; else data[BUFSZ-1] = '\0'; if (retval >= 1 && data[0] == '?') { /* command failed? resync with radio */ write_block(&rs->rigport, EOM, 1); return -RIG_EPROTO; } return RIG_OK; } /* * aor_close * Assumes rig!=NULL */ int aor_close(RIG *rig) { /* * terminate remote operation via the RS-232 * Note: use write_block() instead of aor_transaction * since no reply is to be expected. */ return write_block(&rig->state.rigport, "EX" EOM, 3); } static int format_freq(char *buf, freq_t freq) { int lowhz; int64_t f = (int64_t)freq; /* * actually, frequency must be like nnnnnnnnm0, * where m must be 0 or 5 (for 50Hz). */ lowhz = f % 100; f /= 100; if (lowhz < 25) lowhz = 0; else if (lowhz < 75) lowhz = 50; else lowhz = 100; f = f*100 + lowhz; return sprintf(buf,"RF%010"PRIll, f); } /* * aor_set_freq * Assumes rig!=NULL */ int aor_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char freqbuf[BUFSZ]; int freq_len; freq_len = format_freq(freqbuf, freq); strcpy(freqbuf+freq_len, EOM); freq_len += strlen(EOM); return aor_transaction (rig, freqbuf, freq_len, NULL, NULL); } /* * aor_get_freq * Assumes rig!=NULL, freq!=NULL */ int aor_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { char *rfp; int freq_len, retval; char freqbuf[BUFSZ]; retval = aor_transaction (rig, "RX" EOM, 3, freqbuf, &freq_len); if (retval != RIG_OK) return retval; rfp = strstr(freqbuf, "RF"); if (!rfp && rig->caps->rig_model == RIG_MODEL_AR8000) rfp = strstr(freqbuf, "VA"); if (!rfp && rig->caps->rig_model == RIG_MODEL_AR8000) rfp = strstr(freqbuf, "VB"); if (!rfp) { rig_debug(RIG_DEBUG_WARN, "NO RF in returned string in aor_get_freq: '%s'\n", freqbuf); return -RIG_EPROTO; } sscanf(rfp+2,"%"SCNfreq, freq); return RIG_OK; } /* * aor_set_vfo * Assumes rig!=NULL */ int aor_set_vfo(RIG *rig, vfo_t vfo) { char *vfocmd; switch (vfo) { case RIG_VFO_VFO: if (rig->caps->rig_model == RIG_MODEL_AR8000) { vfocmd = "RF" EOM; } else { vfocmd = "VF" EOM; } break; case RIG_VFO_A: vfocmd = "VA" EOM; break; case RIG_VFO_B: vfocmd = "VB" EOM; break; case RIG_VFO_C: vfocmd = "VC" EOM; break; case RIG_VFO_N(3): vfocmd = "VD" EOM; break; case RIG_VFO_N(4): vfocmd = "VE" EOM; break; case RIG_VFO_MEM: vfocmd = "MR" EOM; break; default: rig_debug(RIG_DEBUG_ERR,"aor_set_vfo: unsupported vfo %d\n", vfo); return -RIG_EINVAL; } return aor_transaction (rig, vfocmd, strlen(vfocmd), NULL, NULL); } /* * aor_get_vfo * Assumes rig!=NULL, freq!=NULL */ int aor_get_vfo(RIG *rig, vfo_t *vfo) { int vfo_len, retval; char vfobuf[BUFSZ]; retval = aor_transaction (rig, "RX" EOM, 3, vfobuf, &vfo_len); if (retval != RIG_OK) return retval; if (rig->caps->rig_model == RIG_MODEL_AR8000) { switch (vfobuf[0]) { case 'S': case 'D': *vfo = RIG_VFO_VFO; break; case 'V': *vfo = RIG_VFO_N(vfobuf[4]-'A'); break; case 'M': *vfo = RIG_VFO_MEM; break; default: rig_debug(RIG_DEBUG_ERR,"aor_get_vfo: unknown vfo %s\n", vfobuf); return -RIG_EINVAL; } } else { switch (vfobuf[1]) { case 'S': case 'V': case 'F': *vfo = RIG_VFO_VFO; break; case 'A': *vfo = RIG_VFO_A; break; case 'B': *vfo = RIG_VFO_B; break; case 'C': *vfo = RIG_VFO_C; break; case 'D': *vfo = RIG_VFO_N(3); break; case 'E': *vfo = RIG_VFO_N(4); break; case 'R': *vfo = RIG_VFO_MEM; break; default: rig_debug(RIG_DEBUG_ERR,"aor_get_vfo: unknown vfo %c\n", vfobuf[1]); return -RIG_EINVAL; } } return RIG_OK; } int format8k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width) { int aormode; switch (mode) { case RIG_MODE_AM: if (rig->caps->rig_model == RIG_MODEL_AR8000) { aormode = AR8K_AM; } else { switch(width) { case RIG_PASSBAND_NORMAL: case s_kHz(9): aormode = AR8K_AM; break; case s_kHz(12): aormode = AR8K_WAM; break; case s_kHz(3): aormode = AR8K_NAM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported passband %d %d\n", __FUNCTION__, mode, width); return -RIG_EINVAL; } } break; case RIG_MODE_CW: aormode = AR8K_CW; break; case RIG_MODE_USB: aormode = AR8K_USB; break; case RIG_MODE_LSB: aormode = AR8K_LSB; break; case RIG_MODE_WFM: aormode = AR8K_WFM; break; case RIG_MODE_FM: if (rig->caps->rig_model == RIG_MODEL_AR8000) { aormode = AR8K_NFM; } else { switch(width) { case RIG_PASSBAND_NORMAL: case s_kHz(12): aormode = AR8K_NFM; break; case s_kHz(9): aormode = AR8K_SFM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported passband %d %d\n", __FUNCTION__, mode, width); return -RIG_EINVAL; } } break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n", __FUNCTION__, mode); return -RIG_EINVAL; } return sprintf(buf, "MD%c", aormode); } /* * aor_set_mode * Assumes rig!=NULL */ int aor_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct aor_priv_caps *priv = (struct aor_priv_caps*)rig->caps->priv; char mdbuf[BUFSZ]; char mdbuf2[BUFSZ] = ""; int mdbuf_len, mdbuf2_len, retval; mdbuf_len = priv->format_mode(rig, mdbuf, mode, width); // Return on error if(mdbuf_len<0) return mdbuf_len; strcpy(mdbuf+mdbuf_len, EOM); mdbuf_len += strlen(EOM); switch (rig->caps->rig_model) { case RIG_MODEL_AR5000: case RIG_MODEL_AR5000A: strncpy(mdbuf2, mdbuf, 3); /* Extract first 'MD' part */ mdbuf2_len = strlen(mdbuf2); strcpy(mdbuf2+mdbuf2_len, EOM); /* Add delimiter */ mdbuf2_len = strlen(mdbuf2); retval = aor_transaction (rig, mdbuf2, mdbuf2_len, NULL, NULL); strncpy(mdbuf2, mdbuf + 4, 3); /* Extract first 'BW' part */ mdbuf2_len = strlen(mdbuf2); retval = aor_transaction (rig, mdbuf2, mdbuf2_len, NULL, NULL); break; default: retval = aor_transaction (rig, mdbuf, mdbuf_len, NULL, NULL); } return retval; } /* * parse8k_aor_mode * don't care about aorwidth, * because there's no such BW command */ int parse8k_aor_mode(RIG *rig, char aormode, char aorwidth, rmode_t *mode, pbwidth_t *width) { *width = RIG_PASSBAND_NORMAL; switch (aormode) { case AR8K_AM: *mode = RIG_MODE_AM; break; case AR8K_NAM: *mode = RIG_MODE_AM; *width = rig_passband_narrow(rig, *mode); break; case AR8K_WAM: *mode = RIG_MODE_AM; *width = rig_passband_wide(rig, *mode); break; case AR8K_CW: *mode = RIG_MODE_CW; break; case AR8K_USB: *mode = RIG_MODE_USB; break; case AR8K_LSB: *mode = RIG_MODE_LSB; break; case AR8K_WFM: *mode = RIG_MODE_WFM; break; case AR8K_NFM: *mode = RIG_MODE_FM; break; case AR8K_SFM: *mode = RIG_MODE_FM; *width = rig_passband_narrow(rig, *mode); break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode '%c'\n", __FUNCTION__, aormode); return -RIG_EINVAL; } if (*width == RIG_PASSBAND_NORMAL) *width = rig_passband_normal(rig, *mode); return RIG_OK; } /* * aor_get_mode * Assumes rig!=NULL, mode!=NULL */ int aor_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct aor_priv_caps *priv = (struct aor_priv_caps*)rig->caps->priv; char ackbuf[BUFSZ], *mdp; char ackbuf2[BUFSZ], *mdp2; int ack_len, ack2_len, retval; retval = aor_transaction (rig, "MD" EOM, 3, ackbuf, &ack_len); if (retval != RIG_OK) return retval; /* * search MD, because on the AR5000, AU is also returned * by MD request */ mdp = strstr(ackbuf, "MD"); if (!mdp) { rig_debug(RIG_DEBUG_ERR, "%s: no MD in returned string: '%s'\n", __FUNCTION__, ackbuf); return -RIG_EPROTO; } if (rig->caps->rig_model == RIG_MODEL_AR5000 || rig->caps->rig_model == RIG_MODEL_AR5000A) { retval = aor_transaction (rig, "BW" EOM, 3, ackbuf2, &ack2_len); if (retval != RIG_OK) return retval; mdp2 = strstr(ackbuf2, "BW"); } else mdp2 = mdp; retval = priv->parse_aor_mode(rig, mdp[2], mdp2[2], mode, width); return retval; } /* * aor_set_ts * Assumes rig!=NULL */ int aor_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) { char tsbuf[BUFSZ]; int ts_len; /* * actually, tuning step must be like nnnnm0, * where m must be 0 or 5 (for 50Hz). */ ts_len = sprintf(tsbuf,"ST%06ld" EOM, ts); return aor_transaction (rig, tsbuf, ts_len, NULL, NULL); } /* * aor_set_level * Assumes rig!=NULL, rig->state.priv!=NULL */ int aor_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct rig_state *rs; char lvlbuf[BUFSZ]; int lvl_len; unsigned i; int agc; rs = &rig->state; switch (level) { case RIG_LEVEL_ATT: { unsigned att = 0; for (i=0; iattenuator[i]); i++) { if (rs->attenuator[i] == val.i) { att = i+1; break; } } /* should be caught by the front end */ if ((val.i != 0) & (i>=MAXDBLSTSIZ || RIG_IS_DBLST_END(rs->attenuator[i])) ) return -RIG_EINVAL; lvl_len = sprintf(lvlbuf, "AT%u" EOM, att); break; } case RIG_LEVEL_AGC: /* AR5000 & AR5000A */ switch(val.i) { case RIG_AGC_FAST: agc = '0'; break; case RIG_AGC_MEDIUM: agc = '1'; break; case RIG_AGC_SLOW: agc = '2'; break; case RIG_AGC_OFF: default: agc = 'F'; } lvl_len = sprintf(lvlbuf,"AC%c" EOM, agc); break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported aor_set_level %d\n", level); return -RIG_EINVAL; } return aor_transaction (rig, lvlbuf, lvl_len, NULL, NULL); } /* * aor_get_level * Assumes rig!=NULL, rig->state.priv!=NULL, val!=NULL */ int aor_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct rig_state *rs; char lvlbuf[BUFSZ],ackbuf[BUFSZ]; int lvl_len, ack_len, retval; rs = &rig->state; switch (level) { case RIG_LEVEL_RAWSTR: lvl_len = sprintf(lvlbuf, "LM" EOM); break; case RIG_LEVEL_ATT: lvl_len = sprintf(lvlbuf, "AT" EOM); break; case RIG_LEVEL_AGC: /* AR5000 & AR5000A */ lvl_len = sprintf(lvlbuf, "AC" EOM); break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported %s %d\n", __FUNCTION__, level); return -RIG_EINVAL; } retval = aor_transaction (rig, lvlbuf, lvl_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; switch (level) { case RIG_LEVEL_RAWSTR: if (ack_len < 4 || ackbuf[0] != 'L' || ackbuf[1] != 'M') return -RIG_EPROTO; if (rig->caps->rig_model == RIG_MODEL_AR8000) { sscanf(ackbuf+2, "%x", &val->i); val->i &= ~0x80; /* mask squelch status */ } else if (rig->caps->rig_model == RIG_MODEL_AR8200 || rig->caps->rig_model == RIG_MODEL_AR8600) sscanf(ackbuf+3, "%d", &val->i); else sscanf(ackbuf+3, "%x", &val->i); break; case RIG_LEVEL_ATT: { unsigned att; if (ack_len < 4 || ackbuf[0] != 'A' || ackbuf[1] != 'T') return -RIG_EPROTO; if (rig->caps->rig_model == RIG_MODEL_AR8000) { att = ackbuf[2]-'0'; } else { att = ackbuf[3]-'0'; } if (att == 0) { val->i = 0; break; } if (att > MAXDBLSTSIZ || rs->attenuator[att-1]==0) { rig_debug(RIG_DEBUG_ERR,"Unsupported att %s %d\n", __FUNCTION__, att); return -RIG_EPROTO; } val->i = rs->attenuator[att-1]; break; } case RIG_LEVEL_AGC: if (ack_len < 3 || ackbuf[0] != 'A' || ackbuf[1] != 'C') return -RIG_EPROTO; if (rig->caps->rig_model == RIG_MODEL_AR5000 || rig->caps->rig_model == RIG_MODEL_AR5000A) { /* AR5000A requires switching to be made on 3rd returned character. SM6PPS */ switch(ackbuf[2]) { case '0': val->i = RIG_AGC_FAST; break; case '1': val->i = RIG_AGC_MEDIUM; break; case '2': val->i = RIG_AGC_SLOW; break; case 'F': default: val->i = RIG_AGC_OFF; } } else { /* Left the switching on 4th position in case models other than AR5000(A) use this. SM6PPS */ switch(ackbuf[3]) { case '0': val->i = RIG_AGC_FAST; break; case '1': val->i = RIG_AGC_MEDIUM; break; case '2': val->i = RIG_AGC_SLOW; break; case 'F': default: val->i = RIG_AGC_OFF; } } break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported %s %d\n", __FUNCTION__, level); return -RIG_EINVAL; } return RIG_OK; } /* * aor_get_dcd * Assumes rig!=NULL, rig->state.priv!=NULL, val!=NULL */ int aor_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { char ackbuf[BUFSZ]; int ack_len, retval; retval = aor_transaction (rig, "LM" EOM, 3, ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (ack_len < 2 || ackbuf[0] != 'L' || ackbuf[1] != 'M') return -RIG_EPROTO; *dcd = ackbuf[2]=='%' ? RIG_DCD_OFF:RIG_DCD_ON; return RIG_OK; } /* * aor_set_powerstat * Assumes rig!=NULL, rig->state.priv!=NULL */ int aor_set_powerstat(RIG *rig, powerstat_t status) { if (status == RIG_POWER_ON) return aor_transaction (rig, "X" EOM, 2, NULL, NULL); /* turn off power */ return aor_transaction (rig, "QP" EOM, 3, NULL, NULL); } /* * aor_vfo_op * Assumes rig!=NULL */ int aor_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { char *aorcmd; switch (op) { case RIG_OP_UP: aorcmd = "\x1e" EOM; break; case RIG_OP_DOWN: aorcmd = "\x1f" EOM; break; case RIG_OP_RIGHT: aorcmd = "\x1c" EOM; break; case RIG_OP_LEFT: aorcmd = "\x1d" EOM; break; case RIG_OP_MCL: aorcmd = "MQ" EOM; break; default: rig_debug(RIG_DEBUG_ERR,"aor_vfo_op: unsupported op %d\n", op); return -RIG_EINVAL; } return aor_transaction (rig, aorcmd, strlen(aorcmd), NULL, NULL); } /* * aor_scan, scan operation * Assumes rig!=NULL, rig->state.priv!=NULL */ int aor_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) { char *aorcmd; switch (scan) { case RIG_SCAN_STOP: /* Not sure how to stop the scanning. * Maye by going by to MEM/VFO mode? * Any clue? */ if (vfo == RIG_VFO_CURR) vfo = RIG_VFO_MEM; /* supported by all the AOR rigs */ return rig_set_vfo(rig, vfo); case RIG_SCAN_MEM: aorcmd = "MS" EOM; break; case RIG_SCAN_SLCT: aorcmd = "SM" EOM; break; case RIG_SCAN_PROG: aorcmd = "VS" EOM; break; /* edges are VFO A & VFO B */ case RIG_SCAN_VFO: aorcmd = "VV1" EOM; break; /* VFO scan mode, VV0 for 2-VFO mode */ default: rig_debug(RIG_DEBUG_ERR,"aor_scan: unsupported scan %d\n", scan); return -RIG_EINVAL; } return aor_transaction (rig, aorcmd, strlen(aorcmd), NULL, NULL); } /* * aor_set_mem * Assumes rig!=NULL */ int aor_set_mem(RIG *rig, vfo_t vfo, int ch) { struct aor_priv_caps *priv = (struct aor_priv_caps*)rig->caps->priv; char membuf[BUFSZ]; int mem_len; int mem_num; char bank_base; /* * FIXME: we're assuming the banks are split 50/50. * MW should be called the first time instead, * and sizing memorized. */ mem_num = ch%100; if (mem_num >= 50 && priv->bank_base1 != priv->bank_base2) { bank_base = priv->bank_base2; mem_num -= 50; } else { bank_base = priv->bank_base1; } mem_len = sprintf(membuf,"MR%c%02d" EOM, bank_base + ch/100, mem_num); return aor_transaction (rig, membuf, mem_len, NULL, NULL); } /* * aor_get_mem * Assumes rig!=NULL, freq!=NULL */ int aor_get_mem(RIG *rig, vfo_t vfo, int *ch) { struct aor_priv_caps *priv = (struct aor_priv_caps*)rig->caps->priv; int mem_len, retval; char membuf[BUFSZ]; retval = aor_transaction (rig, "MR" EOM, 3, membuf, &mem_len); if (retval != RIG_OK) return retval; if (membuf[0] == '?' || membuf[2] == '?') return -RIG_ENAVAIL; sscanf(membuf+3,"%d", ch); /* * FIXME: we're assuming the banks are split 50/50. * MW should be called the first time instead, * and sizing memorized. */ if (membuf[2] >= priv->bank_base2) *ch += 100 * (membuf[2] - priv->bank_base2) + 50; else *ch += 100 * (membuf[2] - priv->bank_base1); return RIG_OK; } /* * aor_set_bank * Assumes rig!=NULL */ int aor_set_bank(RIG *rig, vfo_t vfo, int bank) { struct aor_priv_caps *priv = (struct aor_priv_caps*)rig->caps->priv; char membuf[BUFSZ]; int mem_len; mem_len = sprintf(membuf,"MR%c" EOM, (bank%10) + (bank<10 ? priv->bank_base1:priv->bank_base2)); return aor_transaction (rig, membuf, mem_len, NULL, NULL); } int aor_set_channel(RIG *rig, const channel_t *chan) { struct aor_priv_caps *priv = (struct aor_priv_caps*)rig->caps->priv; char aorcmd[BUFSZ]; int cmd_len; cmd_len = sprintf(aorcmd, "MX%c%02d ", chan->bank_num, chan->channel_num%100); cmd_len += format_freq(aorcmd+cmd_len, chan->freq); /* * FIXME: automode */ cmd_len += sprintf(aorcmd+cmd_len, " AU%d ST%06d ", 0, (int)chan->tuning_step); cmd_len += priv->format_mode(rig, aorcmd+cmd_len, chan->mode, chan->width); cmd_len += sprintf(aorcmd+cmd_len, " AT%d TM%12s"EOM, chan->levels[LVL_ATT].i ? 1:0, chan->channel_desc); return aor_transaction (rig, aorcmd, cmd_len, NULL, NULL); } static int parse_chan_line(RIG *rig, channel_t *chan, char *basep, const channel_cap_t *mem_caps) { struct aor_priv_caps *priv = (struct aor_priv_caps*)rig->caps->priv; int retval; char *tagp; int ts; /* * search for attribute tags in the line. * Using strstr enable support for various models * which may or may not have tag support. */ tagp = strstr(basep, "---"); if (tagp) { vfo_t vfo_save = chan->vfo; int ch_save = chan->channel_num; rig_debug(RIG_DEBUG_WARN, "%s: skipping, channel is empty: '%s'\n", __FUNCTION__, basep); memset(chan, 0, sizeof(channel_t)); chan->vfo = vfo_save; chan->channel_num = ch_save; return -RIG_ENAVAIL; } /* bank_num */ if (mem_caps->bank_num) { tagp = strstr(basep, "MX"); if (!tagp) { rig_debug(RIG_DEBUG_WARN, "%s: no MX in returned string: '%s'\n", __FUNCTION__, basep); return -RIG_EPROTO; } chan->bank_num = tagp[2]-(tagp[2] >= priv->bank_base2 ? priv->bank_base2+10 : priv->bank_base1); } /* pass */ if (mem_caps->flags) { tagp = strstr(basep, "MP"); if (!tagp) { rig_debug(RIG_DEBUG_WARN, "%s: no MP in returned string: '%s'\n", __FUNCTION__, basep); return -RIG_EPROTO; } chan->flags = tagp[2] == '0' ? 0 : RIG_CHFLAG_SKIP; } /* frequency */ if (mem_caps->freq) { tagp = strstr(basep, "RF"); if (!tagp) { rig_debug(RIG_DEBUG_WARN, "%s: no RF in returned string: '%s'\n", __FUNCTION__, basep); return -RIG_EPROTO; } sscanf(tagp+2,"%"SCNfreq, &chan->freq); } /* channel desc */ if (mem_caps->tuning_step) { tagp = strstr(basep, "ST"); if (!tagp) { rig_debug(RIG_DEBUG_WARN, "%s: no ST in returned string: '%s'\n", __FUNCTION__, basep); return -RIG_EPROTO; } ts = chan->tuning_step; sscanf(tagp+2,"%d", &ts); } /* mode and width */ if (mem_caps->mode && mem_caps->width) { char *tag2p; tagp = strstr(basep, "MD"); if (!tagp && mem_caps->mode && mem_caps->width) { rig_debug(RIG_DEBUG_WARN, "%s: no MD in returned string: '%s'\n", __FUNCTION__, basep); return -RIG_EPROTO; } /* "BW" only on AR5000 */ tag2p = strstr(basep, "BW"); if (!tag2p) tag2p = tagp; retval = priv->parse_aor_mode(rig, tagp[2], tag2p[2], &chan->mode, &chan->width); if (retval != RIG_OK) return retval; } /* auto-mode */ if (mem_caps->funcs&RIG_FUNC_ABM) { tagp = strstr(basep, "AU"); if (!tagp) { rig_debug(RIG_DEBUG_WARN, "%s: no AU in returned string: '%s'\n", __FUNCTION__, basep); return -RIG_EPROTO; } chan->funcs = tagp[2] == '0' ? 0 : RIG_FUNC_ABM; } /* attenuator */ if (mem_caps->levels&LVL_ATT) { tagp = strstr(basep, "AT"); if (!tagp) { rig_debug(RIG_DEBUG_WARN, "%s: no AT in returned string: '%s'\n", __FUNCTION__, basep); return -RIG_EPROTO; } chan->levels[LVL_ATT].i = tagp[2] == '0' ? 0 : rig->caps->attenuator[tagp[2] - '0' - 1]; } /* channel desc */ if (mem_caps->channel_desc) { int i; tagp = strstr(basep, "TM"); if (!tagp) { rig_debug(RIG_DEBUG_WARN, "%s: no TM in returned string: '%s'\n", __FUNCTION__, basep); return -RIG_EPROTO; } strncpy(chan->channel_desc, tagp+2, 12); chan->channel_desc[12] = '\0'; /* chop off trailing spaces */ for (i=11; i>0 && chan->channel_desc[i]==' '; i--) chan->channel_desc[i] = '\0'; } return RIG_OK; } int aor_get_channel(RIG *rig, channel_t *chan) { struct aor_priv_caps *priv = (struct aor_priv_caps*)rig->caps->priv; char aorcmd[BUFSZ]; int cmd_len, chan_len; char chanbuf[BUFSZ]; int retval, i; channel_cap_t *mem_caps = NULL; chan_t *chan_list; int mem_num, channel_num = chan->channel_num; char bank_base; chan_list = rig->caps->chan_list; if (chan->vfo == RIG_VFO_CURR) { /* * curr VFO mem_caps same as memory caps */ mem_caps = &chan_list[0].mem_caps; } else { /* * find mem_caps in caps, we'll need it later */ for (i=0; i= chan_list[i].start && channel_num <= chan_list[i].end) { mem_caps = &chan_list[i].mem_caps; break; } } if (!mem_caps) return -RIG_EINVAL; /* * FIXME: we're assuming the banks are split 50/50. * MW should be called the first time instead, * and sizing memorized. */ mem_num = channel_num%100; if (mem_num >= 50 && priv->bank_base1 != priv->bank_base2) { bank_base = priv->bank_base2; mem_num -= 50; } else { bank_base = priv->bank_base1; } cmd_len = sprintf(aorcmd, "MR%c%02d" EOM, bank_base + channel_num/100, mem_num); retval = aor_transaction (rig, aorcmd, cmd_len, chanbuf, &chan_len); /* is the channel empty? */ if (retval == -RIG_EPROTO && chanbuf[0] == '?') { chan->freq = RIG_FREQ_NONE; return -RIG_ENAVAIL; } if (retval != RIG_OK) return retval; } cmd_len = sprintf(aorcmd, "RX" EOM); retval = aor_transaction (rig, aorcmd, cmd_len, chanbuf, &chan_len); if (retval != RIG_OK) return retval; retval = parse_chan_line(rig, chan, chanbuf, mem_caps); return retval; } #define LINES_PER_MA 10 int aor_get_chan_all_cb (RIG * rig, chan_cb_t chan_cb, rig_ptr_t arg) { struct aor_priv_caps *priv = (struct aor_priv_caps*)rig->caps->priv; int i,j,retval; chan_t *chan_list = rig->state.chan_list; channel_t *chan; int chan_count; char aorcmd[BUFSZ]; int cmd_len, chan_len; char chanbuf[BUFSZ]; int chan_next = chan_list[0].start; chan_count = chan_list[0].end - chan_list[0].start + 1; /* * setting chan to NULL means the application * has to provide a struct where to store data * future data for channel channel_num */ chan = NULL; retval = chan_cb(rig, &chan, chan_next, chan_list, arg); if (retval != RIG_OK) return retval; if (chan == NULL) return -RIG_ENOMEM; cmd_len = sprintf(aorcmd, "MA%c" EOM, priv->bank_base1); for (i=0; i < chan_count/LINES_PER_MA; i++) { retval = aor_transaction (rig, aorcmd, cmd_len, chanbuf, &chan_len); if (retval != RIG_OK) return retval; for (j=0; jvfo = RIG_VFO_MEM; chan->channel_num = i*LINES_PER_MA + j; retval = parse_chan_line(rig, chan, chanbuf, &chan_list[0].mem_caps); if (retval == -RIG_ENAVAIL) retval = RIG_OK; if (retval != RIG_OK) return retval; /* notify the end? */ chan_next = chan_next < chan_list[i].end ? chan_next+1 : chan_next; /* * provide application with channel data, * and ask for a new channel structure */ chan_cb(rig, &chan, chan_next, chan_list, arg); if (j >= LINES_PER_MA-1) break; /* * get next line */ retval = read_string(&rig->state.rigport, chanbuf, BUFSZ, EOM, strlen(EOM)); if (retval < 0) return retval; } cmd_len = sprintf(aorcmd, "MA" EOM); } return RIG_OK; } /* * aor_get_info * Assumes rig!=NULL */ const char *aor_get_info(RIG *rig) { static char infobuf[BUFSZ]; int id_len, frm_len, retval; char idbuf[BUFSZ]; char frmbuf[BUFSZ]; retval = aor_transaction (rig, "\001" EOM, 2, idbuf, &id_len); if (retval != RIG_OK) return NULL; idbuf[2] = '\0'; retval = aor_transaction (rig, "VR" EOM, 3, frmbuf, &frm_len); if (retval != RIG_OK || frm_len>16) return NULL; frmbuf[frm_len] = '\0'; sprintf(infobuf, "Remote ID %c%c, Firmware version %s", idbuf[0], idbuf[1], frmbuf); return infobuf; } /* * initrigs_aor is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(aor) { rig_debug(RIG_DEBUG_VERBOSE, "aor: _init called\n"); rig_register(&sr2200_caps); rig_register(&ar2700_caps); rig_register(&ar8200_caps); rig_register(&ar8000_caps); rig_register(&ar8600_caps); rig_register(&ar5000_caps); rig_register(&ar3000a_caps); rig_register(&ar7030_caps); rig_register(&ar3030_caps); rig_register(&ar5000a_caps); rig_register(&ar7030p_caps); return RIG_OK; } hamlib-1.2.15.3/aor/ar7030p.h0000644000175000017500000016041212044564477012165 00000000000000/* * Hamlib AOR backend - AR7030 Plus description * Copyright (c) 2000-2010 by Stephane Fillod & Fritz Melchert * Copyright (c) 2009-2010 by Larry Gadallah (VE6VQ) * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _AR7030P_H #define _AR7030P_H 1 #include "hamlib/rig.h" #include "token.h" /* AR-7030 Computer remote control protocol. Information for firmware releases 1.1A, 1.2A, 1.4A and 1.4B 1) Remote control overview. The AR-7030 receiver allows remote control of all of its functions by means of a direct memory access system. A controlling computer can read and modify the internal memory maps of the receiver to set required parameters and then call for the receiver's control program to process the new settings. Commands to the receiver are byte structured in binary format, so it is not possible to control from a terminal. All multi-byte numbers within the receiver are binary, stored MSB first. 2) Receiver frequency configuration. Receive frequency is set by two oscillators - local and carrier. In AM and FM modes the carrier oscillator is not used, and the final IF frequency is 455 kHz. In Sync mode the carrier oscillator is offset by +20.29kHz before mixing with the IF. The IF frequencies have a fixed inter-conversion frequency of 44.545MHz and, because of the high-side local oscillator, both IF's are inverted. The receiver controller processes the following variables to establish the tuned frequency :- [local offset] Frequency shift applied to local oscillator. [carrier offset] 455.00kHz for LSB, USB, Data and CW modes / 434.71kHz for Sync mode. [filter offset] IF Filter frequency at the (vestigial) carrier position as an offset from 455kHz. [PBS] User set filter shift. [BFO] User set offset between carrier position and frequency display. [TUNE] Receiver tuned frequency as shown on display. The relationship between these variables and the tuning is as follows :- [carrier offset] + [filter offset] + [PBS] + [BFO] ==> Carrier oscillator 45.000MHz + [filter offset] + [PBS] ==> [local offset] [TUNE] + [local offset] ==> Local oscillator 3) Serial data protocol. All data transfers are at 1200 baud, No parity, 8 bits, 1 stop bit (1200 N 8 1). There is no hardware or software flow control other than that inherent in the command structure. The receiver can accept data at any time at full rate provided the IR remote controller is not used or is disabled. A maximum of one byte can be transmitted for each byte received, so data flow into a controlling computer is appropriately limited. Each byte sent to the receiver is a complete command - it is best thought of as two hexadecimal digits - the first digit is the operation code, the second digit is 4-bits of data relating to the operation. Because the receiver operates with 8-bit bytes, intermediate 4-bit values are stored in registers in the receiver for recombination and processing. For example to write into the receiver's memory, the following steps would be followed:- a) Send address high order 4-bits into H-register b) Send address low order 4-bits and set Address register c) Send first data byte high order 4-bits into H-register d) Send first data byte low order 4-bits and execute Write Data Operation e) Send second data byte high order 4-bits into H-register f) Send second data byte low order 4-bits and execute Write Data Operation g) Repeat (e) and (f) for each subsequent byte to be written. 4) Memory organisation. Different memory areas in the receiver are referenced by selecting Pages - up to 16 pages are supported. The memory is broadly divided into 3 sections :- a) Working memory - where all current operating variables are stored and registers and stack are located. This memory is volatile and data is lost when power to the receiver is removed. b) Battery sustained memory - where duplicate parameters are stored for retention when power is removed. This memory area is also used for storage of filter parameters, setup memories and squelch and BFO settings for the frequency memories and contains the real time clock registers. c) EEPROM - where frequency, mode, filter and PBS information for the frequency memories is stored. Additionally S-meter and IF calibration values are stored here. This memory can be read or written to download and upload the receiver's frequency memories, but repetitive writing should be avoided because the memory devices will only support a finite number of write cycles. 5) Variations between A and B types and firmware revisions. Type A firmware supports only basic receiver functions, type B extends operations and includes support for the Notch / Noise Blanker option. The whole of the type A memory map is retained in type B, but more memory and operations are added for the extended functions of type B. In the following information, circled note numbers are included to indicate where items are specific to one type or revision of the firmware:- <1> Applicable to type B firmware only. <2> Applicable to revision 1.4 only, types A and B <3> Function is changed or added to in type B 6) Operation codes. The high order 4-bits of each byte sent to the receiver is the operation code, the low order 4-bits is data (shown here as x) :- Code Ident Operation 0x NOP No Operation 3x SRH Set H-register x => H-register (4-bits) 5x PGE Set page x => Page register (4-bits) 4x ADR Set address 0Hx => Address register (12-bits) 0 => H-register 1x ADH Set address high x => Address register (high 4-bits) 6x WRD Write data Hx => [Page, Address] Address register + 1 => Address register 0 => H-register, 0 => Mask register 9x MSK <1> Set mask Hx => Mask register 0 => H-register 2x EXE Execute routine x Ax BUT <1> Operate button x 7x RDD Read data [Page, Address] => Serial output Address register + x => Address register 8x LOC Set lock level x */ #if 1 #define NOP(x) (unsigned char) ( 0x00 | ( 0x0f & (x) ) ) #define SRH(x) (unsigned char) ( 0x30 | ( 0x0f & (x) ) ) #define PGE(x) (unsigned char) ( 0x50 | ( 0x0f & (x) ) ) #define ADR(x) (unsigned char) ( 0x40 | ( 0x0f & (x) ) ) #define ADH(x) (unsigned char) ( 0x10 | ( 0x0f & (x) ) ) #define WRD(x) (unsigned char) ( 0x60 | ( 0x0f & (x) ) ) #define MSK(x) (unsigned char) ( 0x90 | ( 0x0f & (x) ) ) #define EXE(x) (unsigned char) ( 0x20 | ( 0x0f & (x) ) ) #define BUT(x) (unsigned char) ( 0xa0 | ( 0x0f & (x) ) ) #define RDD(x) (unsigned char) ( 0x70 | ( 0x0f & (x) ) ) #define LOC(x) (unsigned char) ( 0x80 | ( 0x0f & (x) ) ) #endif // 0 enum OPCODE_e { op_NOP = 0x00, op_SRH = 0x30, op_PGE = 0x50, op_ADR = 0x40, op_ADH = 0x10, op_WRD = 0x60, op_MSK = 0x90, op_EXE = 0x20, op_BUT = 0xa0, op_RDD = 0x70, op_LOC = 0x80 }; /* Note that the H-register is zeroed after use, and that the high order 4-bits of the Address register must be set (if non-zero) after the low order 8-bits. The Address register is automatically incremented by one after a write data operation and by x after a read data operation. When writing to any of the EEPROM memory pages a time of 10ms per byte has to be allowed. For this reason it is recommended that instructions SRH and WRD are always used together (even if the SRH is not needed) since this will ensure that the EEPROM has sufficient time to complete its write cycle. Additionally to allow time for local receiver memory updates and SNC detector sampling in addition to the EEPROM write cycle, it is recommended to lock the receiver to level 2 or 3, or add a NOP instruction after each write. This is not required for firmware revision 1.4 but locking is still recommended. The mask operation helps with locations in memory that are shared by two parameters and aids setting and clearing bits. The mask operates only in Page 0. If bits in the mask are set, then a following write operation will leave the corresponding bits unchanged. The mask register is cleared after a write so that subsequent writes are processed normally. Because it defaults to zero at reset, the mask is inoperative unless specifically set. The operate button instruction uses the same button codes as are returned from routine 15 (see section 8), with an additional code of zero which operates the power button, but will not switch the receiver off. Also code 0 will switch the receiver on (from standby state). 7) Memory pages. Page 0 Working memory (RAM) 256 bytes. Page 1 Battery sustained memory (RAM) 256 bytes. Page 2 Non-volatile memory (EEPROM) 512 bytes. Page 3 <1> Non-volatile memory (EEPROM) 4096 bytes. Page 4 <1> Non-volatile memory (EEPROM) 4096 bytes. Pages 5 - 14 Not assigned. Page 15 Receiver Ident (ROM) 8 bytes. */ enum PAGE_e { NONE = -1, WORKING = 0, BBRAM = 1, EEPROM1 = 2, EEPROM2 = 3, EEPROM3 = 4, ROM = 15 }; /* The ident is divided into model number (5 bytes), software revision (2 bytes) and type letter (1 byte). e.g. 7030_14A => Model AR-7030, revision 1.4, type letter A. 8) Lock levels. Level 0 Normal operation. Level 1 IR remote control disabled. Front panel buttons ignored. Front panel spin-wheels logged but not actioned. Display update (frequency & S-meter) continues. Level 2 As level 1, but display update suspended. In revisions before 1.4 squelch operation is inhibited, which results in no audio output after a mode change. In revision 1.4 squelch operation continues and mode changing is as expected. Level 3 Remote operation exclusively. Lock level 1 is recommended during any multi-byte reads or writes of the receiver's memory to prevent data contention between internal and remote memory access. See also EEPROM notes in section (6) */ enum LOCK_LVL_e { LOCK_0 = 0, LOCK_1 = 1, LOCK_2 = 2, LOCK_3 = 3, LOCK_NONE = 4 }; /* 8) Routines. Routine 0 Reset Setup receiver as at switch-on. Routine 1 Set frequency Program local oscillator from frequ area and setup RF filters and oscillator range. Routine 2 Set mode Setup from mode byte in memory and display mode, select preferred filter and PBS, BFO values etc. Routine 3 Set passband Setup all IF parameters from filter, pbsval and bfoval bytes. Routine 4 Set all Set all receiver parameters from current memory values. Routine 5 <2> Set audio Setup audio controller from memory register values. Routine 6 <2> Set RF-IF Setup RF Gain, IF Gain and AGC speed. Also sets Notch Filter and Noise Blanker if these options are fitted. Routine 7 Not assigned Routine 8 Not assigned Routine 9 Direct Rx control Program control register from rxcon area. Routine 10 Direct DDS control Program local oscillator and carrier oscillator DDS systems from wbuff area. The 32-bits at wbuff control the carrier frequency, value is 385674.4682 / kHz. The 32 bits at wbuff+4 control the local osc frequency, value is 753270.4456 / MHz. Routine 11 Display menus Display menus from menu1 and menu2 bytes. Routine 12 Display frequency Display frequency from frequ area. Routine 13 Display buffer Display ASCII data in wbuff area. First byte is display address, starting at 128 for the top line and 192 for the bottom line. An address value of 1 clears the display. Data string (max length 24 characters) ends with a zero byte. Routine 14 Read signal strength Transmits byte representing received signal strength (read from AGC voltage). Output is 8-bit binary in range 0 to 255. Routine 15 Read buttons Transmits byte indicating state of front panel buttons. Output is 8-bit binary with an offset of +48 (i.e. ASCII numbers). Buttons held continuously will only be registered once. */ enum ROUTINE_e { RESET = 0, SET_FREQ = 1, SET_MODE = 2, SET_PASS = 3, SET_ALL = 4, SET_AUDIO = 5, SET_RFIF = 6, DIR_RX_CTL = 9, DIR_DDS_CTL = 10, DISP_MENUS = 11, DISP_FREQ = 12, DISP_BUFF = 13, READ_SIGNAL = 14, READ_BTNS = 15 }; /* Button codes :- 0 = None pressed 5 = RF-IF button 1 = Mode up button 6 = Memory button 2 = Mode down button 7 = * button 3 = Fast button 8 = Menu button 4 = Filter button 9 = Power button */ enum BUTTON_e { BTN_NONE = 0, BTN_UP = 1, BTN_DOWN = 2, BTN_FAST = 3, BTN_FILTER = 4, BTN_RFIF = 5, BTN_MEMORY = 6, BTN_STAR = 7, BTN_MENU = 8, BTN_POWER = 9 }; /* Note that the work buffer wbuff area in memory is used continuously by the receiver unless lock levels 2 or 3 are invoked. Lock levels of 1 or more should be used when reading any front panel controls to prevent erratic results. 10) Battery sustained RAM (Memory page 1) Address Ident Length Description 0 0x000 13 bytes Real time clock / timer registers :- 0 0x000 rt_con 1 byte Clock control register 2 0x002 rt_sec 1 byte Clock seconds (2 BCD digits) 3 0x003 rt_min 1 byte Clock minutes (2 BCD digits) 4 0x004 rt_hrs 1 byte Clock hours (2 BCD digits - 24 hr format) 5 0x005 rt_dat 1 byte Clock year (2 bits) and date (2 BCD digits) 6 0x006 rt_mth 1 byte Clock month (2 BCD digits - low 5 bits only) 8 0x008 tm_con 1 byte Timer control register 10 0x00A tm_sec 1 byte Timer seconds (2 BCD digits) 11 0x00B tm_min 1 byte Timer minutes (2 BCD digits) 12 0x00C tm_hrs 1 byte Timer hours (2 BCD digits - 24 hr format) 13 0x00D 15 bytes Power-down save area :- 13 0x00D ph_cal 1 byte Sync detector phase cal value 14 0x00E pd_slp 1 byte Timer run / sleep time in minutes 15 0x00F pd_dly 1 byte Scan delay value x 0.125 seconds 16 0x010 pd_sst 1 byte Scan start channel 17 0x011 pd_ssp 1 byte Scan stop channel 18 0x012 pd_stp 2 bytes Channel step size 20 0x014 pd_sql 1 byte Squelch 21 0x015 pd_ifg 1 byte IF gain 22 0x016 pd_flg 1 byte Flags (from pdflgs) 23 0x017 pd_frq 3 bytes Frequency 26 0x01A pd_mod <3> 1 byte Mode (bits 0-3) and NB threshold (bits 4-7) 27 0x01B pd_vol <3> 1 byte Volume (bits 0-5) and rx memory hundreds (bits 6&7) 28 0x01C 26 bytes Receiver setup save area :- 28 0x01C md_flt 1 byte AM mode : Filter (bits 0-3) and AGC speed (bits 4-7) 29 0x01D md_pbs 1 byte AM mode : PBS value 30 0x01E md_bfo 1 byte AM mode : BFO value 31 0x01F 3 bytes Ditto for Sync mode 34 0x022 3 bytes Ditto for NFM mode - except Squelch instead of BFO 37 0x025 3 bytes Ditto for Data mode 40 0x028 3 bytes Ditto for CW mode 43 0x02B 3 bytes Ditto for LSB mode 46 0x02E 3 bytes Ditto for USB mode 49 0x031 st_aud <3> 1 byte Audio bass setting (bits 0-4) bit 5 Notch auto track enable bit 6 Ident search enable bit 7 Ident preview enable 50 0x032 1 byte Audio treble setting (bits 0-3) and RF Gain (bits 4-7) 51 0x033 1 byte Aux output level - left channel 52 0x034 1 byte Aux output level - right channel 53 0x035 st_flg 1 byte Flags (from stflgs) 54 0x036 26 bytes Setup memory A (configured as above) 80 0x050 26 bytes Setup memory B (configured as above) 106 0x06A 26 bytes Setup memory C (configured as above) 132 0x084 24 bytes Filter data area :- 132 0x084 fl_sel 1 byte Filter 1 : selection bits and IF bandwidth 133 0x085 fl_bw 1 byte Filter 1 : bandwidth (2 BCD digits, x.x kHz) 134 0x086 fl_uso 1 byte Filter 1 : USB offset value x 33.19Hz 135 0x087 fl_lso 1 byte Filter 1 : LSB offset value x 33.19Hz 136 0x088 4 bytes Ditto for filter 2 140 0x08C 4 bytes Ditto for filter 3 144 0x090 4 bytes Ditto for filter 4 148 0x094 4 bytes Ditto for filter 5 152 0x098 4 bytes Ditto for filter 6 156 0x09C mem_sq 100 bytes Squelch / BFO values for frequency memories 0 to 99 (BFO for Data and CW modes, Squelch for others) */ #define MAX_MEM_SQL_PAGE0 (99) enum FILTER_e { FILTER_1 = 1, FILTER_2 = 2, FILTER_3 = 3, FILTER_4 = 4, FILTER_5 = 5, FILTER_6 = 6 }; enum BBRAM_mem_e { RT_CON = 0, RT_SEC = 2, RT_MIN = 3, RT_HRS = 4, RT_DAT = 5, RT_MTH = 6, TM_CON = 8, TM_SEC = 10, TM_MIN = 11, TM_HRS = 12, PH_CAL = 13, PD_SLP = 14, PD_DLY = 15, PD_SST = 16, PD_SSP = 17, PD_STP = 18, PD_SQL = 20, PD_IFG = 21, PD_FLG = 22, PD_FRQ = 23, PD_MOD = 26, PD_VOL = 27, MD_FLT = 28, MD_PBS = 29, MD_BFO = 30, ST_AUD = 49, ST_FLG = 53, FL_SEL = 132, FL_BW = 133, FL_USO = 134, FL_LSO = 135, MEM_SQ = 156 }; /* 11) EEPROM (Memory page 2) Address Ident Length Description 0 0x000 4 bytes Frequency memory data :- 0 0x000 mem_fr 3 bytes Memory 00 : 24-bit frequency 3 0x003 mem_md 1 byte bits 0 - 3 mode bits 4 - 6 filter bit 7 scan lockout 4 0x004 396 bytes Ditto for memories 01 to 99 400 0x190 mem_pb 100 bytes PBS values for frequency memories 0 to 99 500 0x1F4 sm_cal 8 bytes S-meter calibration values :- 500 0x1F4 1 byte RSS offset for S1 level 501 0x1F5 1 byte RSS steps up to S3 level 502 0x1F6 1 byte RSS steps up to S5 level 503 0x1F7 1 byte RSS steps up to S7 level 504 0x1F8 1 byte RSS steps up to S9 level 505 0x1F9 1 byte RSS steps up to S9+10 level 506 0x1FA 1 byte RSS steps up to S9+30 level 507 0x1FB 1 byte RSS steps up to S9+50 level 508 0x1FC if_cal 2 bytes RSS offsets for -20dB and -8dB filter alignment 510 0x1FE if_def 1 byte Default filter numbers for narrow and wide (2 BCD digits) 511 0x1FF option <1> 1 byte Option information :- bit 0 Noise blanker bit 1 Notch filter bit 2 10 dB step attenuator (DX version) */ #define MAX_MEM_FREQ_PAGE2 (99) #define MAX_MEM_PBS_PAGE2 (99) enum EEPROM1_mem_e { MEM_FR = 0, MEM_MD = 3, MEM_PB = 400, SM_CAL = 500, IF_CAL = 508, IF_DEF = 510, OPTION = 511 }; /* 12) EEPROM (Memory page 3) . Address Ident Length Description 0 0x000 4 bytes Frequency memory data :- 0 0x000 mex_fr 3 bytes Memory 100 : 24-bit frequency 3 0x003 mex_md 1 byte bits 0 - 3 mode bits 4 - 6 filter bit 7 scan lockout 4 0x004 1196 bytes Ditto for memories 101 to 399 1200 0x4B0 8 bytes Timer memory data :- 1200 0x4B0 mtm_mn 1 byte Timer memory 0 : minutes (2 BCD digits) 1201 0x4B1 mtm_hr 1 byte hours (2 BCD digits) 1202 0x4B2 mtm_dt 1 byte date (2 BCD digits) 1203 0x4B3 mtm_mt 1 byte month (2 BCD digits) 1204 0x4B4 mtm_ch 2 bytes rx channel (hundreds and 0-99) 1206 0x4B6 mtm_rn 1 byte run time 1207 0x4B7 mtm_ac 1 byte active (0 = not active) 1208 0x4B8 72 bytes Ditto for timer memories 1 to 9 1280 0x500 16 bytes Frequency memory data :- 1280 0x500 mex_sq 1 byte Memory 0 : Squelch / BFO (not used for mems 0 to 99) (BFO for Data and CW modes) 1281 0x501 mex_pb 1 byte PBS value (not used for mems 0 to 99) 1282 0x502 mex_id 14 bytes Text Ident 1296 0x510 2800 bytes Ditto for memories 1 to 175 */ #define MAX_MEM_FREQ_PAGE3 (399) #define MAX_MEM_SQL_PAGE3 (175) #define MAX_MEM_PBS_PAGE3 (175) #define MAX_MEM_ID_PAGE3 (175) enum EEPROM2_mem_e { MEX_FR = 0, MEX_MD = 3, MEM_MN = 1200, MTM_HR = 1201, MTM_DT = 1202, MTM_MT = 1203, MTM_CH = 1204, MTM_RN = 1206, MTM_AC = 1207, MEX_SQ = 1280, MEX_PB = 1281, MEX_ID = 1282 }; /* 13) EEPROM (Memory page 4) <1> Address Ident Length Description 0 0x000 16 bytes Frequency memory data :- 0 0x000 mey_sq 1 byte Memory 176 : Squelch / BFO (BFO for Data and CW modes) 1 0x001 mey_pb 1 byte PBS value 2 0x002 mey_id 14 bytes Text Ident 16 0x010 3568 bytes Ditto for memories 177 to 399 3584 0xE00 mex_hx 400 bytes Frequency fast find index (1 byte for each memory 0 to 399) Index value is bits 9 to 16 of 24-bit frequency stored in each memory. Empty memories (frequency zero) should have a random index byte. 3984 0xF90 112 bytes spare */ enum EEPROM3_mem_e { MEY_SQ = 0, MEY_PB = 1, MEY_ID = 2, MEX_HX = 3584 }; /* 14) Working memory (Memory page 0) Areas not specifically addressed are used as workspace by the internal processor. - Keep out (by order). Address Ident Length Description 16 0x010 snphs 1 byte Sync detector phase offset cal value 17 0x011 slptim 1 byte Sleep time (minutes) 18 0x012 scnst 1 byte Scan start channel 19 0x013 scnsp 1 byte Scan stop channel 20 0x014 scndly 1 byte Scan delay time value x 0.125 seconds 21 0x015 chnstp 2 bytes 16-bit channel step size, value is 376.6352 / kHz 23 0x017 sqlsav 1 byte Squelch save value (non-fm mode) 24 0x018 ifgain 1 byte IF gain value (zero is max gain) 26 0x01A frequ 3 bytes 24-bit tuned frequency, value is 376635.2228 / MHz. 29 0x01D mode 1 byte Current mode :- 1 = AM 4 = Data 2 = Sync 5 = CW 3 = NFM 6 = LSB 7 = USB 30 0x01E 10 bytes Audio control registers :- 30 0x01E af_vol 1 byte Main channel volume (6-bits, values 15 to 63) 31 0x01F af_vll 1 byte Left channel balance (5-bits, half of volume value above) 32 0x020 af_vlr 1 byte Right channel balance (as above) 33 0x021 af_bas <1> 1 byte Main channel bass (bits 0-4, values 6 to 25, 15 is flat) bit 5 nchtrk Notch auto track enable bit 6 idauto Ident auto search enable bit 7 idprev Ident auto preview enable 34 0x022 af_trb <3> 1 byte Main channel treble (bits 0-3, values 2 to 10, 6 is flat) bit 4 nb_opt Noise blanker menus enabled bit 5 nt_opt Notch Filter menus enabled bit 6 step10 10 dB RF attenuator fitted 35 0x023 af_axl 1 byte Left aux channel level (bits 0-5, values 27 to 63) 36 0x024 af_axr <3> 1 byte Right aux channel level (bits 0-5, values 27 to 63) bit 7 nchsr Notch search running 37 0x025 af_axs <3> 1 byte Aux channel source (bits 0-3) bit 4 nchen Notch filter active bit 5 nchsig Notch filter signal detected bit 6 axmut Aux output mute bit 7 nchato Notch auto tune active 38 0x026 af_opt <3> 1 byte Option output source (bits 0-3) bit 4 idover Ident on LCD over frequency bit 5 idsrdn Ident search downwards bit 7 idsrch Ident search in progress 39 0x027 af_src 1 byte Main channel source bit 6 afmut Main output mute 40 0x028 rxcon 3 bytes Receiver control register mapping :- byte 1 bit 0 rx_fs3 Filter select : FS3 byte 1 bit 1 rx_fs2 Filter select : FS2 byte 1 bit 2 rx_fs1 Filter select : FS1 byte 1 bit 3 rx_fs4 Filter select : FS4 byte 1 bit 4 rx_pre Preamplifier enable byte 1 bit 5 rx_atr Atten : 0 = 20dB / 1 = 40dB byte 1 bit 6 rx_rff Input filter : 0 = HF / 1 = LF byte 1 bit 7 rx_atn Attenuator enable byte 2 bit 0 rx_as1 AGC speed : 00 = Slow byte 2 bit 1 rx_as2 10 = Med 11 = Fast byte 2 bit 2 rx_agi AGC inhibit byte 2 bit 3 rx_en LO and HET enable byte 2 bit 4 rx_aux Aux relay enable byte 2 bit 5 rx_fs5 Filter select : FS5 byte 2 bit 6 rx_fs6 Filter select : FS6 byte 2 bit 7 rx_ibw IF b/w : 0 = 4kHz / 1 = 10kHz byte 3 bit 0 rx_chg Fast charge enable byte 3 bit 1 rx_pwr PSU enable byte 3 bit 2 rx_svi Sync VCO inhibit byte 3 bit 3 rx_agm AGC mode : 0 = peak / 1 = mean byte 3 bit 4 rx_lr1 LO range : 00 = 17 - 30 MHz byte 3 bit 5 rx_lr2 10 = 10 - 17 MHz 01 = 4 - 10 MHz 11 = 0 - 4 MHz byte 3 bit 6 rx_sbw Sync b/w : 0 = Wide / 1 = Narrow byte 3 bit 7 rx_car Car sel : 0 = AM / 1 = DDS 43 0x02B bits 3 bytes General flags :- byte 1 bit 6 lock1 Level 1 lockout byte 1 bit 7 lock2 Level 2 lockout byte 2 bit 0 upfred Update frequency display byte 2 bit 1 upmend Update menus byte 2 bit 2 tune4x Tune 4 times faster (AM & NFM) byte 2 bit 3 quickly Quick tuning (fast AGC, Sync) byte 2 bit 4 fast Fast tuning mode byte 2 bit 5 sncpt1 Auto sync - frequency lock byte 2 bit 6 sncpt2 Auto sync - phase lock byte 2 bit 7 sncal Sync detector calibrating byte 3 bit 0 sqlch Squelch active (i.e. low signal) byte 3 bit 1 mutsql Mute on squelch (current setting) byte 3 bit 2 bscnmd Scan mode for VFO B byte 3 bit 3 dualw Dual watch active byte 3 bit 4 scan Scan active byte 3 bit 5 memlk Current memory scan lockout byte 3 bit 6 pbsclr Enable PBS CLR from IR remote <2> byte 3 bit 7 memodn MEM button scans downwards 46 0x02E pdflgs 1 byte Flags saved at power-down :- bit 0 power Power on bit 1 flock Tuning locked bit 2 batop Battery operation (for fast chg) <1> bit 3 nben Noise blanker active <1> bit 4 nblong Noise blanker long pulse 47 0x02F stflgs 1 byte Flags saved in setup memories :- bit 0 mutsav Mute on squelch (non-fm mode) bit 1 mutaux Mute aux output on squelch bit 2 axren Aux relay on timer bit 3 axrsql Aux relay on squelch bit 4 snauto Auto sync mode bit 5 snarr Sync detector narrow bandwidth bit 6 scanmd Scan runs irrespective of squelch bit 7 autorf RF gain auto controlled 48 0x030 rfgain 1 byte Current RF gain setting (0 to 5) (0=max gain) 49 0x031 rfagc 1 byte Current RF AGC setting (added to above) 50 0x032 agcspd 1 byte Current AGC speed : 0 = Fast 2 = Slow 1 = Medium 3 = Off 51 0x033 sqlval 1 byte Squelch value (current setting) 52 0x034 filter 1 byte Current filter number (1 to 6) 53 0x035 pbsval 1 byte PBS offset (x33.19Hz) 54 0x036 bfoval 1 byte BFO offset (x33.19Hz) 55 0x037 fltofs 1 byte Filter centre frequency offset (x33.19Hz) 56 0x038 fltbw 1 byte Filter bandwidth (2 BCD digits : x.x kHz) 57 0x039 ircode: 2 bytes Current / last IR command code 59 0x03B spnpos 1 byte Misc spin-wheel movement } 0 = no movement 60 0x03C volpos 1 byte Volume control movement } +ve = clockwise 61 0x03D tunpos 1 byte Tuning control movement } -ve = anti-clockwise 62 0x03E lstbut 1 byte Last button pressed 63 0x03F smval 2 bytes Last S-meter reading (bars + segments) 65 0x041 mestmr 1 byte Message time-out timer 66 0x042 rfgtmr 1 byte RF gain delay timer 67 0x043 updtmr 1 byte Sustained RAM update timer 68 0x044 agctmr 1 byte AGC speed restore delay timer 69 0x045 snctmr 1 byte Auto sync refresh timer 70 0x046 scntmr 1 byte Scan delay timer 71 0x047 irdly 1 byte IR remote auto repeat delay counter 72 0x048 runtmr 1 byte Sleep mode timer 73 0x049 snfrq 1 byte Sync detector frequency offset cal value 74 0x04A frange 1 byte Input / LO range 75 0x04B menu1 <3> 1 byte Current left menu (type A and B menu numbers are different) 76 0x04C menu2 <3> 1 byte Current right menu (type A and B menu numbers are different) 77 0x04D memno 1 byte Current memory number 78 0x04E setno 1 byte Setup / config selection - load / save 85 0x055 mempg <1> 1 byte Memory page (hundreds - value 0 to 3) 86 0x056 nbthr <1> 1 byte Noise blanker threshold (values 0 to 15) 87 0x057 hshfr <1> 1 byte Current tuned frequ index value (during ident search) 88 0x058 nchtmr <1> 1 byte Notch filter auto tune / search timer 90 0x059 wbuff 26 bytes Work buffer 115 0x073 keymd 1 byte IR remote +/- keys function 116 0x074 keybuf 20 bytes IR remote key input buffer 136 0x088 frofs: 4 bytes 32-bit local osc offset 140 0x08C carofs 4 bytes 32-bit carrier osc offset 144 0x090 smofs 1 byte S-meter starting offset 145 0x091 smscl 7 bytes S-meter segment values 152 0x098 ifcal 2 bytes RSS offsets for -20 dB and -5 dB filter alignment 154 0x09A ifdef 1 byte Default filter numbers for narrow and wide (2 digits) 155 0x09B vfo_b 22 bytes VFO B storage area :- 155 0x09B 1 byte B : Scan delay time 156 0x09C 2 bytes B : Channel step size 158 0x09E 1 byte B : Squelch save value (non-fm mode) 159 0x09F 1 byte B : IF gain value 160 0x0A0 1 byte not used 161 0x0A1 3 bytes B : Tuned frequency 164 0x0A4 1 byte B : Mode 165 0x0A5 1 byte B : Volume 166 0x0A6 1 byte B : Left channel balance 167 0x0A7 1 byte B : Right channel balance 168 0x0A8 1 byte B : Bass response 169 0x0A9 1 byte B : Treble response 170 0x0AA 1 byte B : RF gain 171 0x0AB 1 byte B : RF AGC 172 0x0AC 1 byte B : AGC speed 173 0x0AD 1 byte B : Squelch value 174 0x0AE 1 byte B : Filter number 175 0x0AF 1 byte B : PBS offset 176 0x0B0 1 byte B : BFO offset 218 0x0DA savmnu <1> 1 byte Saved menu 1 number during ident display 219 0x0DB srchm <1> 2 bytes Ident search memory (page and number) 222 0x0DD idtmr <1> 1 byte Auto ident search start timer 223 0x0DE nchfr <1> 2 bytes 16-bit notch filter frequency, value is 6553.6 / kHz */ #define HZ_PBS_STEP \ ((44545000.0 * 25.0)/(16777216.0 * 2.0)) /* 33.1886 Hz/Step */ #define NOTCH_STEP_HZ (6.5536) /* 6.5536 Hz/Step */ #define VOL_MIN (15) #define VOL_MAX (63) #define BASS_MIN (6) #define BASS_MAX (25) #define TREB_MIN (2) #define TREB_MAX (10) #define AUX_MIN (27) #define AUX_MAX (63) enum MODE_e { MODE_NONE = 0, AM = 1, SAM = 2, FM = 3, DATA = 4, CW = 5, LSB = 6, USB = 7 }; enum AGC_decay_e { DECAY_SLOW = 0, DECAY_MED = 2, DECAY_FAST = 3 }; enum LO_range_e { LO_17_30 = 0, LO_4_10 = 1, LO_10_17 = 2, LO_0_4 = 3 }; enum AGC_spd_e { AGC_NONE = -1, AGC_FAST = 0, AGC_MED = 1, AGC_SLOW = 2, AGC_OFF = 3 }; enum WORKING_mem_e { SNPHS = 16, SLPTIM = 17, SCNST = 18, SCNSP = 19, SCNDLY = 20, CHNSTP = 21, SQLSAV = 23, IFGAIN = 24, FREQU = 26, MODE = 29, AF_VOL = 30, AF_VLL = 31, AF_VLR = 32, AF_BAS = 33, AF_TRB = 34, AF_AXL = 35, AF_AXR = 36, AF_AXS = 37, AF_OPT = 38, AF_SRC = 39, RXCON = 40, BITS = 43, PDFLGS = 46, STFLGS = 47, RFGAIN = 48, RFAGC = 49, AGCSPD = 50, SQLVAL = 51, FILTER = 52, PBSVAL = 53, BFOVAL = 54, FLTOFS = 55, FLTBW = 56, IRCODE = 57, SPNPOS = 59, VOLPOS = 60, TUNPOS = 61, LSTBUT = 62, SMVAL = 63, MESTMR = 65, RFGTMR = 66, UPDTMR = 67, AGCTMR = 68, SNCTMR = 69, SCNTMR = 70, IRDLY = 71, RUNTMR = 72, SNFRQ = 73, FRANGE = 74, MENU1 = 75, MENU2 = 76, MEMNO = 77, SETNO = 78, MEMPG = 85, NBTHR = 86, HSHFR = 87, NCHTMR = 88, WBUFF = 90, KEYMD = 115, KEYBUF = 116, FROFS = 136, CAROFS = 140, SMOFS = 144, SMSCL = 145, IFCAL = 152, IFDEF = 154, VFO_B = 155, SCNDLY_B = 155, CHNSTP_B = 156, SQLSAV_B = 158, IFGAIN_B = 159, FREQU_B = 161, MODE_B = 164, AF_VOL_B = 165, AF_VLL_B = 166, AF_VLR_B = 167, AF_BAS_B = 168, AF_TRB_B = 169, RFGAIN_B = 170, RFAGC_B = 171, AGCSPD_B = 172, SQLVAL_B = 173, FILTER_B = 174, PBSVAL_B = 175, BFOVAL_B = 176, SAVMNU = 218, SRCHM = 219, IDTMR = 222, NCHFR = 223 }; enum ROM_mem_e { IDENT = 0 }; #define HZ_PER_STEP ( 44545000.0 / 16777216.0 ) /* 2.655 Hz/Step */ #define STEPS_PER_HZ ( 16777216.0 / 44545000.0 ) /* 0.3766 Steps/Hz */ #define MAX_FREQ (32010000.0) #define MIN_FREQ (10000.0) /* RS232 signal meter reading - additional comments Several commercial organisations are using the AR7030 for signal monitoring purposes and wish to accurately log signal meter level. The information is given in the RS232 PROTOCOL LISTING but the subject is fairly complex. A summary of the required process is given here, the text has been generated by John Thorpe in response to a commercial request for more detailed guidance (November 2001). Reading the input signal strength from the AR7030 is not too difficult, but some maths is needed to convert the level into dBm. Each set is calibrated after manufacture and a set of S-meter calibration values stored in EEPROM in the receiver. This means that the signal strength readings should be quite good and consistent. I think that you should get less than 2dB change with frequency and maybe 3dB with temperature. Initial calibration error should be less than +/- 2dB. I think the sets that you use have been modified for DRM use have some changes in the IF stage. This will require that the sets are re-calibrated if you are to get accurate results. The SM7030 service kit has a calibration program (for PC) and is available from AOR. The signal strength is read from the AGC voltage within the 7030 so AGC should be switched on and RF Gain set to maximum. To read AGC voltage send opcode 02EH (execute routine 14) and the receiver will return a single byte value between 0 and 255 which is the measured AGC voltage. The calibration table is stored in EEPROM, so the control software should read this when connection to the receiver is established and store the data in an array for computing. Calibration data is 8 bytes long and is stored in Page2 at locations 500 (0x01F4) to 507 (0x01FB). Use the PaGE opcode (0x52) then SRH, ADR, ADH to setup the address, then 8 RDD opcodes to read the data, as below :- Opcode Hex Operation PGE 2 0x52 Set page 2 SRH 15 0x3F H register = 15 ADR 4 0x44 Set address 0x0F4 ADH 1 0x11 Set address 0x1F4 RDD +1 0x71 Read byte 1 of cal data RDD +1 0x71 Read byte 2 of cal data . . . RDD +1 0x71 Read byte 8 of cal data PGE 0 0x50 Return to page 0 for subsequent control operations The first byte of calibration data holds the value of the AGC voltage for a signal level of -113dBm (S1). Successive bytes hold the incremental values for 10dB increases in signal level :- Cal data Typical Value RF signal level byte 1 64 -113dBm byte 2 10 -103dBm byte 3 10 -93dBm byte 4 12 -83dBm byte 5 12 -73dBm byte 6 15 -63dBm byte 7 30 -43dBm (note 20dB step) byte 8 20 -23dBm (note 20dB step) */ #define CAL_TAB_LENGTH (8) #define STEP_SIZE_LOW (10) #define STEP_SIZE_HIGH (20) /* To calculate the signal level, table values should be subtracted from the AGC voltage in turn until a negative value would result. This gives the rough level from the table position. The accuracy can be improved by proportioning the remainder into the next table step. See the following example :- A read signal strength operation returns a value of 100 Subtract cal byte 1 (64) leaves 36 level > -113dBm Subtract cal byte 2 (10) leaves 26 level > -103dBm Subtract cal byte 3 (10) leaves 16 level > -93dBm Subtract cal byte 4 (12) leaves 4 level > -83dBm Test cal byte 5 (12) - no subtraction Fine adjustment value = (remainder) / (cal byte 5) * (level step) = 4 / 12 * 10 = 3dB Signal level = -83dBm + 3dB = -80dB The receiver can operate the RF attenuator automatically if the signal level is likely to overload the RF stages. Reading the RFAGC byte (page 0, location 49) gives the attenuation in 10dB steps. This value should be read and added to the value calculated above. Further discussion has taken place on the subject of PC control with the designer, the comments may be of assistance to other operators... As far as I can tell all of the commands and operations work exactly as documented so when the client talks of "the set frequency command doesn't work" they are obviously doing something wrong. Similarly, I am unable to duplicate the effects that they notice with changing audio settings after changing modes. There are some issues with the parameters that they are changing which I will address later, but first they must sort out the basic communication so that the receiver control is as expected. Further issues cannot really be sorted until this is working properly. Programming issues... Since I have no Knowledge of what programming system the client is using these are only general comments. The receiver control is in 8-bit binary code so any communication must maintain all 8 bits (and not truncate bit 7 as some printer outputs do). It is also essential that no extra characters are added to the output stream so check that the software is not adding carriage returns, line feeds, nulls or end-of-file markers to the output. If this might be a problem, monitor the computer to receiver communication with a serial line monitor or another computer running a simple RS-232 reading program. There is some sample BASIC code in the "AR-7030 Computer remote control protocol" document which gives subroutines that cover the commonly used receiver settings. Use this as a starting point for your own routines. The published routines have been thoroughly tested and work without problems. http://www.aoruk.com/pdf/comp.pdf http://www.aoruk.com/7030bulletin.htm#7030_rs232_s-meter With all "buffered" RS-232 connections it is possible for the computer and receiver to get out of step when using two-way communication. For this reason I included some "flush input buffer" routines in the sample code. Using these ensures that missed characters or extra characters inserted due to noise or disconnection do not disrupt communication between the computer and receiver, and a recovery after communications failure can be automatic. Because the receiver's remote control is by direct access to memory and processor it is a very flexible system but is also able to disrupt receiver operation if incorrectly used. Only a few bytes of information stored in the receiver's memory affect S-meter calibration and AOR (UK) hold records of this data for each receiver made so that in the event of corruption it can be re-programmed. See the note that follows regarding AGC calibration. All other working memory contents can be set to sensible values by a "Set defaults" operation from the front panel. Most, but not all, of the working memory is re-established by executing a remote "Reset" command (0x20) which can be done as a last resort after control failure. Specific parameter settings... The client describes the correct operations for setting mode and frequency but if, as he states, the set frequency command (021h) does not work then this needs to be investigated. This may lead to discovering the cause of other problems suffered by the client. Note that changing the frequency in this way re-tunes the receiver but does not update the display on the front panel. A "Display frequency" command is included for this purpose. To set the receiver main volume, three locations need to be written - Page 0, addr 0x1e, 0x1f & 0x20. Details are in the protocol document, note the minimum value (for zero volume) is 15. The aux channel level change is as described by the client and after writing new values into the RAM will need either a "Set audio" command or a "Set all" command to make the change. I can find no reason for, nor duplicate, the effect of changing mode altering the aux level so this effect also needs investigating - maybe the clients "write to memory" is writing too many locations ? To initialise several receiver parameters I would recommend locking the receiver, writing all of the required memory data, sending a "Set all" command and then unlocking if required. There is no need to send individual "Set" commands after each parameter. Unless very special requirements are needed (mainly test, setup and alignment ) the 3 rxcon locations should not be written. When a "Set all" command is sent these will be programmed by the receiver firmware to appropriate values for the mode, frequency and filters selected. Only the parameters that need changing need to be written, all other values will be maintained. The locations that the client needs to program for the parameters he lists are as follows:- (all Page 0) frequency frequ 0x1a 0x1b 0x1c mode mode 0x1d volume af_vol 0x1e 0x1f 0x20 (values=0x0f 0x07 0x07 for min volume) aux level af_axl 0x23 0x24 agc speed agcspd 0x32 squelch sqlval 0x33 filter filter 0x34 IF gain ifgain 0x18 RF gain rfgain 0x30 (value=0x01 for no pre-amp) message wbuff 0x59 (max 26 bytes) If the required parameter values are unknown, I recommend setting the receiver as required through the front panel controls and then reading the value of the memory locations affected using the "read data" operation. 15) Sample routines (in MS QBASIC) REM Sample subroutines for communication with the AR-7030 A-type REM These subroutines use the following variables :- REM rx.freq# frequency in kHz (double precision) REM rx.mode mode number (1 to 7) REM rx.filt filter number (1 to 6) REM rx.mem memory number (0 to 99) REM rx.pbs passband shift value (-4.2 to +4.2 in kHz) REM rx.sql squelch value (0 to 255) REM ident$ -model number, revision and type REM Subroutine to open comms link to receiver open.link: open "com1:1200,n,8,1,cd0,cs0,ds0,rs" for random as #1 len = 1 field #1, 1 as input.byte$ return REM Subroutine to flush QBASIC serial input buffer flush.buffer: print #1,"//"; do time.mark# = timer do while timer - time.mark# < 0.2 loop if eof(1) then exit do get #1 loop return REM Subroutines to lock and unlock receiver controls lock.rx: print #1,chr$(&H81); ' Set lockout level 1 return unlock.rx: print #1,chr$(&H80); ' Lockout level 0 (not locked) return REM Subroutine to read byte from comms link read.byte: read.value = -1 ' Value assigned for read error time.mark# = timer print #1,chr$(&H71); ' Read byte command do while timer - time.mark# < 0.3 if eof(1) = 0 then get #1 read.value = asc(input.byte$) exit do end if loop return REM Subroutine to set receiver frequency and mode tune.rx: gosub lock.rx print #1,chr$(&H50); ' Select working mem (page 0) print #1,chr$(&H31);chr$(&H4A); ' Frequency address = 01AH gosub send.freq ' Write frequency print #1,chr$(&H60+rx.mode); ' Write mode print #1,chr$(&H24); ' Tune receiver gosub unlock.rx return REM Subroutine to store data into receiver's frequency memory set.memory: mem.loc = rx.mem+156 ' Squelch memory origin mem.h = int(mem.loc/16) mem.l = mem.loc mod 16 print #1,chr$(&H51); ' Select squelch memory (page 1) print #1,chr$(&H30+mem.h); print #1,chr$(&H40+mem.l); ' Set memory address print #1,chr$(&H30+int(rx.sql/16)) print #1,chr$(&H60+rx.sql mod 16) ' Write squelch value mem.loc = rx.mem*4 ' Frequency memory origin mem.t = int(mem.loc/256) mem.loc = mem.loc mod 256 mem.h = int(mem.loc/16) mem.l = mem.loc mod 16 print #1,chr$(&H52); ' Select frequency memory (page 2) print #1,chr$(&H30+mem.h); print #1,chr$(&H40+mem.l); ' Set memory address print #1,chr$(&H10+mem.t); gosub send.freq ' Write frequency print #1,chr$(&H30+rx.filt); print #1,chr$(&H60+rx.mode); ' Write filter and mode mem.loc = rx.mem+400-256 ' PBS memory origin mem.h = int(mem.loc/16) mem.l = mem.loc mod 16 pbs.val = 255 and int(rx.pbs/0.033189+0.5) print #1,chr$(&H30+mem.h); print #1,chr$(&H40+mem.l); ' Set memory address print #1,chr$(&H11); print #1,chr$(&H30+int(pbs.val/16)) print #1,chr$(&H60+pbs.val mod 16) ' Write passband value return REM Subroutine to read data from receiver's frequency memory read.memory: mem.loc = rx.mem+156 ' Squelch memory origin mem.h = int(mem.loc/16) mem.l = mem.loc mod 16 print #1,chr$(&H51); ' Select squelch memory (page 1) print #1,chr$(&H30+mem.h); print #1,chr$(&H40+mem.l); ' Set memory address gosub read.byte ' Read squelch value rx.sql = read.value mem.loc = rx.mem*4 ' Frequency memory origin mem.t = int(mem.loc/256) mem.loc = mem.loc mod 256 mem.h = int(mem.loc/16) mem.l = mem.loc mod 16 print #1,chr$(&H52); ' Select frequency memory (page 2) print #1,chr$(&H30+mem.h); print #1,chr$(&H40+mem.l); ' Set memory address print #1,chr$(&H10+mem.t); gosub read.freq ' Read frequency gosub read.byte ' Read filter and mode if read.value < 0 then return rx.filt = int(read.value/16) rx.mode = read.value mod 16 mem.loc = rx.mem+400-256 ' PBS memory origin mem.h = int(mem.loc/16) mem.l = mem.loc mod 16 print #1,chr$(&H30+mem.h); print #1,chr$(&H40+mem.l); ' Set memory address print #1,chr$(&H11); gosub read.byte ' Read passband value if read.value < 0 then return if read.value > 127 then read.value = 256-read.value rx.pbs = read.value*0.033189 return REM Subroutine to read receiver ident string read.ident: print #1,chr$(&H5F); ' Select ident memory (page 15) print #1,chr$(&H40); ' Set address 0 ident$="" for read.loop = 1 to 8 gosub read.byte ' Read 8-byte ident if read.value < 0 then exit for ident$ = ident$+chr$(read.value) next read.loop return REM Subroutine to send frequency (Called only from other routines) send.freq: fr.val# = int(rx.freq#*376.635223+0.5) ' Convert kHz to steps ' Exact multiplicand is ' (2^24)/44545 print #1,chr$(&H30+int(fr.val#/1048576)); fr.val# = fr.val# mod 1048576 ' Write frequency as 6 hex digits print #1,chr$(&H60+int(fr.val#/65536)); fr.val# = fr.val# mod 65536 print #1,chr$(&H30+int(fr.val#/4096)); fr.val# = fr.val# mod 4096 print #1,chr$(&H60+int(fr.val#/256)); fr.val# = fr.val# mod 256 print #1,chr$(&H30+int(fr.val#/16)); print #1,chr$(&H60+(fr.val# mod 16)); return REM Subroutine to read frequency (Called only from other routines) read.freq: fr.val# = 0 for read.loop = 1 to 3 gosub read.byte ' Read frequency as 3 bytes if read.value < 0 then exit for fr.val# = fr.val#*256+read.value next read.loop rx.freq# = fr.val#/376.635223 ' Convert steps to kHz return */ /* * (from http://www.aoruk.com/archive/pdf/ir.pdf) * * AOR AR7030 receiver infrared protocol listing * * There have been two types of IR7030 infrared hand controller employed * by the AR7030. Late in 2005 a VERSION 2 handset (IR7030-2) was adopted * in production. The protocol is slightly different, so a matching CPU * must be employed (firmware 1xA or 1xB uses the original IR7030, * firmware 2xA or 2xB uses the later IR7030-2). * * IR7030 IR7030-2 * NEC protocol 16 bit NEC protocol 16 bit * * Address 026 HEX Address 04D HEX * I.R key Hex value I.R key Hex value * 1 0C 1 11 * 2 11 2 13 * 3 12 3 1C * 4 10 4 15 * 5 19 5 16 * 6 1A 6 14 * 7 18 7 19 * 8 1D 8 17 * 9 1E 9 1B * 0 15 0 1D * . DECIMAL 16 . DECIMAL 12 * CLEAR 13 CLEAR 07 * BACKSPACE 1C BACKSPACE 1F * kHz 17 kHz 1A * MHz 1F MHz 1E * CW/NFM 8 CW/NFM 0F * LSB/USB 0D LSB/USB 10 * AM/SYNC 0E AM/SYNC 18 * + MODIFY 2 + MODIFY 01 * - MODIFY 6 - MODIFY 0B * TUNE UP 3 TUNE UP 04 * TUNE DOWN 7 TUNE DOWN 05 * VOLUME UP 0B VOLUME UP 02 * VOLUME DOWN 0F VOLUME DOWN 03 * PASSBAND MODIFY 0 PASSBAND MODIFY 09 * FILTER MODIFY 1 FILTER MODIFY 08 * BASS MODIFY 5 BASS MODIFY 0A * TREBLE MODIFY 14 TREBLE MODIFY 0C * VFO SELECT A/B 0A VFO SELECT A/B 0E * MEMORY STORE 4 MEMORY STORE 0D * MEMORY PREVIEW 9 MEMORY PREVIEW 00 * MEMORY RECALL 1B MEMORY RECALL 06 * * www.aoruk.com - 25.07.2006 */ /* * These are the translated key codes shown in the last IR code * address 58 in page 0. */ enum IR_CODE_e { IR_ONE = 0x12, IR_TWO = 0x14, IR_THREE = 0x1d, IR_FOUR = 0x16, IR_FIVE = 0x17, IR_SIX = 0x15, IR_SEVEN = 0x1a, IR_EIGHT = 0x18, IR_NINE = 0x1c, IR_ZERO = 0x1e, IR_DOT = 0x13, IR_CLR = 0x08, IR_BS = 0x20, IR_KHZ = 0x1b, IR_MHZ = 0x1f, IR_CWFM = 0x10, IR_LSBUSB = 0x11, IR_AMSYNC = 0x19, IR_PLUS = 0x02, IR_MINUS = 0x0c, IR_TUN_UP = 0x05, IR_TUN_DWN = 0x06, IR_VOL_UP = 0x03, IR_VOL_DWN = 0x04, IR_PBS = 0x0a, IR_TREBLE = 0x0d, IR_BASS = 0x0b, IR_VFO = 0x0f, IR_MEM_STO = 0x0e, IR_MEM_PRE = 0x01, IR_MEM_RCL = 0x07, IR_NONE = -1 }; /* backend conf */ #define TOK_CFG_MAGICCONF TOKEN_BACKEND(1) /* ext_level's and ext_parm's tokens */ #define TOK_EL_MAGICLEVEL TOKEN_BACKEND(1) #define TOK_EL_MAGICFUNC TOKEN_BACKEND(2) #define TOK_EL_MAGICOP TOKEN_BACKEND(3) #define TOK_EP_MAGICPARM TOKEN_BACKEND(4) /* Utility function prototypes */ #if 0 int NOP( RIG *rig, unsigned char x ); int SRH( RIG *rig, unsigned char x ); int PGE( RIG *rig, enum PAGE_e page ); int ADR( RIG *rig, unsigned char x ); int ADH( RIG *rig, unsigned char x ); int WRD( RIG *rig, unsigned char out ); int MSK( RIG *rig, unsigned char mask ); int EXE( RIG *rig, enum ROUTINE_e routine ); int RDD( RIG *rig, unsigned char len ); int LOC( RIG *rig, enum LOCK_LVL_e level ); int BUT( RIG *rig, enum BUTTON_e button ); #endif // 0 int execRoutine( RIG * rig, enum ROUTINE_e rtn ); int writeByte( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned char x ); int writeShort( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned short x ); int write3Bytes( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned int x ); int writeInt( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned int x ); int readByte( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned char *x ); int readShort( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned short *x ); int read3Bytes( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned int *x ); int readInt( RIG *rig, enum PAGE_e page, unsigned int addr, unsigned int *x ); int readSignal( RIG * rig, unsigned char *x ); int flushBuffer( RIG * rig ); int lockRx( RIG * rig, enum LOCK_LVL_e level ); int bcd2Int( const unsigned char bcd ); unsigned char int2BCD( const unsigned int val ); int getCalLevel( RIG * rig, unsigned char rawAgc, int *dbm ); int getFilterBW( RIG *rig, enum FILTER_e filter ); freq_t ddsToHz( const unsigned int steps ); unsigned int hzToDDS( const freq_t freq ); float pbsToHz( const unsigned char steps ); unsigned char hzToPBS( const float freq ); rmode_t modeToHamlib( const unsigned char mode ); unsigned char modeToNative( const rmode_t mode ); enum agc_level_e agcToHamlib( const unsigned char agc ); unsigned char agcToNative( const enum agc_level_e agc ); int pageSize( const enum PAGE_e page ); int sendIRCode( RIG *rig, enum IR_CODE_e code ); #endif /* _AR7030P_H */ hamlib-1.2.15.3/aor/ar3030.c0000644000175000017500000003503312044564477011774 00000000000000/* * Hamlib AOR backend - AR3030 description * Copyright (c) 2000-2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "hamlib/rig.h" #include "serial.h" #include "idx_builtin.h" #include "misc.h" #include "aor.h" static int ar3030_set_vfo(RIG *rig, vfo_t vfo); static int ar3030_get_vfo(RIG *rig, vfo_t *vfo); static int ar3030_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ar3030_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ar3030_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ar3030_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int ar3030_set_mem(RIG *rig, vfo_t vfo, int ch); static int ar3030_get_mem(RIG *rig, vfo_t vfo, int *ch); static int ar3030_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int ar3030_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int ar3030_get_channel(RIG *rig, channel_t *chan); static int ar3030_init(RIG *rig); static int ar3030_cleanup(RIG *rig); static int ar3030_close(RIG *rig); static int ar3030_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); struct ar3030_priv_data { int curr_ch; int curr_vfo; }; /* * TODO: * set_channel(emulated?),rig_vfo_op * rig_reset(RIG_RESET_MCALL) * quit the remote control mode on close? */ #define AR3030_MODES (RIG_MODE_AM|RIG_MODE_AMS|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_FAX) #define AR3030_FUNC_ALL (RIG_FUNC_NONE) #define AR3030_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_RAWSTR) #define AR3030_PARM (RIG_PARM_NONE) #define AR3030_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_MCL) #define AR3030_VFO (RIG_VFO_A|RIG_VFO_MEM) /* * FIXME: */ #define AR3030_STR_CAL { 2, \ { \ { 0x00, -60 }, \ { 0x3f, 60 } \ } } #define AR3030_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .levels = RIG_LEVEL_SET(AR3030_LEVEL), \ .flags = 1, \ } /* * Data was obtained from AR3030 pdf on http://www.aoruk.com * * ar3030 rig capabilities. */ const struct rig_caps ar3030_caps = { .rig_model = RIG_MODEL_AR3030, .model_name = "AR3030", .mfg_name = "AOR", .version = "0.4", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 9600, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 1, /* ms */ .timeout = 500, .retry = 0, .has_get_func = AR3030_FUNC_ALL, .has_set_func = AR3030_FUNC_ALL, .has_get_level = AR3030_LEVEL, .has_set_level = RIG_LEVEL_SET(AR3030_LEVEL), .has_get_parm = AR3030_PARM, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { 10, 20, 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, .vfo_ops = AR3030_VFO_OPS, .str_cal = AR3030_STR_CAL, .chan_list = { { 0, 99, RIG_MTYPE_MEM, AR3030_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30),MHz(30),AR3030_MODES,-1,-1,AR3030_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(30),AR3030_MODES,-1,-1,AR3030_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { RIG_FRNG_END, }, /* no tx range, this is a receiver! */ .tuning_steps = { {AR3030_MODES,10}, {AR3030_MODES,100}, {AR3030_MODES,kHz(1)}, {AR3030_MODES,MHz(1)}, RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_AM, kHz(6)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_CW, 500}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .rig_init = ar3030_init, .rig_cleanup = ar3030_cleanup, .rig_close = ar3030_close, .set_freq = ar3030_set_freq, .get_freq = ar3030_get_freq, .set_mode = ar3030_set_mode, .get_mode = ar3030_get_mode, .set_vfo = ar3030_set_vfo, .get_vfo = ar3030_get_vfo, .set_level = ar3030_set_level, .get_level = ar3030_get_level, .set_mem = ar3030_set_mem, .get_mem = ar3030_get_mem, .get_channel = ar3030_get_channel, .vfo_op = ar3030_vfo_op, }; /* * Function definitions below */ /* is LF really needed? */ #define EOM "\x0a\x0d" #define BUFSZ 64 /* * ar3030_transaction * We assume that rig!=NULL, rig->state!= NULL * Otherwise, you'll get a nice seg fault. You've been warned! * return value: RIG_OK if everything's fine, negative value otherwise * TODO: error case handling */ static int ar3030_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval; struct rig_state *rs; rs = &rig->state; serial_flush(&rs->rigport); retval = write_block(&rs->rigport, cmd, cmd_len); if (retval != RIG_OK) return retval; /* will flush data on next transaction */ if (!data || !data_len) return RIG_OK; retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM)); if (retval == -RIG_ETIMEOUT) retval = 0; if (retval < 0) return retval; *data_len = retval; return RIG_OK; } int ar3030_init(RIG *rig) { struct ar3030_priv_data *priv; priv = malloc(sizeof(struct ar3030_priv_data)); if (!priv) return -RIG_ENOMEM; priv->curr_ch = 99; /* huh! FIXME: get_mem in open() ? */ priv->curr_vfo = RIG_VFO_A; rig->state.priv = priv; return RIG_OK; } int ar3030_cleanup(RIG *rig) { struct ar3030_priv_data *priv = rig->state.priv; free(priv); return RIG_OK; } int ar3030_close(RIG *rig) { int retval; retval = ar3030_transaction (rig, "Q" EOM, strlen("Q" EOM), NULL, NULL); return retval; } int ar3030_set_vfo(RIG *rig, vfo_t vfo) { struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv; char *cmd = ""; int retval; switch(vfo) { case RIG_VFO_CURR: return RIG_OK; case RIG_VFO_VFO: case RIG_VFO_A: cmd = "D" EOM; break; case RIG_VFO_MEM: cmd = "M" EOM; break; default: return -RIG_EINVAL; } retval = ar3030_transaction (rig, cmd, strlen(cmd), NULL, NULL); if (retval == RIG_OK) priv->curr_vfo = vfo; return retval; } int ar3030_get_vfo(RIG *rig, vfo_t *vfo) { struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv; *vfo = priv->curr_vfo; return RIG_OK; } /* * ar3030_set_freq * Assumes rig!=NULL */ int ar3030_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv; char freqbuf[BUFSZ]; int freq_len, retval; freq_len = sprintf(freqbuf,"%03.4f" EOM, ((double)freq)/MHz(1)); retval = ar3030_transaction (rig, freqbuf, freq_len, NULL, NULL); if (retval != RIG_OK) return retval; priv->curr_vfo = RIG_VFO_A; return RIG_OK; } /* * ar3030_get_freq * Assumes rig!=NULL, freq!=NULL */ int ar3030_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv; char *rfp; int freq_len, retval; char freqbuf[BUFSZ]; /* * D Rn Gn Bn Tn Fnnnnnnnn C * Note: spaces are transmitted. */ retval = ar3030_transaction (rig, "D" EOM, 3, freqbuf, &freq_len); if (retval != RIG_OK) return retval; priv->curr_vfo = RIG_VFO_A; rfp = strchr(freqbuf, 'F'); if (!rfp) return -RIG_EPROTO; sscanf(rfp+1,"%"SCNfreq, freq); return RIG_OK; } /* * ar3030_set_mode * Assumes rig!=NULL */ int ar3030_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { char mdbuf[BUFSZ]; int mdbuf_len, aormode, retval; switch (mode) { case RIG_MODE_AM: aormode = 'A'; break; case RIG_MODE_CW: aormode = 'C'; break; case RIG_MODE_USB: aormode = 'U'; break; case RIG_MODE_LSB: aormode = 'L'; break; case RIG_MODE_FM: aormode = 'N'; break; case RIG_MODE_AMS: aormode = 'S'; break; case RIG_MODE_FAX: aormode = 'X'; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n", __FUNCTION__,mode); return -RIG_EINVAL; } mdbuf_len = sprintf(mdbuf, "%dB%c" EOM, width < rig_passband_normal(rig,mode) ? 1 : 0, aormode); retval = ar3030_transaction (rig, mdbuf, mdbuf_len, NULL, NULL); return retval; } /* * ar3030_get_mode * Assumes rig!=NULL, mode!=NULL */ int ar3030_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv; int buf_len, retval; char buf[BUFSZ]; /* * D Rn Gn Bn Tn Fnnnnnnnn C * Note: spaces are transmitted */ retval = ar3030_transaction (rig, "D" EOM, 3, buf, &buf_len); if (retval != RIG_OK) return retval; priv->curr_vfo = RIG_VFO_A; switch (buf[25]) { case 'A': *mode = RIG_MODE_AM; break; case 'L': *mode = RIG_MODE_LSB; break; case 'U': *mode = RIG_MODE_USB; break; case 'C': *mode = RIG_MODE_CW; break; case 'S': *mode = RIG_MODE_AMS; break; case 'N': *mode = RIG_MODE_FM; break; case 'X': *mode = RIG_MODE_FAX; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode '%c'\n", __FUNCTION__,buf[25]); return -RIG_EPROTO; } *width = buf[9] == '1' ? rig_passband_narrow(rig, *mode) : rig_passband_normal(rig, *mode); return RIG_OK; } int ar3030_set_mem(RIG *rig, vfo_t vfo, int ch) { struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv; char cmdbuf[BUFSZ]; int cmd_len, retval=RIG_OK; if (priv->curr_vfo == RIG_VFO_MEM) { cmd_len = sprintf(cmdbuf, "%02dM" EOM, ch); retval = ar3030_transaction (rig, cmdbuf, cmd_len, NULL, NULL); } if (retval == RIG_OK) { priv->curr_ch = ch; } return retval; } int ar3030_get_mem(RIG *rig, vfo_t vfo, int *ch) { struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv; char infobuf[BUFSZ]; int info_len, retval; if (priv->curr_vfo != RIG_VFO_MEM) { *ch = priv->curr_ch; } retval = ar3030_transaction (rig, "M" EOM, 3, infobuf, &info_len); if (retval != RIG_OK) return retval; /* * MnnPnRnGnBnTnFnnnnnnnnC */ if (infobuf[0] != 'M') { return -RIG_EPROTO; } /* * Is it a blank mem channel ? */ if (infobuf[1] == '-' && infobuf[2] == '-') { *ch = -1; /* FIXME: return error instead? */ return RIG_OK; } *ch = priv->curr_ch = atoi(infobuf+1); return RIG_OK; } int ar3030_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { char *cmd; int retval; switch(level) { case RIG_LEVEL_AGC: /* SLOW otherwise */ cmd = val.i == RIG_AGC_FAST ? "1G" EOM : "0G" EOM; break; case RIG_LEVEL_ATT: cmd = val.i == 0 ? "0R" EOM : (val.i == 1 ? "1R" EOM : "2R" EOM); break; default: return -RIG_EINVAL; } retval = ar3030_transaction (rig, cmd, strlen(cmd), NULL, NULL); if (retval != RIG_OK) return retval; return RIG_OK; } int ar3030_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv; int info_len, retval; char infobuf[BUFSZ], *p; switch(level) { case RIG_LEVEL_ATT: /* * DRnGnBnTnFnnnnnnnnC */ retval = ar3030_transaction (rig, "D" EOM, 3, infobuf, &info_len); if (retval != RIG_OK) return retval; priv->curr_vfo = RIG_VFO_A; p = strchr(infobuf, 'R'); if (!p) return -RIG_EPROTO; val->i = p[1] == '0' ? 0 : rig->caps->attenuator[p[1] - '1']; return RIG_OK; case RIG_LEVEL_AGC: /* * DRnGnBnTnFnnnnnnnnC */ retval = ar3030_transaction (rig, "D" EOM, 3, infobuf, &info_len); if (retval != RIG_OK) return retval; priv->curr_vfo = RIG_VFO_A; p = strchr(infobuf, 'G'); if (!p) return -RIG_EPROTO; val->i = p[1] == '0' ? RIG_AGC_SLOW : RIG_AGC_FAST; return RIG_OK; case RIG_LEVEL_RAWSTR: retval = ar3030_transaction (rig, "Y" EOM, 3, infobuf, &info_len); if (retval != RIG_OK) return retval; infobuf[3] = '\0'; val->i = strtol(infobuf, (char **)NULL, 16); return RIG_OK; default: return -RIG_EINVAL; } return RIG_OK; } int ar3030_get_channel(RIG *rig, channel_t *chan) { struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv; char cmdbuf[BUFSZ], infobuf[BUFSZ]; int info_len, cmd_len, retval; cmd_len = sprintf(cmdbuf, "%02dM" EOM, chan->channel_num); retval = ar3030_transaction (rig, cmdbuf, cmd_len, infobuf, &info_len); if (retval != RIG_OK) return retval; priv->curr_vfo = RIG_VFO_A; /* * MnnPnRnGnBnTnFnnnnnnnnC */ if (infobuf[0] != 'M') { return -RIG_EPROTO; } /* * Is it a blank mem channel ? */ if (infobuf[1] == '-' && infobuf[2] == '-') { chan->freq = RIG_FREQ_NONE; return RIG_OK; } sscanf(infobuf+14,"%"SCNfreq, &chan->freq); chan->freq *= 10; switch (infobuf[22]) { case 'A': chan->mode = RIG_MODE_AM; break; case 'L': chan->mode = RIG_MODE_LSB; break; case 'U': chan->mode = RIG_MODE_USB; break; case 'C': chan->mode = RIG_MODE_CW; break; case 'S': chan->mode = RIG_MODE_AMS; break; case 'N': chan->mode = RIG_MODE_FM; break; case 'X': chan->mode = RIG_MODE_FAX; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode '%c'\n", __FUNCTION__,infobuf[22]); return -RIG_EPROTO; } chan->width = infobuf[10] == '1' ? rig_passband_narrow(rig, chan->mode) : rig_passband_normal(rig, chan->mode); chan->levels[LVL_ATT].i = infobuf[6] == '0' ? 0 : rig->caps->attenuator[infobuf[4] - '1']; chan->levels[LVL_AGC].i = infobuf[8] == '0' ? RIG_AGC_SLOW : RIG_AGC_FAST; chan->flags = infobuf[4] == '1' ? RIG_CHFLAG_SKIP : RIG_CHFLAG_NONE; return RIG_OK; } int ar3030_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { struct ar3030_priv_data *priv = (struct ar3030_priv_data *)rig->state.priv; char buf[16]; int len, retval; switch(op) { case RIG_OP_MCL: len = sprintf(buf,"%02d%%" EOM, priv->curr_ch); break; case RIG_OP_FROM_VFO: len = sprintf(buf,"%02dW" EOM, priv->curr_ch); priv->curr_vfo = RIG_VFO_MEM; break; default: return -RIG_EINVAL; } retval = ar3030_transaction(rig, buf, len, NULL, NULL); return retval; } hamlib-1.2.15.3/aor/ar7030p.c0000644000175000017500000011640712044564477012165 00000000000000 /* * Hamlib AOR backend - AR7030 Plus description * Copyright (c) 2000-2010 by Stephane Fillod & Fritz Melchert * Copyright (c) 2009-2010 by Larry Gadallah (VE6VQ) * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * Version 2009.11.21 Larry Gadallah (VE6VQ) */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "hamlib/rig.h" #include "ar7030p.h" #include "serial.h" #include "idx_builtin.h" #define AR7030P_MODES ( RIG_MODE_AM | \ RIG_MODE_SSB | \ RIG_MODE_CW | \ RIG_MODE_RTTY | \ RIG_MODE_FM | \ RIG_MODE_AMS ) #define AR7030P_FUNC ( RIG_FUNC_FAGC | \ RIG_FUNC_NB | \ RIG_FUNC_ANF | \ RIG_FUNC_AIP | \ RIG_FUNC_MN | \ RIG_FUNC_RF | \ RIG_FUNC_LOCK | \ RIG_FUNC_MUTE | \ RIG_FUNC_SQL ) #define AR7030P_LEVEL ( RIG_LEVEL_PREAMP | \ RIG_LEVEL_ATT | \ RIG_LEVEL_AF | \ RIG_LEVEL_RF | \ RIG_LEVEL_SQL | \ RIG_LEVEL_PBT_IN | \ RIG_LEVEL_CWPITCH | \ RIG_LEVEL_NOTCHF | \ RIG_LEVEL_AGC | \ RIG_LEVEL_RAWSTR | \ RIG_LEVEL_STRENGTH ) #define AR7030P_PARM ( RIG_PARM_APO | \ RIG_PARM_TIME | \ RIG_PARM_BAT ) #define AR7030P_VFO_OPS ( RIG_OP_CPY | \ RIG_OP_XCHG | \ RIG_OP_TOGGLE ) #define AR7030P_VFO ( RIG_VFO_A | \ RIG_VFO_B) #define AR7030P_STR_CAL { 8, { \ { 10, -113 }, \ { 10, -103 }, \ { 10, -93 }, \ { 10, -83 }, \ { 10, -73 }, \ { 10, -63 }, \ { 20, -43 }, \ { 20, -23 }, \ } } /* Channel capabilities - Frequency - Mode - Width - Scan lockout - PBT - Squelch - ID */ #define AR7030P_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .funcs = RIG_FUNC_NONE, \ .levels = RIG_LEVEL_SQL | RIG_LEVEL_PBT_IN, \ .flags = 1, \ .channel_desc = 1 \ } struct ar7030p_priv_caps { int max_freq_len; int info_len; int mem_len; int pbs_info_len; int pbs_len; int chan_num; }; static const struct ar7030p_priv_caps ar7030p_priv_caps = { .max_freq_len = 3, .info_len = 14, .mem_len = 17, .pbs_info_len = 1, .pbs_len = 1, .chan_num = 0, }; #define NB_CHAN 400 /* see caps->chan_list */ struct ar7030p_priv_data { vfo_t curr_vfo; vfo_t last_vfo; /* VFO A or VFO B, when in MEM mode */ powerstat_t powerstat; int bank; value_t parms[ RIG_SETTING_MAX ]; channel_t *curr; /* points to vfo_a, vfo_b or mem[] */ channel_t vfo_a; channel_t vfo_b; channel_t mem[ NB_CHAN ]; struct ext_list *ext_parms; }; static const struct confparams ar7030p_ext_levels[] = { { TOK_EL_MAGICLEVEL, "MGL", "Magic level", "Magic level, as an example", NULL, RIG_CONF_NUMERIC, { .n = { 0, 1, .001 } } }, { TOK_EL_MAGICFUNC, "MGF", "Magic func", "Magic function, as an example", NULL, RIG_CONF_CHECKBUTTON }, { TOK_EL_MAGICOP, "MGO", "Magic Op", "Magic Op, as an example", NULL, RIG_CONF_BUTTON }, { RIG_CONF_END, NULL, } }; static const struct confparams ar7030p_ext_parms[] = { { TOK_EP_MAGICPARM, "MGP", "Magic parm", "Magic parameter, as an example", NULL, RIG_CONF_NUMERIC, { .n = { 0, 1, .001 } } }, { RIG_CONF_END, NULL, } }; /* TODO - move this somewhere where it belongs */ static unsigned int filterTab[ 6 + 1 ] = { 0 }; static void init_chan(RIG *rig, vfo_t vfo, channel_t *chan) { assert( NULL != rig ); assert( NULL != chan ); chan->channel_num = 0; chan->vfo = vfo; strcpy( chan->channel_desc, rig_strvfo( vfo ) ); chan->freq = MHz( 10 ); chan->mode = RIG_MODE_AM; chan->width = rig_passband_normal( rig, RIG_MODE_AM ); chan->tuning_step = 110; chan->funcs = (setting_t) 0; memset( chan->levels, 0, RIG_SETTING_MAX * sizeof( value_t ) ); } static struct ext_list *alloc_init_ext( const struct confparams *cfp ) { struct ext_list *elp; int i, nb_ext; assert( NULL != cfp ); for ( nb_ext = 0; !RIG_IS_EXT_END(cfp[nb_ext]); nb_ext++ ) { ; } elp = calloc( ( nb_ext + 1 ), sizeof( struct ext_list ) ); if ( !elp ) { return NULL; } for ( i = 0; !RIG_IS_EXT_END(cfp[i]); i++ ) { elp[i].token = cfp[i].token; /* value reset already by calloc */ } /* last token in array is set to 0 by calloc */ return elp; } #if 0 /* unused; re-enabled as needed. */ static struct ext_list *find_ext( struct ext_list *elp, token_t token ) { int i; for ( i = 0; elp[ i ].token != 0; i++ ) { if ( elp[ i ].token == token ) { return &( elp[ i ] ); } } return NULL; } #endif /* unused */ static int ar7030p_init( RIG *rig ) { struct ar7030p_priv_data *priv; int rc = RIG_OK; int i; assert( NULL != rig ); rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __func__); priv = (struct ar7030p_priv_data *) malloc( sizeof( struct ar7030p_priv_data ) ); if (!priv) { rc = -RIG_ENOMEM; } else { rig->state.priv = (void *) priv; rig->state.rigport.type.rig = RIG_PORT_SERIAL; priv->powerstat = RIG_POWER_ON; priv->bank = 0; memset(priv->parms, 0, RIG_SETTING_MAX * sizeof( value_t ) ); memset(priv->mem, 0, sizeof( priv->mem ) ); for ( i = 0; i < NB_CHAN; i++ ) { priv->mem[ i ].channel_num = i; priv->mem[ i ].vfo = RIG_VFO_MEM; priv->mem[ i ].ext_levels = alloc_init_ext( ar7030p_ext_levels ); if ( !priv->mem[ i ].ext_levels ) { rc = -RIG_ENOMEM; break; } } if ( RIG_OK == rc ) { priv->vfo_a.ext_levels = alloc_init_ext( ar7030p_ext_levels ); if ( !priv->vfo_a.ext_levels ) { return -RIG_ENOMEM; } else { priv->vfo_b.ext_levels = alloc_init_ext( ar7030p_ext_levels ); } if ( !priv->vfo_b.ext_levels ) { return -RIG_ENOMEM; } priv->ext_parms = alloc_init_ext( ar7030p_ext_parms ); if ( !priv->ext_parms ) { return -RIG_ENOMEM; } init_chan(rig, RIG_VFO_A, &priv->vfo_a); init_chan(rig, RIG_VFO_B, &priv->vfo_b); priv->curr = &priv->vfo_a; priv->curr_vfo = priv->last_vfo = RIG_VFO_A; } } return( rc ); } static int ar7030p_cleanup( RIG *rig ) { struct ar7030p_priv_data *priv = (struct ar7030p_priv_data *) rig->state.priv; int rc = RIG_OK; int i; assert( NULL != rig ); rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); for ( i = 0; i < NB_CHAN; i++ ) { free( priv->mem[ i ].ext_levels ); } free( priv->vfo_a.ext_levels ); free( priv->vfo_b.ext_levels ); free( priv->ext_parms ); if ( NULL != rig->state.priv ) { free( rig->state.priv ); } rig->state.priv = NULL; return( rc ); } /* * /brief Open I/O to receiver * * /param rig Pointer to rig struct * * /return 0 on success, < 0 on failure */ static int ar7030p_open( RIG * rig ) { int rc = RIG_OK; int i; unsigned char v; assert( NULL != rig ); rc = lockRx( rig, LOCK_1 ); if ( RIG_OK == rc ) { /* Load calibration table */ rig->state.str_cal.size = rig->caps->str_cal.size; for ( i = 0; i < rig->state.str_cal.size; i++ ) { rc = readByte( rig, EEPROM1, SM_CAL + i, &v ); if ( RIG_OK != rc ) { break; } rig->state.str_cal.table[ i ].val = rig->caps->str_cal.table[ i ].val; rig->state.str_cal.table[ i ].raw = (int) v; rig_debug( RIG_DEBUG_VERBOSE, "%s: index %d, val %d, raw %d\n", __func__, i, rig->state.str_cal.table[ i ].val, rig->state.str_cal.table[ i ].raw); } if ( RIG_OK == rc ) { /* Load filter BW table */ for ( i = 1; i <= 6; i++ ) { rc = getFilterBW( rig, i ); if ( 0 > rc ) { rc = -RIG_EIO; break; } else { filterTab[i] = (unsigned int) rc; } } } rc = lockRx( rig, LOCK_0 ); rig_debug( RIG_DEBUG_VERBOSE, "%s: \n", __func__ ); } return ( rc ); } /* * /brief Close I/O to receiver * * /param rig Pointer to rig struct * * /return 0 on success, < 0 on failure */ static int ar7030p_close( RIG * rig ) { assert( NULL != rig ); rig_debug( RIG_DEBUG_VERBOSE, "%s: \n", __func__ ); return ( RIG_OK ); } static const char *ar7030p_get_info( RIG * rig ) { static char version[10] = ""; unsigned int i; char *p = &( version[ 0 ] ); assert( NULL != rig ); for ( i = 0; i < pageSize(ROM); i++ ) { if ( RIG_OK != readByte( rig, ROM, i, (unsigned char *) p++ ) ) { p = NULL; break; } } if ( NULL != p ) { *p++ = '\0'; p = &( version[ 0 ] ); rig_debug( RIG_DEBUG_VERBOSE, "%s: ident - %s\n", __func__, version ); } return ( p ); } /* * /brief Set receiver frequency * * /param rig Pointer to rig struct * /param vfo VFO to operate on * /param freq Frequency to set * */ static int ar7030p_set_freq( RIG * rig, vfo_t vfo, freq_t freq ) { int rc = RIG_OK; const struct rig_caps *caps; assert( NULL != rig ); rc = lockRx( rig, LOCK_1 ); if ( RIG_OK == rc ) { caps = rig->caps; if ( ( caps->rx_range_list1[ 0 ].end > freq ) && ( caps->rx_range_list1[ 0 ].start < freq ) ) { switch( vfo ) { case RIG_VFO_CURR: case RIG_VFO_A: rc = write3Bytes( rig, WORKING, FREQU, hzToDDS( freq ) ); break; case RIG_VFO_B: rc = write3Bytes( rig, WORKING, FREQU_B, hzToDDS( freq ) ); break; default: rc = -RIG_EINVAL; }; } else { rc = -RIG_EINVAL; } rc = execRoutine( rig, SET_ALL ); rc = lockRx( rig, LOCK_0 ); } return( rc ); } /* * /brief Get receiver frequency * * /param rig Pointer to rig struct * /param vfo VFO to operate on * /param freq Pointer to hold frequency value (in Hz) * */ static int ar7030p_get_freq( RIG * rig, vfo_t vfo, freq_t * freq ) { int rc = RIG_OK; unsigned int x; rc = lockRx( rig, LOCK_1 ); if ( RIG_OK == rc ) { switch( vfo ) { case RIG_VFO_CURR: case RIG_VFO_A: rc = read3Bytes( rig, WORKING, FREQU, &x ); if ( RIG_OK == rc ) { *freq = ddsToHz( x ); } break; case RIG_VFO_B: rc = read3Bytes( rig, WORKING, FREQU_B, &x ); { *freq = ddsToHz( x ); } break; default: rc = -RIG_EINVAL; }; rc = lockRx( rig, LOCK_0 ); } return( rc ); } /* * /brief Set receiver mode * * /param rig Pointer to rig struct * /param vfo VFO to operate on * /param mode Mode to set * /param width Bandwidth to set * */ static int ar7030p_set_mode( RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) { int rc = RIG_OK; unsigned char ar_mode = (unsigned char) USB; unsigned char ar_filter = (unsigned char) FILTER_3; int i; rc = lockRx( rig, LOCK_1 ); if ( RIG_OK == rc ) { /* TODO - deal with selected VFO */ ar_mode = modeToNative( mode ); rc = writeByte( rig, WORKING, MODE, ar_mode ); if ( RIG_OK == rc ) { if ( RIG_PASSBAND_NORMAL == width ) { width = rig_passband_normal( rig, mode ); } else { /* TODO - get filter BWs at startup */ ar_filter = (unsigned char) 6; for ( i = 1; i <= 6; i++ ) { if ( width <= filterTab[ i ] ) { if ( filterTab[ i ] < filterTab[ (int) ar_filter ] ) { ar_filter = (unsigned char) i; } } rig_debug( RIG_DEBUG_VERBOSE, "%s: width %d ar_filter %d filterTab[%d] %d\n", __func__, width, ar_filter, i, filterTab[i] ); } } rc = writeByte( rig, WORKING, FILTER, ar_filter ); if ( RIG_OK == rc ) { rc = execRoutine( rig, SET_ALL ); } } rc = lockRx( rig, LOCK_0 ); } return( rc ); } /* * /brief Get receiver mode and bandwidth * * /param rig Pointer to rig struct * /param vfo VFO to operate on * /param mode Pointer to value to hold mode * /param width Pointer to value to hold bandwidth * */ static int ar7030p_get_mode( RIG * rig, vfo_t vfo, rmode_t * mode, pbwidth_t * width ) { int rc = RIG_OK; unsigned char bcd_bw; unsigned char m; assert( NULL != rig ); assert( NULL != mode ); assert( NULL != width ); rc = lockRx( rig, LOCK_1 ); if ( RIG_OK == rc ) { /* TODO - deal with selected VFO */ rc = readByte( rig, WORKING, MODE, &m ); if ( RIG_OK == rc ) { *mode = modeToHamlib( m ); rc = readByte( rig, WORKING, FLTBW, &bcd_bw ); if ( RIG_OK == rc ) { *width = (pbwidth_t) ((int) bcd2Int( bcd_bw ) * 100); } } rc = lockRx( rig, LOCK_0 ); } return( rc ); } /* * /brief Get memory channel parameters * * /param rig Pointer to rig struct * /param chan Channel number (0-399) * /param freq Pointer to frequency value * /param mode Pointer to mode value (1-7) * /param filt Pointer to filter value (1-6) * /param pbs Pointer to passband tuning value * /param sql Pointer to squelch value (0-255) * /param id Pointer to channel ident string (14 chars) * */ #if 0 /* unused; re-enabled as needed. */ static void ar7030p_get_memory( RIG * rig, const unsigned int chan, double *const freq, unsigned char *const mode, unsigned char *const filt, unsigned char *const pbs, unsigned char *const sql, char *const id ) { int rc = RIG_OK; unsigned char v; unsigned int f; unsigned char *p = (unsigned char *) id; int i; assert( NULL != rig ); assert( NULL != freq ); assert( NULL != mode ); assert( NULL != filt ); assert( NULL != pbs ); assert( NULL != sql ); assert( NULL != id ); rc = lockRx( rig, LOCK_1 ); if ( RIG_OK == rc ) { /* Squelch values */ if ( 100 > chan ) { rc = readByte( rig, BBRAM, (MEM_SQ + chan), &v ); /* mem_sq */ } else if ( 176 > chan ) { rc = readByte( rig, EEPROM2, (MEX_SQ + (chan * 16) ), &v ); /* mex_sq */ } else { rc = readByte( rig, EEPROM3, (MEY_SQ + ((chan - 176) * 16) ), &v ); /* mey_sq */ } if ( RIG_OK == rc ) { *sql = v; } /* Frequency, mode and filter values */ if ( 100 > chan ) { rc = read3Bytes( rig, EEPROM2, (MEM_FR + (chan * 4) ), &f ); /* mem_fr */ rc = readByte( rig, EEPROM2, (MEM_MD + (chan * 4) ), &v ); /* mem_md */ } else { rc = read3Bytes( rig, EEPROM3, (MEX_FR + ((chan - 100) * 4) ), &f ); /* mex_fr */ rc = readByte( rig, EEPROM3, (MEX_MD + ((chan - 100) * 4) ), &v ); /* mex_md */ } if ( RIG_OK == rc ) { *freq = ddsToHz( f ); *mode = ( v & 0x07 ); *filt = ( ( v & 0x70 ) >> 4 ); /* lockout = ( ( v & 0x80 ) >> 7 ); */ } /* PBT values */ if ( 100 > chan ) { rc = readByte( rig, EEPROM1, (MEM_PB + chan), &v ); /* mem_pb */ } else if ( 176 > chan ) { rc = readByte( rig, EEPROM2, (MEX_PB + (chan * 16)), &v ); /* mex_pb */ } else { rc = readByte( rig, EEPROM3, (MEY_PB + ((chan - 176) * 16)), &v ); /* mey_pb */ } if ( RIG_OK == rc ) { *pbs = v; } /* Memory ID values */ for ( i = 0; i < 14; i++ ) { if ( 176 > chan ) { rc = readByte( rig, EEPROM2, (MEX_ID + (chan * 16)), p++ ); /* mex_id */ } else { rc = readByte( rig, EEPROM3, (MEY_ID + ((chan - 176) * 16)), p++ ); /* mey_id */ } if ( RIG_OK != rc ) { p = (unsigned char *) id; break; } } *p++ = '\0'; rc = lockRx( rig, LOCK_0 ); } } #endif /* unused */ /* * /brief Set receiver levels * * /param rig Pointer to rig struct * /param vfo VFO to operate on * /param level Level to set * /param val Value to set level to * * /return RIG_OK on success */ static int ar7030p_set_level( RIG * rig, vfo_t vfo, setting_t level, value_t val ) { int rc = RIG_OK; unsigned char v; rc = lockRx( rig, LOCK_1 ); if ( RIG_OK == rc ) { /* TODO - deal with selected VFO */ switch ( level ) { case RIG_LEVEL_PREAMP: /* Scale parameter */ if ( 10 <= val.i ) { v = (unsigned char) 0; } else { v = (unsigned char) 1; } rc = writeByte( rig, WORKING, RFGAIN, v ); /* rfgain */ rig_debug( RIG_DEBUG_VERBOSE, "%s: rfgain %d (%d)\n", __func__, val.i, v ); rc = execRoutine( rig, SET_ALL ); break; case RIG_LEVEL_ATT: /* Scale parameter */ if ( 10 > val.i ) { v = (unsigned char) 1; } else if ( 20 > val.i ) { v = (unsigned char) 2; } else if ( 40 > val.i ) { v = (unsigned char) 3; } else if ( 80 > val.i ) { v = (unsigned char) 4; } else { v = (unsigned char) 5; } rc = writeByte( rig, WORKING, RFGAIN, v ); /* rfgain */ rig_debug( RIG_DEBUG_VERBOSE, "%s: rfgain %d (%d)\n", __func__, val.i, v ); rc = execRoutine( rig, SET_ALL ); break; case RIG_LEVEL_AF: /* Scale parameter */ v = ( unsigned char ) ( ( val.f * ( VOL_MAX - VOL_MIN ) ) + VOL_MIN ); v = ( v & 0x3f ); rc = writeByte( rig, WORKING, AF_VOL, v ); /* af_vol */ rig_debug( RIG_DEBUG_VERBOSE, "%s: af_vol %f (%d)\n", __func__, val.f, v ); v = ( ( v >> 1 ) & 0x1f ); /* half value for L/R volume */ rc = writeByte( rig, WORKING, AF_VLL, v ); /* af_vll */ rc = writeByte( rig, WORKING, AF_VLR, v ); /* af_vlr */ rc = execRoutine( rig, SET_AUDIO ); break; case RIG_LEVEL_RF: /* Scale parameter, values 0 (99%) to 130 (3%) */ v = (unsigned char) (134U - ((unsigned int) (val.f * 135.0))); rc = writeByte( rig, WORKING, IFGAIN, v ); /* ifgain */ rig_debug( RIG_DEBUG_VERBOSE, "%s: ifgain %f (%d)\n", __func__, val.f, v ); rc = execRoutine( rig, SET_ALL ); break; case RIG_LEVEL_SQL: /* Scale parameter */ v = (unsigned char) (val.f * 255.0); rc = writeByte( rig, WORKING, SQLVAL, v ); /* sqlval */ rig_debug( RIG_DEBUG_VERBOSE, "%s: sqlval %f (%d)\n", __func__, val.f, v ); rc = execRoutine( rig, SET_ALL ); break; case RIG_LEVEL_PBT_IN: /* Scale parameter */ v = (unsigned char) (val.f / (HZ_PER_STEP * 12.5)); rc = writeByte( rig, WORKING, PBSVAL, v ); /* pbsval */ rig_debug( RIG_DEBUG_VERBOSE, "%s: pbsval %f (%d)\n", __func__, val.f, v ); rc = execRoutine( rig, SET_ALL ); break; case RIG_LEVEL_CWPITCH: /* Scale parameter */ v = (unsigned char) (val.f / (HZ_PER_STEP * 12.5)); rc = writeByte( rig, WORKING, BFOVAL, v ); /* bfoval */ rig_debug( RIG_DEBUG_VERBOSE, "%s: bfoval %f (%d)\n", __func__, val.f, v ); rc = execRoutine( rig, SET_ALL ); break; case RIG_LEVEL_NOTCHF: rc = -RIG_ENIMPL; break; case RIG_LEVEL_AGC: /* Scale parameter */ v = agcToNative( val.i ); rc = writeByte( rig, WORKING, AGCSPD, v ); /* agcspd */ rig_debug( RIG_DEBUG_VERBOSE, "%s: agcspd %d (%d)\n", __func__, val.i, v ); rc = execRoutine( rig, SET_ALL ); break; default: rc = -RIG_EINVAL; }; rc = lockRx( rig, LOCK_0 ); } return( rc ); } /* * /brief Get receiver levels * * /param rig Pointer to rig struct * /param vfo VFO to operate on * /param level Level to get * /param val Pointer to value to get * * /return RIG_OK on success */ static int ar7030p_get_level( RIG * rig, vfo_t vfo, setting_t level, value_t * val ) { int rc = RIG_OK; unsigned char v; unsigned int x = 0; unsigned short s = 0; int i; rc = lockRx( rig, LOCK_1 ); if ( RIG_OK == rc ) { /* TODO - deal with selected VFO */ switch ( level ) { case RIG_LEVEL_PREAMP: rc = readByte( rig, WORKING, RFGAIN, &v ); /* rfgain */ if ( RIG_OK == rc ) { /* Scale parameter */ if ( 0 == v ) { val->i = 10; } else { val->i = 0; } rig_debug( RIG_DEBUG_VERBOSE, "%s: rfgain %d (%d)\n", __func__, v, val->i ); } break; case RIG_LEVEL_ATT: rc = readByte( rig, WORKING, RFGAIN, &v ); /* rfgain */ if ( RIG_OK == rc ) { /* Scale parameter */ switch( v ) { case 2: val->i = 10; break; case 3: val->i = 20; break; case 4: val->i = 40; break; default: case 0: case 1: val->i = 0; }; rig_debug( RIG_DEBUG_VERBOSE, "%s: rfgain %d (%d)\n", __func__, v, val->i ); } break; case RIG_LEVEL_AF: rc = readByte( rig, WORKING, AF_VOL, &v ); /* af_vol */ if ( RIG_OK == rc ) { /* Scale parameter */ v = ( v & 0x3f ); val->f = (( (float) v - VOL_MIN) / ( VOL_MAX - VOL_MIN ) ); rig_debug( RIG_DEBUG_VERBOSE, "%s: af_vol %d (%f)\n", __func__, v, val->f ); } break; case RIG_LEVEL_RF: rc = readByte( rig, WORKING, IFGAIN, &v ); /* ifgain */ if ( RIG_OK == rc ) { /* Scale parameter, values 0 (99%) to 130 (3%) */ val->f = ((float) (134 - v) / 135.0 ); rig_debug( RIG_DEBUG_VERBOSE, "%s: ifgain %d (%f)\n", __func__, v, val->f ); } break; case RIG_LEVEL_SQL: rc = readByte( rig, WORKING, SQLVAL, &v ); /* sqlval */ if ( RIG_OK == rc ) { /* Scale parameter */ val->f = ((float) (v) / 255.0 ); rig_debug( RIG_DEBUG_VERBOSE, "%s: sqlval %d (%f)\n", __func__, v, val->f ); } break; case RIG_LEVEL_PBT_IN: rc = readByte( rig, WORKING, PBSVAL, &v ); /* pbsval */ if ( RIG_OK == rc ) { /* Scale parameter */ if (127 < v) { v = v | 0xffffff00; } val->f = ((float) (v) * HZ_PER_STEP * 12.5 ); rig_debug( RIG_DEBUG_VERBOSE, "%s: pbsval %d (%f)\n", __func__, v, val->f ); } break; case RIG_LEVEL_CWPITCH: rc = readByte( rig, WORKING, BFOVAL, &v ); /* bfoval */ if ( RIG_OK == rc ) { /* Scale parameter */ if (127 < v) { v = v | 0xffffff00; } val->f = ((float) (v) * HZ_PER_STEP * 12.5 ); rig_debug( RIG_DEBUG_VERBOSE, "%s: bfoval %d (%f)\n", __func__, v, val->f ); } break; case RIG_LEVEL_NOTCHF: rc = readShort( rig, WORKING, NCHFR, &s ); /* nchfr */ if ( RIG_OK == rc ) { x = (unsigned int) s; /* Scale parameter */ val->i = (int) ((float) (x) / NOTCH_STEP_HZ); rig_debug( RIG_DEBUG_VERBOSE, "%s: nchfr %d (%d)\n", __func__, x, val->i ); } break; case RIG_LEVEL_AGC: rc = readByte( rig, WORKING, AGCSPD, &v ); /* agcspd */ if ( RIG_OK == rc ) { /* Scale parameter */ val->i = agcToHamlib( v ); rig_debug( RIG_DEBUG_VERBOSE, "%s: agcspd %d (%d)\n", __func__, v, val->i ); } break; case RIG_LEVEL_RAWSTR: rc = readSignal( rig, &v ); if ( RIG_OK == rc ) { val->i = (int) v; } break; case RIG_LEVEL_STRENGTH: rc = readSignal( rig, &v ); if ( RIG_OK == rc ) { rc = getCalLevel( rig, v, &i ); if ( RIG_OK == rc ) { val->i = i; } } break; default: rc = -RIG_EINVAL; } rc = lockRx( rig, LOCK_0 ); } return( rc ); } static int ar7030p_set_vfo( RIG * rig, vfo_t vfo ) { int rc = RIG_OK; struct ar7030p_priv_data *priv = (struct ar7030p_priv_data *) rig->state.priv; assert( NULL != rig ); switch( vfo ) { case RIG_VFO_B: if ( RIG_VFO_B != priv->curr_vfo ) { rc = sendIRCode( rig, IR_VFO ); if ( RIG_OK == rc ) { priv->curr_vfo = RIG_VFO_B; priv->last_vfo = RIG_VFO_A; } } break; case RIG_VFO_A: case RIG_VFO_CURR: if ( RIG_VFO_A != priv->curr_vfo ) { rc = sendIRCode( rig, IR_VFO ); if ( RIG_OK == rc ) { priv->curr_vfo = RIG_VFO_A; priv->last_vfo = RIG_VFO_B; } } break; default: rc = -RIG_EINVAL; break; } return ( rc ); } static int ar7030p_get_vfo( RIG * rig, vfo_t * vfo ) { int rc = RIG_OK; struct ar7030p_priv_data *priv = (struct ar7030p_priv_data *) rig->state.priv; assert( NULL != rig ); assert( NULL != vfo ); *vfo = priv->curr_vfo; return ( rc ); } static int ar7030p_set_parm( RIG * rig, setting_t parm, value_t val ) { int rc = -RIG_ENIMPL; assert( NULL != rig ); switch ( parm ) { case RIG_PARM_APO: break; case RIG_PARM_TIME: break; case RIG_PARM_BAT: break; default: break; }; return ( rc ); } static int ar7030p_get_parm( RIG * rig, setting_t parm, value_t * val ) { int rc = -RIG_ENIMPL; assert( NULL != rig ); assert( NULL != val ); switch ( parm ) { case RIG_PARM_APO: break; case RIG_PARM_TIME: break; case RIG_PARM_BAT: break; default: break; }; return ( rc ); } static int ar7030p_set_mem( RIG * rig, vfo_t vfo, int ch ) { int rc = RIG_OK; struct ar7030p_priv_data *priv = (struct ar7030p_priv_data *) rig->state.priv; if ( RIG_VFO_MEM == priv->curr_vfo ) { priv->curr = &priv->mem[ ch ]; } else { priv->curr->channel_num = ch; } rig_debug(RIG_DEBUG_VERBOSE, "%s: ch %d\n", __func__, ch); return ( rc ); } static int ar7030p_get_mem( RIG * rig, vfo_t vfo, int *ch ) { int rc = RIG_OK; struct ar7030p_priv_data *priv = (struct ar7030p_priv_data *) rig->state.priv; channel_t *curr = priv->curr; assert( NULL != ch ); *ch = curr->channel_num; rig_debug(RIG_DEBUG_VERBOSE, "%s: ch %d\n", __func__, *ch); return ( rc ); } static int ar7030p_vfo_op( RIG * rig, vfo_t vfo, vfo_op_t op ) { int rc = -RIG_ENIMPL; assert( NULL != rig ); switch( op ) { case RIG_OP_CPY: rc = -RIG_ENIMPL; break; case RIG_OP_XCHG: rc = -RIG_ENIMPL; break; case RIG_OP_TOGGLE: rc = sendIRCode( rig, IR_VFO ); break; default: break; }; return ( rc ); } static int ar7030p_scan( RIG * rig, vfo_t vfo, scan_t scan, int ch ) { int rc = -RIG_ENIMPL; assert( NULL != rig ); return ( rc ); } static int ar7030p_get_dcd( RIG * rig, vfo_t vfo, dcd_t * dcd ) { int rc = RIG_OK; unsigned char v; assert( NULL != rig ); assert( NULL != dcd ); rc = lockRx( rig, LOCK_1 ); if ( RIG_OK == rc ) { rc = readByte( rig, WORKING, BITS + 2, &v ); if ( RIG_OK == rc ) { if ( (v & 0x02) ) { if ( (v & 0x01) ) /* low bit set if Squelch is NOT active/open */ { *dcd = RIG_DCD_OFF; } else { *dcd = RIG_DCD_ON; } } else { *dcd = RIG_DCD_ON; } } rc = lockRx( rig, LOCK_0 ); } return ( rc ); } static int ar7030p_set_ts( RIG * rig, vfo_t vfo, shortfreq_t ts ) { int rc = RIG_OK; unsigned short v; assert( NULL != rig ); rc = lockRx( rig, LOCK_1 ); if ( RIG_OK == rc ) { /* Scale parameter */ v = (unsigned short) ((double) (ts + 1) / HZ_PER_STEP); rc = writeShort( rig, WORKING, CHNSTP, v ); /* chnstp */ if ( RIG_OK == rc ) { rc = execRoutine( rig, SET_ALL ); rig_debug( RIG_DEBUG_VERBOSE, "%s: chnstp %d (%d)\n", __func__, ts, v ); } rc = lockRx( rig, LOCK_0 ); } return ( rc ); } /* * /brief Get receiver tuning step size * * /param rig Pointer to rig struct * /param vfo VFO to operate on * /param ts Pointer to tuning step value * * /return RIG_OK on success */ static int ar7030p_get_ts( RIG * rig, vfo_t vfo, shortfreq_t * ts ) { int rc = RIG_OK; unsigned short v; double x; assert( NULL != rig ); assert( NULL != ts ); rc = lockRx( rig, LOCK_1 ); if ( RIG_OK == rc ) { rc = readShort( rig, WORKING, CHNSTP, &v ); /* chnstp */ if ( RIG_OK == rc ) { x = (double) v; *ts = (shortfreq_t) (x * HZ_PER_STEP); rig_debug( RIG_DEBUG_VERBOSE, "%s: step= %d\n", __func__, *ts ); } rc = lockRx( rig, LOCK_0 ); } return ( rc ); } /* * /brief Set receiver power status * * /param rig Pointer to rig struct * /param status Power status to set * * /return RIG_OK on success */ static int ar7030p_set_powerstat( RIG * rig, powerstat_t status ) { int rc = -RIG_ENIMPL; assert( NULL != rig ); rc = lockRx( rig, LOCK_1 ); if ( RIG_OK == rc ) { switch ( status ) { case RIG_POWER_OFF: break; case RIG_POWER_ON: break; default: break; } rc = lockRx( rig, LOCK_0 ); } return( -RIG_ENIMPL ); } /* * /brief Get receiver power status * * /param rig Pointer to rig struct * /param status Pointer to power status value * * /return RIG_OK on success */ static int ar7030p_get_powerstat( RIG * rig, powerstat_t * status ) { int rc = RIG_OK; unsigned char v; assert( NULL != rig ); rc = lockRx( rig, LOCK_1 ); if ( RIG_OK == rc ) { rc = readByte( rig, WORKING, PDFLGS, &v ); if ( RIG_OK == rc ) { if ( 0 == ( v & 0x01 ) ) { *status = RIG_POWER_OFF; } else { *status = RIG_POWER_ON; } } rc = lockRx( rig, LOCK_0 ); } return( rc ); } /* * /brief Reset receiver * * /param rig Pointer to rig struct * /param reset Reset operation to perform * * /return RIG_OK on success */ static int ar7030p_reset( RIG * rig, reset_t reset ) { int rc = RIG_OK; assert( NULL != rig ); switch ( reset ) { case RIG_RESET_SOFT: rc = execRoutine( rig, RESET ); break; default: rc = -RIG_EINVAL; } return( rc ); } static int ar7030p_set_func( RIG * rig, vfo_t vfo, setting_t func, int status ) { assert( NULL != rig ); return ( -RIG_ENIMPL ); } static int ar7030p_get_func( RIG * rig, vfo_t vfo, setting_t func, int *status ) { assert( NULL != rig ); assert( NULL != status ); return ( -RIG_ENIMPL ); } static int ar7030p_decode_event( RIG * rig ) { assert( NULL != rig ); return ( -RIG_ENIMPL ); } static int ar7030p_set_channel( RIG * rig, const channel_t * chan ) { assert( NULL != rig ); assert( NULL != chan ); return ( -RIG_ENIMPL ); } static int ar7030p_get_channel( RIG * rig, channel_t * chan ) { int rc = RIG_OK; unsigned char v; unsigned int f; unsigned char *p = NULL; int ch; int i; struct ar7030p_priv_data *priv = (struct ar7030p_priv_data *)rig->state.priv; channel_t *curr = priv->curr; assert( NULL != chan ); ch = curr->channel_num; rc = lockRx( rig, LOCK_1 ); if ( RIG_OK == rc ) { /* Squelch values */ /* TODO - fix magic numbers */ if ( 100 > ch ) { rc = readByte( rig, BBRAM, (MEM_SQ + ch), &v ); /* mem_sq */ } else if ( 176 > ch ) { rc = readByte( rig, EEPROM2, (MEX_SQ + (ch * 16) ), &v ); /* mex_sq */ } else { rc = readByte( rig, EEPROM3, (MEY_SQ + ((ch - 176) * 16) ), &v ); /* mey_sq */ } if ( RIG_OK == rc ) { chan->levels[ LVL_SQL ].f = (float) v / 255.0; } /* Frequency, mode and filter values */ if ( 100 > ch ) { rc = read3Bytes( rig, EEPROM1, (MEM_FR + (ch * 4) ), &f ); /* mem_fr */ rc = readByte( rig, EEPROM1, (MEM_MD + (ch * 4) ), &v ); /* mem_md */ } else { rc = read3Bytes( rig, EEPROM2, (MEX_FR + ((ch - 100) * 4) ), &f ); /* mex_fr */ rc = readByte( rig, EEPROM2, (MEX_MD + ((ch - 100) * 4) ), &v ); /* mex_md */ } if ( RIG_OK == rc ) { chan->freq = ddsToHz( f ); chan->mode = modeToHamlib( ( v & 0x07 ) ); chan->width = getFilterBW( rig, ( ( v & 0x70 ) >> 4 ) ); if ( ( v & 0x80 ) >> 7 ) { chan->flags = RIG_CHFLAG_SKIP; } else { chan->flags = RIG_CHFLAG_NONE; } } /* PBT values */ if ( 100 > ch ) { rc = readByte( rig, EEPROM1, (MEM_PB + ch), &v ); /* mem_pb */ } else if ( 176 > ch ) { rc = readByte( rig, EEPROM2, (MEX_PB + (ch * 16)), &v ); /* mex_pb */ } else { rc = readByte( rig, EEPROM3, (MEY_PB + ((ch - 176) * 16)), &v ); /* mey_pb */ } if ( RIG_OK == rc ) { chan->levels[ LVL_PBT_IN ].f = pbsToHz( v ); } /* Memory ID values */ p = (unsigned char *) chan->channel_desc; for ( i = 0; i < 14; i++ ) { if ( 176 > ch ) { rc = readByte( rig, EEPROM2, (MEX_ID + (ch * 16) + i), p++ ); /* mex_id */ } else { rc = readByte( rig, EEPROM3, (MEY_ID + ((ch - 176) * 16) + i), p++ ); /* mey_id */ } if ( RIG_OK != rc ) { p = (unsigned char *) chan->channel_desc; break; } } *p++ = '\0'; rc = lockRx( rig, LOCK_0 ); } return ( rc ); } const struct rig_caps ar7030p_caps = { .rig_model = RIG_MODEL_AR7030P, .model_name = "AR7030 Plus", .mfg_name = "AOR", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_RECEIVER, .dcd_type = RIG_DCD_RIG, .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 = 12, .timeout = 650, .retry = 0, .has_get_func = AR7030P_FUNC, .has_set_func = AR7030P_FUNC, .has_get_level = AR7030P_LEVEL, .has_set_level = RIG_LEVEL_SET( AR7030P_LEVEL ), .has_get_parm = AR7030P_PARM, .has_set_parm = RIG_PARM_SET( AR7030P_PARM ), .level_gran = { [LVL_PREAMP] = {.min = {.i = 0}, .max = {.i = 10} }, [LVL_ATT] = {.min = {.i = 0}, .max = {.i = 20} }, [LVL_RF] = {.min = {.f = 0.0}, .max = {.f = 1.0} }, [LVL_AF] = {.min = {.f = 0.0}, .max = {.f = 1.0} }, [LVL_SQL] = {.min = {.f = 0.0}, .max = {.f = 1.0} }, [LVL_IF] = {.min = {.i = 255}, .max = {.i = 0} }, [LVL_PBT_IN] = {.min = {.f = -4248.0}, .max = {.f = 4248.0} }, [LVL_CWPITCH] = {.min = {.i = -4248}, .max = {.i = 4248} }, [LVL_NOTCHF] = {.min = {.i = 0}, .max = {.i = 10000} }, [LVL_AGC] = {.min = {.i = 0}, .max = {.i = 10} }, [LVL_BALANCE] = {.min = {.f = -1.0}, .max = {.f = 1.0} }, [LVL_RAWSTR] = {.min = {.i = 0}, .max = {.i = 255} }, [LVL_STRENGTH] = {.min = {.i = 0}, .max = {.i = 255} }, }, .extparms = NULL, .extlevels = NULL, .parm_gran = { [PARM_APO] = {.min = {.i = 1}, .max = {.i = 86400} }, [PARM_TIME] = {.min = {.i = 0}, .max = {.i = 86400} }, [PARM_BAT] = {.min = {.f = 0.0}, .max = {.f = 1.0} }, }, .preamp = {10, RIG_DBLST_END,}, .attenuator = {10, 20, RIG_DBLST_END,}, .max_rit = Hz( 0 ), .max_xit = Hz( 0 ), .max_ifshift = Hz( 4248 ), .announces = RIG_ANN_NONE, .vfo_ops = AR7030P_VFO_OPS, .scan_ops = RIG_SCAN_STOP | RIG_SCAN_MEM | RIG_SCAN_VFO, .targetable_vfo = 0, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 14, .chan_list = {{0, 399, RIG_MTYPE_MEM, AR7030P_MEM_CAP}, RIG_CHAN_END,}, .rx_range_list1 = { {kHz( 10 ), kHz( 32010 ), AR7030P_MODES, -1, -1, AR7030P_VFO}, RIG_FRNG_END, }, .tx_range_list1 = {RIG_FRNG_END,}, .rx_range_list2 = { {kHz( 10 ), kHz( 32010 ), AR7030P_MODES, -1, -1, AR7030P_VFO}, RIG_FRNG_END, }, .tx_range_list2 = {RIG_FRNG_END,}, .tuning_steps = { {AR7030P_MODES, Hz( 10 )}, {AR7030P_MODES, Hz( 20 )}, {AR7030P_MODES, Hz( 50 )}, {AR7030P_MODES, Hz( 100 )}, {AR7030P_MODES, Hz( 200 )}, {AR7030P_MODES, Hz( 500 )}, {AR7030P_MODES, kHz( 1 )}, {AR7030P_MODES, kHz( 2 )}, {AR7030P_MODES, kHz( 5 )}, {AR7030P_MODES, kHz( 6.25 )}, {AR7030P_MODES, kHz( 9 )}, {AR7030P_MODES, kHz( 10 )}, {AR7030P_MODES, Hz( 12500 )}, {AR7030P_MODES, kHz( 20 )}, {AR7030P_MODES, kHz( 25 )}, RIG_TS_END, }, .filters = { {RIG_MODE_FM, kHz( 9.5 )}, {RIG_MODE_FM, kHz( 0 )}, {RIG_MODE_FM, kHz( 0 )}, {RIG_MODE_AMS, kHz( 6.5 )}, {RIG_MODE_AMS, kHz( 5.3 )}, {RIG_MODE_AMS, kHz( 9.5 )}, {RIG_MODE_AM, kHz( 5.3 )}, {RIG_MODE_AM, kHz( 3.7 )}, {RIG_MODE_AM, kHz( 6.5 )}, {RIG_MODE_SSB, kHz( 2.0 )}, {RIG_MODE_SSB, kHz( 1.4 )}, {RIG_MODE_SSB, kHz( 3.7 )}, {RIG_MODE_CW, kHz( 1.4 )}, {RIG_MODE_CW, kHz( 0 )}, {RIG_MODE_CW, kHz( 2.0 )}, {RIG_MODE_RTTY, kHz( 1.4 )}, {RIG_MODE_RTTY, kHz( 0 )}, {RIG_MODE_RTTY, kHz( 2.0 )}, RIG_FLT_END, }, .str_cal = AR7030P_STR_CAL, .cfgparams = NULL, .priv = ( void * ) &ar7030p_priv_caps, .rig_init = ar7030p_init, .rig_cleanup = ar7030p_cleanup, .rig_open = ar7030p_open, .rig_close = ar7030p_close, .set_freq = ar7030p_set_freq, .get_freq = ar7030p_get_freq, .set_mode = ar7030p_set_mode, .get_mode = ar7030p_get_mode, .set_vfo = ar7030p_set_vfo, .get_vfo = ar7030p_get_vfo, .get_dcd = ar7030p_get_dcd, .set_ts = ar7030p_set_ts, .get_ts = ar7030p_get_ts, .set_powerstat = ar7030p_set_powerstat, .get_powerstat = ar7030p_get_powerstat, .reset = ar7030p_reset, .set_level = ar7030p_set_level, .get_level = ar7030p_get_level, .set_func = ar7030p_set_func, .get_func = ar7030p_get_func, .set_parm = ar7030p_set_parm, .get_parm = ar7030p_get_parm, .set_ext_level = RIG_FUNC_NONE, .get_ext_level = RIG_FUNC_NONE, .set_ext_parm = RIG_FUNC_NONE, .get_ext_parm = RIG_FUNC_NONE, .set_conf = RIG_FUNC_NONE, .get_conf = RIG_FUNC_NONE, .set_mem = ar7030p_set_mem, .get_mem = ar7030p_get_mem, .vfo_op = ar7030p_vfo_op, .scan = ar7030p_scan, .decode_event = ar7030p_decode_event, .set_channel = ar7030p_set_channel, .get_channel = ar7030p_get_channel, .get_info = ar7030p_get_info, .set_chan_all_cb = RIG_FUNC_NONE, .get_chan_all_cb = RIG_FUNC_NONE, .set_mem_all_cb = RIG_FUNC_NONE, .get_mem_all_cb = RIG_FUNC_NONE, }; hamlib-1.2.15.3/aor/ar8600.c0000644000175000017500000001314412044564477012003 00000000000000/* * Hamlib AOR backend - AR8600 description * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "aor.h" #define AR8600_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_WFM) #define AR8600_FUNC (RIG_FUNC_TSQL|RIG_FUNC_ABM|RIG_FUNC_AFC) #define AR8600_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR) #define AR8600_PARM (RIG_PARM_APO|RIG_PARM_BACKLIGHT|RIG_PARM_BEEP) #define AR8600_VFO_OPS (RIG_OP_MCL|RIG_OP_UP|RIG_OP_DOWN|RIG_OP_LEFT|RIG_OP_RIGHT) #define AR8600_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO|RIG_SCAN_PROG|RIG_SCAN_SLCT) #define AR8600_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) /* Measurement by Mark, WAØTOP, * using a HP8640B signal generator on an AR8600 Mark 2 (sn. 551454). * The mode was AM. The ATT was off. */ #define AR8600_STR_CAL { 12, \ { \ { 0, -54 }, /* 1st point is extrapolated */ \ { 13, -27 }, /* S-pixels: none */ \ { 29, -17 }, \ { 41, - 7 }, \ { 49, 3 }, /* S-pixels: 21 */ \ { 54, 13 }, \ { 59, 23 }, \ { 62, 33 }, /* S-pixels: 30 */ \ { 64, 43 }, \ { 65, 53 }, \ { 68, 63 }, \ { 69, 73 } /* S-pixels: 36 */ \ } } #define AR8600_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .bank_num = 1, \ .tuning_step = 1, \ .channel_desc = 1, \ .flags = 1, \ .levels = RIG_LEVEL_ATT, \ .funcs = RIG_FUNC_ABM, \ } static const struct aor_priv_caps ar8600_priv_caps = { .format_mode = format8k_mode, .parse_aor_mode = parse8k_aor_mode, .bank_base1 = 'A', .bank_base2 = 'a', }; /* * ar8600 rig capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! * * part of info from http://www.aoruk.com/8600.htm */ const struct rig_caps ar8600_caps = { .rig_model = RIG_MODEL_AR8600, .model_name = "AR8600", .mfg_name = "AOR", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_SCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 19200, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_XONXOFF, .write_delay = 0, .post_write_delay = 0, .timeout = 200, .retry = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = AR8600_FUNC, .has_get_level = AR8600_LEVEL, .has_set_level = RIG_LEVEL_SET(AR8600_LEVEL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, /* FIXME: CTCSS list */ .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { 20, RIG_DBLST_END, }, /* TBC */ .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_RIG, .bank_qty = 20, /* A through J, and a trough j */ .chan_desc_sz = 12, .vfo_ops = AR8600_VFO_OPS, .scan_ops = AR8600_SCAN_OPS, .str_cal = AR8600_STR_CAL, .chan_list = { { 0, 999, RIG_MTYPE_MEM, AR8600_MEM_CAP }, /* flat space */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100),MHz(2040),AR8600_MODES,-1,-1,AR8600_VFO_ALL}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(2040),AR8600_MODES,-1,-1,AR8600_VFO_ALL}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { RIG_FRNG_END, }, /* no tx range, this is a scanner! */ .tuning_steps = { {AR8600_MODES,50}, {AR8600_MODES,100}, {AR8600_MODES,kHz(1)}, {AR8600_MODES,kHz(5)}, {AR8600_MODES,kHz(9)}, {AR8600_MODES,kHz(10)}, {AR8600_MODES,12500}, {AR8600_MODES,kHz(20)}, {AR8600_MODES,kHz(25)}, {AR8600_MODES,kHz(100)}, {AR8600_MODES,MHz(1)}, #if 0 {AR8600_MODES,0}, /* any tuning step */ #endif RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { /* mode/filter list, .remember = order matters! */ {RIG_MODE_AM, kHz(9)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_AM, kHz(3)}, {RIG_MODE_FM|RIG_MODE_AM, kHz(12)}, {RIG_MODE_FM, kHz(9)}, {RIG_MODE_WFM, kHz(230)}, /* 150kHz at -3dB, 380kHz at -20dB */ RIG_FLT_END, }, .priv = (void*)&ar8600_priv_caps, .rig_init = NULL, .rig_cleanup = NULL, .rig_open = NULL, .rig_close = aor_close, .set_freq = aor_set_freq, .get_freq = aor_get_freq, .set_vfo = aor_set_vfo, .get_vfo = aor_get_vfo, .set_mode = aor_set_mode, .get_mode = aor_get_mode, .set_level = aor_set_level, .get_level = aor_get_level, .get_dcd = aor_get_dcd, .set_ts = aor_set_ts, .set_powerstat = aor_set_powerstat, .vfo_op = aor_vfo_op, .scan = aor_scan, .get_info = aor_get_info, .set_mem = aor_set_mem, .get_mem = aor_get_mem, .set_bank = aor_set_bank, .set_channel = aor_set_channel, .get_channel = aor_get_channel, .get_chan_all_cb = aor_get_chan_all_cb, }; /* * Function definitions below */ hamlib-1.2.15.3/aor/ar8000.c0000644000175000017500000001160512044564477011775 00000000000000/* * Hamlib AOR backend - AR8000 description * Copyright (c) 2000-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "aor.h" #define AR8000_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_WFM) #define AR8000_FUNC_ALL (RIG_FUNC_TSQL|RIG_FUNC_ABM|RIG_FUNC_AFC) #define AR8000_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_RAWSTR) #define AR8000_PARM (RIG_PARM_APO|RIG_PARM_BACKLIGHT|RIG_PARM_BEEP) #define AR8000_VFO_OPS (RIG_OP_MCL|RIG_OP_UP|RIG_OP_DOWN|RIG_OP_LEFT|RIG_OP_RIGHT) #define AR8000_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO|RIG_SCAN_PROG|RIG_SCAN_SLCT) #define AR8000_VFO (RIG_VFO_A|RIG_VFO_B) /* TODO: measure and report real values */ #define AR8000_STR_CAL { 2, \ { \ { 0x00, -60 }, \ { 0xff, 60 } \ } } static const struct aor_priv_caps ar8000_priv_caps = { .format_mode = format8k_mode, .parse_aor_mode = parse8k_aor_mode, .bank_base1 = 'A', .bank_base2 = 'a', }; /* * ar8000 rig capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! * * part of info from http://www.aoruk.com/8000.htm */ const struct rig_caps ar8000_caps = { .rig_model = RIG_MODEL_AR8000, .model_name = "AR8000", .mfg_name = "AOR", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_SCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 19200, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_XONXOFF, .write_delay = 0, .post_write_delay = 0, .timeout = 200, .retry = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = AR8000_FUNC_ALL, .has_get_level = AR8000_LEVEL, .has_set_level = RIG_LEVEL_SET(AR8000_LEVEL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, /* FIXME: CTCSS list */ .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { 10, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_RIG, .bank_qty = 20, .chan_desc_sz = 12, .vfo_ops = AR8000_VFO_OPS, .scan_ops = AR8000_SCAN_OPS, .str_cal = AR8000_STR_CAL, .chan_list = { RIG_CHAN_END, }, /* FIXME: memory channel list: 1000 memories */ .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(1900),AR8000_MODES,-1,-1,AR8000_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { RIG_FRNG_END, }, /* no tx range, this is a scanner! */ .tuning_steps = { {AR8000_MODES,50}, {AR8000_MODES,100}, {AR8000_MODES,200}, {AR8000_MODES,500}, {AR8000_MODES,kHz(1)}, {AR8000_MODES,kHz(2)}, {AR8000_MODES,kHz(5)}, {AR8000_MODES,kHz(6.25)}, {AR8000_MODES,kHz(9)}, {AR8000_MODES,kHz(10)}, {AR8000_MODES,12500}, {AR8000_MODES,kHz(20)}, {AR8000_MODES,kHz(25)}, {AR8000_MODES,kHz(30)}, {AR8000_MODES,kHz(50)}, {AR8000_MODES,kHz(100)}, {AR8000_MODES,kHz(200)}, {AR8000_MODES,kHz(250)}, {AR8000_MODES,kHz(500)}, #if 0 {AR8000_MODES,0}, /* any tuning step */ #endif RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { /* mode/filter list, .remember = order matters! */ {RIG_MODE_SSB|RIG_MODE_CW, kHz(2)}, {RIG_MODE_FM|RIG_MODE_AM, kHz(12)}, {RIG_MODE_WFM, kHz(180)}, /* 50kHz at -3dB, 380kHz at -20dB */ RIG_FLT_END, }, .priv = (void*)&ar8000_priv_caps, .rig_init = NULL, .rig_cleanup = NULL, .rig_open = NULL, .rig_close = aor_close, .set_freq = aor_set_freq, .get_freq = aor_get_freq, .set_mode = aor_set_mode, .get_mode = aor_get_mode, .set_vfo = aor_set_vfo, .get_vfo = aor_get_vfo, .set_level = aor_set_level, .get_level = aor_get_level, .get_dcd = aor_get_dcd, .set_ts = aor_set_ts, .set_powerstat = aor_set_powerstat, .vfo_op = aor_vfo_op, .scan = aor_scan, .get_info = aor_get_info, .get_chan_all_cb = aor_get_chan_all_cb, }; /* * Function definitions below */ hamlib-1.2.15.3/aor/Makefile.in0000644000175000017500000005145612044564550012764 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = aor DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_aor_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = ar8200.lo ar8000.lo ar5000.lo ar3000.lo ar7030.lo \ ar3030.lo ar2700.lo ar8600.lo ar7030p.lo ar7030p_utils.lo \ sr2200.lo am_hamlib_aor_la_OBJECTS = $(am__objects_1) aor.lo hamlib_aor_la_OBJECTS = $(am_hamlib_aor_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_aor_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(hamlib_aor_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_aor_la_SOURCES) DIST_SOURCES = $(hamlib_aor_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AORSRCLIST = ar8200.c ar8000.c ar5000.c ar3000.c ar7030.c ar3030.c \ ar2700.c ar8600.c ar7030p.c ar7030p_utils.c sr2200.c pkglib_LTLIBRARIES = hamlib-aor.la hamlib_aor_la_SOURCES = $(AORSRCLIST) aor.c hamlib_aor_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_aor_la_LIBADD = $(top_builddir)/src/libhamlib.la EXTRA_DIST = README.aor README.ar5000 README.ar7030 noinst_HEADERS = aor.h ar7030p.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu aor/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu aor/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-aor.la: $(hamlib_aor_la_OBJECTS) $(hamlib_aor_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_aor_la_LINK) -rpath $(pkglibdir) $(hamlib_aor_la_OBJECTS) $(hamlib_aor_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ar2700.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ar3000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ar3030.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ar5000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ar7030.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ar7030p.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ar7030p_utils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ar8000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ar8200.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ar8600.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sr2200.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/aor/README.ar50000000644000175000017500000000142212044564477012501 00000000000000hamlib-1.2.5 aor.c ar5000.c 2006-10-29 The previous AR5000 could: - get and set frequency. - read mode if radio were not set to SAH, SAL or SAM. - not set mode. Radio did not accept two commands to be sent at once. - not return VFO-name if rig were set to VFO D or VFO E. - not set VFO D or VFO E. - vfo_op Up and Down works, but radio returns a "?", resulting in "Protocol error". - get_info does not work. - not read AGC-level. Now, it: - can get and set frequency. - can read and set (all) modes. - still does not support VFO D & E. I probably have not understood how VFO_N(3) and VFO_N(4) are ment to be used :-( - can read AGC-level. - corrected channel description size from 12 to 8. - filter-list mode/bw rearranged. - list of tuning steps corrected. Göran Sandin, SM6PPS hamlib-1.2.15.3/aor/ar5000.c0000644000175000017500000003112212044564477011766 00000000000000/* * Hamlib AOR backend - AR5000 description * * Copyright (c) 2000-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "aor.h" #define AR5000_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM| \ RIG_MODE_WFM|RIG_MODE_SAM|RIG_MODE_SAL|RIG_MODE_SAH) #define AR5000_FUNC_ALL (RIG_FUNC_TSQL | RIG_FUNC_ABM) #define AR5000_LEVEL (RIG_LEVEL_ATT | RIG_LEVEL_AGC | RIG_LEVEL_RAWSTR) #define AR5000_PARM (RIG_PARM_NONE) #define AR5000_VFO_OPS (RIG_OP_MCL | RIG_OP_UP | RIG_OP_DOWN) #define AR5000_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO|RIG_SCAN_PROG|RIG_SCAN_SLCT) #define AR5000_VFO (RIG_VFO_A | RIG_VFO_B | RIG_VFO_C | RIG_VFO_N(3) | RIG_VFO_N(4)) /* As reported with rigctl 'l RAWSTR' for AR5000A S/n: 171218 on 7040kHz / CW / 3kHz Bw. The data available on http://www.aoruk.com did not match very well on HF */ #define AR5000_STR_CAL { 16, { \ { 0, -60 }, \ { 3, -48 }, \ { 14, -42 }, \ { 26, -36 }, \ { 34, -30 }, \ { 42, -24 }, \ { 52, -18 }, \ { 62, -12 }, \ { 74, -6 }, \ { 87, 0 }, \ { 101, 10 }, \ { 117, 20 }, \ { 135, 30 }, \ { 152, 40 }, \ { 202, 50 }, \ { 255, 60 }, \ } } #define AR5000_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .bank_num = 1, \ .tuning_step = 1, \ .channel_desc = 1, \ .flags = 1, \ .levels = RIG_LEVEL_ATT | RIG_LEVEL_AGC, \ .funcs = RIG_FUNC_ABM, \ } static int format5k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width); static int parse5k_aor_mode(RIG *rig, char aormode, char aorwidth, rmode_t *mode, pbwidth_t *width); static const struct aor_priv_caps ar5k_priv_caps = { .format_mode = format5k_mode, .parse_aor_mode = parse5k_aor_mode, .bank_base1 = '0', .bank_base2 = '0', }; /* * ar5000 rig capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! * * part of info from http://www.aoruk.com/5000.htm * * TODO: retrieve BW info, and rest of commands */ const struct rig_caps ar5000_caps = { .rig_model = RIG_MODEL_AR5000, .model_name = "AR5000", .mfg_name = "AOR", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_SCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 19200, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_XONXOFF, .write_delay = 0, .post_write_delay = 0, .timeout = 200, .retry = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = AR5000_FUNC_ALL, .has_get_level = AR5000_LEVEL, .has_set_level = RIG_LEVEL_SET(AR5000_LEVEL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, /* FIXME: CTCSS list */ .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { 10, 20, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_RIG, .bank_qty = 10, .chan_desc_sz = 8, .vfo_ops = AR5000_VFO_OPS, .scan_ops = AR5000_SCAN_OPS, .str_cal = AR5000_STR_CAL, .chan_list = { { 0, 999, RIG_MTYPE_MEM, AR5000_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(10),MHz(2600),AR5000_MODES,-1,-1,AR5000_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(10),MHz(2600),AR5000_MODES,-1,-1,AR5000_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { RIG_FRNG_END, }, /* no tx range, this is a scanner! */ .tuning_steps = { {AR5000_MODES,1}, {AR5000_MODES,10}, {AR5000_MODES,50}, {AR5000_MODES,100}, {AR5000_MODES,500}, {AR5000_MODES,kHz(1)}, {AR5000_MODES,kHz(5)}, {AR5000_MODES,kHz(6.25)}, {AR5000_MODES,kHz(9)}, {AR5000_MODES,kHz(10)}, {AR5000_MODES,kHz(12.5)}, {AR5000_MODES,kHz(20)}, {AR5000_MODES,kHz(25)}, {AR5000_MODES,kHz(30)}, {AR5000_MODES,kHz(50)}, {AR5000_MODES,kHz(100)}, {AR5000_MODES,kHz(500)}, #if 0 {AR5000_MODES,0}, /* any tuning step */ #endif RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_SAL|RIG_MODE_SAH|RIG_MODE_CW, kHz(3)}, {RIG_MODE_CW, Hz(500)}, /* narrow */ {RIG_MODE_AM|RIG_MODE_SAM, kHz(6)}, {RIG_MODE_AM|RIG_MODE_SAM, kHz(3)}, /* narrow */ {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SAM, kHz(15)}, {RIG_MODE_FM, kHz(6)}, /* narrow */ {RIG_MODE_FM, kHz(30)}, /* wide */ {RIG_MODE_WFM, kHz(110)}, {RIG_MODE_WFM, kHz(30)}, /* narrow */ {RIG_MODE_WFM, kHz(220)}, /* wide */ RIG_FLT_END, }, .priv = (void*)&ar5k_priv_caps, .rig_init = NULL, .rig_cleanup = NULL, .rig_open = NULL, .rig_close = aor_close, .set_freq = aor_set_freq, .get_freq = aor_get_freq, .set_mode = aor_set_mode, .get_mode = aor_get_mode, .set_vfo = aor_set_vfo, .get_vfo = aor_get_vfo, .set_level = aor_set_level, .get_level = aor_get_level, .get_dcd = aor_get_dcd, .set_ts = aor_set_ts, .set_powerstat = aor_set_powerstat, .vfo_op = aor_vfo_op, .scan = aor_scan, .get_info = aor_get_info, .set_mem = aor_set_mem, .get_mem = aor_get_mem, .set_bank = aor_set_bank, .set_channel = aor_set_channel, .get_channel = aor_get_channel, .get_chan_all_cb = aor_get_chan_all_cb, }; /* * ar5000a rig capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! * * part of info from http://www.aoruk.com/5000.htm * * TODO: retrieve BW info, and rest of commands */ const struct rig_caps ar5000a_caps = { .rig_model = RIG_MODEL_AR5000A, .model_name = "AR5000A", .mfg_name = "AOR", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_SCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 19200, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_XONXOFF, .write_delay = 0, .post_write_delay = 0, .timeout = 200, .retry = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = AR5000_FUNC_ALL, .has_get_level = AR5000_LEVEL, .has_set_level = RIG_LEVEL_SET(AR5000_LEVEL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, /* FIXME: CTCSS list */ .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { 10, 20, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_RIG, .bank_qty = 10, .chan_desc_sz = 8, .vfo_ops = AR5000_VFO_OPS, .scan_ops = AR5000_SCAN_OPS, .str_cal = AR5000_STR_CAL, .chan_list = { { 0, 999, RIG_MTYPE_MEM, AR5000_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(10),MHz(3000),AR5000_MODES,-1,-1,AR5000_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(10),MHz(3000),AR5000_MODES,-1,-1,AR5000_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { RIG_FRNG_END, }, /* no tx range, this is a scanner! */ .tuning_steps = { {AR5000_MODES,1}, {AR5000_MODES,10}, {AR5000_MODES,50}, {AR5000_MODES,100}, {AR5000_MODES,500}, {AR5000_MODES,kHz(1)}, {AR5000_MODES,kHz(5)}, {AR5000_MODES,kHz(6.25)}, {AR5000_MODES,kHz(9)}, {AR5000_MODES,kHz(10)}, {AR5000_MODES,kHz(12.5)}, {AR5000_MODES,kHz(20)}, {AR5000_MODES,kHz(25)}, {AR5000_MODES,kHz(30)}, {AR5000_MODES,kHz(50)}, {AR5000_MODES,kHz(100)}, {AR5000_MODES,kHz(500)}, #if 0 {AR5000_MODES,0}, /* any tuning step */ #endif RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_SAL|RIG_MODE_SAH|RIG_MODE_CW, kHz(3)}, {RIG_MODE_CW, Hz(500)}, /* narrow */ {RIG_MODE_AM|RIG_MODE_SAM, kHz(6)}, {RIG_MODE_AM|RIG_MODE_SAM, kHz(3)}, /* narrow */ {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SAM, kHz(15)}, {RIG_MODE_FM, kHz(6)}, /* narrow */ {RIG_MODE_FM, kHz(30)}, /* wide */ {RIG_MODE_WFM, kHz(110)}, {RIG_MODE_WFM, kHz(30)}, /* narrow */ {RIG_MODE_WFM, kHz(220)}, /* wide */ RIG_FLT_END, }, .priv = (void*)&ar5k_priv_caps, .rig_init = NULL, .rig_cleanup = NULL, .rig_open = NULL, .rig_close = aor_close, .set_freq = aor_set_freq, .get_freq = aor_get_freq, .set_mode = aor_set_mode, .get_mode = aor_get_mode, .set_vfo = aor_set_vfo, .get_vfo = aor_get_vfo, .set_level = aor_set_level, .get_level = aor_get_level, .get_dcd = aor_get_dcd, .set_ts = aor_set_ts, .set_powerstat = aor_set_powerstat, .vfo_op = aor_vfo_op, .scan = aor_scan, .get_info = aor_get_info, .set_mem = aor_set_mem, .get_mem = aor_get_mem, .set_bank = aor_set_bank, .set_channel = aor_set_channel, .get_channel = aor_get_channel, .get_chan_all_cb = aor_get_chan_all_cb, }; /* * Function definitions below */ /* * modes in use by the "MD" command of AR5000 */ #define AR5K_FM '0' #define AR5K_AM '1' #define AR5K_LSB '2' #define AR5K_USB '3' #define AR5K_CW '4' #define AR5K_SAM '5' #define AR5K_SAL '6' #define AR5K_SAH '7' int format5k_mode(RIG *rig, char *buf, rmode_t mode, pbwidth_t width) { int aormode, aorwidth; switch (mode) { case RIG_MODE_AM: aormode = AR5K_AM; break; case RIG_MODE_WFM: case RIG_MODE_FM: aormode = AR5K_FM; break; case RIG_MODE_LSB: aormode = AR5K_LSB; break; case RIG_MODE_USB: aormode = AR5K_USB; break; case RIG_MODE_CW: aormode = AR5K_CW; break; case RIG_MODE_SAM: aormode = AR5K_SAM; break; case RIG_MODE_SAL: aormode = AR5K_SAL; break; case RIG_MODE_SAH: aormode = AR5K_SAH; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n", __FUNCTION__, mode); return -RIG_EINVAL; } if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); switch (width) { case 500: aorwidth = '0'; break; case s_kHz(3): aorwidth = '1'; break; case s_kHz(6): aorwidth = '2'; break; case s_kHz(15): aorwidth = '3'; break; case s_kHz(30): aorwidth = '4'; break; case s_kHz(110): aorwidth = '5'; break; case s_kHz(220): aorwidth = '6'; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported width %d\n", __FUNCTION__, width); return -RIG_EINVAL; } return sprintf(buf, "MD%c BW%c", aormode, aorwidth); } int parse5k_aor_mode(RIG *rig, char aormode, char aorwidth, rmode_t *mode, pbwidth_t *width) { switch (aormode) { case AR5K_FM: *mode = RIG_MODE_FM; break; case AR5K_AM: *mode = RIG_MODE_AM; break; case AR5K_LSB: *mode = RIG_MODE_LSB; break; case AR5K_USB: *mode = RIG_MODE_USB; break; case AR5K_CW: *mode = RIG_MODE_CW; break; case AR5K_SAM: *mode = RIG_MODE_SAM; break; case AR5K_SAL: *mode = RIG_MODE_SAL; break; case AR5K_SAH: *mode = RIG_MODE_SAH; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode '%c'\n", __FUNCTION__, aormode); return -RIG_EPROTO; } switch (aorwidth) { case '0': *width = 500; break; case '1': *width = s_kHz(3); break; case '2': *width = s_kHz(6); break; case '3': *width = s_kHz(15); break; case '4': *width = s_kHz(30); break; case '5': *width = s_kHz(110); break; case '6': *width = s_kHz(220); break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported width %d\n", __FUNCTION__, aorwidth); return -RIG_EPROTO; } return RIG_OK; } hamlib-1.2.15.3/aor/sr2200.c0000644000175000017500000004060012044564477012010 00000000000000/* * Hamlib AOR backend - SR2200 description * * Copyright (c) 2000-2011 by Stephane Fillod * * Author: Stefano Speretta, Innovative Solutions In Space BV * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "serial.h" #include "idx_builtin.h" #include "misc.h" #include "aor.h" #define SR2200_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define SR2200_FUNC_ALL () #define SR2200_LEVEL_GET (RIG_LEVEL_ATT | RIG_LEVEL_AGC | RIG_LEVEL_STRENGTH | RIG_LEVEL_AF | RIG_LEVEL_PREAMP ) #define SR2200_LEVEL_SET (RIG_LEVEL_ATT | RIG_LEVEL_AGC | RIG_LEVEL_AF | RIG_LEVEL_PREAMP) #define SR2200_PARM (RIG_PARM_NONE) #define SR2200_VFO_OPS (RIG_OP_MCL | RIG_OP_UP | RIG_OP_DOWN) #define SR2200_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO|RIG_SCAN_PROG|RIG_SCAN_SLCT) #define SR2200_VFO (RIG_VFO_A | RIG_VFO_B | RIG_VFO_C | RIG_VFO_N(3) | RIG_VFO_N(4) \ | RIG_VFO_N(5) | RIG_VFO_N(6) | RIG_VFO_N(7) | RIG_VFO_N(8) \ | RIG_VFO_N(9)) #define SR2200_PREAMP 10 /* The data available on http://www.aoruk.com did not match very well on HF */ #define SR2200_STR_CAL { 16, { \ { 0, -60 }, \ { 3, -48 }, \ { 14, -42 }, \ { 26, -36 }, \ { 34, -30 }, \ { 42, -24 }, \ { 52, -18 }, \ { 62, -12 }, \ { 74, -6 }, \ { 87, 0 }, \ { 101, 10 }, \ { 117, 20 }, \ { 135, 30 }, \ { 152, 40 }, \ { 202, 50 }, \ { 255, 60 }, \ } } #define SR2200_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .bank_num = 1, \ .tuning_step = 1, \ .channel_desc = 1, \ .flags = 1, \ .levels = RIG_LEVEL_ATT | RIG_LEVEL_AGC, \ .funcs = RIG_FUNC_ABM, \ } #define CR '\r' #define LF '\n' #define EOM "\r" #define BUFSZ 256 static int sr2200_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int parse_s2200_aor_mode(RIG *rig, char aormode, char aorwidth, rmode_t *mode, pbwidth_t *width); static int sr2200_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len); static int sr2200_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int sr2200_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int sr2200_get_vfo(RIG *rig, vfo_t *vfo); static int sr2200_set_vfo(RIG *rig, vfo_t vfo); static int sr2200_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int sr2200_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static const struct aor_priv_caps sr2200_priv_caps = { .bank_base1 = '0', .bank_base2 = '0', }; // Derived from AOR AR8200 backend /* * sr2200 rig capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! * * part of info from http://www.aoruk.com/ * * TODO: retrieve BW info, and rest of commands */ const struct rig_caps sr2200_caps = { .rig_model = RIG_MODEL_SR2200, .model_name = "SR2200", .mfg_name = "AOR", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_SCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 19200, .serial_rate_max = 38400, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_XONXOFF, .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 = SR2200_LEVEL_GET, .has_set_level = SR2200_LEVEL_SET, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, /* FIXME: CTCSS list */ .dcs_list = NULL, .preamp = { SR2200_PREAMP, RIG_DBLST_END, }, .attenuator = { 10, 20, RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_RIG, .bank_qty = 10, .chan_desc_sz = 8, .vfo_ops = SR2200_VFO_OPS, .scan_ops = SR2200_SCAN_OPS, .str_cal = SR2200_STR_CAL, .chan_list = { { 0, 999, RIG_MTYPE_MEM, SR2200_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {MHz(25),MHz(3000),SR2200_MODES,-1,-1,SR2200_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {MHz(25),MHz(3000),SR2200_MODES,-1,-1,SR2200_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, /* no tx range, this is a scanner! */ .tuning_steps = { {SR2200_MODES,1}, {SR2200_MODES,100}, {SR2200_MODES,500}, {SR2200_MODES,kHz(1)}, {SR2200_MODES,kHz(2)}, {SR2200_MODES,kHz(5)}, {SR2200_MODES,kHz(6.25)}, {SR2200_MODES,kHz(9)}, {SR2200_MODES,kHz(10)}, {SR2200_MODES,kHz(12.5)}, {SR2200_MODES,kHz(20)}, {SR2200_MODES,kHz(25)}, {SR2200_MODES,kHz(30)}, {SR2200_MODES,kHz(50)}, {SR2200_MODES,kHz(100)}, #if 0 {SR2200_MODES,0}, /* any tuning step */ #endif RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_AM, kHz(6)}, {RIG_MODE_AM, kHz(15)}, {RIG_MODE_FM, kHz(15)}, /* narrow */ {RIG_MODE_FM, kHz(6)}, {RIG_MODE_WFM, kHz(300)}, /* wide */ RIG_FLT_END, }, .priv = (void*)&sr2200_priv_caps, .rig_init = NULL, .rig_cleanup = NULL, .rig_open = NULL, .rig_close = NULL, .set_freq = sr2200_set_freq, .get_freq = aor_get_freq, .set_mode = sr2200_set_mode, .get_mode = sr2200_get_mode, .set_vfo = sr2200_set_vfo, .get_vfo = sr2200_get_vfo, .set_level = sr2200_set_level, .get_level = sr2200_get_level, .get_dcd = aor_get_dcd, .set_ts = aor_set_ts, .set_powerstat = aor_set_powerstat, .vfo_op = aor_vfo_op, .scan = aor_scan, .get_info = aor_get_info, .set_mem = aor_set_mem, .get_mem = aor_get_mem, .set_bank = aor_set_bank, .set_channel = aor_set_channel, .get_channel = aor_get_channel, .get_chan_all_cb = aor_get_chan_all_cb, }; /* * Function definitions below */ /* * modes in use by the "MD" command of SR2200 */ #define SR2200_FM '0' #define SR2200_WFM '1' #define SR2200_AM '2' #define SR2200_SFM '3' #define SR2200_WAM '4' /* * sr2200_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! * return value: RIG_OK if everything's fine, negative value otherwise * TODO: error case handling */ static int sr2200_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval; struct rig_state *rs; char ackbuf[BUFSZ]; int ack_len; rs = &rig->state; serial_flush(&rs->rigport); retval = write_block(&rs->rigport, cmd, cmd_len); if (retval != RIG_OK) return retval; if (!data) data = ackbuf; if (!data_len) data_len = &ack_len; /* * Do wait for a reply */ retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM)); if (retval < 0) return retval; *data_len = retval; if (*data_len < BUFSZ) data[*data_len] = '\0'; else data[BUFSZ-1] = '\0'; if (data[0] == '?') { /* command failed? resync with radio */ write_block(&rs->rigport, EOM, 1); return -RIG_EPROTO; } return RIG_OK; } /* * sr2200_set_freq * Assumes rig!=NULL */ int sr2200_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char freqbuf[BUFSZ],ackbuf[BUFSZ],*rfp; int freq_len, ret_freq_len; ret_freq_len = BUFSZ; if (freq < sr2200_caps.rx_range_list1[0].start) { rig_debug(RIG_DEBUG_WARN, "Error in %s: frequency is lower than minimum supported value (%.0f Hz)\n", __FUNCTION__, sr2200_caps.rx_range_list1[0].start); return -RIG_EPROTO; } if (freq > sr2200_caps.rx_range_list1[0].end) { rig_debug(RIG_DEBUG_WARN, "Error in %s: frequency is higher than maximum supported value (%.0f Hz)\n", __FUNCTION__, sr2200_caps.rx_range_list1[0].end); return -RIG_EPROTO; } freq_len = sprintf(freqbuf,"RF%010.0f"EOM, freq); strcpy(freqbuf+freq_len, EOM); freq_len += strlen(EOM); int retval = sr2200_transaction (rig, freqbuf, freq_len, ackbuf, &ret_freq_len); if (retval != RIG_OK) return retval; rfp = strstr(ackbuf, "RF"); if (!rfp) { rig_debug(RIG_DEBUG_WARN, "NO RF in returned string in %s: '%s'\n", __FUNCTION__, freqbuf); return -RIG_EPROTO; } sscanf(rfp+2,"%"SCNfreq, &freq); return RIG_OK; } /* * sr2200_set_mode * Assumes rig!=NULL */ int sr2200_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { char mdbuf[BUFSZ]; int mdbuf_len, aormode, retval; pbwidth_t normal_width; normal_width = rig_passband_normal(rig, mode); if (width == 0) width = normal_width; switch (mode) { case RIG_MODE_AM: aormode = width > normal_width ? SR2200_WAM : SR2200_AM; break; case RIG_MODE_FM: aormode = width < normal_width ? SR2200_SFM : SR2200_FM; break; case RIG_MODE_WFM: aormode = SR2200_WFM; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n", __FUNCTION__,mode); return -RIG_EINVAL; } mdbuf_len = sprintf(mdbuf, "MD%c" EOM, aormode); retval = sr2200_transaction (rig, mdbuf, mdbuf_len, NULL, NULL); return retval; } /* * sr2200_get_mode * Assumes rig!=NULL, mode!=NULL */ int sr2200_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char ackbuf[BUFSZ], *mdp; int ack_len, retval; retval = sr2200_transaction (rig, "MD" EOM, 3, ackbuf, &ack_len); if (retval != RIG_OK) return retval; mdp = strstr(ackbuf, "MD"); if (!mdp) { rig_debug(RIG_DEBUG_ERR, "%s: no MD in returned string: '%s'\n", __FUNCTION__, ackbuf); return -RIG_EPROTO; } retval = parse_s2200_aor_mode(rig, mdp[2], mdp[2], mode, width); return retval; } int parse_s2200_aor_mode(RIG *rig, char aormode, char aorwidth, rmode_t *mode, pbwidth_t *width) { switch (aormode) { case SR2200_FM: *mode = RIG_MODE_FM; break; case SR2200_AM: *mode = RIG_MODE_AM; break; case SR2200_SFM: *mode = RIG_MODE_FM; break; case SR2200_WAM: *mode = RIG_MODE_AM; break; case SR2200_WFM: *mode = RIG_MODE_WFM; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode '%c'\n", __FUNCTION__, aormode); return -RIG_EPROTO; } switch (aorwidth) { case SR2200_FM: *width = s_kHz(15); break; case SR2200_AM: *width = s_kHz(6); break; case SR2200_SFM: *width = s_kHz(6); break; case SR2200_WAM: *width = s_kHz(15); break; case SR2200_WFM: *width = s_kHz(300); break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported width %d\n", __FUNCTION__, aorwidth); return -RIG_EPROTO; } return RIG_OK; } /* * sr2200_set_vfo * Assumes rig!=NULL */ int sr2200_set_vfo(RIG *rig, vfo_t vfo) { char *vfocmd; switch (vfo) { case RIG_VFO_A: vfocmd = "VA" EOM; break; case RIG_VFO_B: vfocmd = "VB" EOM; break; case RIG_VFO_C: vfocmd = "VC" EOM; break; case RIG_VFO_N(3): vfocmd = "VD" EOM; break; case RIG_VFO_N(4): vfocmd = "VE" EOM; break; case RIG_VFO_N(5): vfocmd = "VF" EOM; break; case RIG_VFO_N(6): vfocmd = "VG" EOM; break; case RIG_VFO_N(7): vfocmd = "VH" EOM; break; case RIG_VFO_N(8): vfocmd = "VI" EOM; break; case RIG_VFO_N(9): vfocmd = "VJ" EOM; break; default: rig_debug(RIG_DEBUG_ERR,"aor_set_vfo: unsupported vfo %d\n", vfo); return -RIG_EINVAL; } return sr2200_transaction (rig, vfocmd, strlen(vfocmd), NULL, NULL); } /* * sr2200_get_vfo * Assumes rig!=NULL, freq!=NULL */ int sr2200_get_vfo(RIG *rig, vfo_t *vfo) { int vfo_len, retval; char vfobuf[BUFSZ]; retval = sr2200_transaction (rig, "RX" EOM, 3, vfobuf, &vfo_len); if (retval != RIG_OK) return retval; switch (vfobuf[1]) { case 'A': *vfo = RIG_VFO_A; break; case 'B': *vfo = RIG_VFO_B; break; case 'C': *vfo = RIG_VFO_C; break; case 'D': *vfo = RIG_VFO_N(3); break; case 'E': *vfo = RIG_VFO_N(4); break; case 'F': *vfo = RIG_VFO_N(5); break; case 'G': *vfo = RIG_VFO_N(6); break; case 'H': *vfo = RIG_VFO_N(7); break; case 'I': *vfo = RIG_VFO_N(8); break; case 'J': *vfo = RIG_VFO_N(9); break; default: rig_debug(RIG_DEBUG_ERR,"aor_get_vfo: unknown vfo %c\n", vfobuf[1]); return -RIG_EINVAL; } return RIG_OK; } /* * sr2200_set_level * Assumes rig!=NULL, rig->state.priv!=NULL */ int sr2200_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct rig_state *rs; char lvlbuf[BUFSZ]; int lvl_len; unsigned i; int agc; unsigned att = 0; rs = &rig->state; switch (level) { case RIG_LEVEL_AF: if (val.f > 255.0F) lvl_len = sprintf(lvlbuf, "AG255" EOM); else lvl_len = sprintf(lvlbuf, "AG%03d" EOM,(int)val.f); break; case RIG_LEVEL_PREAMP: if (val.f > 0) lvl_len = sprintf(lvlbuf, "AM1" EOM); else lvl_len = sprintf(lvlbuf, "AM0" EOM); break; case RIG_LEVEL_ATT: for (i=0; iattenuator[i]); i++) { if (rs->attenuator[i] == val.i) { att = i+1; break; } } /* should be caught by the front end */ if ((val.i != 0) & (i>=MAXDBLSTSIZ || RIG_IS_DBLST_END(rs->attenuator[i])) ) return -RIG_EINVAL; lvl_len = sprintf(lvlbuf, "AT%u" EOM, att); break; case RIG_LEVEL_AGC: switch(val.i) { case RIG_AGC_FAST: agc = '1'; break; case RIG_AGC_MEDIUM: agc = '3'; break; case RIG_AGC_SLOW: agc = '2'; break; case RIG_AGC_OFF: default: agc = '0'; } lvl_len = sprintf(lvlbuf,"AC%c" EOM, agc); break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported aor_set_level %d\n", level); return -RIG_EINVAL; } return sr2200_transaction (rig, lvlbuf, lvl_len, NULL, NULL); } /* * sr2200_get_level * Assumes rig!=NULL, rig->state.priv!=NULL, val!=NULL */ int sr2200_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct rig_state *rs; char lvlbuf[BUFSZ],ackbuf[BUFSZ]; int lvl_len, ack_len, retval; rs = &rig->state; switch (level) { case RIG_LEVEL_STRENGTH: lvl_len = sprintf(lvlbuf, "LB" EOM); break; case RIG_LEVEL_ATT: lvl_len = sprintf(lvlbuf, "AT" EOM); break; case RIG_LEVEL_AGC: lvl_len = sprintf(lvlbuf, "AC" EOM); break; case RIG_LEVEL_AF: lvl_len = sprintf(lvlbuf, "AG" EOM); break; case RIG_LEVEL_PREAMP: lvl_len = sprintf(lvlbuf, "AM" EOM); break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported %s %d\n", __FUNCTION__, level); return -RIG_EINVAL; } retval = sr2200_transaction (rig, lvlbuf, lvl_len, ackbuf, &ack_len); if (retval != RIG_OK) return retval; switch (level) { case RIG_LEVEL_STRENGTH: if (ack_len < 7 || ackbuf[0] != 'L' || ackbuf[1] != 'B') return -RIG_EPROTO; sscanf(ackbuf+3, "%d", &val->i); // calibrate the S-meter -> values should be referred to S9 (-73 dBm) val->i += 73; break; case RIG_LEVEL_ATT: { unsigned att; if (ack_len < 4 || ackbuf[0] != 'A' || ackbuf[1] != 'T') return -RIG_EPROTO; att = ackbuf[2]-'0'; if (att == 0) { val->i = 0; break; } if (att > MAXDBLSTSIZ || rs->attenuator[att-1]==0) { rig_debug(RIG_DEBUG_ERR,"Unsupported att %s %d\n", __FUNCTION__, att); return -RIG_EPROTO; } val->i = rs->attenuator[att-1]; break; } case RIG_LEVEL_AGC: if (ack_len < 3 || ackbuf[0] != 'A' || ackbuf[1] != 'C') return -RIG_EPROTO; switch(ackbuf[2]) { case '1': val->i = RIG_AGC_FAST; break; case '3': val->i = RIG_AGC_MEDIUM; break; case '2': val->i = RIG_AGC_SLOW; break; case '0': default: val->i = RIG_AGC_OFF; } break; case RIG_LEVEL_AF: if (ack_len < 3 || ackbuf[0] != 'A' || ackbuf[1] != 'G') return -RIG_EPROTO; sscanf(ackbuf+2, "%f", &val->f); break; case RIG_LEVEL_PREAMP: if (ack_len < 3 || ackbuf[0] != 'A' || ackbuf[1] != 'M') return -RIG_EPROTO; float tmp; sscanf(ackbuf+2, "%f", &tmp); if (tmp != 0.0) { val->i = SR2200_PREAMP; } else { val->i = 0; } break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported %s %d\n", __FUNCTION__, level); return -RIG_EINVAL; } return RIG_OK; } hamlib-1.2.15.3/aor/ar3000.c0000644000175000017500000002476312044564477012001 00000000000000/* * Hamlib AOR backend - AR3000 description * Copyright (c) 2000-2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "aor.h" static int ar3k_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ar3k_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ar3k_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ar3k_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int ar3k_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts); static int ar3k_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts); static int ar3k_set_mem(RIG *rig, vfo_t vfo, int ch); static int ar3k_set_bank(RIG *rig, vfo_t vfo, int bank); static int ar3k_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int ar3k_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); #define AR3000A_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_WFM) #define AR3000A_FUNC_ALL (RIG_FUNC_MUTE|RIG_FUNC_SQL) #define AR3000A_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_RAWSTR) #define AR3000A_VFO_OPS (RIG_OP_NONE) #define AR3000A_VFO (RIG_VFO_A) #define AR3000A_STR_CAL { 3, \ { \ { '%', -60 }, /* mute */ \ { 'A', -54 }, /* S1 */ \ { 'P', 20 } /* +20 */ \ } } /* * AR3000A rig capabilities. * * info coming from A3000A pdf manual from http://www.aoruk.com/ * * TODO: * set_channel, get_channel, set_func MUTE,SQL, get_dcd, ... */ const struct rig_caps ar3000a_caps = { .rig_model = RIG_MODEL_AR3000A, .model_name = "AR3000A", .mfg_name = "AOR", .version = "0.5", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_SCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 9600, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 0, .timeout = 200, .retry = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = AR3000A_FUNC_ALL, .has_get_level = AR3000A_LEVEL, .has_set_level = RIG_LEVEL_SET(AR3000A_LEVEL), .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 = { 20, RIG_DBLST_END, }, /* TBC */ .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_OFF, .bank_qty = 4, .chan_desc_sz = 0, .vfo_ops = AR3000A_VFO_OPS, .chan_list = { RIG_CHAN_END, }, /* FIXME: memory channel list: 4x100 memories */ .rx_range_list1 = { {kHz(100),MHz(2036),AR3000A_MODES,-1,-1,AR3000A_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(2036),AR3000A_MODES,-1,-1,AR3000A_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { RIG_FRNG_END, }, /* no tx range, this is a scanner! */ .tuning_steps = { {AR3000A_MODES,50}, {AR3000A_MODES,kHz(999.95)}, #if 0 {AR3000A_MODES,0}, /* any tuning step */ #endif RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { /* mode/filter list, .remember = order matters! */ {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.4)}, {RIG_MODE_FM|RIG_MODE_AM, kHz(12)}, {RIG_MODE_WFM, kHz(180)}, RIG_FLT_END, }, .str_cal = AR3000A_STR_CAL, .priv = NULL, .rig_init = NULL, .rig_cleanup = NULL, .rig_open = NULL, .rig_close = NULL, .set_freq = ar3k_set_freq, .get_freq = ar3k_get_freq, .set_mode = ar3k_set_mode, .get_mode = ar3k_get_mode, .set_ts = ar3k_set_ts, .get_ts = ar3k_get_ts, .set_mem = ar3k_set_mem, .set_bank = ar3k_set_bank, .set_level = ar3k_set_level, .get_level = ar3k_get_level, }; /* * Function definitions below */ /* * acknowledge is CR * Is \r portable enough? */ #define CR '\r' #define EOM "\x0a\x0d" #define BUFSZ 64 /* * ar3k_transaction * We assume that rig!=NULL, rig->state!= NULL * Otherwise, you'll get a nice seg fault. You've been warned! * return value: RIG_OK if everything's fine, negative value otherwise * TODO: error case handling */ static int ar3k_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval; struct rig_state *rs; rs = &rig->state; serial_flush(&rs->rigport); retval = write_block(&rs->rigport, cmd, cmd_len); if (retval != RIG_OK) return retval; /* will flush data on next transaction */ if (!data || !data_len) return RIG_OK; retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM)); if (retval == -RIG_ETIMEOUT) retval = 0; if (retval < 0) return retval; *data_len = retval; return RIG_OK; } /* * ar3k_set_freq * Assumes rig!=NULL */ int ar3k_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char freqbuf[BUFSZ]; int freq_len, retval; unsigned lowhz; /* * actually, frequency must be like nnnn.nnnnm, * where m must be 0 or 5 (for 50Hz). */ lowhz = ((unsigned)freq) % 100; freq /= 100; if (lowhz < 25) lowhz = 0; else if (lowhz < 75) lowhz = 50; else lowhz = 100; freq = freq*100 + lowhz; freq_len = sprintf(freqbuf,"%04.5f" EOM, ((double)freq)/MHz(1)); retval = ar3k_transaction (rig, freqbuf, freq_len, NULL, NULL); if (retval != RIG_OK) return retval; return RIG_OK; } /* * ar3k_get_freq * Assumes rig!=NULL, freq!=NULL */ int ar3k_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { char *rfp; int freq_len, retval; char freqbuf[BUFSZ]; /* * #--J0WZ-----Y---------Q * X R,S,T,U,V */ retval = ar3k_transaction (rig, "D" EOM, 3, freqbuf, &freq_len); if (retval != RIG_OK) return retval; rfp = strchr(freqbuf, 'Y'); if (!rfp) return -RIG_EPROTO; sscanf(rfp+1,"%"SCNfreq, freq); *freq *= 10; return RIG_OK; } /* * ar3k_set_mode * Assumes rig!=NULL */ int ar3k_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { char mdbuf[BUFSZ]; int mdbuf_len, aormode, retval; switch (mode) { case RIG_MODE_AM: aormode = 'A'; break; case RIG_MODE_CW: aormode = 'C'; break; case RIG_MODE_USB: aormode = 'U'; break; case RIG_MODE_LSB: aormode = 'L'; break; case RIG_MODE_WFM: aormode = 'W'; break; case RIG_MODE_FM: aormode = 'N'; break; default: rig_debug(RIG_DEBUG_ERR,"ar3k_set_mode: unsupported mode %d\n", mode); return -RIG_EINVAL; } mdbuf_len = sprintf(mdbuf, "%c" EOM, aormode); retval = ar3k_transaction (rig, mdbuf, mdbuf_len, NULL, NULL); return retval; } /* * ar3k_get_mode * Assumes rig!=NULL, mode!=NULL */ int ar3k_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char *rfp; int buf_len, retval; char buf[BUFSZ]; /* * #--J0WZ-----Y---------Q * X R,S,T,U,V */ retval = ar3k_transaction (rig, "D" EOM, 3, buf, &buf_len); if (retval != RIG_OK) return retval; rfp = strchr(buf, 'Y'); if (!rfp) return -RIG_EPROTO; rfp += 11; switch (*rfp) { case 'Q': *mode = RIG_MODE_FM; break; case 'R': *mode = RIG_MODE_WFM; break; case 'S': *mode = RIG_MODE_AM; break; case 'T': *mode = RIG_MODE_LSB; break; case 'U': *mode = RIG_MODE_USB; break; case 'V': *mode = RIG_MODE_CW; break; default: rig_debug(RIG_DEBUG_ERR,"ar3k_get_mode: unsupported mode '%c'\n", *rfp); return -RIG_EPROTO; } *width = rig_passband_normal(rig, *mode); return RIG_OK; } /* * ar3k_set_ts * Assumes rig!=NULL */ int ar3k_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) { char freqbuf[BUFSZ]; int freq_len, retval; int lowhz; /* * actually, frequency must be like nnn.nm, * where m must be 0 or 5 (for 50Hz). */ lowhz = ts % 100; ts /= 100; if (lowhz < 25) lowhz = 0; else if (lowhz < 75) lowhz = 50; else lowhz = 100; ts = ts*100 + lowhz; freq_len = sprintf(freqbuf,"%03.2fS" EOM, ((double)ts)/kHz(1)); retval = ar3k_transaction (rig, freqbuf, freq_len, NULL, NULL); if (retval != RIG_OK) return retval; return RIG_OK; } /* * ar3k_get_ts * Assumes rig!=NULL, ts!=NULL */ int ar3k_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) { char *rfp; int freq_len, retval; char freqbuf[BUFSZ]; /* * #--J0WZ-----Y---------Q * X R,S,T,U,V */ retval = ar3k_transaction (rig, "D" EOM, 3, freqbuf, &freq_len); if (retval != RIG_OK) return retval; rfp = strchr(freqbuf, 'Z'); if (!rfp) return -RIG_EPROTO; sscanf(rfp+1,"%ld", ts); *ts *= 10; return RIG_OK; } int ar3k_set_mem(RIG *rig, vfo_t vfo, int ch) { char cmdbuf[BUFSZ]; int cmd_len, retval; cmd_len = sprintf(cmdbuf, "%02dM" EOM, ch); retval = ar3k_transaction (rig, cmdbuf, cmd_len, NULL, NULL); return retval; } int ar3k_set_bank(RIG *rig, vfo_t vfo, int bank) { char cmdbuf[BUFSZ]; int cmd_len, retval; cmd_len = sprintf(cmdbuf, "%dX" EOM, bank); retval = ar3k_transaction (rig, cmdbuf, cmd_len, NULL, NULL); return retval; } int ar3k_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { char *cmd; int retval; switch(level) { case RIG_LEVEL_ATT: cmd = val.i ? "R" EOM : "T" EOM; break; default: return -RIG_EINVAL; } retval = ar3k_transaction (rig, cmd, strlen(cmd), NULL, NULL); if (retval != RIG_OK) return retval; return RIG_OK; } int ar3k_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int info_len, retval; char infobuf[BUFSZ]; switch(level) { case RIG_LEVEL_ATT: /* * #--J0WZ-----Y---------Q * X R,S,T,U,V */ retval = ar3k_transaction (rig, "D" EOM, 3, infobuf, &info_len); if (retval != RIG_OK) return retval; val->i = strchr(infobuf, 'W') ? rig->caps->attenuator[1] : 0; return RIG_OK; case RIG_LEVEL_RAWSTR: retval = ar3k_transaction (rig, "Y" EOM, 3, infobuf, &info_len); if (retval != RIG_OK) return retval; val->i = infobuf[0]; return RIG_OK; default: return -RIG_EINVAL; } return RIG_OK; } hamlib-1.2.15.3/aor/ar8200.c0000644000175000017500000001272512044564477012003 00000000000000/* * Hamlib AOR backend - AR8200 description * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "aor.h" #define AR8200_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_WFM) #define AR8200_FUNC (RIG_FUNC_TSQL|RIG_FUNC_ABM|RIG_FUNC_AFC) #define AR8200_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR) #define AR8200_PARM (RIG_PARM_APO|RIG_PARM_BACKLIGHT|RIG_PARM_BEEP) #define AR8200_VFO_OPS (RIG_OP_MCL|RIG_OP_UP|RIG_OP_DOWN|RIG_OP_LEFT|RIG_OP_RIGHT) #define AR8200_SCAN_OPS (RIG_SCAN_MEM|RIG_SCAN_VFO|RIG_SCAN_PROG|RIG_SCAN_SLCT) #define AR8200_VFO_ALL (RIG_VFO_A|RIG_VFO_B|RIG_VFO_MEM) /* TODO: measure and report real values */ /* series-2 (black cabinet), from AR8200 Bulletin page */ #define AR8200_STR_CAL { 12, \ { \ { 0,-54 }, \ { 27,-32 }, \ { 42,-27 }, \ { 55,-22 }, \ { 68,-17 }, \ { 86, -7 }, \ { 97, 3 }, \ { 103, 13 }, \ { 106, 23 }, \ { 109, 33 }, \ { 112, 43 }, \ { 139, 53 }, \ } } #define AR8200_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .bank_num = 1, \ .tuning_step = 1, \ .channel_desc = 1, \ .flags = 1, \ .levels = RIG_LEVEL_ATT, \ .funcs = RIG_FUNC_ABM, \ } static const struct aor_priv_caps ar8k_priv_caps = { .format_mode = format8k_mode, .parse_aor_mode = parse8k_aor_mode, .bank_base1 = 'A', .bank_base2 = 'a', }; /* * ar8200 rig capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! * * part of info from http://www.aoruk.com/8200.htm */ const struct rig_caps ar8200_caps = { .rig_model = RIG_MODEL_AR8200, .model_name = "AR8200", .mfg_name = "AOR", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_SCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 19200, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_XONXOFF, .write_delay = 0, .post_write_delay = 0, .timeout = 200, .retry = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = AR8200_FUNC, .has_get_level = AR8200_LEVEL, .has_set_level = RIG_LEVEL_SET(AR8200_LEVEL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, /* FIXME: CTCSS list */ .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { 20, RIG_DBLST_END, }, /* TBC */ .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_RIG, .bank_qty = 20, /* A through J, and a trough j */ .chan_desc_sz = 12, .vfo_ops = AR8200_VFO_OPS, .scan_ops = AR8200_SCAN_OPS, .str_cal = AR8200_STR_CAL, .chan_list = { { 0, 999, RIG_MTYPE_MEM, AR8200_MEM_CAP }, /* flat space */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100),MHz(2040),AR8200_MODES,-1,-1,AR8200_VFO_ALL}, RIG_FRNG_END, }, /* rx range */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(2040),AR8200_MODES,-1,-1,AR8200_VFO_ALL}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { RIG_FRNG_END, }, /* no tx range, this is a scanner! */ .tuning_steps = { {AR8200_MODES,50}, {AR8200_MODES,100}, {AR8200_MODES,kHz(1)}, {AR8200_MODES,kHz(5)}, {AR8200_MODES,kHz(9)}, {AR8200_MODES,kHz(10)}, {AR8200_MODES,12500}, {AR8200_MODES,kHz(20)}, {AR8200_MODES,kHz(25)}, {AR8200_MODES,kHz(100)}, {AR8200_MODES,MHz(1)}, #if 0 {AR8200_MODES,0}, /* any tuning step */ #endif RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { /* mode/filter list, .remember = order matters! */ {RIG_MODE_SSB|RIG_MODE_CW, kHz(3)}, {RIG_MODE_AM, kHz(9)}, {RIG_MODE_AM, kHz(3)}, {RIG_MODE_FM|RIG_MODE_AM, kHz(12)}, {RIG_MODE_FM, kHz(9)}, {RIG_MODE_WFM, kHz(230)}, /* 50kHz at -3dB, 380kHz at -20dB */ RIG_FLT_END, }, .priv = (void*)&ar8k_priv_caps, .rig_init = NULL, .rig_cleanup = NULL, .rig_open = NULL, .rig_close = aor_close, .set_freq = aor_set_freq, .get_freq = aor_get_freq, .set_vfo = aor_set_vfo, .get_vfo = aor_get_vfo, .set_mode = aor_set_mode, .get_mode = aor_get_mode, .set_level = aor_set_level, .get_level = aor_get_level, .get_dcd = aor_get_dcd, .set_ts = aor_set_ts, .set_powerstat = aor_set_powerstat, .vfo_op = aor_vfo_op, .scan = aor_scan, .get_info = aor_get_info, .set_mem = aor_set_mem, .get_mem = aor_get_mem, .set_bank = aor_set_bank, .set_channel = aor_set_channel, .get_channel = aor_get_channel, .get_chan_all_cb = aor_get_chan_all_cb, }; /* * Function definitions below */ hamlib-1.2.15.3/aor/Makefile.am0000644000175000017500000000063412044564477012753 00000000000000AORSRCLIST = ar8200.c ar8000.c ar5000.c ar3000.c ar7030.c ar3030.c \ ar2700.c ar8600.c ar7030p.c ar7030p_utils.c sr2200.c pkglib_LTLIBRARIES = hamlib-aor.la hamlib_aor_la_SOURCES = $(AORSRCLIST) aor.c hamlib_aor_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_aor_la_LIBADD = $(top_builddir)/src/libhamlib.la EXTRA_DIST = README.aor README.ar5000 README.ar7030 noinst_HEADERS = aor.h ar7030p.h hamlib-1.2.15.3/aor/README.aor0000644000175000017500000000134612044564477012360 00000000000000hamlib - Copyright (C) 2000 Frank Singleton libaor.so - Copyright (C) 2000 Stephane Fillod This shared library provides an API for communicating via serial interface to an AOR scanner. Reference Documentation ----------------------- AOR RS232 protocol listing for the AR8200 (accompanies the CC8200) Document release V1.3 AOR Ltd. Status ------ This is a WIP. Handles 5% of all opcodes. All primitives are written from spec. In other words, they are totally untested because I don't own an AOR scanner myself. Patchs and contributions are welcome! I'm also looking for a real maintainer :) --SF This lib should/will support other AOR models. Warnings -------- 1. NOTHING IS WORKING, this is a WIP. Contributors ------------ hamlib-1.2.15.3/aor/README.ar70300000644000175000017500000000264412044564477012515 00000000000000hamlib-1.2.3 aor ar7030.c 2004.11.26 Parameteraenderung fuer USB-Serial //.post_write_delay = 0, //Device: /dev/ttyS0 //.post_write_delay = 85, //Device: /dev/tts/USB0 < 85 sec 'timedout after 0 chars' Befehle mit rigctl # rigctl -m 503 -r /dev/ttyS0 # rigctl -m 503 -r /dev/tts/USB0 Rig command: F Frequency: 0 .. 32016718 Hz Rig command: f Rig command: \get_freq Rig command: M Mode: FM, AMS, AM, USB, LSB, CW, RTTY Passband: 1 - 6 Rig command: m Passband: 800, 2100, 3700, 5200, 9500, XXXX (Value from RX) Hz Rig command: L Level: AF Value: 0.0 - 1.0 Level: RF Value: 0.1, 0.0 -0.1, -0.2, -0.3, -0.4 > +10, 0 ,-10 , -20, -30, -40 dB Level: SQL Value: 0.0 - 1.0 Level: AGC Value: 0 > OFF, 2 > FAST, 3 > SLOW, 5 > MEDIUM Level: CWPITCH Value: -4248 .. 0 .. 4215 Hz Rig command: l Level: AF Level: RF Level: SQL Level: AGC Level: CWPITCH Level: RAWSTR Level: STRENGTH Value: -121dBm ... -23dBm > S1 ... S9 + 50 dB Rig command: \set_powerstat Status: 0 > Power off, 1 > Power on Rig command: \get_powerstat Rig command: \reset Reset: 1 > Software reset Rig command: Quitt Q q Rig command: Quitt Q Q Rig command: 1 Caps dump for model 503 Friedrich Melchert (DC9RP) hamlib-1.2.15.3/aor/ar7030.c0000644000175000017500000006657312044564477012015 00000000000000/* * Hamlib AOR backend - AR7030 description * Copyright (c) 2000-2006 by Stephane Fillod & Fritz Melchert * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ // // Version 2004.12.13 F.Melchert (DC9RP) // Version 2004.11.29 F.Melchert (DC9RP) // #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "aor.h" #include "serial.h" #include "idx_builtin.h" /* * Maintainer wanted! * * TODO: * - everything: this rig has nothing in common with other aor's. * * set_mem, get_mem, set_channel, get_channel */ #define AR7030_MODES (RIG_MODE_AM|RIG_MODE_AMS|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define AR7030_FUNC_ALL (RIG_FUNC_NONE) #define AR7030_LEVEL (RIG_LEVEL_AF | RIG_LEVEL_RF | RIG_LEVEL_SQL | RIG_LEVEL_CWPITCH | RIG_LEVEL_RAWSTR | RIG_LEVEL_AGC | RIG_LEVEL_STRENGTH) #define AR7030_PARM (RIG_PARM_NONE) #define AR7030_VFO_OPS (RIG_OP_NONE) #define AR7030_VFO (RIG_VFO_A|RIG_VFO_B) /* * Data was obtained from AR7030 pdf on http://www.aoruk.com */ /**************************************************************************** * Misc Routines * ****************************************************************************/ static int rxr_writeByte(RIG *rig, unsigned char c) { return write_block(&rig->state.rigport, (char *) &c, 1); } static int rxr_readByte(RIG *rig) { unsigned char response[1]; unsigned char buf[] = {0x71}; // Read command int retval; retval = write_block(&rig->state.rigport, (char *) buf, 1); if (retval != RIG_OK) return retval; retval = read_block(&rig->state.rigport, (char *) response, 1); if (retval != RIG_OK) return retval; return response[0]; } /*! Umwandlung von BCD nach char */ static int BCD_To_int(RIG *rig, int c) { if (((c & 0x0F) < 0x0a) && ((c & 0xF0) < 0xa0)) // Test pseudo Tetrade { return (((c >> 4)*10)+(c & 0x0F)); } return (-1); }// End of method BCD_To_char( /**************************************************************************** * Routines to set receiver lock levels * ****************************************************************************/ /*! Locks, or unlocks if called with argument 0, the receiver, disabling the front panel controls or updates. The level of locking is determined by the argument level which may be in the range 0 (no lock) to 3 (Remote operation exclusively). Calling the method without arguments sets the lock level to 1. It is recommended to lock to this level during any multi byte read or writes to prevent data contention between internal and remote access. Calls with invalid arguments are ignored. */ static void unlock(RIG *rig) { rxr_writeByte(rig, 0x80); } // Level 1 = 0x81 IR remote control disabled. // Front panel buttons ignored. // Front panel spin-wheels logged but not actioned. // Display update (frequency & S-meter) continues. static void setLock(RIG *rig, int level) { if ((0 <= level) && (level <= 3)) { rxr_writeByte(rig, 0x80+level); } } // Level 2 = 0x82 As level 1, but display update suspended. In revisions before 1.4 // squelch operation is inhibited, which results in no audio output // after a mode change. In revision 1.4 squelch operation continues // and mode changing is as expected. // Level 3 = 0x83 Remote operation exclusively. static void setMemPtr(RIG *rig, int page, int address) { rxr_writeByte(rig, 0x50 + page); //Set Page if (address <= 0xFF) { //*** <= 8 Bit Adresse *** rxr_writeByte(rig, 0x30 + (address >> 4)); //Set H-Register 4 Bits rxr_writeByte(rig, 0x40 + (address & 0x0F)); //Set Adress(12 Bits = (4 Bit H Register) + 8 Bit) } else { //*** > 8 Bit Adresse *** rxr_writeByte(rig, 0x30 + ((address >> 4) & 0x0F)) ;//Set H-Register 4 Bits rxr_writeByte(rig, 0x40 + (address & 0x0F)); //Set Adress(12 Bits = (4 Bit H Register) + 8 Bit) rxr_writeByte(rig, 0x10 + (address >> 8)); //Set Adress high(12 Bits=(4 Bit H Register)+8 Bit) } } /**************************************************************************** * Routines * ****************************************************************************/ // Routine 0 Reset Setup receiver as at switch-on. static void Execute_Routine_0(RIG *rig) { //setLock(rig, 1); //Set Lock Level rxr_writeByte(rig, 0x20); //unlock(rig); //Set UnLock Level } // Routine 1 Set frequency Program local oscillator from frequ area and setup // RF filters and oscillator range. // Routine 2 Set mode Setup from mode byte in memory and display mode, // select preferred filter and PBS, BFO values etc. // currently not used #if 0 static void Execute_Routine_2_1(RIG *rig, char mp , char ad , int numSteps) { setLock(rig, 1); //Set Lock Level setMemPtr(rig, mp , ad ); //page, address rxr_writeByte(rig, 0x30 | (0x0F & (char)(numSteps>>4))); rxr_writeByte(rig, 0x60 | (0x0F & (char)(numSteps))); rxr_writeByte(rig, 0x22); unlock(rig); //Set UnLock Level } #endif // Routine 3 Set passband Setup all IF parameters from filter, pbsval and bfoval bytes. static void Execute_Routine_3_1(RIG *rig, char mp , char ad , int numSteps) { setLock(rig, 1); //Set Lock Level setMemPtr(rig, mp , ad ); //page, address rxr_writeByte(rig, 0x30 | (0x0F & (char)(numSteps>>4))); rxr_writeByte(rig, 0x60 | (0x0F & (char)(numSteps))); rxr_writeByte(rig, 0x23); unlock(rig); //Set UnLock Level } // Routine 4 Set all Set all receiver parameters from current memory values static void Execute_Routine_4_1(RIG *rig, char mp , char ad , int numSteps) { setLock(rig, 1); //Set Lock Level setMemPtr(rig, mp , ad ); //page, address // 0x30 = Set H-register x ---> H-register (4-bits) // The high order 4-bits of each byte sent to the receiver is the operation code, // the low order 4-bits is data (shown here as x) rxr_writeByte(rig, 0x30 | (0x0F & (char)(numSteps>>4))); // 0x60 = Write data Hx // ---> [Page, Address] Address register + 1 // ---> Address register 0 // ---> H-register, 0 // ---> Mask register rxr_writeByte(rig, 0x60 | (0x0F & (char)(numSteps))); //Execute routine //Set all Set all receiver parameters from current memory values rxr_writeByte(rig, 0x24); unlock(rig); //Set UnLock Level } static void Execute_Routine_4_3(RIG *rig, char mp , char ad , int numSteps) { setLock(rig, 1); //Set Lock Level setMemPtr(rig, mp , ad ); //page, address rxr_writeByte(rig, 0x30 | (0x0F & (char)(numSteps>>20))); rxr_writeByte(rig, 0x60 | (0x0F & (char)(numSteps>>16))); rxr_writeByte(rig, 0x30 | (0x0F & (char)(numSteps>>12))); rxr_writeByte(rig, 0x60 | (0x0F & (char)(numSteps>>8))); rxr_writeByte(rig, 0x30 | (0x0F & (char)(numSteps>>4))); rxr_writeByte(rig, 0x60 | (0x0F & (char)(numSteps))); //Execute routine //Set all Set all receiver parameters from current memory values rxr_writeByte(rig, 0x24); unlock(rig); //Set UnLock Level } // Routine 5 Set audio Setup audio controller from memory register values. // currently not used #if 0 static void Execute_Routine_5_1(RIG *rig, char mp , char ad , int numSteps) { setLock(rig, 1); //Set Lock Level setMemPtr(rig, mp , ad ); //page, address rxr_writeByte(rig, 0x30 | (0x0F & (char)(numSteps>>4))); rxr_writeByte(rig, 0x60 | (0x0F & (char)(numSteps))); rxr_writeByte(rig, 0x25); unlock(rig); //Set UnLock Level } #endif // Routine 6 Set RF-IF Setup RF Gain, IF Gain and AGC speed. Also sets Notch Filter and // Noise Blanker if these options are fitted. static void Execute_Routine_6_1(RIG *rig, char mp , char ad , int numSteps) { setLock(rig, 1); //Set Lock Level setMemPtr(rig, mp , ad ); //page, address rxr_writeByte(rig, 0x30 | (0x0F & (char)(numSteps>>4))); rxr_writeByte(rig, 0x60 | (0x0F & (char)(numSteps))); rxr_writeByte(rig, 0x26); unlock(rig); //Set UnLock Level } // Routine 14 Read signal strength // Transmits byte representing received signal strength (read from AGC voltage). // Output is 8-bit binary in range 0 to 255. static int Execute_Routine_14(RIG *rig) { unsigned char response[1]; unsigned char buf[] = {0x2e}; // Read command int retval; retval = write_block(&rig->state.rigport, (char *) buf, 1); if (retval != RIG_OK) return retval; retval = read_block(&rig->state.rigport, (char *) response, 1); if (retval != RIG_OK) return retval; return response[0]; } // Operate button x // Button codes :- // 0 = None pressed 5 = RF-IF button // 1 = Mode up button 6 = Memory button // 2 = Mode down button 7 = * button // 3 = Fast button 8 = Menu button // 4 = Filter button 9 = Power button static void Execute_Operate_button(RIG *rig, char button) { // setLock(rig, 1); //Set Lock Level rxr_writeByte(rig, 0xa0 | (0x0F & button)); // unlock(rig); //Set UnLock Level } static int ar7030_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { // frequ Mem_Page=0 Address=1A // 3 bytes 24-bit tuned frequency, value is 376635.2228 / MHz freq = freq * .3766352228; if (freq < 0){freq = 0;} if (freq > 12058624){freq = 12058624;} Execute_Routine_4_3(rig, 0 , 0x1a , freq); return RIG_OK; } static int ar7030_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { // frequ Mem_Page=0 Address=1A // 3 bytes 24-bit tuned frequency, value is 376635.2228 / MHz unsigned int frequ_i = 0; setMemPtr(rig ,0 ,0x1a); frequ_i = (int)(rxr_readByte(rig) << 16); frequ_i = frequ_i + (int)(rxr_readByte(rig) << 8); frequ_i = frequ_i + (int)(rxr_readByte(rig)); *freq = ((float)(frequ_i) * 2.65508890157896); return RIG_OK; } /*! Current mode :- RIG_MODE_NONE = 0, < None 1 = AM RIG_MODE_AM = (1<<0), < Amplitude Modulation 5 = CW RIG_MODE_CW = (1<<1), < CW 7 = USB RIG_MODE_USB = (1<<2), < Upper Side Band 6 = LSB RIG_MODE_LSB = (1<<3), < Lower Side Band 4 = Data RIG_MODE_RTTY = (1<<4), < Remote Teletype 3 = NFM RIG_MODE_FM = (1<<5), < "narrow" band FM RIG_MODE_WFM = (1<<6), < broadcast wide FM RIG_MODE_CWR = (1<<7), < CW reverse sideband RIG_MODE_RTTYR = (1<<8), < RTTY reverse sideband 2 = Sync RIG_MODE_AMS = (1<<9), < Amplitude Modulation Synchronous RIG_MODE_PKTLSB = (1<<10),< Packet/Digital LSB mode (dedicated port) RIG_MODE_PKTUSB = (1<<11),< Packet/Digital USB mode (dedicated port) RIG_MODE_PKTFM = (1<<12),< Packet/Digital FM mode (dedicated port) RIG_MODE_ECSSUSB = (1<<13),< Exalted Carrier Single Sideband USB RIG_MODE_ECSSLSB = (1<<14),< Exalted Carrier Single Sideband LSB RIG_MODE_FAX = (1<<15) < Facsimile Mode */ static int ar7030_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { int filter_num; // mode Mem_Page=0 Address=1D // Current mode :- 1 = AM 4 = Data 2 = Sync 5 = CW 3 = NFM 6 = LSB 7 = USB. switch(mode) { case RIG_MODE_AM : Execute_Routine_4_1(rig, 0 , 0x1d , 1); break; case RIG_MODE_AMS : Execute_Routine_4_1(rig, 0 , 0x1d , 2); break; case RIG_MODE_FM : Execute_Routine_4_1(rig, 0 , 0x1d , 3); break; case RIG_MODE_RTTY : Execute_Routine_4_1(rig, 0 , 0x1d , 4); break; case RIG_MODE_CW : Execute_Routine_4_1(rig, 0 , 0x1d , 5); break; case RIG_MODE_LSB : Execute_Routine_4_1(rig, 0 , 0x1d , 6); break; case RIG_MODE_USB : Execute_Routine_4_1(rig, 0 , 0x1d , 7); break; default : return -RIG_EINVAL; } if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); /* * pass-through values 1..6, as filter number * Otherwise find out filter number from passband width */ if (width <= 6) { filter_num = width; } else { if (width <= 800) filter_num = 1; else if (width <= 2100) filter_num = 2; else if (width <= 3700) filter_num = 3; else if (width <= 5200) filter_num = 4; else if (width <= 9500) filter_num = 5; else filter_num = 6; } // filter Mem_Page=0 Address=34 // Current filter number (1 to 6). Execute_Routine_4_1(rig, 0, 0x34, filter_num); return RIG_OK; } static int ar7030_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { // mode Mem_Page=0 Address=1D // Current mode :- 1 = AM 4 = Data 2 = Sync 5 = CW 3 = NFM 6 = LSB 7 = USB. setMemPtr(rig ,0 ,0x1d); switch(rxr_readByte(rig)) { case 1: *mode = RIG_MODE_AM; break; case 2: *mode = RIG_MODE_AMS; break; case 3: *mode = RIG_MODE_FM; break; case 4: *mode = RIG_MODE_RTTY; break; case 5: *mode = RIG_MODE_CW; break; case 6: *mode = RIG_MODE_LSB; break; case 7: *mode = RIG_MODE_USB; break; default : return -RIG_EINVAL; } // fltbw Mem_Page=0 Address=38 // Filter bandwidth dezimal in Hz. // Filter bandwidth (2 BCD digits : x.x kHz). setMemPtr(rig ,0 ,0x38); if ((*width = BCD_To_int(rig, rxr_readByte(rig))*100) < 0) { return -RIG_EINVAL; } return RIG_OK; } /*! RIG_LEVEL_NONE = 0, < None RIG_LEVEL_PREAMP = (1<<0), < Preamp, arg int (dB) RIG_LEVEL_ATT = (1<<1), < Attenuator, arg int (dB) RIG_LEVEL_VOX = (1<<2), < VOX delay, arg int (tenth of seconds) af_vol RIG_LEVEL_AF = (1<<3), < Volume, arg float [0.0..1.0] rfgain RIG_LEVEL_RF = (1<<4), < RF gain (not TX power), arg float [-0.4..0.0..0.1 > -40..0..10 dB] sqlval RIG_LEVEL_SQL = (1<<5), < Squelch, arg float [0.0 .. 1.0] RIG_LEVEL_IF = (1<<6), < IF, arg int (Hz) RIG_LEVEL_APF = (1<<7), < APF, arg float [0.0 .. 1.0] RIG_LEVEL_NR = (1<<8), < Noise Reduction, arg float [0.0 .. 1.0] RIG_LEVEL_PBT_IN = (1<<9), < Twin PBT (inside), arg float [0.0 .. 1.0] RIG_LEVEL_PBT_OUT = (1<<10),< Twin PBT (outside), arg float [0.0 .. 1.0] bfoval RIG_LEVEL_CWPITCH = (1<<11),< CW pitch, arg int (Hz) RIG_LEVEL_RFPOWER = (1<<12),< RF Power, arg float [0.0 .. 1.0] RIG_LEVEL_MICGAIN = (1<<13),< MIC Gain, arg float [0.0 .. 1.0] RIG_LEVEL_KEYSPD = (1<<14),< Key Speed, arg int (WPM) RIG_LEVEL_NOTCHF = (1<<15),< Notch Freq., arg int (Hz) RIG_LEVEL_COMP = (1<<16),< Compressor, arg float [0.0 .. 1.0] agcspd RIG_LEVEL_AGC = (1<<17),< AGC, arg int (see enum agc_level_e) Current AGC speed : 0 = Fast 2 = Slow 1 = Medium 3 = Off. RIG_LEVEL_BKINDL = (1<<18),< BKin Delay, arg int (tenth of dots) RIG_LEVEL_BALANCE = (1<<19),< Balance (Dual Watch), arg float [0.0 .. 1.0] RIG_LEVEL_METER = (1<<20),< Display meter, arg int (see enum meter_level_e) RIG_LEVEL_VOXGAIN = (1<<21),< VOX gain level, arg float [0.0 .. 1.0] RIG_LEVEL_VOXDELAY = RIG_LEVEL_VOX, < VOX delay, arg int (tenth of seconds) RIG_LEVEL_ANTIVOX = (1<<22),< anti-VOX level, arg float [0.0 .. 1.0] RIG_LEVEL_LINEOUT = (1<<23),< Lineout Volume, arg float [0.0 .. 1.0] < These ones are not settable Rou.14 RIG_LEVEL_RAWSTR = (1<<26),< Raw (A/D) value for signal strength, specific to each rig, arg int RIG_LEVEL_SQLSTAT = (1<<27),< SQL status, arg int (open=1/closed=0). Deprecated, use get_dcd instead RIG_LEVEL_SWR = (1<<28),< SWR, arg float RIG_LEVEL_ALC = (1<<29),< ALC, arg float smval RIG_LEVEL_STRENGTH = (1<<30) < Effective (calibrated) signal strength relative to S9, arg int(dB) RIG_LEVEL_BWC = (1<<31) < Bandwidth Control, arg int (Hz) */ static int ar7030_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { switch(level) { case RIG_LEVEL_AF : // af_vol Mem_Page=0 Address=1E // Main channel volume (6-bits, values 15 to 63) val.f = (val.f * 50) + 15; if (val.f < 15){val.f = 15;} if (val.f > 63){val.f = 63;} Execute_Routine_4_1(rig, 0 ,0x1e , val.f); return RIG_OK; case RIG_LEVEL_RF : // rfgain Mem_Page=0 Address=30 // Current RF gain setting (0 to 5) (0=max gain) val.f = ((val.f * 10) - 1) * -1; if (val.f < 0){val.f = 0;} if (val.f > 5){val.f = 5;} Execute_Routine_6_1(rig, 0 ,0x30 , val.f) ; return RIG_OK; case RIG_LEVEL_SQL : // sqlval Mem_Page=0 Address=33 // Squelch value (current setting)(values 0 to 150) if (val.f < 0){val.f = 0;} if (val.f > 1){val.f = 1;} Execute_Routine_6_1(rig, 0 ,0x33 , val.f * 150); return RIG_OK; case RIG_LEVEL_CWPITCH : // bfoval Mem_Page=0 Address=36 // BFO offset in Hz (x33.19Hz)(values -4248.320 to 4215.130kHz). val.i = val.i * 100 / 3319; if (val.i < -128){val.i = -128;} if (val.i > 127){val.i = 127;} Execute_Routine_3_1(rig, 0 ,0x36 , val.i); return RIG_OK; case RIG_LEVEL_AGC : //ar7030 agcspd 3 > RIG_AGC_OFF // > RIG_AGC_SUPERFAST //ar7030 agcspd 0 > RIG_AGC_FAST //ar7030 agcspd 2 > RIG_AGC_SLOW // > RIG_AGC_USER /*!< user selectable */ //ar7030 agcspd 1 > RIG_AGC_MEDIUM // agcspd Mem_Page=0 Address=32 // Current AGC speed : 0 = Fast 2 = Slow 1 = Medium 3 = Off switch (val.i) { case RIG_AGC_OFF: Execute_Routine_6_1(rig, 0 ,0x32 , 3); break; case RIG_AGC_SLOW: Execute_Routine_6_1(rig, 0 ,0x32 , 2); break; case RIG_AGC_MEDIUM: Execute_Routine_6_1(rig, 0 ,0x32 , 1); break; case RIG_AGC_FAST: Execute_Routine_6_1(rig, 0 ,0x32 , 0); break; default: return -RIG_EINVAL; } return RIG_OK; default : return -RIG_EINVAL; } } static int ar7030_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int smval1; int smval2; switch(level) { case RIG_LEVEL_AF : // af_vol Mem_Page=0 Address=1E // Main channel volume (6-bits, values 15 to 63) setMemPtr(rig ,0 ,0x1e); val->f = (float)(rxr_readByte(rig) - 15) / 50; return RIG_OK; case RIG_LEVEL_RF : // rfgain Mem_Page=0 Address=30 // Current RF gain setting (0 to 5) (0=max gain) setMemPtr(rig ,0 ,0x30); val->f = (float)((rxr_readByte(rig) * -1) + 1) / 10; return RIG_OK; case RIG_LEVEL_SQL : // sqlval Mem_Page=0 Address=33 // Squelch value (current setting)(values 0 to 150) setMemPtr(rig ,0 ,0x33); val->f = (float)rxr_readByte(rig) / 150; return RIG_OK; case RIG_LEVEL_CWPITCH : // bfoval Mem_Page=0 Address=36 // BFO offset in Hz (x33.19Hz)(values -4248.320 to 4215.130kHz). setMemPtr(rig ,0 ,0x36); val->i = ((char)rxr_readByte(rig) * 3319) / 100; return RIG_OK; case RIG_LEVEL_AGC : //ar7030 agcspd 3 > RIG_AGC_OFF // > RIG_AGC_SUPERFAST, //ar7030 agcspd 0 > RIG_AGC_FAST, //ar7030 agcspd 2 > RIG_AGC_SLOW // > RIG_AGC_USER, //ar7030 agcspd 1 > RIG_AGC_MEDIUM // agcspd Mem_Page=0 Address=32 // Current AGC speed : 0 = Fast 2 = Slow 1 = Medium 3 = Off setMemPtr(rig ,0 ,0x32); switch (rxr_readByte(rig)) { case 0: val->i = RIG_AGC_FAST; break; case 1: val->i = RIG_AGC_MEDIUM; break; case 2: val->i = RIG_AGC_SLOW; break; case 3: val->i = RIG_AGC_OFF; break; default: return -RIG_EINVAL; } return RIG_OK; // case RIG_LEVEL_LINEOUT : // geht nicht in hamlib // // af_axl Mem_Page=0 Address=23 Bit=0 - 5 // setMemPtr(rig ,0 ,0x23); // val->f = ((float)(rxr_readByte(rig) - 27) * 2) / 100; // // af_axr Mem_Page=0 Address=24 Bit=0 - 5 // return RIG_OK; case RIG_LEVEL_RAWSTR : // Routine 14 Read signal strength // Read signal strength Transmits byte representing received signal strength // (read from AGC voltage). Output is 8-bit binary in range 0 to 255 val->i = Execute_Routine_14(rig); return RIG_OK; case RIG_LEVEL_STRENGTH : // smval Mem_Page=0 Address=3F - 40 // 2 bytes Last S-meter reading (bars + segments) setMemPtr(rig ,0 ,0x3f); smval1 = (unsigned char)rxr_readByte(rig); smval2 = (unsigned char)rxr_readByte(rig); if (smval1 < 9) { val->i = (smval1 * 6 + smval2) - 127; } else if (smval1 < 11) { /* int ops => int result => round has no effect (besides compiler warning */ //val->i = round((smval1 * 6 + smval2) * 10 / 12) - 118; val->i = ((smval1 * 6 + smval2) * 10 / 12) - 118; } else if (smval1 >= 11) { /* int ops => int result => round has no effect (besides compiler warning */ //val->i = round((smval1 * 6 + smval2) * 10 / 6) - 173; val->i = ((smval1 * 6 + smval2) * 10 / 6) - 173; } return RIG_OK; default : return -RIG_EINVAL; } } static int ar7030_set_powerstat(RIG *rig, powerstat_t status) { // Radio power state. // 0 > RIG_POWER_OFF Power off // 1 > RIG_POWER_ON Power on // 2 > RIG_POWER_STANDBY Standby switch (status) { case RIG_POWER_OFF: // Operate button 9 = Power button Execute_Operate_button(rig, 9); return RIG_OK; case RIG_POWER_ON: // Operate button 0 = None pressed Execute_Operate_button(rig, 0); return RIG_OK; default: break; } return -RIG_EINVAL; } static int ar7030_get_powerstat(RIG *rig, powerstat_t *status) { // power Mem_Page=0 Address=2E Bit=0 - 0 // Power on setMemPtr(rig ,0 ,0x2e); *status = (char)rxr_readByte(rig) & 0x01; return RIG_OK; } static int ar7030_reset(RIG *rig, reset_t reset) { // Reset operation. // 0 > RIG_RESET_NONE No reset // 1 > RIG_RESET_SOFT Software reset // 2 > RIG_RESET_VFO VFO reset // 3 > RIG_RESET_MCALL Memory clear // 4 > RIG_RESET_MASTER Master reset switch(reset) { // Routine 0 Reset Setup receiver as at switch-on. case RIG_RESET_SOFT : Execute_Routine_0(rig) ; return RIG_OK; default: break; } return -RIG_EINVAL; } const struct rig_caps ar7030_caps = { .rig_model = RIG_MODEL_AR7030, .model_name = "AR7030", .mfg_name = "AOR", .version = "0.4.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_RECEIVER, .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, /* TBC */ .write_delay = 0, .post_write_delay = 0, //Device: /dev/ttyS0 //.post_write_delay = 85, //Device: /dev/tts/USB0 < 85 sec timedout after 0 chars .timeout = 500, /* 0.5 second */ .retry = 0, .has_get_func = AR7030_FUNC_ALL, .has_set_func = AR7030_FUNC_ALL, .has_get_level = AR7030_LEVEL, .has_set_level = RIG_LEVEL_SET(AR7030_LEVEL), .has_get_parm = AR7030_PARM, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .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 = 100, /* FIXME */ .vfo_ops = AR7030_VFO_OPS, .chan_list = { RIG_CHAN_END, }, /* FIXME: memory channel list: 1000 memories */ .rx_range_list1 = { {kHz(10),MHz(2600),AR7030_MODES,-1,-1,AR7030_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(10),MHz(2600),AR7030_MODES,-1,-1,AR7030_VFO}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { RIG_FRNG_END, }, /* no tx range, this is a scanner! */ .tuning_steps = { {AR7030_MODES,50}, {AR7030_MODES,100}, {AR7030_MODES,200}, {AR7030_MODES,500}, {AR7030_MODES,kHz(1)}, {AR7030_MODES,kHz(2)}, {AR7030_MODES,kHz(5)}, {AR7030_MODES,kHz(6.25)}, {AR7030_MODES,kHz(9)}, {AR7030_MODES,kHz(10)}, {AR7030_MODES,12500}, {AR7030_MODES,kHz(20)}, {AR7030_MODES,kHz(25)}, {AR7030_MODES,kHz(30)}, {AR7030_MODES,kHz(50)}, {AR7030_MODES,kHz(100)}, {AR7030_MODES,kHz(200)}, {AR7030_MODES,kHz(250)}, {AR7030_MODES,kHz(500)}, // {AR7030_MODES,0}, /* any tuning step */ RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { /* mode/filter list, .remember = order matters! */ {RIG_MODE_SSB|RIG_MODE_CW, kHz(3)}, {RIG_MODE_SSB|RIG_MODE_CW, kHz(0.8)}, /* narrow */ {RIG_MODE_SSB, kHz(4.8)}, /* wide */ {RIG_MODE_CW, kHz(9.5)}, /* wide */ {RIG_MODE_FM|RIG_MODE_AM, kHz(15)}, {RIG_MODE_FM|RIG_MODE_AM, kHz(6)}, /* narrow */ {RIG_MODE_FM|RIG_MODE_AM, kHz(30)}, /* wide */ RIG_FLT_END, }, .priv = NULL, /* priv */ // .rig_init = ar7030_init, // .rig_cleanup = ar7030_cleanup, // .rig_open = ar7030_open, // .rig_close = ar7030_close, .set_freq = ar7030_set_freq, .get_freq = ar7030_get_freq, .set_mode = ar7030_set_mode, .get_mode = ar7030_get_mode, // .set_vfo = ar7030_set_vfo, // .get_vfo = ar7030_get_vfo, .set_powerstat = ar7030_set_powerstat, .get_powerstat = ar7030_get_powerstat, .set_level = ar7030_set_level, .get_level = ar7030_get_level, // .set_func = ar7030_set_func, // .get_func = ar7030_get_func, // .set_parm = ar7030_set_parm, // .get_parm = ar7030_get_parm, // .get_info = ar7030_get_info, // .set_ptt = ar7030_set_ptt, // .get_ptt = ar7030_get_ptt, // .get_dcd = ar7030_get_dcd, // .set_rptr_shift = ar7030_set_rptr_shift, // .get_rptr_shift = ar7030_get_rptr_shift, // .set_rptr_offs = ar7030_set_rptr_offs, // .get_rptr_offs = ar7030_get_rptr_offs, // .set_ctcss_tone = ar7030_set_ctcss_tone, // .get_ctcss_tone = ar7030_get_ctcss_tone, // .set_dcs_code = ar7030_set_dcs_code, // .get_dcs_code = ar7030_get_dcs_code, // .set_ctcss_sql = ar7030_set_ctcss_sql, // .get_ctcss_sql = ar7030_get_ctcss_sql, // .set_dcs_sql = ar7030_set_dcs_sql, // .get_dcs_sql = ar7030_get_dcs_sql, // .set_split_freq = ar7030_set_split_freq, // .get_split_freq = ar7030_get_split_freq, // .set_split_mode = ar7030_set_split_mode, // .get_split_mode = ar7030_get_split_mode, // .set_split_vfo = ar7030_set_split_vfo, // .get_split_vfo = ar7030_get_split_vfo, // .set_rit = ar7030_set_rit, // .get_rit = ar7030_get_rit, // .set_xit = ar7030_set_xit, // .get_xit = ar7030_get_xit, // .set_ts = ar7030_set_ts, // .get_ts = ar7030_get_ts, // .set_ant = ar7030_set_ant, // .get_ant = ar7030_get_ant, // .set_bank = ar7030_set_bank, // .set_mem = ar7030_set_mem, // .get_mem = ar7030_get_mem, // .vfo_op = ar7030_vfo_op, // .scan = ar7030_scan, // .send_dtmf = ar7030_send_dtmf, // .recv_dtmf = ar7030_recv_dtmf, // .send_morse = ar7030_send_morse, .reset = ar7030_reset, // .set_channel = ar7030_set_channel, // .get_channel = ar7030_get_channel, // .set_trn = ar7030_set_trn, // .get_trn = ar7030_get_trn, }; hamlib-1.2.15.3/README.win320000644000175000017500000000554712044564477011767 00000000000000Win32 builds ------------ MinGW ===== For DLLs compatible with MSVC++ cross-compiled from Linux with MinGW, see the build-win32.sh script in the scripts/ directory and its companion README file. Cygwin ====== From: "Mark J. Fine" Subject: [Hamlib-developer] Building under Cygwin for Windows (Mingw32) List-Archive: Date: Sun, 20 Jun 2004 15:25:24 -0400 Found this to be helpful for building hamlib under Cygwin/Mingw32 for linking with Windows apps: 1. To create the dlls, do the following from within Cygwin (assumes Cygwin is fully updated): # export CC="gcc -mno-cygwin" # export CXX="g++ -mno-cygwin" # ./autogen.sh --prefix=/usr/local --disable-static \ --without-rpc-backends --without-tcl-binding --without-perl-binding \ --without-python-binding --build=i686-pc-cygwin --host=i686-pc-mingw32 \ --target=i686-pc-mingw32 Note: on subsequent runs you can replace ./autogen.sh with ./configure unless there are modifications to any .ac, .m4, or Makefile.am file. In that case, "make clean", and re-run autogen as above. # make If you are only building one version of hamlib, you can proceed to install it: # make install Note: Don't run "make install" if you've already made a native Cygwin or Linux version of hamlib. It will interfere with the pkgconfig used for linking the hamlib library with a native Cygwin or Linux application. In fact if you are building two versions, it's best to have one tree for native Cygwin and another tree for cross-compiling with MingW32. This way you can avoid overwriting or corrupting any needed object files or libraries. As an alternative to "make install", manually go through all of the .libs in the source tree and copy the resulting .exes and .dlls in to a single directory. Or, create a script or batch file to do it for you. Likewise, you will need to copy all of the the .h files from include/hamlib into this same directory. Go to the directory you've just put all that stuff in and run: # strip *.dll # strip *.exe This will make the resulting images smaller. 2. To create a MSVC-compatible interface library, do the following in a Windows command window from the directory where you put all that stuff: > lib /def:libhamlib.def /machine:IX86 /name:libhamlib-1-2-2cvs-2 This will create libhamlib.lib and libhamlib.exp. This example is for hamlib v1.2.2cvs-2. You will have to use the correct version of the library in the "/name:" switch, above. REM: Using the (free) Microsoft Visual C++ Toolkit 2003, replace the "lib" command by "link /lib". libhamlib.lib and the .h includes from include/hamlib can now be used within any MSVC build (i.e., dream), but all the dlls must be put in the same directory or in PATH as the resulting .exe otherwise it won't find it. -- Mark J. Fine Remington, Virginia, USA hamlib-1.2.15.3/ars/0000755000175000017500000000000012044565037010771 500000000000000hamlib-1.2.15.3/ars/Makefile.in0000644000175000017500000004736712044564550012776 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = ars DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_ars_la_DEPENDENCIES = $(top_builddir)/lib/libmisc.la \ $(top_builddir)/src/libhamlib.la am_hamlib_ars_la_OBJECTS = ars.lo hamlib_ars_la_OBJECTS = $(am_hamlib_ars_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_ars_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(hamlib_ars_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_ars_la_SOURCES) DIST_SOURCES = $(hamlib_ars_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = hamlib-ars.la hamlib_ars_la_SOURCES = ars.c hamlib_ars_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_ars_la_LIBADD = $(top_builddir)/lib/libmisc.la \ $(top_builddir)/src/libhamlib.la noinst_HEADERS = ars.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ars/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu ars/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-ars.la: $(hamlib_ars_la_OBJECTS) $(hamlib_ars_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_ars_la_LINK) -rpath $(pkglibdir) $(hamlib_ars_la_OBJECTS) $(hamlib_ars_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ars.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/ars/ars.c0000644000175000017500000005027012044564477011655 00000000000000/* * Hamlib Rotator backend - ARS parallel port backend * Copyright (c) 2010 by Stephane Fillod * This code is inspired by work from Pablo GARCIA - EA4TX * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #ifdef HAVE_SYS_IOCTL_H #include #endif #ifdef HAVE_PTHREAD #include #endif #include "hamlib/rotator.h" #include "parallel.h" #include "misc.h" #include "register.h" #include "ars.h" #define CTL_PIN_CS PARPORT_CONTROL_AUTOFD /* pin14: Control Linefeed */ #define CTL_PIN_CLK PARPORT_CONTROL_STROBE /* pin01: Control /Strobe */ #define STA_PIN_D0 PARPORT_STATUS_BUSY /* pin11: Status Busy */ #define STA_PIN_D1 PARPORT_STATUS_ERROR /* pin15: Status /Error */ #define DTA_PIN02 0x01 /* Data0 */ #define DTA_PIN03 0x02 /* Data1 */ #define DTA_PIN04 0x04 /* Data2 */ #define DTA_PIN05 0x08 /* Data3 */ #define DTA_PIN06 0x10 /* Data4 */ #define DTA_PIN07 0x20 /* Data5 */ #define DTA_PIN08 0x40 /* Data6 */ #define DTA_PIN09 0x80 /* Data7 */ #define CTL_PIN16 PARPORT_CONTROL_INIT #define CTL_PIN17 PARPORT_CONTROL_SELECT #define ARS_BRAKE_DELAY (100*1000) /* usecs */ #define ARS_SETTLE_DELAY (500*1000) /* usecs */ #define PP_IO_PERIOD (25) /* usecs */ #define NUM_SAMPLES 3 /* TODO: take into account ADC res (8 bits -> 1.4 deg at 360 deg) * Rem: at 360 deg/mn, that's 6 deg/sec. */ #define AZ_RANGE 3. #define EL_RANGE 2. /* Check return value, with appropriate unlocking upon error. * Assumes "rot" variable is current ROT pointer. */ #define CHKPPRET(a) \ do { int _retval = a; if (_retval != RIG_OK) \ {par_unlock (&rot->state.rotport);return _retval; }} while(0) static int ars_init(ROT *rot); static int ars_cleanup(ROT *rot); static int ars_open(ROT *rot); static int ars_close(ROT *rot); static int ars_stop(ROT *rot); static int ars_move(ROT *rot, int direction, int speed); static int ars_set_position_sync(ROT *rot, azimuth_t az, elevation_t el); static int ars_set_position(ROT *rot, azimuth_t az, elevation_t el); static int ars_get_position(ROT *rot, azimuth_t *az, elevation_t *el); #ifdef HAVE_PTHREAD static void *handle_set_position(void*); #endif /* ************************************************************************* */ static int ars_clear_ctrl_pin(ROT *rot, unsigned char pin) { hamlib_port_t *pport = &rot->state.rotport; struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv; priv->pp_control &= ~pin; return par_write_control(pport, priv->pp_control); } static int ars_set_ctrl_pin(ROT *rot, unsigned char pin) { hamlib_port_t *pport = &rot->state.rotport; struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv; priv->pp_control |= pin; return par_write_control(pport, priv->pp_control); } static int ars_clear_data_pin(ROT *rot, unsigned char pin) { hamlib_port_t *pport = &rot->state.rotport; struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv; priv->pp_data &= ~pin; return par_write_data(pport, priv->pp_data); } static int ars_set_data_pin(ROT *rot, unsigned char pin) { hamlib_port_t *pport = &rot->state.rotport; struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv; priv->pp_data |= pin; return par_write_data(pport, priv->pp_data); } static int ars_has_el(const ROT *rot) { return (rot->caps->rot_type & ROT_FLAG_ELEVATION); } /* ************************************************************************* */ int ars_init(ROT *rot) { struct ars_priv_data *priv; if (!rot) return -RIG_EINVAL; priv = (struct ars_priv_data*)malloc(sizeof(struct ars_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } priv->pp_control = 0; priv->pp_data = 0; /* Always use 10 bit resolution, which supports also 8 bits * at the cost of 2 potentialy wrong lsb */ priv->adc_res = 10; /* 8 bits vs. 10 bits ADC */ priv->brake_off = 0; /* i.e. brake is ON */ priv->curr_move = 0; rot->state.priv = (void*)priv; return RIG_OK; } int ars_cleanup(ROT *rot) { if (!rot) return -RIG_EINVAL; if (rot->state.priv) { free(rot->state.priv); rot->state.priv = NULL; } return RIG_OK; } int ars_open(ROT *rot) { /* make it idle, and known state */ ars_stop(rot); #ifdef HAVE_PTHREAD { struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv; pthread_attr_t attr; int retcode; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); /* create behind-the-scene thread doing the ars_set_position_sync() */ retcode = pthread_create(&priv->thread, &attr, handle_set_position, rot); if (retcode != RIG_OK) { rig_debug(RIG_DEBUG_ERR, "%s: pthread_create: %s\n", __func__, strerror(retcode)); return -RIG_ENOMEM; } } #endif return RIG_OK; } int ars_close(ROT *rot) { #ifdef HAVE_PTHREAD struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv; pthread_cancel(priv->thread); #endif /* leave it in safe state */ ars_stop(rot); return RIG_OK; } int ars_stop(ROT *rot) { struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv; hamlib_port_t *pport = &rot->state.rotport; rig_debug(RIG_DEBUG_TRACE, "%s called, brake was %s\n", __func__, priv->brake_off ? "OFF" : "ON"); #ifdef HAVE_PTHREAD priv->set_pos_active = 0; #endif par_lock (pport); priv->brake_off = 0; priv->curr_move = 0; // Relay AUX -> Off CHKPPRET(ars_clear_data_pin(rot, DTA_PIN02 | DTA_PIN04 | DTA_PIN08)); CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN17 | CTL_PIN16)); // Elevation Relays -> Off CHKPPRET(ars_clear_data_pin(rot, DTA_PIN03 | DTA_PIN07)); par_unlock (pport); return RIG_OK; } int ars_move(ROT *rot, int direction, int speed) { struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv; hamlib_port_t *pport = &rot->state.rotport; int need_settle_delay = 0; rig_debug(RIG_DEBUG_TRACE, "%s called%s%s%s%s%s\n", __func__, direction & ROT_MOVE_LEFT ? " LEFT" : "", direction & ROT_MOVE_RIGHT ? " RIGHT" : "", direction & ROT_MOVE_UP ? " UP" : "", direction & ROT_MOVE_DOWN ? " DOWN" : "", direction == 0 ? " STOP" : ""); par_lock (pport); /* Allow the rotator to settle down when changing direction */ if (((priv->curr_move & ROT_MOVE_LEFT) && (direction & ROT_MOVE_RIGHT)) || ((priv->curr_move & ROT_MOVE_RIGHT) && (direction & ROT_MOVE_LEFT))) { // Relay AUX -> Off CHKPPRET(ars_clear_data_pin(rot, DTA_PIN02 | DTA_PIN04 | DTA_PIN08)); CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN17 | CTL_PIN16)); need_settle_delay = 1; priv->brake_off = 0; } if (ars_has_el(rot) && (((priv->curr_move & ROT_MOVE_UP) && (direction & ROT_MOVE_DOWN)) || ((priv->curr_move & ROT_MOVE_DOWN) && (direction & ROT_MOVE_UP)))) { // Elevation Relays -> Off CHKPPRET(ars_clear_data_pin(rot, DTA_PIN03 | DTA_PIN07)); need_settle_delay = 1; } if (need_settle_delay) { rig_debug(RIG_DEBUG_TRACE, "%s need settling delay\n", __func__); usleep(ARS_SETTLE_DELAY); } priv->curr_move = direction; /* Brake handling, only for AZ */ if (!priv->brake_off && (direction & (ROT_MOVE_LEFT|ROT_MOVE_RIGHT))) { /* release the brake */ if (ars_has_el(rot)) { // RCI Model Azim & Elev // Desactivated CCW/CW relays CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN17 | CTL_PIN16)); // Relay Aux CHKPPRET(ars_set_data_pin(rot, DTA_PIN02 | DTA_PIN04 | DTA_PIN06 | DTA_PIN08)); CHKPPRET(ars_clear_data_pin (rot, DTA_PIN09)); } else { // RCI Model Azimuth only // Desactivated CCW/CW relays CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN17 | CTL_PIN16)); // Relay Aux CHKPPRET(ars_set_data_pin(rot, DTA_PIN02 | DTA_PIN04 | DTA_PIN06 | DTA_PIN07 | DTA_PIN08 | DTA_PIN09)); CHKPPRET(ars_clear_data_pin(rot, DTA_PIN03 | DTA_PIN05)); } priv->brake_off = 1; usleep(ARS_BRAKE_DELAY); } if (ars_has_el(rot)) { if (direction & ROT_MOVE_UP) { /* UP */ CHKPPRET(ars_set_data_pin(rot, DTA_PIN03 | DTA_PIN06 | DTA_PIN07)); CHKPPRET(ars_clear_data_pin(rot, DTA_PIN05 | DTA_PIN09)); } else if (direction & ROT_MOVE_DOWN) { CHKPPRET(ars_set_data_pin(rot, DTA_PIN03 | DTA_PIN05 | DTA_PIN06 | DTA_PIN07)); CHKPPRET(ars_clear_data_pin(rot, DTA_PIN09)); } else { // Elevation Relays -> Off CHKPPRET(ars_clear_data_pin(rot, DTA_PIN03 | DTA_PIN07)); } } if (direction & ROT_MOVE_LEFT) { // Relay Left if (ars_has_el(rot)) { // RCI Model Azim & Elev CHKPPRET(ars_set_data_pin(rot, DTA_PIN02 | DTA_PIN04 | DTA_PIN06)); CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN16)); CHKPPRET(ars_clear_data_pin(rot, DTA_PIN09)); CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN17)); } else { // RCI Model Azimuth only CHKPPRET(ars_set_data_pin(rot, DTA_PIN02 | DTA_PIN04 | DTA_PIN06 | DTA_PIN07 | DTA_PIN08)); CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN16)); CHKPPRET(ars_clear_data_pin(rot, DTA_PIN03 | DTA_PIN05)); CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN17)); } } else if (direction & ROT_MOVE_RIGHT) { // Relay Right if (ars_has_el(rot)) { // RCI Model Azim & Elev CHKPPRET(ars_set_data_pin (rot, DTA_PIN02 | DTA_PIN04 | DTA_PIN06)); CHKPPRET(ars_set_ctrl_pin (rot, CTL_PIN17)); CHKPPRET(ars_clear_data_pin(rot, DTA_PIN09)); CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN16)); } else { // RCI Model Azimuth only CHKPPRET(ars_set_data_pin(rot, DTA_PIN02 | DTA_PIN04 | DTA_PIN06 | DTA_PIN07 | DTA_PIN08)); CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN17)); CHKPPRET(ars_clear_data_pin(rot, DTA_PIN03 | DTA_PIN05)); CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN16)); } } else { // Relay AUX -> Off CHKPPRET(ars_clear_data_pin(rot, DTA_PIN02 | DTA_PIN04 | DTA_PIN08)); CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN17 | CTL_PIN16)); // AZ stop } par_unlock (pport); return RIG_OK; } static int angle_in_range(float angle, float angle_base, float range) { return (angle >= angle_base-range && angle <= angle_base+range); } /* * Thread handler */ #ifdef HAVE_PTHREAD static void *handle_set_position(void *arg) { ROT *rot = (ROT*) arg; struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv; int retcode; while (1) { if (!priv->set_pos_active) { /* TODO: replace polling period by cond var */ usleep(100*1000); continue; } retcode = ars_set_position_sync(rot, priv->target_az, priv->target_el); priv->set_pos_active = 0; if (retcode != RIG_OK) { rig_debug(RIG_DEBUG_WARN, "%s: ars_set_position_sync() failed: %s\n", __func__, rigerror(retcode)); usleep(1000*1000); continue; } } return NULL; } #endif /* * ars_set_position_sync() is synchronous. * See handle_set_position_async() for asynchronous thread handler, * with wait loop in background */ int ars_set_position_sync(ROT *rot, azimuth_t az, elevation_t el) { azimuth_t curr_az, prev_az; elevation_t curr_el, prev_el; int retval; int az_move, el_move; struct timeval last_pos_az_tv, last_pos_el_tv; rig_debug(RIG_DEBUG_TRACE, "%s called: %.1f %.1f\n", __func__, az, el); ars_stop(rot); retval = ars_get_position(rot, &curr_az, &curr_el); if (retval != RIG_OK) return retval; /* watchdog init */ prev_az = curr_az; prev_el = curr_el; gettimeofday(&last_pos_az_tv, NULL); last_pos_el_tv = last_pos_az_tv; while (!angle_in_range(curr_az, az, AZ_RANGE) || (ars_has_el(rot) && !angle_in_range(curr_el, el, EL_RANGE)) ) { if (curr_az < (az-AZ_RANGE)) az_move = ROT_MOVE_RIGHT; else if (curr_az > (az+AZ_RANGE)) az_move = ROT_MOVE_LEFT; else az_move = 0; if (ars_has_el(rot)) { if (curr_el < (el-EL_RANGE)) el_move = ROT_MOVE_UP; else if (curr_el > (el+EL_RANGE)) el_move = ROT_MOVE_DOWN; else el_move = 0; } else { el_move = 0; } retval = ars_move(rot, az_move|el_move, 0); if (retval != RIG_OK) { ars_stop(rot); return retval; } /* wait a little */ usleep(10*1000); retval = ars_get_position(rot, &curr_az, &curr_el); if (retval != RIG_OK) { ars_stop(rot); return retval; } /* Watchdog detecting when rotor is blocked unexpectedly */ #define AZ_WATCHDOG 5000 /* ms */ #define EL_WATCHDOG 5000 /* ms */ if (az_move != 0 && angle_in_range(curr_az, prev_az, AZ_RANGE)) { if (rig_check_cache_timeout(&last_pos_az_tv, AZ_WATCHDOG)) { ars_stop(rot); return -RIG_ETIMEOUT; } } else { prev_az = curr_az; gettimeofday(&last_pos_az_tv, NULL); } if (el_move != 0 && ars_has_el(rot) && angle_in_range(curr_el, prev_el, EL_RANGE)) { if (rig_check_cache_timeout(&last_pos_el_tv, EL_WATCHDOG)) { ars_stop(rot); return -RIG_ETIMEOUT; } } else { prev_el = curr_el; gettimeofday(&last_pos_el_tv, NULL); } } return ars_stop(rot); } int ars_set_position(ROT *rot, azimuth_t az, elevation_t el) { #ifdef HAVE_PTHREAD struct ars_priv_data *priv = (struct ars_priv_data *)rot->state.priv; /* will be picked by handle_set_position() next polling tick */ priv->target_az = az; priv->target_el = el; priv->set_pos_active = 1; return RIG_OK; #else return ars_set_position_sync(rot, az, el); #endif } static int comparunsigned(const void *a, const void *b) { const unsigned ua=*(const unsigned*)a, ub = *(const unsigned*)b; return ua==ub ? 0 : uastate.priv; struct rot_state *rs = &rot->state; hamlib_port_t *pport = &rs->rotport; int i, num_sample; unsigned az_samples[NUM_SAMPLES], az_value; unsigned el_samples[NUM_SAMPLES], el_value; unsigned char status; par_lock (pport); /* flush last sampled value, with a dummy read */ CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK)); usleep (PP_IO_PERIOD); CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CS)); usleep (PP_IO_PERIOD); for (i = 0; i < priv->adc_res; i++) { CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN_CLK)); usleep (PP_IO_PERIOD); CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK)); usleep (PP_IO_PERIOD); } CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK)); usleep (PP_IO_PERIOD); CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN_CS)); /* end of dummy read */ for (num_sample=0; num_sample < NUM_SAMPLES; num_sample++) { /* read ADC value TLC(1)549 (8/10 bits), by SPI bitbanging */ usleep (PP_IO_PERIOD); CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK)); usleep (PP_IO_PERIOD); CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CS)); usleep (PP_IO_PERIOD); az_samples[num_sample] = 0; el_samples[num_sample] = 0; for (i = 0; i < priv->adc_res; i++) { CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN_CLK)); usleep (PP_IO_PERIOD); CHKPPRET(par_read_status(pport, &status)); az_samples[num_sample] <<= 1; az_samples[num_sample] |= (status & STA_PIN_D0) ? 1 : 0; el_samples[num_sample] <<= 1; el_samples[num_sample] |= (status & STA_PIN_D1) ? 1 : 0; CHKPPRET(ars_clear_ctrl_pin(rot, CTL_PIN_CLK)); usleep (PP_IO_PERIOD); } CHKPPRET(ars_set_ctrl_pin(rot, CTL_PIN_CS)); rig_debug(RIG_DEBUG_TRACE, "%s: raw samples: az %u, el %u\n", __func__, az_samples[num_sample], el_samples[num_sample]); usleep (PP_IO_PERIOD); } par_unlock (pport); qsort (az_samples, NUM_SAMPLES, sizeof(unsigned), comparunsigned); qsort (el_samples, NUM_SAMPLES, sizeof(unsigned), comparunsigned); /* select median value in order to rule out glitches */ az_value = az_samples[NUM_SAMPLES/2]; el_value = el_samples[NUM_SAMPLES/2]; *az = rs->min_az + ((float)az_value * (rs->max_az - rs->min_az)) / ((1 << priv->adc_res)-1); *el = rs->min_el + ((float)el_value * (rs->max_el - rs->min_el)) / ((1 << priv->adc_res)-1); rig_debug(RIG_DEBUG_TRACE, "%s: az=%.1f el=%.1f\n", __func__, *az, *el); return RIG_OK; } /* ************************************************************************* */ /* * ARS rotator capabilities. */ /* * RCI/RCI-SE, with Elevation daugtherboard/unit. */ const struct rot_caps rci_azel_rot_caps = { .rot_model = ROT_MODEL_RCI_AZEL, .model_name = "ARS RCI AZ&EL", .mfg_name = "EA4TX", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_AZEL, /* AZ&EL units */ .port_type = RIG_PORT_PARALLEL, .write_delay = 0, .post_write_delay = 10, .timeout = 0, .retry = 3, .min_az = 0, .max_az = 360, .min_el = 0, .max_el = 180, /* TBC */ .rot_init = ars_init, .rot_cleanup = ars_cleanup, .rot_open = ars_open, .rot_close = ars_close, .set_position = ars_set_position, .get_position = ars_get_position, .stop = ars_stop, .move = ars_move, }; /* * RCI/RCI-SE, without Elevation daugtherboard/unit. * Azimuth only */ const struct rot_caps rci_az_rot_caps = { .rot_model = ROT_MODEL_RCI_AZ, .model_name = "ARS RCI AZ", .mfg_name = "EA4TX", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_AZIMUTH, /* AZ-only unit */ .port_type = RIG_PORT_PARALLEL, .write_delay = 0, .post_write_delay = 10, .timeout = 0, .retry = 3, .min_az = 0, .max_az = 360, .min_el = 0, .max_el = 180, /* TBC */ .rot_init = ars_init, .rot_cleanup = ars_cleanup, .rot_open = ars_open, .rot_close = ars_close, .set_position = ars_set_position, .get_position = ars_get_position, .stop = ars_stop, .move = ars_move, }; /* ************************************************************************* */ DECLARE_INITROT_BACKEND(ars) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rot_register(&rci_az_rot_caps); rot_register(&rci_azel_rot_caps); return RIG_OK; } /* ************************************************************************* */ /* end of file */ hamlib-1.2.15.3/ars/ars.h0000644000175000017500000000246012044564477011660 00000000000000/* * Hamlib Rotator backend - ARS interface protocol * Copyright (c) 2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROT_ARS_H #define _ROT_ARS_H 1 #include "hamlib/rig.h" struct ars_priv_data { unsigned adc_res; int brake_off; int curr_move; unsigned char pp_control; unsigned char pp_data; #ifdef HAVE_PTHREAD pthread_t thread; int set_pos_active; azimuth_t target_az; elevation_t target_el; #endif }; extern const struct rot_caps rci_az_rot_caps; extern const struct rot_caps rci_azel_rot_caps; #endif /* _ROT_ARS_H */ hamlib-1.2.15.3/ars/Makefile.am0000644000175000017500000000036412044564477012757 00000000000000 pkglib_LTLIBRARIES = hamlib-ars.la hamlib_ars_la_SOURCES = ars.c hamlib_ars_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_ars_la_LIBADD = $(top_builddir)/lib/libmisc.la \ $(top_builddir)/src/libhamlib.la noinst_HEADERS = ars.h hamlib-1.2.15.3/kachina/0000755000175000017500000000000012044565021011573 500000000000000hamlib-1.2.15.3/kachina/505dsp.c0000644000175000017500000001206312044564477012717 00000000000000/* * Hamlib Kachina backend - 505DSP description * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #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_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_IF|RIG_LEVEL_RAWSTR|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 dBm2S9(x) ((x)+73) #define K505DSP_STR_CAL { 2, { \ { 0, dBm2S9(-130) }, \ { 127, dBm2S9(20) }, \ } } /* * 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.3", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_COMPUTER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .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 = RIG_LEVEL_RAWSTR, .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, }, .str_cal = K505DSP_STR_CAL, .set_freq = kachina_set_freq, .set_mode = kachina_set_mode, .get_level = kachina_get_level, }; /* * Function definitions below */ hamlib-1.2.15.3/kachina/kachina.h0000644000175000017500000000231512044564477013301 00000000000000/* * Hamlib Kachina backend - main header * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _KACHINA_H #define _KACHINA_H 1 #include #include 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); int kachina_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); extern const struct rig_caps k505dsp_caps; #endif /* _KACHINA_H */ hamlib-1.2.15.3/kachina/Makefile.in0000644000175000017500000004766212044564553013610 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = kachina DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_kachina_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = 505dsp.lo am_hamlib_kachina_la_OBJECTS = $(am__objects_1) kachina.lo hamlib_kachina_la_OBJECTS = $(am_hamlib_kachina_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_kachina_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_kachina_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_kachina_la_SOURCES) DIST_SOURCES = $(hamlib_kachina_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ALINCOSRCLIST = 505dsp.c pkglib_LTLIBRARIES = hamlib-kachina.la hamlib_kachina_la_SOURCES = $(ALINCOSRCLIST) kachina.c hamlib_kachina_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_kachina_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = kachina.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu kachina/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu kachina/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-kachina.la: $(hamlib_kachina_la_OBJECTS) $(hamlib_kachina_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_kachina_la_LINK) -rpath $(pkglibdir) $(hamlib_kachina_la_OBJECTS) $(hamlib_kachina_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/505dsp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kachina.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/kachina/kachina.c0000644000175000017500000001417612044564477013304 00000000000000/* * Hamlib Kachina backend - main file * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "cal.h" #include "register.h" #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 */ static 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; serial_flush(&rs->rigport); retval = write_block(&rs->rigport, (char *) buf4, 4); if (retval != RIG_OK) return retval; count = read_string(&rs->rigport, (char *) buf4, 1, "", 0); if (count != 1) return count; return (buf4[0]==GDCMD) ? RIG_OK : -RIG_EPROTO; } static 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; serial_flush(&rs->rigport); retval = write_block(&rs->rigport, (char *) buf, cmd_len); if (retval != RIG_OK) return retval; count = read_string(&rs->rigport, (char *) buf, 1, "", 0); 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. */ static void 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', (char *) freqbuf, 4); if (retval != RIG_OK) return retval; /* transmit frequency */ retval = kachina_trans_n(rig, 'T', (char *) 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; } /* * kachina_get_level * Assumes rig!=NULL */ int kachina_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int i, count; unsigned char buf[32]; static const char rcv_signal_range[128] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f }; /* so far, only RAWSTR supported! */ if (level != RIG_LEVEL_RAWSTR) return -RIG_ENIMPL; /* telemetry sent to the PC automatically at a 50msec rate */ serial_flush(&rig->state.rigport); count = read_string(&rig->state.rigport, (char *) buf, 31, rcv_signal_range, 128); if (count < 1) return count; for (i=0; ii = buf[i]; return RIG_OK; } /* * initrigs_kachina is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(kachina) { rig_debug(RIG_DEBUG_VERBOSE, "kachina: _init called\n"); rig_register(&k505dsp_caps); return RIG_OK; } hamlib-1.2.15.3/kachina/Makefile.am0000644000175000017500000000042112044564477013562 00000000000000ALINCOSRCLIST = 505dsp.c pkglib_LTLIBRARIES = hamlib-kachina.la hamlib_kachina_la_SOURCES = $(ALINCOSRCLIST) kachina.c hamlib_kachina_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_kachina_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = kachina.h hamlib-1.2.15.3/install-sh0000755000175000017500000003253712044564547012147 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: hamlib-1.2.15.3/rpcrot/0000755000175000017500000000000012044565026011513 500000000000000hamlib-1.2.15.3/rpcrot/rpcrot_backend.c0000644000175000017500000002214412044564477014573 00000000000000/* * Hamlib RPC backend - main file * Copyright (c) 2001-2008 by Stephane Fillod * Contributed by Francois Retief * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include #include "hamlib/rotator.h" #include "serial.h" #include "misc.h" #include "token.h" #include "register.h" #include #ifdef HAVE_RPC_RPCENT_H #include #endif #include "rpcrot.h" #include "rpcrot_backend.h" struct rpcrot_priv_data { CLIENT *cl; unsigned long prognum; }; #define ROTPROTO "udp" /* * Borrowed from stringify.h * Indirect stringification. Doing two levels allows the parameter to be a * macro itself. For example, compile with -DFOO=bar, __stringify(FOO) * converts to "bar". */ #define r_stringify_1(x) #x #define r_stringify(x) r_stringify_1(x) /* ************************************************************************* */ static unsigned long extract_prognum(const char val[]) { if (val[0] == '+') { return ROTPROG + atol(val+1); } else if (val[0] < '0' || val[0] > '9') { struct rpcent *ent; ent = getrpcbyname (val); if (ent) return ent->r_number; else return 0; } else return atol(val); } static int rpcrot_init(ROT *rot) { struct rpcrot_priv_data *priv; if (!rot || !rot->caps) return -RIG_EINVAL; rot->state.priv = malloc(sizeof(struct rpcrot_priv_data)); if (!rot->state.priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } priv = (struct rpcrot_priv_data*)rot->state.priv; rot->state.rotport.type.rig = RIG_PORT_RPC; strcpy(rot->state.rotport.pathname, "localhost"); priv->prognum = ROTPROG; return RIG_OK; } static int rpcrot_cleanup(ROT *rot) { if (!rot) return -RIG_EINVAL; if (rot->state.priv) free(rot->state.priv); rot->state.priv = NULL; return RIG_OK; } /* ************************************************************************* */ /* * assumes rot!=NULL, rs->priv != NULL */ static int rpcrot_open(ROT *rot) { struct rpcrot_priv_data *priv; struct rot_state *rs; model_x *mdl_res; rotstate_res *rs_res; rot_model_t model; // const struct rot_caps *caps; char *server, *s; rs = &rot->state; priv = (struct rpcrot_priv_data *)rs->priv; server = strdup(rs->rotport.pathname); s = strchr(server, ':'); if (s) { unsigned long prognum; *s = '\0'; prognum = extract_prognum(s+1); if (prognum == 0) { free(server); return -RIG_ECONF; } priv->prognum = prognum; } priv->cl = clnt_create(server, priv->prognum, ROTVERS, ROTPROTO); if (priv->cl == NULL) { clnt_pcreateerror(server); free(server); return -RIG_ECONF; } mdl_res = getmodel_1(NULL, priv->cl); if (mdl_res == NULL) { clnt_perror(priv->cl, server); clnt_destroy(priv->cl); free(server); priv->cl = NULL; return -RIG_EPROTO; } model = *mdl_res; rig_debug(RIG_DEBUG_TRACE,"%s: model %d\n", __FUNCTION__, model); /* * autoload if necessary */ rot_check_backend(model); // caps = rot_get_caps(model); /* * Load state values from remote rotator. */ rs_res = getrotstate_1(NULL, priv->cl); if (rs_res == NULL) { clnt_perror(priv->cl, server); clnt_destroy(priv->cl); free(server); priv->cl = NULL; return -RIG_EPROTO; } free(server); if (rs_res->rotstatus != RIG_OK) { rig_debug(RIG_DEBUG_VERBOSE, "%s: error from remote - %s\n", __FUNCTION__, rigerror(rs_res->rotstatus)); return rs_res->rotstatus; } rs->min_az = rs_res->rotstate_res_u.state.az_min; rs->max_az = rs_res->rotstate_res_u.state.az_max; rs->min_el = rs_res->rotstate_res_u.state.el_min; rs->max_el = rs_res->rotstate_res_u.state.el_max; return RIG_OK; } static int rpcrot_close(ROT *rot) { struct rpcrot_priv_data *priv; priv = (struct rpcrot_priv_data*)rot->state.priv; if (priv->cl) clnt_destroy(priv->cl); return RIG_OK; } /* ************************************************************************* */ static int rpcrot_set_position(ROT *rot, azimuth_t az, elevation_t el) { struct rpcrot_priv_data *priv; int *result; position_s parg; priv = (struct rpcrot_priv_data *)rot->state.priv; parg.az = az; parg.el = el; result = setposition_1(&parg, priv->cl); if (result == NULL) { clnt_perror(priv->cl, "setposition_1"); return -RIG_EPROTO; } return *result; } static int rpcrot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { struct rpcrot_priv_data *priv; position_res *pres; priv = (struct rpcrot_priv_data *)rot->state.priv; pres = getposition_1(NULL, priv->cl); if (pres == NULL) { clnt_perror(priv->cl, "getposition_1"); return -RIG_EPROTO; } if (pres->rotstatus == RIG_OK) { *az = pres->position_res_u.pos.az; *el = pres->position_res_u.pos.el; } return pres->rotstatus; } static int rpcrot_stop(ROT *rot) { struct rpcrot_priv_data *priv; int *result; priv = (struct rpcrot_priv_data *)rot->state.priv; result = stop_1(NULL, priv->cl); if (result == NULL) { clnt_perror(priv->cl, "stop_1"); return -RIG_EPROTO; } return *result; } static int rpcrot_reset(ROT *rot, rot_reset_t reset) { struct rpcrot_priv_data *priv; int *result; rot_reset_x rstx; rstx = reset; /* FIXME: is this correct? */ priv = (struct rpcrot_priv_data *)rot->state.priv; result = reset_1(&rstx, priv->cl); if (result == NULL) { clnt_perror(priv->cl, "reset_1"); return -RIG_EPROTO; } return *result; } static int rpcrot_park(ROT *rot) { struct rpcrot_priv_data *priv; int *result; priv = (struct rpcrot_priv_data *)rot->state.priv; result = park_1(NULL, priv->cl); if (result == NULL) { clnt_perror(priv->cl, "park_1"); return -RIG_EPROTO; } return *result; } static int rpcrot_move(ROT *rot, int direction, int speed) { struct rpcrot_priv_data *priv; move_s arg; int *result; arg.direction = direction; arg.speed = speed; priv = (struct rpcrot_priv_data *)rot->state.priv; result = move_1(&arg, priv->cl); if (result == NULL) { clnt_perror(priv->cl, "move_1"); return -RIG_EPROTO; } return *result; } #define TOK_PROGNUM TOKEN_BACKEND(1) static const struct confparams rpcrot_cfg_params[] = { { TOK_PROGNUM, "prognum", "Program number", "RPC program number", r_stringify(ROTPROG), RIG_CONF_NUMERIC, { .n = { 100000, ULONG_MAX, 1 } } }, { RIG_CONF_END, NULL, } }; /* * Assumes rot!=NULL, rot->state.priv!=NULL */ int rpcrot_set_conf(ROT *rot, token_t token, const char *val) { struct rpcrot_priv_data *priv; struct rot_state *rs; rs = &rot->state; priv = (struct rpcrot_priv_data*)rs->priv; switch(token) { case TOK_PROGNUM: { unsigned long prognum; prognum = extract_prognum(val); if (prognum == 0) return -RIG_EINVAL; priv->prognum = prognum; break; } default: return -RIG_EINVAL; } return RIG_OK; } /* * assumes rot!=NULL, * Assumes rot!=NULL, rot->state.priv!=NULL * and val points to a buffer big enough to hold the conf value. */ int rpcrot_get_conf(ROT *rot, token_t token, char *val) { struct rpcrot_priv_data *priv; struct rot_state *rs; rs = &rot->state; priv = (struct rpcrot_priv_data*)rs->priv; switch(token) { case TOK_PROGNUM: sprintf(val, "%ld", priv->prognum); break; default: return -RIG_EINVAL; } return RIG_OK; } /* ************************************************************************* */ struct rot_caps rpcrot_caps = { .rot_model = ROT_MODEL_RPC, .model_name = "RPC rotator", .mfg_name = "Hamlib", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_OTHER, .port_type = RIG_PORT_NONE, .priv = NULL, .rot_init = rpcrot_init, .rot_cleanup = rpcrot_cleanup, .rot_open = rpcrot_open, .rot_close = rpcrot_close, .cfgparams = rpcrot_cfg_params, .set_conf = rpcrot_set_conf, .get_conf = rpcrot_get_conf, .set_position = rpcrot_set_position, .get_position = rpcrot_get_position, .stop = rpcrot_stop, .reset = rpcrot_reset, .park = rpcrot_park, .move = rpcrot_move, }; /* ************************************************************************* */ DECLARE_INITROT_BACKEND(rpcrot) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); rot_register(&rpcrot_caps); return RIG_OK; } /* ************************************************************************* */ /* end of file */ hamlib-1.2.15.3/rpcrot/rpc.rotd.80000644000175000017500000001126512044564477013275 00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH ROTD "8" "February 24, 2007" "Hamlib" "RPC Rotator Daemon" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME rotd \- Hamlib rotator service daemon .SH SYNOPSIS .B rpc.rotd [\fIOPTION\fR]... .SH DESCRIPTION The \fBrotd\fP program is a \fBHamlib\fP rotator daemon that handles RPC client requests. This allows multiple user programs to share one rotator. At this time multiple rotator support is not available (help needed!). .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. Keep in mind that \fBHamlib\fP is BETA level software. While a lot of backend libraries lack complete rig support, the basic functions are usually well supported. The API may change without publicized notice, while an advancement of the minor version (e.g. 1.1.x to 1.2.x) indicates such a change. .PP Please report bugs and provide feedback at the e-mail address given in the REPORTING BUGS section. Patches and code enhancements are also welcome. .SH OPTIONS This program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). Here is a summary of the supported options: .TP .B \-m, --model=id Select rotator model number. See model list (use 'rotctl -l'). .br NB: \fBrotctl\fP (or third party software) will use rotor model 101 when using \fBrotd\fP. .TP .B \-r, --rot-file=device Use \fIdevice\fP as the file name of the port the rotator is connected. Often a serial port, but could be a USB to serial adapter. Typically /dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0, etc. .TP .B \-s, --serial-speed=baud Set serial speed to \fIbaud\fP rate. Uses maximum serial speed from rotor backend as the default. .TP .B \-C, --set-conf=parm=val[,parm=val]* Set config parameter. e.g. stop_bits=2 .br Use -L option of \fBrotctl\fP for a list. .TP .B \-t, --prog=number Use \fInumber\fP as the RPC program number. The default is 536873369. .TP .B \-v, --verbose Set verbose mode, cumulative (see DIAGNOSTICS below). .TP .B \-h, --help Show summary of these options and exit. .TP .B \-V, \-\-version Show version of \fBrpc.rotd\fP and exit. .PP Please note that the backend for the rotator to be controlled, or the rotator itself may not support some commands. In that case, the operation will fail with a \fBHamlib\fP error code. .SH EXAMPLES Start \fBrotd\fP as root for a RotorEZ using a USB to serial adapter and backgrounding: .PP # rpc.rotd -m 401 -r /dev/ttyUSB1 & .PP Start \fBrotd\fP as root for a RotorEZ using COM1 while generating TRACE output: .PP # rpc.rotd -m 401 -r /dev/ttyS0 -vvvvv .PP Start \fBrotd\fP as root for a RotorEZ using a USB to serial adapter while setting baud rate and stop bits and backgrounding: .PP # rpc.rotd -m 401 -r /dev/ttyUSB1 -s 4800 -C stop_bits=2 & .SH DIAGNOSTICS The \fB-v\fP, \fB--version\fP option allows different levels of diagnostics to be output to \fBstderr\fP and correspond to -v for BUG, -vv for ERR, -vvv for WARN, -vvvv for VERBOSE, or -vvvvv for TRACE. .PP A given verbose level is useful for providing needed debugging information to the email address below. For example, TRACE output shows all of the values sent to and received from the rotator which is very useful for rotator backend library development and may be requested by the developers. .SH SECURITY No authentication whatsoever; could be done through domain restriction, though. Please ask if stronger security is needed. .SH BUGS Does not support more than one communication device for multiple rotor control. (e.g. for Single Operator 2 Radio) Help needed! .SH REPORTING BUGS Report bugs to . .br We are already aware of the bug in the previous section :-) .SH AUTHORS Written by Stephane Fillod and the Hamlib Group .br . .SH COPYRIGHT Copyright \(co 2000-2007 Stephane Fillod and the Hamlib Group. Contributed by Francois Retief . .br This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .SH SEE ALSO .BR rotctl (1), .BR hamlib (3) hamlib-1.2.15.3/rpcrot/rpcrot.x0000644000175000017500000000531412044564477013151 00000000000000%/* % * Hamlib Interface - RPC definitions % * Copyright (c) 2000-2002 by Stephane Fillod and Frank Singleton % * Contributed by Francois Retief % * % * % * This library is free software; you can redistribute it and/or % * modify it under the terms of the GNU Lesser General Public % * License as published by the Free Software Foundation; either % * version 2.1 of the License, or (at your option) any later version. % * % * This library 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 % * Lesser General Public License for more details. % * % * You should have received a copy of the GNU Lesser General Public % * License along with this library; if not, write to the Free Software % * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA % * % */ % #if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__ % /* rpcgen produces code containing unused variables. hush that... */ % # pragma GCC diagnostic ignored "-Wunused-variable" % #endif /* This gets stuffed into the source files. */ #if RPC_HDR %#ifdef HAVE_CONFIG_H %#include "config.h" %#endif %#include %#include #endif %#if __APPLE__ %static int _rpcsvcdirty; %#endif /* ************************************************************************* */ typedef unsigned int model_x; typedef float azimuth_x; typedef float elevation_x; typedef unsigned int rot_reset_x; /* ************************************************************************* */ struct position_arg { azimuth_x az; elevation_x el; }; struct move_s { int direction; int speed; }; /* ************************************************************************* */ struct position_s { azimuth_x az; elevation_x el; }; union position_res switch (int rotstatus) { case 0: position_s pos; default: void; }; /* ************************************************************************* */ struct rotstate_s { azimuth_x az_min; azimuth_x az_max; elevation_x el_min; elevation_x el_max; }; union rotstate_res switch (int rotstatus) { case 0: rotstate_s state; default: void; }; /* ************************************************************************* */ program ROTPROG { version ROTVERS { model_x GETMODEL(void) = 1; rotstate_res GETROTSTATE(void) = 3; int SETPOSITION(position_s) = 10; position_res GETPOSITION(void) = 11; int STOP(void) = 12; int RESET(rot_reset_x) = 13; int PARK(void) = 14; int MOVE(move_s) = 15; } = 1; } = 0x20000999; /* ************************************************************************* */ /* end of file */ hamlib-1.2.15.3/rpcrot/rpcrot_proc.c0000644000175000017500000000671012044564477014150 00000000000000/* * Hamlib RPC server - procedures * Copyright (c) 2000-2002 by Stephane Fillod and Frank Singleton * Contributed by Francois Retief * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "rpcrot.h" #include extern ROT *the_rpc_rot; model_x * getmodel_1_svc(void *argp, struct svc_req *rqstp) { static model_x result; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); result = the_rpc_rot->caps->rot_model; return &result; } rotstate_res * getrotstate_1_svc(void *argp, struct svc_req *rqstp) { static rotstate_res res; struct rot_state *rs; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); if (!the_rpc_rot->state.comm_state) { res.rotstatus = -RIG_ERJCTED; return &res; } rs = &the_rpc_rot->state; /* Copy the current state of the rotator into the transfer variable */ res.rotstate_res_u.state.az_min = rs->min_az; res.rotstate_res_u.state.az_max = rs->max_az; res.rotstate_res_u.state.el_min = rs->min_el; res.rotstate_res_u.state.el_max = rs->max_el; res.rotstatus = RIG_OK; return &res; } int * setposition_1_svc(position_s *argp, struct svc_req *rqstp) { static int result; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); rig_debug(RIG_DEBUG_VERBOSE, "Setting position to %.1f deg Az, %.1f deg El\n", argp->az, argp->el); result = rot_set_position(the_rpc_rot, argp->az, argp->el); return &result; } position_res * getposition_1_svc(void *argp, struct svc_req *rqstp) { static position_res res; azimuth_t az; elevation_t el; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); memset(&res, 0, sizeof(res)); res.rotstatus = rot_get_position(the_rpc_rot, &az, &el); if (res.rotstatus == RIG_OK) { rig_debug(RIG_DEBUG_VERBOSE, "Getting position of %.1f deg Az, %.1f deg El\n", az, el); res.position_res_u.pos.az = az; res.position_res_u.pos.el = el; } return &res; } int * stop_1_svc(void *argp, struct svc_req *rqstp) { static int result; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); result = rot_stop(the_rpc_rot); return &result; } int * reset_1_svc(rot_reset_x *argp, struct svc_req *rqstp) { static int result; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); result = rot_reset(the_rpc_rot, *argp); return &result; } int * park_1_svc(void *argp, struct svc_req *rqstp) { static int result; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); result = rot_park(the_rpc_rot); return &result; } int * move_1_svc(move_s *argp, struct svc_req *rqstp) { static int result; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); result = rot_move(the_rpc_rot, argp->direction, argp->speed); return &result; } hamlib-1.2.15.3/rpcrot/Makefile.in0000644000175000017500000006662612044564555013526 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ # rpcrot_xdr.c rpcrot_svc.c rpcrot_clnt.c and rpcrot.h are generated by rpcgen # have to provide: rpcrot_proc.c rpcrotd.c rpcrot_backend.c # # Note: automake complains rpcrot_xdr.c is generated both with and # without libtool, hence the copy rpcrot_xdr_lt.c VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ sbin_PROGRAMS = rpc.rotd$(EXEEXT) subdir = rpcrot DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(sbindir)" \ "$(DESTDIR)$(man8dir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_rpcrot_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am_hamlib_rpcrot_la_OBJECTS = rpcrot_backend.lo nodist_hamlib_rpcrot_la_OBJECTS = rpcrot_clnt.lo rpcrot_xdr_lt.lo hamlib_rpcrot_la_OBJECTS = $(am_hamlib_rpcrot_la_OBJECTS) \ $(nodist_hamlib_rpcrot_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_rpcrot_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_rpcrot_la_LDFLAGS) $(LDFLAGS) \ -o $@ PROGRAMS = $(sbin_PROGRAMS) am_rpc_rotd_OBJECTS = rpcrotd.$(OBJEXT) rpcrot_proc.$(OBJEXT) nodist_rpc_rotd_OBJECTS = rpcrot_svc.$(OBJEXT) rpcrot_xdr.$(OBJEXT) rpc_rotd_OBJECTS = $(am_rpc_rotd_OBJECTS) $(nodist_rpc_rotd_OBJECTS) rpc_rotd_LDADD = $(LDADD) rpc_rotd_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(rpc_rotd_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_rpcrot_la_SOURCES) \ $(nodist_hamlib_rpcrot_la_SOURCES) $(rpc_rotd_SOURCES) \ $(nodist_rpc_rotd_SOURCES) DIST_SOURCES = $(hamlib_rpcrot_la_SOURCES) $(rpc_rotd_SOURCES) man8dir = $(mandir)/man8 NROFF = nroff MANS = $(man_MANS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LDADD = $(top_builddir)/src/libhamlib.la $(top_builddir)/lib/libmisc.la @NET_LIBS@ DEPENDENCIES = $(top_builddir)/src/libhamlib.la BUILT_SOURCES = rpcrot_xdr.c rpcrot_svc.c rpcrot_xdr_lt.c rpcrot_clnt.c rpcrot.h DISTCLEANFILES = $(BUILT_SOURCES) # needed for backward compatibility on Solaris. AM_CFLAGS = $(CFLAGS) -DPORTMAP # The RPC backend pkglib_LTLIBRARIES = hamlib-rpcrot.la hamlib_rpcrot_la_SOURCES = rpcrot_backend.c rpcrot_backend.h nodist_hamlib_rpcrot_la_SOURCES = rpcrot_clnt.c rpcrot_xdr_lt.c rpcrot.h hamlib_rpcrot_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_rpcrot_la_LIBADD = $(top_builddir)/src/libhamlib.la @NET_LIBS@ rpc_rotd_DEPENDENCIES = $(DEPENDENCIES) @ROT_BACKENDEPS@ hamlib-rpcrot.la rpc_rotd_SOURCES = rpcrotd.c rpcrot_proc.c nodist_rpc_rotd_SOURCES = rpcrot_svc.c rpcrot_xdr.c rpcrot.h rpc_rotd_LDFLAGS = @ROT_BACKENDLNK@ man_MANS = rpc.rotd.8 EXTRA_DIST = rpcrot.x $(man_MANS) RPCGEN = rpcgen all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu rpcrot/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu rpcrot/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-rpcrot.la: $(hamlib_rpcrot_la_OBJECTS) $(hamlib_rpcrot_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_rpcrot_la_LINK) -rpath $(pkglibdir) $(hamlib_rpcrot_la_OBJECTS) $(hamlib_rpcrot_la_LIBADD) $(LIBS) install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)" @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files clean-sbinPROGRAMS: @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list rpc.rotd$(EXEEXT): $(rpc_rotd_OBJECTS) $(rpc_rotd_DEPENDENCIES) @rm -f rpc.rotd$(EXEEXT) $(AM_V_CCLD)$(rpc_rotd_LINK) $(rpc_rotd_OBJECTS) $(rpc_rotd_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcrot_backend.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcrot_clnt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcrot_proc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcrot_svc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcrot_xdr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcrot_xdr_lt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpcrotd.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man8: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)" @list=''; test -n "$(man8dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ done; } uninstall-man8: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man8dir)" && rm -f $$files; } ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ clean-sbinPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-sbinPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man8 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-pkglibLTLIBRARIES \ uninstall-sbinPROGRAMS uninstall-man: uninstall-man8 .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES clean-sbinPROGRAMS ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-man8 install-pdf \ install-pdf-am install-pkglibLTLIBRARIES install-ps \ install-ps-am install-sbinPROGRAMS install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-man uninstall-man8 \ uninstall-pkglibLTLIBRARIES uninstall-sbinPROGRAMS rpcrot.h: Makefile rpcrot.x rm -f $@ $(RPCGEN) -h -C `test -f rpcrot.x || echo '$(srcdir)/'`rpcrot.x -o $@ # Need to chdir in source dir, otherwise rpcgen hardcodes header path. sigh. rpcrot_clnt.c: Makefile rpcrot.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -l -C rpcrot.x -o $$abs_builddir/$@ rpcrot_svc.c: Makefile rpcrot.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -m -C rpcrot.x -o $$abs_builddir/$@ # note: # we need 2 rpcrot_xdr.c's: one for static rpcrot deamon, one for lt backend rpcrot_xdr.c: Makefile rpcrot.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -c -C rpcrot.x -o $$abs_builddir/$@ rpcrot_xdr_lt.c: Makefile rpcrot.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -c -C rpcrot.x -o $$abs_builddir/$@ # 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: hamlib-1.2.15.3/rpcrot/rpcrotd.c0000644000175000017500000001545512044564477013277 00000000000000/* * rpcrotd - (C) Stephane Fillod 2001-2002 * * This program let programs control a rotator through * the mean of RPC services using Hamlib. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "rpcrot.h" #include #include #include #include #include #include #include #include #include #ifdef HAVE_RPC_RPCENT_H #include #endif #include #include /* * Prototypes */ void usage(); void version(); void rotd_exit(); void rotprog_1(struct svc_req *rqstp, register SVCXPRT *transp); /* * Reminder: when adding long options, * keep up to date SHORT_OPTIONS, usage()'s output and man page. thanks. * NB: do NOT use -W since it's reserved by POSIX. * TODO: add an option to read from a file */ #define SHORT_OPTIONS "m:r:s:C:t:vhV" static struct option long_options[] = { {"model", 1, 0, 'm'}, {"rot-file", 1, 0, 'r'}, {"serial-speed", 1, 0, 's'}, {"set-conf", 1, 0, 'C'}, {"prog", 1, 0, 't'}, {"verbose", 0, 0, 'v'}, {"help", 0, 0, 'h'}, {"version", 0, 0, 'V'}, {0, 0, 0, 0} }; int set_conf(ROT *my_rot, char *conf_parms) { char *p, *q, *n; int ret; p = conf_parms; while (p && *p != '\0') { /* FIXME: left hand value of = cannot be null */ q = strchr(p, '='); if (q) *q++ = '\0'; n = strchr(q, ','); if (n) *n++ = '\0'; ret = rot_set_conf(my_rot, rot_token_lookup(my_rot, p), q); if (ret != RIG_OK) return ret; p = n; } return RIG_OK; } static unsigned long extract_prognum(const char val[]) { if (val[0] == '+') { return ROTPROG + atol(val+1); } else if (val[0] < '0' || val[0] > '9') { struct rpcent *ent; ent = getrpcbyname (val); if (ent) return ent->r_number; else return 0; } else return atol(val); } ROT *the_rpc_rot; #define MAXCONFLEN 128 int main (int argc, char *argv[]) { register SVCXPRT *transp; rot_model_t my_model = ROT_MODEL_DUMMY; int retcode; /* generic return code from functions */ int verbose = 0; const char *rot_file=NULL; int serial_rate = 0; char conf_parms[MAXCONFLEN] = ""; unsigned long prognum = ROTPROG; /* Arguments parsing */ while(1) { int c; int option_index = 0; c = getopt_long (argc, argv, SHORT_OPTIONS, long_options, &option_index); if (c == -1) break; switch(c) { case 'h': usage(); exit(0); case 'V': version(); exit(0); case 'm': if (!optarg) { usage(); /* wrong arg count */ exit(1); } my_model = atoi(optarg); break; case 'r': if (!optarg) { usage(); /* wrong arg count */ exit(1); } rot_file = optarg; break; case 's': if (!optarg) { usage(); /* wrong arg count */ exit(1); } serial_rate = atoi(optarg); break; case 'C': if (!optarg) { usage(); /* wrong arg count */ exit(1); } if (*conf_parms != '\0') strcat(conf_parms, ","); strncat(conf_parms, optarg, MAXCONFLEN-strlen(conf_parms)); break; case 't': if (!optarg) { usage(); /* wrong arg count */ exit(1); } prognum = extract_prognum(optarg); break; case 'v': verbose++; break; default: usage(); /* unknown option? */ exit(1); } } if (verbose < 2) rig_set_debug(RIG_DEBUG_WARN); /* Opening the local rotator */ the_rpc_rot = rot_init(my_model); if (!the_rpc_rot) { fprintf(stderr, "Unknown rotator num %d, or initialization error.\n", my_model); fprintf(stderr, "Please check with rotctl --list option.\n"); exit(2); } retcode = set_conf(the_rpc_rot, conf_parms); if (retcode != RIG_OK) { fprintf(stderr, "Config parameter error: %s\n", rigerror(retcode)); exit(2); } if (rot_file) strncpy(the_rpc_rot->state.rotport.pathname, rot_file, FILPATHLEN - 1); /* FIXME: bound checking and port type == serial */ if (serial_rate != 0) the_rpc_rot->state.rotport.parm.serial.rate = serial_rate; retcode = rot_open(the_rpc_rot); if (retcode != RIG_OK) { fprintf(stderr,"rot_open: error = %s \n", rigerror(retcode)); exit(2); } atexit(rotd_exit); if (verbose > 0) printf("Opened rotator model %d, '%s'\n", the_rpc_rot->caps->rot_model, the_rpc_rot->caps->model_name); /* Setup the RPC service and fire it up */ pmap_unset (prognum, ROTVERS); transp = svcudp_create(RPC_ANYSOCK); /* Looks like we can spesify a socket number here?? */ if (transp == NULL) { fprintf (stderr, "cannot create udp service."); exit(1); } if (!svc_register(transp, prognum, ROTVERS, rotprog_1, IPPROTO_UDP)) { fprintf (stderr, "unable to register (%lu, %u, udp).", prognum, ROTVERS); exit(1); } transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { fprintf (stderr, "%s", "cannot create tcp service."); exit(1); } if (!svc_register(transp, prognum, ROTVERS, rotprog_1, IPPROTO_TCP)) { fprintf (stderr, "unable to register (%lu, %u, tcp).", prognum, ROTVERS); exit(1); } svc_run (); fprintf (stderr, "svc_run returned"); /* the rotator gets automatically closed in rotd_exit() */ exit (1); /* NOTREACHED */ } void rotd_exit() { rot_close(the_rpc_rot); rot_cleanup(the_rpc_rot); } void usage() { printf("Usage: rpc.rotd [OPTION]... [COMMAND]...\n" "Offer RPC services to remotely control a connected rotator.\n\n"); printf( " -m, --model=ID select rotator model number. See model list\n" " -r, --rot-file=DEVICE set device of the rotator to operate on\n" " -s, --serial-speed=BAUD set serial speed of the serial port\n" " -C, --set-conf=PARM=VAL set config parameters\n" " -t, --prog=NUMBER set RPC program number\n" " -v, --verbose set verbose mode, cumulative\n" " -h, --help display this help and exit\n" " -V, --version output version information and exit\n\n" ); printf("\nReport bugs to .\n"); } void version() { printf("rpcrotd, %s\n\n", hamlib_version); printf("%s\n", hamlib_copyright); } /* end of file */ hamlib-1.2.15.3/rpcrot/Makefile.am0000644000175000017500000000400012044564477013472 00000000000000# rpcrot_xdr.c rpcrot_svc.c rpcrot_clnt.c and rpcrot.h are generated by rpcgen # have to provide: rpcrot_proc.c rpcrotd.c rpcrot_backend.c # # Note: automake complains rpcrot_xdr.c is generated both with and # without libtool, hence the copy rpcrot_xdr_lt.c LDADD = $(top_builddir)/src/libhamlib.la $(top_builddir)/lib/libmisc.la @NET_LIBS@ DEPENDENCIES = $(top_builddir)/src/libhamlib.la BUILT_SOURCES = rpcrot_xdr.c rpcrot_svc.c rpcrot_xdr_lt.c rpcrot_clnt.c rpcrot.h DISTCLEANFILES = $(BUILT_SOURCES) # needed for backward compatibility on Solaris. AM_CFLAGS = $(CFLAGS) -DPORTMAP # The RPC backend pkglib_LTLIBRARIES = hamlib-rpcrot.la hamlib_rpcrot_la_SOURCES = rpcrot_backend.c rpcrot_backend.h nodist_hamlib_rpcrot_la_SOURCES = rpcrot_clnt.c rpcrot_xdr_lt.c rpcrot.h hamlib_rpcrot_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_rpcrot_la_LIBADD = $(top_builddir)/src/libhamlib.la @NET_LIBS@ # The RPC server sbin_PROGRAMS = rpc.rotd rpc_rotd_DEPENDENCIES = $(DEPENDENCIES) @ROT_BACKENDEPS@ hamlib-rpcrot.la rpc_rotd_SOURCES = rpcrotd.c rpcrot_proc.c nodist_rpc_rotd_SOURCES = rpcrot_svc.c rpcrot_xdr.c rpcrot.h rpc_rotd_LDFLAGS = @ROT_BACKENDLNK@ man_MANS = rpc.rotd.8 EXTRA_DIST = rpcrot.x $(man_MANS) RPCGEN = rpcgen rpcrot.h: Makefile rpcrot.x rm -f $@ $(RPCGEN) -h -C `test -f rpcrot.x || echo '$(srcdir)/'`rpcrot.x -o $@ # Need to chdir in source dir, otherwise rpcgen hardcodes header path. sigh. rpcrot_clnt.c: Makefile rpcrot.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -l -C rpcrot.x -o $$abs_builddir/$@ rpcrot_svc.c: Makefile rpcrot.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -m -C rpcrot.x -o $$abs_builddir/$@ # note: # we need 2 rpcrot_xdr.c's: one for static rpcrot deamon, one for lt backend rpcrot_xdr.c: Makefile rpcrot.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -c -C rpcrot.x -o $$abs_builddir/$@ rpcrot_xdr_lt.c: Makefile rpcrot.x rm -f $@ abs_builddir=`pwd` ; \ cd $(srcdir) && $(RPCGEN) -c -C rpcrot.x -o $$abs_builddir/$@ hamlib-1.2.15.3/rpcrot/rpcrot_backend.h0000644000175000017500000000201112044564477014567 00000000000000/* * Hamlib RPC backend - main file * Copyright (c) 2001-2008 by Stephane Fillod * Contributed by Francois Retief * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef __RPCROT_BACKEND_H__ #define __RPCROT_BACKEND_H__ /* TODO: for future use */ #endif /* end of file */ hamlib-1.2.15.3/c++/0000755000175000017500000000000012044565002010544 500000000000000hamlib-1.2.15.3/c++/Makefile.in0000644000175000017500000005713512044564551012554 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = testcpp$(EXEEXT) TESTS = testcpp$(EXEEXT) subdir = c++ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libhamlib___la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am_libhamlib___la_OBJECTS = rigclass.lo rotclass.lo libhamlib___la_OBJECTS = $(am_libhamlib___la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent libhamlib___la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(AM_CXXFLAGS) $(CXXFLAGS) $(libhamlib___la_LDFLAGS) \ $(LDFLAGS) -o $@ am_testcpp_OBJECTS = testcpp.$(OBJEXT) testcpp_OBJECTS = $(am_testcpp_OBJECTS) testcpp_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(testcpp_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_$(V)) am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY)) am__v_CXX_0 = @echo " CXX " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CXXLD = $(CXX) CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CXXLD = $(am__v_CXXLD_$(V)) am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY)) am__v_CXXLD_0 = @echo " CXXLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libhamlib___la_SOURCES) $(testcpp_SOURCES) DIST_SOURCES = $(libhamlib___la_SOURCES) $(testcpp_SOURCES) ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ lib_LTLIBRARIES = libhamlib++.la libhamlib___la_SOURCES = rigclass.cc rotclass.cc libhamlib___la_LDFLAGS = -no-undefined -version-info @ABI_VERSION@:16:0 libhamlib___la_LIBADD = $(top_builddir)/src/libhamlib.la testcpp_SOURCES = testcpp.cc testcpp_LDADD = libhamlib++.la testcpp_LDFLAGS = @BACKENDLNK@ testcpp_DEPENDENCIES = libhamlib++.la @BACKENDEPS@ all: all-am .SUFFIXES: .SUFFIXES: .cc .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu c++/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu c++/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libhamlib++.la: $(libhamlib___la_OBJECTS) $(libhamlib___la_DEPENDENCIES) $(AM_V_CXXLD)$(libhamlib___la_LINK) -rpath $(libdir) $(libhamlib___la_OBJECTS) $(libhamlib___la_LIBADD) $(LIBS) clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list testcpp$(EXEEXT): $(testcpp_OBJECTS) $(testcpp_DEPENDENCIES) @rm -f testcpp$(EXEEXT) $(AM_V_CXXLD)$(testcpp_LINK) $(testcpp_OBJECTS) $(testcpp_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rigclass.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rotclass.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcpp.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cc.lo: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-libLTLIBRARIES \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-libLTLIBRARIES # 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: hamlib-1.2.15.3/c++/rotclass.cc0000644000175000017500000000536712044564477012657 00000000000000/** * \file src/rotclass.cc * \brief Ham Radio Control Libraries C++ interface * \author Stephane Fillod * \date 2002 * * Hamlib C++ interface is a frontend implementing wrapper functions. */ /* * Hamlib C++ bindings - main file * Copyright (c) 2002 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #define CHECK_ROT(cmd) { int _retval = cmd; if (_retval != RIG_OK) \ THROW(new RigException (_retval)); } Rotator::Rotator(rot_model_t rot_model) { theRot = rot_init(rot_model); if (!theRot) THROW(new RigException ("Rotator initialization error")); caps = theRot->caps; theRot->state.obj = (rig_ptr_t)this; } Rotator::~Rotator() { theRot->state.obj = NULL; CHECK_ROT( rot_cleanup(theRot) ); caps = NULL; } void Rotator::open(void) { CHECK_ROT( rot_open(theRot) ); } void Rotator::close(void) { CHECK_ROT( rot_close(theRot) ); } void Rotator::setConf(token_t token, const char *val) { CHECK_ROT( rot_set_conf(theRot, token, val) ); } void Rotator::setConf(const char *name, const char *val) { CHECK_ROT( rot_set_conf(theRot, tokenLookup(name), val) ); } void Rotator::getConf(token_t token, char *val) { CHECK_ROT( rot_get_conf(theRot, token, val) ); } void Rotator::getConf(const char *name, char *val) { CHECK_ROT( rot_get_conf(theRot, tokenLookup(name), val) ); } token_t Rotator::tokenLookup(const char *name) { return rot_token_lookup(theRot, name); } void Rotator::setPosition(azimuth_t az, elevation_t el) { CHECK_ROT( rot_set_position(theRot, az, el) ); } void Rotator::getPosition(azimuth_t& az, elevation_t& el) { CHECK_ROT( rot_get_position(theRot, &az, &el) ); } void Rotator::stop() { CHECK_ROT(rot_stop(theRot)); } void Rotator::park() { CHECK_ROT(rot_park(theRot)); } void Rotator::reset (rot_reset_t reset) { CHECK_ROT( rot_reset(theRot, reset) ); } void Rotator::move (int direction, int speed) { CHECK_ROT( rot_move(theRot, direction, speed) ); } hamlib-1.2.15.3/c++/rigclass.cc0000644000175000017500000003100512044564477012620 00000000000000/** * \file src/rigclass.cc * \brief Ham Radio Control Libraries C++ interface * \author Stephane Fillod * \date 2001-2003 * * Hamlib C++ interface is a frontend implementing wrapper functions. */ /* * Hamlib C++ bindings - main file * Copyright (c) 2001-2003 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #define CHECK_RIG(cmd) { int _retval = cmd; if (_retval != RIG_OK) \ THROW(new RigException (_retval)); } static int hamlibpp_freq_event(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg); static int hamlibpp_freq_event(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg) { if (!rig || !rig->state.obj) return -RIG_EINVAL; /* assert rig == ((Rig*)rig->state.obj).theRig */ return ((Rig*)rig->state.obj)->FreqEvent(vfo, freq, arg); } Rig::Rig(rig_model_t rig_model) { theRig = rig_init(rig_model); if (!theRig) THROW(new RigException ("Rig initialization error")); caps = theRig->caps; theRig->callbacks.freq_event = &hamlibpp_freq_event; theRig->state.obj = (rig_ptr_t)this; } Rig::~Rig() { theRig->state.obj = NULL; CHECK_RIG( rig_cleanup(theRig) ); caps = NULL; } void Rig::open(void) { CHECK_RIG( rig_open(theRig) ); } void Rig::close(void) { CHECK_RIG( rig_close(theRig) ); } void Rig::setConf(token_t token, const char *val) { CHECK_RIG( rig_set_conf(theRig, token, val) ); } void Rig::setConf(const char *name, const char *val) { CHECK_RIG( rig_set_conf(theRig, tokenLookup(name), val) ); } void Rig::getConf(token_t token, char *val) { CHECK_RIG( rig_get_conf(theRig, token, val) ); } void Rig::getConf(const char *name, char *val) { CHECK_RIG( rig_get_conf(theRig, tokenLookup(name), val) ); } token_t Rig::tokenLookup(const char *name) { return rig_token_lookup(theRig, name); } void Rig::setFreq(freq_t freq, vfo_t vfo) { CHECK_RIG( rig_set_freq(theRig, vfo, freq) ); } freq_t Rig::getFreq(vfo_t vfo) { freq_t freq; CHECK_RIG( rig_get_freq(theRig, vfo, &freq) ); return freq; } void Rig::setMode(rmode_t mode, pbwidth_t width, vfo_t vfo) { CHECK_RIG(rig_set_mode(theRig, vfo, mode, width)); } rmode_t Rig::getMode(pbwidth_t& width, vfo_t vfo) { rmode_t mode; CHECK_RIG( rig_get_mode(theRig, vfo, &mode, &width) ); return mode; } void Rig::setVFO(vfo_t vfo) { CHECK_RIG( rig_set_vfo(theRig, vfo) ); } vfo_t Rig::getVFO() { vfo_t vfo; CHECK_RIG( rig_get_vfo(theRig, &vfo) ); return vfo; } void Rig::setPTT(ptt_t ptt, vfo_t vfo) { CHECK_RIG( rig_set_ptt(theRig, vfo, ptt) ); } ptt_t Rig::getPTT(vfo_t vfo) { ptt_t ptt; CHECK_RIG( rig_get_ptt(theRig, vfo, &ptt) ); return ptt; } dcd_t Rig::getDCD(vfo_t vfo) { dcd_t dcd; CHECK_RIG( rig_get_dcd(theRig, vfo, &dcd) ); return dcd; } void Rig::setLevel(setting_t level, int vali, vfo_t vfo) { value_t val; val.i = vali; CHECK_RIG( rig_set_level(theRig, vfo, level, val) ); } void Rig::setLevel(setting_t level, float valf, vfo_t vfo) { value_t val; val.f = valf; CHECK_RIG( rig_set_level(theRig, vfo, level, val) ); } void Rig::getLevel(setting_t level, int& vali, vfo_t vfo) { value_t val; if (RIG_LEVEL_IS_FLOAT(level)) THROW(new RigException (-RIG_EINVAL)); CHECK_RIG( rig_get_level(theRig, vfo, level, &val) ); vali = val.i; } void Rig::getLevel(setting_t level, float& valf, vfo_t vfo) { value_t val; if (!RIG_LEVEL_IS_FLOAT(level)) THROW(new RigException (-RIG_EINVAL)); CHECK_RIG( rig_get_level(theRig, vfo, level, &val) ); valf = val.f; } int Rig::getLevelI(setting_t level, vfo_t vfo) { value_t val; if (RIG_LEVEL_IS_FLOAT(level)) THROW(new RigException (-RIG_EINVAL)); CHECK_RIG( rig_get_level(theRig, vfo, level, &val) ); return val.i; } float Rig::getLevelF(setting_t level, vfo_t vfo) { value_t val; if (!RIG_LEVEL_IS_FLOAT(level)) THROW(new RigException (-RIG_EINVAL)); CHECK_RIG( rig_get_level(theRig, vfo, level, &val) ); return val.f; } void Rig::setParm(setting_t parm, int vali) { value_t val; val.i = vali; CHECK_RIG( rig_set_parm(theRig, parm, val) ); } void Rig::setParm(setting_t parm, float valf) { value_t val; val.f = valf; CHECK_RIG( rig_set_parm(theRig, parm, val) ); } void Rig::getParm(setting_t parm, int& vali) { value_t val; if (RIG_LEVEL_IS_FLOAT(parm)) THROW(new RigException (-RIG_EINVAL)); CHECK_RIG( rig_get_parm(theRig, parm, &val) ); vali = val.i; } void Rig::getParm(setting_t parm, float& valf) { value_t val; if (!RIG_LEVEL_IS_FLOAT(parm)) THROW(new RigException (-RIG_EINVAL)); CHECK_RIG( rig_get_parm(theRig, parm, &val) ); valf = val.f; } int Rig::getParmI(setting_t parm) { value_t val; if (RIG_LEVEL_IS_FLOAT(parm)) THROW(new RigException (-RIG_EINVAL)); CHECK_RIG( rig_get_parm(theRig, parm, &val) ); return val.i; } float Rig::getParmF(setting_t parm) { value_t val; if (!RIG_LEVEL_IS_FLOAT(parm)) THROW(new RigException (-RIG_EINVAL)); CHECK_RIG( rig_get_parm(theRig, parm, &val) ); return val.f; } void Rig::setSplitFreq(freq_t tx_freq, vfo_t vfo) { CHECK_RIG( rig_set_split_freq(theRig, vfo, tx_freq) ); } freq_t Rig::getSplitFreq(vfo_t vfo) { freq_t freq; CHECK_RIG( rig_get_split_freq(theRig, vfo, &freq) ); return freq; } void Rig::setSplitMode(rmode_t mode, pbwidth_t width, vfo_t vfo) { CHECK_RIG(rig_set_split_mode(theRig, vfo, mode, width)); } rmode_t Rig::getSplitMode(pbwidth_t& width, vfo_t vfo) { rmode_t mode; CHECK_RIG( rig_get_split_mode(theRig, vfo, &mode, &width) ); return mode; } void Rig::setSplitVFO(split_t split, vfo_t vfo, vfo_t tx_vfo) { CHECK_RIG(rig_set_split_vfo(theRig, vfo, split, tx_vfo)); } split_t Rig::getSplitVFO(vfo_t &tx_vfo, vfo_t vfo) { split_t split; CHECK_RIG( rig_get_split_vfo(theRig, vfo, &split, &tx_vfo) ); return split; } bool Rig::hasGetLevel (setting_t level) { return rig_has_get_level(theRig, level) == level; } bool Rig::hasSetLevel (setting_t level) { return rig_has_set_level(theRig, level) == level; } bool Rig::hasGetParm (setting_t parm) { return rig_has_get_parm(theRig, parm) == parm; } bool Rig::hasSetParm (setting_t parm) { return rig_has_set_parm(theRig, parm) == parm; } const char *Rig::getInfo (void) { return rig_get_info(theRig); } pbwidth_t Rig::passbandNormal (rmode_t mode) { return rig_passband_normal(theRig, mode); } pbwidth_t Rig::passbandNarrow (rmode_t mode) { return rig_passband_narrow(theRig, mode); } pbwidth_t Rig::passbandWide (rmode_t mode) { return rig_passband_wide(theRig, mode); } void Rig::setRptrShift (rptr_shift_t rptr_shift, vfo_t vfo) { CHECK_RIG( rig_set_rptr_shift(theRig, vfo, rptr_shift) ); } rptr_shift_t Rig::getRptrShift (vfo_t vfo) { rptr_shift_t rptr_shift; CHECK_RIG( rig_get_rptr_shift(theRig, vfo, &rptr_shift) ); return rptr_shift; } void Rig::setRptrOffs (shortfreq_t rptr_offs, vfo_t vfo) { CHECK_RIG( rig_set_rptr_offs(theRig, vfo, rptr_offs) ); } shortfreq_t Rig::getRptrOffs (vfo_t vfo) { shortfreq_t rptr_offs; CHECK_RIG( rig_get_rptr_offs(theRig, vfo, &rptr_offs) ); return rptr_offs; } void Rig::setTs (shortfreq_t ts, vfo_t vfo) { CHECK_RIG( rig_set_ts(theRig, vfo, ts) ); } shortfreq_t Rig::getTs (vfo_t vfo) { shortfreq_t ts; CHECK_RIG( rig_get_ts(theRig, vfo, &ts) ); return ts; } void Rig::setCTCSS (tone_t tone, vfo_t vfo) { CHECK_RIG( rig_set_ctcss_tone(theRig, vfo, tone) ); } tone_t Rig::getCTCSS (vfo_t vfo) { tone_t tone; CHECK_RIG( rig_get_ctcss_tone(theRig, vfo, &tone) ); return tone; } void Rig::setDCS (tone_t code, vfo_t vfo) { CHECK_RIG( rig_set_dcs_code(theRig, vfo, code) ); } tone_t Rig::getDCS (vfo_t vfo) { tone_t code; CHECK_RIG( rig_get_dcs_code(theRig, vfo, &code) ); return code; } void Rig::setCTCSSsql (tone_t tone, vfo_t vfo) { CHECK_RIG( rig_set_ctcss_sql(theRig, vfo, tone) ); } tone_t Rig::getCTCSSsql (vfo_t vfo) { tone_t tone; CHECK_RIG( rig_get_ctcss_sql(theRig, vfo, &tone) ); return tone; } void Rig::setDCSsql (tone_t code, vfo_t vfo) { CHECK_RIG( rig_set_dcs_sql(theRig, vfo, code) ); } tone_t Rig::getDCSsql (vfo_t vfo) { tone_t code; CHECK_RIG( rig_get_dcs_sql(theRig, vfo, &code) ); return code; } void Rig::setFunc (setting_t func, bool status, vfo_t vfo) { CHECK_RIG( rig_set_func(theRig, vfo, func, status? 1:0) ); } bool Rig::getFunc (setting_t func, vfo_t vfo) { int status; CHECK_RIG( rig_get_func(theRig, vfo, func, &status) ); return status ? true : false; } void Rig::VFOop (vfo_op_t op, vfo_t vfo) { CHECK_RIG( rig_vfo_op(theRig, vfo, op) ); } bool Rig::hasVFOop (vfo_op_t op) { return rig_has_vfo_op(theRig, op)==op; } void Rig::scan (scan_t scan, int ch, vfo_t vfo) { CHECK_RIG( rig_scan(theRig, vfo, scan, ch) ); } bool Rig::hasScan (scan_t scan) { return rig_has_scan(theRig, scan)==scan; } void Rig::setRit(shortfreq_t rit, vfo_t vfo) { CHECK_RIG(rig_set_rit(theRig, vfo, rit)); } shortfreq_t Rig::getRit(vfo_t vfo) { shortfreq_t rit; CHECK_RIG( rig_get_rit(theRig, vfo, &rit) ); return rit; } void Rig::setXit(shortfreq_t xit, vfo_t vfo) { CHECK_RIG(rig_set_xit(theRig, vfo, xit)); } shortfreq_t Rig::getXit(vfo_t vfo) { shortfreq_t xit; CHECK_RIG( rig_get_xit(theRig, vfo, &xit) ); return xit; } void Rig::setAnt(ant_t ant, vfo_t vfo) { CHECK_RIG(rig_set_ant(theRig, vfo, ant)); } ant_t Rig::getAnt(vfo_t vfo) { ant_t ant; CHECK_RIG( rig_get_ant(theRig, vfo, &ant) ); return ant; } void Rig::sendDtmf(const char *digits, vfo_t vfo) { CHECK_RIG(rig_send_dtmf(theRig, vfo, digits)); } int Rig::recvDtmf(char *digits, vfo_t vfo) { int len; CHECK_RIG( rig_recv_dtmf(theRig, vfo, digits, &len) ); return len; } void Rig::sendMorse(const char *msg, vfo_t vfo) { CHECK_RIG(rig_send_morse(theRig, vfo, msg)); } shortfreq_t Rig::getResolution (rmode_t mode) { shortfreq_t res; res = rig_get_resolution(theRig, mode); if (res < 0) THROW(new RigException (res)); return res; } void Rig::reset (reset_t reset) { CHECK_RIG( rig_reset(theRig, reset) ); } bool Rig::hasGetFunc (setting_t func) { return rig_has_get_func(theRig, func)==func; } bool Rig::hasSetFunc (setting_t func) { return rig_has_set_func(theRig, func)==func; } unsigned int Rig::power2mW (float power, freq_t freq, rmode_t mode) { unsigned int mwpower; CHECK_RIG( rig_power2mW(theRig, &mwpower, power, freq, mode) ); return mwpower; } float Rig::mW2power (unsigned int mwpower, freq_t freq, rmode_t mode) { float power; CHECK_RIG( rig_mW2power(theRig, &power, mwpower, freq, mode) ); return power; } void Rig::setTrn (int trn) { CHECK_RIG( rig_set_trn(theRig, trn) ); } int Rig::getTrn () { int trn; CHECK_RIG( rig_get_trn(theRig, &trn) ); return trn; } void Rig::setBank (int bank, vfo_t vfo) { CHECK_RIG( rig_set_ts(theRig, vfo, bank) ); } void Rig::setMem (int ch, vfo_t vfo) { CHECK_RIG( rig_set_mem(theRig, vfo, ch) ); } int Rig::getMem (vfo_t vfo) { int mem; CHECK_RIG( rig_get_mem(theRig, vfo, &mem) ); return mem; } void Rig::setChannel (const channel_t *chan) { CHECK_RIG( rig_set_channel(theRig, chan) ); } void Rig::getChannel (channel_t *chan) { CHECK_RIG( rig_get_channel(theRig, chan) ); } void Rig::setPowerStat (powerstat_t status) { CHECK_RIG( rig_set_powerstat(theRig, status) ); } powerstat_t Rig::getPowerStat (void) { powerstat_t status; CHECK_RIG( rig_get_powerstat(theRig, &status) ); return status; } rmode_t Rig::RngRxModes (freq_t freq) { unsigned modes = RIG_MODE_NONE; freq_range_t *rng; int i; for (i=0; istate.rx_range_list[i]; if (RIG_IS_FRNG_END(*rng)) { return (rmode_t)modes; } if (freq >= rng->start && freq <= rng->end) modes |= (unsigned)rng->modes; } return (rmode_t)modes; } rmode_t Rig::RngTxModes (freq_t freq) { unsigned modes = RIG_MODE_NONE; freq_range_t *rng; int i; for (i=0; istate.tx_range_list[i]; if (RIG_IS_FRNG_END(*rng)) { return (rmode_t)modes; } if (freq >= rng->start && freq <= rng->end) modes |= (unsigned)rng->modes; } return (rmode_t)modes; } hamlib-1.2.15.3/c++/Makefile.am0000644000175000017500000000061512044564477012541 00000000000000 lib_LTLIBRARIES = libhamlib++.la libhamlib___la_SOURCES = rigclass.cc rotclass.cc libhamlib___la_LDFLAGS = -no-undefined -version-info @ABI_VERSION@:16:0 libhamlib___la_LIBADD = $(top_builddir)/src/libhamlib.la check_PROGRAMS = testcpp TESTS = testcpp testcpp_SOURCES = testcpp.cc testcpp_LDADD = libhamlib++.la testcpp_LDFLAGS = @BACKENDLNK@ testcpp_DEPENDENCIES = libhamlib++.la @BACKENDEPS@ hamlib-1.2.15.3/c++/testcpp.cc0000644000175000017500000000100312044564477012466 00000000000000 /* * Hamlib sample C++ program */ #include #include int main(int argc, char* argv[]) { Rig myRig = Rig(RIG_MODEL_DUMMY); try { myRig.setConf("rig_pathname", "/dev/ttyS1"); myRig.open(); myRig.setFreq(MHz(144)); std::cout << myRig.getLevelI(RIG_LEVEL_STRENGTH) << "dB" << std::endl; std::cout << "Modes for freq 14.332: " << myRig.RngRxModes(MHz(14.332)) << std::endl; myRig.close(); } catch (const RigException &Ex) { Ex.print(); return 1; } return 0; } hamlib-1.2.15.3/missing0000755000175000017500000002623312044564547011536 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2009-04-28.21; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar*) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: hamlib-1.2.15.3/lowe/0000755000175000017500000000000012044565030011143 500000000000000hamlib-1.2.15.3/lowe/lowe.h0000644000175000017500000000255212044564477012224 00000000000000/* * Hamlib Lowe backend - main header * Copyright (c) 2003 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _LOWE_H #define _LOWE_H 1 #include int lowe_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int lowe_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int lowe_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int lowe_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int lowe_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int lowe_reset(RIG *rig, reset_t reset); const char *lowe_get_info(RIG *rig); extern const struct rig_caps hf235_caps; #endif /* _LOWE_H */ hamlib-1.2.15.3/lowe/hf235.c0000644000175000017500000000627412044564477012105 00000000000000/* * Hamlib Lowe backend - HF-235 description * Copyright (c) 2003 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "lowe.h" #define HF235_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_AM|RIG_MODE_FM) #define HF235_FUNC (RIG_FUNC_LOCK|RIG_FUNC_MUTE) #define HF235_LEVEL_ALL (RIG_LEVEL_STRENGTH) #define HF235_PARM_ALL (RIG_PARM_NONE) #define HF235_VFO (RIG_VFO_A) #define HF235_VFO_OPS (RIG_OP_NONE) /* * HF-235 rig capabilities. * */ const struct rig_caps hf235_caps = { .rig_model = RIG_MODEL_HF235, .model_name = "HF-235", .mfg_name = "Lowe", .version = "0.3", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, /* and only basic support */ .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 1200, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 1, .timeout = 200, .retry = 3, .has_get_func = HF235_FUNC, .has_set_func = HF235_FUNC, .has_get_level = HF235_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(HF235_LEVEL_ALL), .has_get_parm = HF235_PARM_ALL, .has_set_parm = RIG_PARM_SET(HF235_PARM_ALL), .level_gran = {}, .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 = 7, .vfo_ops = HF235_VFO_OPS, .chan_list = { RIG_CHAN_END, /* FIXME */ }, .rx_range_list1 = { {kHz(30),MHz(30),HF235_MODES,-1,-1,HF235_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30),MHz(30),HF235_MODES,-1,-1,HF235_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {HF235_MODES,10}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_AM, kHz(2.2)}, {RIG_MODE_FM, kHz(12)}, RIG_FLT_END, }, .priv = NULL, .set_freq = lowe_set_freq, .get_freq = lowe_get_freq, .set_mode = lowe_set_mode, .get_mode = lowe_get_mode, //.set_func = lowe_set_func, .get_level = lowe_get_level, .reset = lowe_reset, .get_info = lowe_get_info, }; /* * Function definitions below */ hamlib-1.2.15.3/lowe/Makefile.in0000644000175000017500000004753012044564554013153 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = lowe DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_lowe_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = hf235.lo am_hamlib_lowe_la_OBJECTS = $(am__objects_1) lowe.lo hamlib_lowe_la_OBJECTS = $(am_hamlib_lowe_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_lowe_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_lowe_la_LDFLAGS) $(LDFLAGS) -o \ $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_lowe_la_SOURCES) DIST_SOURCES = $(hamlib_lowe_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ LOWESRC = hf235.c pkglib_LTLIBRARIES = hamlib-lowe.la hamlib_lowe_la_SOURCES = $(LOWESRC) lowe.c hamlib_lowe_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_lowe_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = lowe.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lowe/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lowe/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-lowe.la: $(hamlib_lowe_la_OBJECTS) $(hamlib_lowe_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_lowe_la_LINK) -rpath $(pkglibdir) $(hamlib_lowe_la_OBJECTS) $(hamlib_lowe_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hf235.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lowe.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/lowe/lowe.c0000644000175000017500000001514512044564477012221 00000000000000/* * Hamlib Lowe backend - main file * Copyright (c) 2003-2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "register.h" #include "lowe.h" #define BUFSZ 64 #define CR "\x0d" #define EOM CR #define MD_USB "USB" #define MD_LSB "LSB" #define MD_FAX "FAX" #define MD_CW "CW" #define MD_FM "FM" #define MD_AM "AM" #define MD_AMS "AMS" /* * lowe_transaction * We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL */ int lowe_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval; struct rig_state *rs; rs = &rig->state; serial_flush(&rs->rigport); 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; retval = read_string(&rs->rigport, data, BUFSZ, CR, 1); if (retval == -RIG_ETIMEOUT) retval = 0; if (retval < 0) return retval; *data_len = retval; return RIG_OK; } /* * lowe_set_freq * Assumes rig!=NULL */ int lowe_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char freqbuf[16], ackbuf[16]; int freq_len, ack_len, retval; /* */ freq_len = sprintf(freqbuf,"FRQ%f" EOM, (float)freq/1000); retval = lowe_transaction(rig, freqbuf, freq_len, ackbuf, &ack_len); return retval; } /* * lowe_get_freq * Assumes rig!=NULL */ int lowe_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { char freqbuf[16]; int freq_len, retval; float f_freq; retval = lowe_transaction(rig, "FRQ?" EOM, 5, freqbuf, &freq_len); if (retval != RIG_OK) return retval; freqbuf[freq_len < 16 ? freq_len : 15] = '\0'; sscanf(freqbuf+1, "%f", &f_freq); *freq = f_freq*1000; return retval; } /* * lowe_set_mode * Assumes rig!=NULL */ int lowe_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { char mdbuf[16], ackbuf[16]; char *mode_sel; int mdbuf_len, ack_len, retval; switch (mode) { case RIG_MODE_CW: mode_sel = MD_CW; break; case RIG_MODE_USB: mode_sel = MD_USB; break; case RIG_MODE_LSB: mode_sel = MD_LSB; break; case RIG_MODE_FM: mode_sel = MD_FM; break; case RIG_MODE_AM: mode_sel = MD_AM; break; case RIG_MODE_FAX: mode_sel = MD_FAX; break; case RIG_MODE_AMS: mode_sel = MD_AMS; break; default: rig_debug(RIG_DEBUG_ERR,"lowe_set_mode: " "unsupported mode %d\n", mode); return -RIG_EINVAL; } mdbuf_len = sprintf(mdbuf, "MOD%s" EOM, mode_sel); retval = lowe_transaction (rig, mdbuf, mdbuf_len, ackbuf, &ack_len); return retval; } /* * lowe_get_mode * Assumes rig!=NULL */ int lowe_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char mdbuf[16]; int mdbuf_len, retval; retval = lowe_transaction (rig, "MOD?" EOM, 5, mdbuf, &mdbuf_len); if (retval != RIG_OK) return retval; if (!strcmp(mdbuf+1, MD_CW)) *mode = RIG_MODE_CW; else if (!strcmp(mdbuf+1, MD_USB)) *mode = RIG_MODE_USB; else if (!strcmp(mdbuf+1, MD_LSB)) *mode = RIG_MODE_LSB; else if (!strcmp(mdbuf+1, MD_FM)) *mode = RIG_MODE_FM; else if (!strcmp(mdbuf+1, MD_FAX)) *mode = RIG_MODE_FAX; else if (!strcmp(mdbuf+1, MD_AMS)) *mode = RIG_MODE_AMS; else if (!strcmp(mdbuf+1, MD_AM)) *mode = RIG_MODE_AM; else { rig_debug(RIG_DEBUG_WARN,"%s: unknown mode '%s'\n", __FUNCTION__, mdbuf); return -RIG_EPROTO; } *width = RIG_PASSBAND_NORMAL; return retval; } /* * lowe_get_level * Assumes rig!=NULL */ int lowe_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { char lvlbuf[16]; int lvl_len, retval; if (level != RIG_LEVEL_STRENGTH) return -RIG_EINVAL; retval = lowe_transaction(rig, "RSS?" EOM, 5, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; lvlbuf[lvl_len < 16 ? lvl_len : 15] = '\0'; sscanf(lvlbuf+1, "%d", &val->i); val->i += 60; /* dBm */ return retval; } /* * lowe_reset * Assumes rig!=NULL */ int lowe_reset(RIG *rig, reset_t reset) { static char ackbuf[BUFSZ]; int retval, ack_len; retval = lowe_transaction(rig, "RES" EOM, 4, ackbuf, &ack_len); return retval; } /* * lowe_get_info * Assumes rig!=NULL */ const char *lowe_get_info(RIG *rig) { static char idbuf[BUFSZ]; int retval, id_len; /* hack: no idea what INF is for */ retval = lowe_transaction(rig, "INF?" EOM, 5, idbuf, &id_len); /* this is the real one */ retval = lowe_transaction(rig, "TYP?" EOM, 5, idbuf, &id_len); if (retval != RIG_OK) return NULL; idbuf[id_len] = '\0'; return idbuf; } /* * probe_lowe(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data) */ DECLARE_PROBERIG_BACKEND(lowe) { static char idbuf[BUFSZ]; int retval, id_len; if (!port) return RIG_MODEL_NONE; if (port->type.rig != RIG_PORT_SERIAL) return RIG_MODEL_NONE; port->parm.serial.rate = hf235_caps.serial_rate_max; port->write_delay = port->post_write_delay = 0; port->timeout = 50; port->retry = 1; retval = serial_open(port); if (retval != RIG_OK) return RIG_MODEL_NONE; retval = write_block(port, "TYP?" EOM, 4); id_len = read_string(port, idbuf, BUFSZ, CR, 2); close(port->fd); if (retval != RIG_OK || id_len <= 0 || id_len >= BUFSZ) return RIG_MODEL_NONE; idbuf[id_len] = '\0'; if (!strcmp(idbuf, "HF-235")) { if (cfunc) (*cfunc)(port, RIG_MODEL_HF235, data); return RIG_MODEL_HF235; } /* * not found... */ if (memcmp(idbuf, "ID" EOM, 3)) /* catch loopback serial */ rig_debug(RIG_DEBUG_VERBOSE,"probe_lowe: found unknown device " "with ID '%s', please report to Hamlib " "developers.\n", idbuf); return RIG_MODEL_NONE; } /* * initrigs_lowe is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(lowe) { rig_debug(RIG_DEBUG_VERBOSE, "lowe: _init called\n"); rig_register(&hf235_caps); return RIG_OK; } hamlib-1.2.15.3/lowe/Makefile.am0000644000175000017500000000036212044564477013136 00000000000000LOWESRC = hf235.c pkglib_LTLIBRARIES = hamlib-lowe.la hamlib_lowe_la_SOURCES = $(LOWESRC) lowe.c hamlib_lowe_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_lowe_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = lowe.h hamlib-1.2.15.3/tuner/0000755000175000017500000000000012044565035011337 500000000000000hamlib-1.2.15.3/tuner/videodev.h0000644000175000017500000002746312044564477013262 00000000000000/* This header is extracted from linux/videodev.h, approximately version 2.6.0. We can't use linux/videodev.h directly because it indirectly defines struct timespec, which is also defined by the standard C library headers. Argh. -blp */ #ifndef FM_VIDEODEV_H #define FM_VIDEODEV_H 1 #include #include #define VID_TYPE_CAPTURE 1 /* Can capture */ #define VID_TYPE_TUNER 2 /* Can tune */ #define VID_TYPE_TELETEXT 4 /* Does teletext */ #define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ #define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ #define VID_TYPE_CLIPPING 32 /* Can clip */ #define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ #define VID_TYPE_SCALES 128 /* Scalable */ #define VID_TYPE_MONOCHROME 256 /* Monochrome only */ #define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ #define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ #define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ #define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ #define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ struct video_capability { char name[32]; int type; int channels; /* Num channels */ int audios; /* Num audio devices */ int maxwidth; /* Supported width */ int maxheight; /* And height */ int minwidth; /* Supported width */ int minheight; /* And height */ }; struct video_channel { int channel; char name[32]; int tuners; uint32_t flags; #define VIDEO_VC_TUNER 1 /* Channel has a tuner */ #define VIDEO_VC_AUDIO 2 /* Channel has audio */ uint16_t type; #define VIDEO_TYPE_TV 1 #define VIDEO_TYPE_CAMERA 2 uint16_t norm; /* Norm set by channel */ }; struct video_tuner { int tuner; char name[32]; unsigned long rangelow, rangehigh; /* Tuner range */ uint32_t flags; #define VIDEO_TUNER_PAL 1 #define VIDEO_TUNER_NTSC 2 #define VIDEO_TUNER_SECAM 4 #define VIDEO_TUNER_LOW 8 /* Uses KHz not MHz */ #define VIDEO_TUNER_NORM 16 /* Tuner can set norm */ #define VIDEO_TUNER_STEREO_ON 128 /* Tuner is seeing stereo */ #define VIDEO_TUNER_RDS_ON 256 /* Tuner is seeing an RDS datastream */ #define VIDEO_TUNER_MBS_ON 512 /* Tuner is seeing an MBS datastream */ uint16_t mode; /* PAL/NTSC/SECAM/OTHER */ #define VIDEO_MODE_PAL 0 #define VIDEO_MODE_NTSC 1 #define VIDEO_MODE_SECAM 2 #define VIDEO_MODE_AUTO 3 uint16_t signal; /* Signal strength 16bit scale */ }; struct video_picture { uint16_t brightness; uint16_t hue; uint16_t colour; uint16_t contrast; uint16_t whiteness; /* Black and white only */ uint16_t depth; /* Capture depth */ uint16_t palette; /* Palette in use */ #define VIDEO_PALETTE_GREY 1 /* Linear greyscale */ #define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */ #define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */ #define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */ #define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */ #define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */ #define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */ #define VIDEO_PALETTE_YUYV 8 #define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */ #define VIDEO_PALETTE_YUV420 10 #define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */ #define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */ #define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */ #define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */ #define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */ #define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */ #define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */ #define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */ }; struct video_audio { int audio; /* Audio channel */ uint16_t volume; /* If settable */ uint16_t bass, treble; uint32_t flags; #define VIDEO_AUDIO_MUTE 1 #define VIDEO_AUDIO_MUTABLE 2 #define VIDEO_AUDIO_VOLUME 4 #define VIDEO_AUDIO_BASS 8 #define VIDEO_AUDIO_TREBLE 16 #define VIDEO_AUDIO_BALANCE 32 char name[16]; #define VIDEO_SOUND_MONO 1 #define VIDEO_SOUND_STEREO 2 #define VIDEO_SOUND_LANG1 4 #define VIDEO_SOUND_LANG2 8 uint16_t mode; uint16_t balance; /* Stereo balance */ uint16_t step; /* Step actual volume uses */ }; struct video_clip { int32_t x,y; int32_t width, height; struct video_clip *next; /* For user use/driver use only */ }; struct video_window { uint32_t x,y; /* Position of window */ uint32_t width,height; /* Its size */ uint32_t chromakey; uint32_t flags; struct video_clip *clips; /* Set only */ int clipcount; #define VIDEO_WINDOW_INTERLACE 1 #define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */ #define VIDEO_CLIP_BITMAP -1 /* bitmap is 1024x625, a '1' bit represents a clipped pixel */ #define VIDEO_CLIPMAP_SIZE (128 * 625) }; struct video_capture { uint32_t x,y; /* Offsets into image */ uint32_t width, height; /* Area to capture */ uint16_t decimation; /* Decimation divider */ uint16_t flags; /* Flags for capture */ #define VIDEO_CAPTURE_ODD 0 /* Temporal */ #define VIDEO_CAPTURE_EVEN 1 }; struct video_buffer { void *base; int height,width; int depth; int bytesperline; }; struct video_mmap { unsigned int frame; /* Frame (0 - n) for double buffer */ int height,width; unsigned int format; /* should be VIDEO_PALETTE_* */ }; struct video_key { uint8_t key[8]; uint32_t flags; }; #define VIDEO_MAX_FRAME 32 struct video_mbuf { int size; /* Total memory to map */ int frames; /* Frames */ int offsets[VIDEO_MAX_FRAME]; }; #define VIDEO_NO_UNIT (-1) struct video_unit { int video; /* Video minor */ int vbi; /* VBI minor */ int radio; /* Radio minor */ int audio; /* Audio minor */ int teletext; /* Teletext minor */ }; struct vbi_format { uint32_t sampling_rate; /* in Hz */ uint32_t samples_per_line; uint32_t sample_format; /* VIDEO_PALETTE_RAW only (1 byte) */ int32_t start[2]; /* starting line for each frame */ uint32_t count[2]; /* count of lines for each frame */ uint32_t flags; #define VBI_UNSYNC 1 /* can distingues between top/bottom field */ #define VBI_INTERLACED 2 /* lines are interlaced */ }; /* video_info is biased towards hardware mpeg encode/decode */ /* but it could apply generically to any hardware compressor/decompressor */ struct video_info { uint32_t frame_count; /* frames output since decode/encode began */ uint32_t h_size; /* current unscaled horizontal size */ uint32_t v_size; /* current unscaled veritcal size */ uint32_t smpte_timecode; /* current SMPTE timecode (for current GOP) */ uint32_t picture_type; /* current picture type */ uint32_t temporal_reference; /* current temporal reference */ uint8_t user_data[256]; /* user data last found in compressed stream */ /* user_data[0] contains user data flags, user_data[1] has count */ }; /* generic structure for setting playback modes */ struct video_play_mode { int mode; int p1; int p2; }; /* for loading microcode / fpga programming */ struct video_code { char loadwhat[16]; /* name or tag of file being passed */ int datasize; uint8_t *data; }; #define VIDIOCGCAP _IOR('v',1,struct video_capability) /* Get capabilities */ #define VIDIOCGCHAN _IOWR('v',2,struct video_channel) /* Get channel info (sources) */ #define VIDIOCSCHAN _IOW('v',3,struct video_channel) /* Set channel */ #define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) /* Get tuner abilities */ #define VIDIOCSTUNER _IOW('v',5,struct video_tuner) /* Tune the tuner for the current channel */ #define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */ #define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */ #define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */ #define VIDIOCGWIN _IOR('v',9, struct video_window) /* Get the video overlay window */ #define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */ #define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */ #define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */ #define VIDIOCKEY _IOR('v',13, struct video_key) /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */ #define VIDIOCGFREQ _IOR('v',14, unsigned long) /* Set tuner */ #define VIDIOCSFREQ _IOW('v',15, unsigned long) /* Set tuner */ #define VIDIOCGAUDIO _IOR('v',16, struct video_audio) /* Get audio info */ #define VIDIOCSAUDIO _IOW('v',17, struct video_audio) /* Audio source, mute etc */ #define VIDIOCSYNC _IOW('v',18, int) /* Sync with mmap grabbing */ #define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) /* Grab frames */ #define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) /* Memory map buffer info */ #define VIDIOCGUNIT _IOR('v',21, struct video_unit) /* Get attached units */ #define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) /* Get subcapture */ #define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) /* Set subcapture */ #define VIDIOCSPLAYMODE _IOW('v',24, struct video_play_mode) /* Set output video mode/feature */ #define VIDIOCSWRITEMODE _IOW('v',25, int) /* Set write mode */ #define VIDIOCGPLAYINFO _IOR('v',26, struct video_info) /* Get current playback info from hardware */ #define VIDIOCSMICROCODE _IOW('v',27, struct video_code) /* Load microcode into hardware */ #define VIDIOCGVBIFMT _IOR('v',28, struct vbi_format) /* Get VBI information */ #define VIDIOCSVBIFMT _IOW('v',29, struct vbi_format) /* Set VBI information */ #define BASE_VIDIOCPRIVATE 192 /* 192-255 are private */ /* VIDIOCSWRITEMODE */ #define VID_WRITE_MPEG_AUD 0 #define VID_WRITE_MPEG_VID 1 #define VID_WRITE_OSD 2 #define VID_WRITE_TTX 3 #define VID_WRITE_CC 4 #define VID_WRITE_MJPEG 5 /* VIDIOCSPLAYMODE */ #define VID_PLAY_VID_OUT_MODE 0 /* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */ #define VID_PLAY_GENLOCK 1 /* p1: 0 = OFF, 1 = ON */ /* p2: GENLOCK FINE DELAY value */ #define VID_PLAY_NORMAL 2 #define VID_PLAY_PAUSE 3 #define VID_PLAY_SINGLE_FRAME 4 #define VID_PLAY_FAST_FORWARD 5 #define VID_PLAY_SLOW_MOTION 6 #define VID_PLAY_IMMEDIATE_NORMAL 7 #define VID_PLAY_SWITCH_CHANNELS 8 #define VID_PLAY_FREEZE_FRAME 9 #define VID_PLAY_STILL_MODE 10 #define VID_PLAY_MASTER_MODE 11 /* p1: see below */ #define VID_PLAY_MASTER_NONE 1 #define VID_PLAY_MASTER_VIDEO 2 #define VID_PLAY_MASTER_AUDIO 3 #define VID_PLAY_ACTIVE_SCANLINES 12 /* p1 = first active; p2 = last active */ #define VID_PLAY_RESET 13 #define VID_PLAY_END_MARK 14 #define VID_HARDWARE_BT848 1 #define VID_HARDWARE_QCAM_BW 2 #define VID_HARDWARE_PMS 3 #define VID_HARDWARE_QCAM_C 4 #define VID_HARDWARE_PSEUDO 5 #define VID_HARDWARE_SAA5249 6 #define VID_HARDWARE_AZTECH 7 #define VID_HARDWARE_SF16MI 8 #define VID_HARDWARE_RTRACK 9 #define VID_HARDWARE_ZOLTRIX 10 #define VID_HARDWARE_SAA7146 11 #define VID_HARDWARE_VIDEUM 12 /* Reserved for Winnov videum */ #define VID_HARDWARE_RTRACK2 13 #define VID_HARDWARE_PERMEDIA2 14 /* Reserved for Permedia2 */ #define VID_HARDWARE_RIVA128 15 /* Reserved for RIVA 128 */ #define VID_HARDWARE_PLANB 16 /* PowerMac motherboard video-in */ #define VID_HARDWARE_BROADWAY 17 /* Broadway project */ #define VID_HARDWARE_GEMTEK 18 #define VID_HARDWARE_TYPHOON 19 #define VID_HARDWARE_VINO 20 /* SGI Indy Vino */ #define VID_HARDWARE_CADET 21 /* Cadet radio */ #define VID_HARDWARE_TRUST 22 /* Trust FM Radio */ #define VID_HARDWARE_TERRATEC 23 /* TerraTec ActiveRadio */ #define VID_HARDWARE_CPIA 24 #define VID_HARDWARE_ZR36120 25 /* Zoran ZR36120/ZR36125 */ #define VID_HARDWARE_ZR36067 26 /* Zoran ZR36067/36060 */ #define VID_HARDWARE_OV511 27 #define VID_HARDWARE_ZR356700 28 /* Zoran 36700 series */ #define VID_HARDWARE_W9966 29 #define VID_HARDWARE_SE401 30 /* SE401 USB webcams */ #define VID_HARDWARE_PWC 31 /* Philips webcams */ #define VID_HARDWARE_MEYE 32 /* Sony Vaio MotionEye cameras */ #define VID_HARDWARE_CPIA2 33 #define VID_HARDWARE_VICAM 34 #define VID_HARDWARE_SF16FMR2 35 #endif /* videodev.h */ hamlib-1.2.15.3/tuner/v4l2.c0000644000175000017500000002205612044564477012230 00000000000000/* * Hamlib Tuner backend - Video4Linux (v2) description * Copyright (c) 2004-2011 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include "hamlib/rig.h" #include "tuner.h" /* include config.h */ #include "misc.h" #ifdef HAVE_SYS_IOCTL_H #include #endif #ifdef V4L_IOCTL #include #include "idx_builtin.h" #define V4L2_FUNC (RIG_FUNC_MUTE) #define V4L2_LEVEL_ALL (RIG_LEVEL_AF|RIG_LEVEL_RAWSTR) #define V4L2_PARM_ALL (RIG_PARM_NONE) #define V4L2_VFO (RIG_VFO_A) /* FIXME: per card measures? */ #define V4L2_STR_CAL { 2, { \ { 0, -60 }, \ { 65535, 60 }, \ } } static int v4l2_init(RIG *rig); static int v4l2_open(RIG *rig); static int v4l2_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int v4l2_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int v4l2_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static int v4l2_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); static int v4l2_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int v4l2_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static const char *v4l2_get_info(RIG *rig); /* * v4l (v1) rig capabilities. * * */ const struct rig_caps v4l2_caps = { .rig_model = RIG_MODEL_V4L2, .model_name = "SW/FM radio", .mfg_name = "Video4Linux2", .version = "0.2.1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_PCRECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_DEVICE, .write_delay = 0, .post_write_delay = 0, .timeout = 2000, .retry = 1, .has_get_func = V4L2_FUNC, .has_set_func = V4L2_FUNC, .has_get_level = V4L2_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(V4L2_LEVEL_ALL), .has_get_parm = V4L2_PARM_ALL, .has_set_parm = RIG_PARM_SET(V4L2_PARM_ALL), .vfo_ops = RIG_OP_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 65535 } }, }, .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, }, /* will be rewritten at runtime */ .rx_range_list1 = { {MHz(87.9),MHz(108.9),RIG_MODE_WFM,-1,-1,V4L2_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {MHz(87.9),MHz(108.9),RIG_MODE_WFM,-1,-1,V4L2_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_WFM,100}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_WFM, kHz(230)}, /* guess */ {RIG_MODE_AM, kHz(8)}, /* guess */ RIG_FLT_END, }, .str_cal = V4L2_STR_CAL, .rig_init = v4l2_init, .rig_open = v4l2_open, .set_freq = v4l2_set_freq, .get_freq = v4l2_get_freq, .set_func = v4l2_set_func, .get_func = v4l2_get_func, .set_level = v4l2_set_level, .get_level = v4l2_get_level, .get_info = v4l2_get_info, }; /* * Function definitions below */ #include "videodev2.h" #define DEFAULT_V4L2_PATH "/dev/radio0" int v4l2_init(RIG *rig) { rig->state.rigport.type.rig = RIG_PORT_DEVICE; strncpy(rig->state.rigport.pathname, DEFAULT_V4L2_PATH, FILPATHLEN - 1); return RIG_OK; } int v4l2_open(RIG *rig) { int ret, i; struct v4l2_tuner vt; struct rig_state *rs = &rig->state; double fact; for (i=0; i<8; i++) { vt.index = i; ret = ioctl(rig->state.rigport.fd, VIDIOC_G_TUNER, &vt); if (ret < 0) break; fact = (vt.capability & V4L2_TUNER_CAP_LOW) == 0 ? 16 : 16000; rs->rx_range_list[i].start = vt.rangelow/fact; rs->rx_range_list[i].end = vt.rangehigh/fact; rs->rx_range_list[i].modes = vt.rangehigh/fact < MHz(30) ? RIG_MODE_AM : RIG_MODE_WFM; /* hack! hack! store the resolution in low_power! */ rs->rx_range_list[i].low_power = rint(fact); } return RIG_OK; } int v4l2_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct rig_state *rs = &rig->state; struct v4l2_tuner vt; const freq_range_t *range; unsigned long f; double fact; int ret; /* AM or WFM */ range = rig_get_range (rs->rx_range_list, freq, RIG_MODE_AM|RIG_MODE_WFM); if (!range) return -RIG_ECONF; /* at this point, we are trying to tune to a frequency */ vt.index = (rs->rx_range_list-range)/sizeof(freq_range_t); ret = ioctl(rig->state.rigport.fd, VIDIOC_S_TUNER, &vt); /* set tuner # */ if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOC_S_TUNER: %s\n", strerror(errno)); return -RIG_EIO; } fact = range->low_power; f = rint(freq * fact); /* rounding to nearest int */ ret = ioctl(rig->state.rigport.fd, VIDIOC_S_FREQUENCY, &f); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOC_S_FREQUENCY: %s\n", strerror(errno)); return -RIG_EIO; } return RIG_OK; } int v4l2_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct rig_state *rs = &rig->state; const freq_range_t *range; unsigned long f; double fact; int ret; /* FIXME */ ret = ioctl(rig->state.rigport.fd, VIDIOC_G_FREQUENCY, &f); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOC_G_FREQUENCY: %s\n", strerror(errno)); return -RIG_EIO; } /* FIXME: remember tuner and current *fact* */ range = rig_get_range (rs->rx_range_list, f/16, RIG_MODE_AM|RIG_MODE_WFM); if (!range) return -RIG_ECONF; fact = range->low_power; *freq = f/fact; return RIG_OK; } int v4l2_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { struct v4l2_audio va; int ret; switch ( func ) { case RIG_FUNC_MUTE: ret = ioctl(rig->state.rigport.fd, VIDIOC_G_AUDIO, &va); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOC_G_AUDIO: %s\n", strerror(errno)); return -RIG_EIO; } va.capability = status ? V4L2_CID_AUDIO_MUTE : 0; ret = ioctl(rig->state.rigport.fd, VIDIOC_S_AUDIO, &va); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOC_S_AUDIO: %s\n", strerror(errno)); return -RIG_EIO; } break; default: return -RIG_EINVAL; } return RIG_OK; } int v4l2_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { struct v4l2_audio va; int ret; switch ( func ) { case RIG_FUNC_MUTE: ret = ioctl(rig->state.rigport.fd, VIDIOC_G_AUDIO, &va); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOC_G_AUDIO: %s\n", strerror(errno)); return -RIG_EIO; } *status = (va.capability & V4L2_CID_AUDIO_MUTE) == V4L2_CID_AUDIO_MUTE ; break; default: return -RIG_EINVAL; } return RIG_OK; } int v4l2_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct v4l2_audio va; int ret; ret = ioctl(rig->state.rigport.fd, VIDIOC_G_AUDIO, &va); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOC_G_AUDIO: %s\n", strerror(errno)); return -RIG_EIO; } // TODO RIG_LEVEL_AGC:V4L2_CID_AUTOGAIN & RIG_LEVEL_RF:V4L2_CID_GAIN //V4L2_CID_AUDIO_VOLUME switch ( level ) { case RIG_LEVEL_AF: //va.volume = val.f * 65535; break; default: return -RIG_EINVAL; } ret = ioctl(rig->state.rigport.fd, VIDIOC_S_AUDIO, &va); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOC_S_AUDIO: %s\n", strerror(errno)); return -RIG_EIO; } return RIG_OK; } int v4l2_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct v4l2_audio va; struct v4l2_tuner vt; int ret; switch ( level ) { case RIG_LEVEL_AF: ret = ioctl(rig->state.rigport.fd, VIDIOC_G_AUDIO, &va); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOC_G_AUDIO: %s\n", strerror(errno)); return -RIG_EIO; } //val->f = (float)va.volume / 65535.; break; case RIG_LEVEL_RAWSTR: /* FE_READ_SIGNAL_STRENGTH ? */ ret = ioctl(rig->state.rigport.fd, VIDIOC_G_TUNER, &vt); /* get info */ if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOC_G_TUNER: %s\n", strerror(errno)); return -RIG_EIO; } val->i = vt.signal; break; default: return -RIG_EINVAL; } return RIG_OK; } /* * FIXME: static buf does not allow reentrancy! */ const char *v4l2_get_info(RIG *rig) { static struct v4l2_tuner vt; int ret; vt.index = 0; ret = ioctl(rig->state.rigport.fd, VIDIOC_G_TUNER, &vt); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOC_G_TUNER: %s\n", strerror(errno)); return "Get info failed"; } return (const char *)vt.name; } #endif /* V4L_IOCTL */ hamlib-1.2.15.3/tuner/tuner.h0000644000175000017500000000233612044564477012602 00000000000000/* * Hamlib Tuners backend - main header * Copyright (c) 2004-2011 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _TUNER_H #define _TUNER_H 1 #ifdef HAVE_CONFIG_H #include "config.h" #endif /* * So far, only Linux has Video4Linux support through ioctl :) * until someone port it to some other OS... */ #ifdef HAVE_LINUX_IOCTL_H #define V4L_IOCTL #endif #include "hamlib/rig.h" extern const struct rig_caps v4l_caps; extern const struct rig_caps v4l2_caps; #endif /* _TUNER_H */ hamlib-1.2.15.3/tuner/videodev2.h0000644000175000017500000017754512044564477013353 00000000000000/* * Video for Linux Two header file * * Copyright (C) 1999-2007 the contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * Alternatively you can redistribute this file under the terms of the * BSD license as stated below: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. The names of its contributors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Header file for v4l or V4L2 drivers and applications * with public API. * All kernel-specific stuff were moved to media/v4l2-dev.h, so * no #if __KERNEL tests are allowed here * * See http://linuxtv.org for more info * * Author: Bill Dirks * Justin Schoeman * Hans Verkuil * et al. */ #ifndef __LINUX_VIDEODEV2_H #define __LINUX_VIDEODEV2_H #include #include #include /* * Common stuff for both V4L1 and V4L2 * Moved from videodev.h */ #define VIDEO_MAX_FRAME 32 /* These defines are V4L1 specific and should not be used with the V4L2 API! They will be removed from this header in the future. */ #define VID_TYPE_CAPTURE 1 /* Can capture */ #define VID_TYPE_TUNER 2 /* Can tune */ #define VID_TYPE_TELETEXT 4 /* Does teletext */ #define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ #define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ #define VID_TYPE_CLIPPING 32 /* Can clip */ #define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ #define VID_TYPE_SCALES 128 /* Scalable */ #define VID_TYPE_MONOCHROME 256 /* Monochrome only */ #define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ #define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ #define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ #define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ #define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ /* * M I S C E L L A N E O U S */ /* Four-character-code (FOURCC) */ #define v4l2_fourcc(a, b, c, d)\ ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24)) /* * E N U M S */ enum v4l2_field { V4L2_FIELD_ANY = 0, /* driver can choose from none, top, bottom, interlaced depending on whatever it thinks is approximate ... */ V4L2_FIELD_NONE = 1, /* this device has no fields ... */ V4L2_FIELD_TOP = 2, /* top field only */ V4L2_FIELD_BOTTOM = 3, /* bottom field only */ V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */ V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one buffer, top-bottom order */ V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into separate buffers */ V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field first and the top field is transmitted first */ V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field first and the bottom field is transmitted first */ }; #define V4L2_FIELD_HAS_TOP(field) \ ((field) == V4L2_FIELD_TOP ||\ (field) == V4L2_FIELD_INTERLACED ||\ (field) == V4L2_FIELD_INTERLACED_TB ||\ (field) == V4L2_FIELD_INTERLACED_BT ||\ (field) == V4L2_FIELD_SEQ_TB ||\ (field) == V4L2_FIELD_SEQ_BT) #define V4L2_FIELD_HAS_BOTTOM(field) \ ((field) == V4L2_FIELD_BOTTOM ||\ (field) == V4L2_FIELD_INTERLACED ||\ (field) == V4L2_FIELD_INTERLACED_TB ||\ (field) == V4L2_FIELD_INTERLACED_BT ||\ (field) == V4L2_FIELD_SEQ_TB ||\ (field) == V4L2_FIELD_SEQ_BT) #define V4L2_FIELD_HAS_BOTH(field) \ ((field) == V4L2_FIELD_INTERLACED ||\ (field) == V4L2_FIELD_INTERLACED_TB ||\ (field) == V4L2_FIELD_INTERLACED_BT ||\ (field) == V4L2_FIELD_SEQ_TB ||\ (field) == V4L2_FIELD_SEQ_BT) enum v4l2_buf_type { V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, V4L2_BUF_TYPE_VBI_CAPTURE = 4, V4L2_BUF_TYPE_VBI_OUTPUT = 5, V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, #if 1 /* Experimental */ V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, #endif V4L2_BUF_TYPE_PRIVATE = 0x80, }; enum v4l2_tuner_type { V4L2_TUNER_RADIO = 1, V4L2_TUNER_ANALOG_TV = 2, V4L2_TUNER_DIGITAL_TV = 3, }; enum v4l2_memory { V4L2_MEMORY_MMAP = 1, V4L2_MEMORY_USERPTR = 2, V4L2_MEMORY_OVERLAY = 3, }; /* see also http://vektor.theorem.ca/graphics/ycbcr/ */ enum v4l2_colorspace { /* ITU-R 601 -- broadcast NTSC/PAL */ V4L2_COLORSPACE_SMPTE170M = 1, /* 1125-Line (US) HDTV */ V4L2_COLORSPACE_SMPTE240M = 2, /* HD and modern captures. */ V4L2_COLORSPACE_REC709 = 3, /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */ V4L2_COLORSPACE_BT878 = 4, /* These should be useful. Assume 601 extents. */ V4L2_COLORSPACE_470_SYSTEM_M = 5, V4L2_COLORSPACE_470_SYSTEM_BG = 6, /* I know there will be cameras that send this. So, this is * unspecified chromaticities and full 0-255 on each of the * Y'CbCr components */ V4L2_COLORSPACE_JPEG = 7, /* For RGB colourspaces, this is probably a good start. */ V4L2_COLORSPACE_SRGB = 8, }; enum v4l2_priority { V4L2_PRIORITY_UNSET = 0, /* not initialized */ V4L2_PRIORITY_BACKGROUND = 1, V4L2_PRIORITY_INTERACTIVE = 2, V4L2_PRIORITY_RECORD = 3, V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE, }; struct v4l2_rect { __s32 left; __s32 top; __s32 width; __s32 height; }; struct v4l2_fract { __u32 numerator; __u32 denominator; }; /* * D R I V E R C A P A B I L I T I E S */ struct v4l2_capability { __u8 driver[16]; /* i.e. "bttv" */ __u8 card[32]; /* i.e. "Hauppauge WinTV" */ __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ __u32 version; /* should use KERNEL_VERSION() */ __u32 capabilities; /* Device capabilities */ __u32 reserved[4]; }; /* Values for 'capabilities' field */ #define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ #define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ #define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ #define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ #define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ #define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ #define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */ #define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */ #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ #define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ #define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */ #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ /* * V I D E O I M A G E F O R M A T */ struct v4l2_pix_format { __u32 width; __u32 height; __u32 pixelformat; enum v4l2_field field; __u32 bytesperline; /* for padding, zero if unused */ __u32 sizeimage; enum v4l2_colorspace colorspace; __u32 priv; /* private data, depends on pixelformat */ }; /* Pixel format FOURCC depth Description */ /* RGB formats */ #define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */ #define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */ #define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */ #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ #define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ #define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ #define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */ /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ #define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ /* Palette formats */ #define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */ /* Luminance+Chrominance formats */ #define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */ #define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */ #define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */ #define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */ #define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ #define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */ #define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */ #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */ #define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */ #define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */ #define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */ #define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */ #define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */ #define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */ #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ #define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */ #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */ #define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */ /* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ #define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */ #define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ #define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ /* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */ #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ #define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ #define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */ #define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10 BGBG.. GRGR.. */ #define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */ #define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */ #define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */ /* 10bit raw bayer DPCM compressed to 8 bits */ #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') /* * 10bit raw bayer, expanded to 16 bits * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb... */ #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ /* compressed formats */ #define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */ #define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */ #define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */ #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */ /* Vendor-specific formats */ #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */ #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */ #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */ #define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */ #define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */ #define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */ #define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */ #define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */ #define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */ #define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */ #define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ #define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ #define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ #define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */ #define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ #define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ #define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ #define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ #define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */ #define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */ /* * F O R M A T E N U M E R A T I O N */ struct v4l2_fmtdesc { __u32 index; /* Format number */ enum v4l2_buf_type type; /* buffer type */ __u32 flags; __u8 description[32]; /* Description string */ __u32 pixelformat; /* Format fourcc */ __u32 reserved[4]; }; #define V4L2_FMT_FLAG_COMPRESSED 0x0001 #define V4L2_FMT_FLAG_EMULATED 0x0002 #if 1 /* Experimental Frame Size and frame rate enumeration */ /* * F R A M E S I Z E E N U M E R A T I O N */ enum v4l2_frmsizetypes { V4L2_FRMSIZE_TYPE_DISCRETE = 1, V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, V4L2_FRMSIZE_TYPE_STEPWISE = 3, }; struct v4l2_frmsize_discrete { __u32 width; /* Frame width [pixel] */ __u32 height; /* Frame height [pixel] */ }; struct v4l2_frmsize_stepwise { __u32 min_width; /* Minimum frame width [pixel] */ __u32 max_width; /* Maximum frame width [pixel] */ __u32 step_width; /* Frame width step size [pixel] */ __u32 min_height; /* Minimum frame height [pixel] */ __u32 max_height; /* Maximum frame height [pixel] */ __u32 step_height; /* Frame height step size [pixel] */ }; struct v4l2_frmsizeenum { __u32 index; /* Frame size number */ __u32 pixel_format; /* Pixel format */ __u32 type; /* Frame size type the device supports. */ union { /* Frame size */ struct v4l2_frmsize_discrete discrete; struct v4l2_frmsize_stepwise stepwise; }; __u32 reserved[2]; /* Reserved space for future use */ }; /* * F R A M E R A T E E N U M E R A T I O N */ enum v4l2_frmivaltypes { V4L2_FRMIVAL_TYPE_DISCRETE = 1, V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, V4L2_FRMIVAL_TYPE_STEPWISE = 3, }; struct v4l2_frmival_stepwise { struct v4l2_fract min; /* Minimum frame interval [s] */ struct v4l2_fract max; /* Maximum frame interval [s] */ struct v4l2_fract step; /* Frame interval step size [s] */ }; struct v4l2_frmivalenum { __u32 index; /* Frame format index */ __u32 pixel_format; /* Pixel format */ __u32 width; /* Frame width */ __u32 height; /* Frame height */ __u32 type; /* Frame interval type the device supports. */ union { /* Frame interval */ struct v4l2_fract discrete; struct v4l2_frmival_stepwise stepwise; }; __u32 reserved[2]; /* Reserved space for future use */ }; #endif /* * T I M E C O D E */ struct v4l2_timecode { __u32 type; __u32 flags; __u8 frames; __u8 seconds; __u8 minutes; __u8 hours; __u8 userbits[4]; }; /* Type */ #define V4L2_TC_TYPE_24FPS 1 #define V4L2_TC_TYPE_25FPS 2 #define V4L2_TC_TYPE_30FPS 3 #define V4L2_TC_TYPE_50FPS 4 #define V4L2_TC_TYPE_60FPS 5 /* Flags */ #define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */ #define V4L2_TC_FLAG_COLORFRAME 0x0002 #define V4L2_TC_USERBITS_field 0x000C #define V4L2_TC_USERBITS_USERDEFINED 0x0000 #define V4L2_TC_USERBITS_8BITCHARS 0x0008 /* The above is based on SMPTE timecodes */ struct v4l2_jpegcompression { int quality; int APPn; /* Number of APP segment to be written, * must be 0..15 */ int APP_len; /* Length of data in JPEG APPn segment */ char APP_data[60]; /* Data in the JPEG APPn segment. */ int COM_len; /* Length of data in JPEG COM segment */ char COM_data[60]; /* Data in JPEG COM segment */ __u32 jpeg_markers; /* Which markers should go into the JPEG * output. Unless you exactly know what * you do, leave them untouched. * Inluding less markers will make the * resulting code smaller, but there will * be fewer applications which can read it. * The presence of the APP and COM marker * is influenced by APP_len and COM_len * ONLY, not by this property! */ #define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */ #define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */ #define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ #define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ #define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will * allways use APP0 */ }; /* * M E M O R Y - M A P P I N G B U F F E R S */ struct v4l2_requestbuffers { __u32 count; enum v4l2_buf_type type; enum v4l2_memory memory; __u32 reserved[2]; }; struct v4l2_buffer { __u32 index; enum v4l2_buf_type type; __u32 bytesused; __u32 flags; enum v4l2_field field; struct timeval timestamp; struct v4l2_timecode timecode; __u32 sequence; /* memory location */ enum v4l2_memory memory; union { __u32 offset; unsigned long userptr; } m; __u32 length; __u32 input; __u32 reserved; }; /* Flags for 'flags' field */ #define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */ #define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */ #define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */ #define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */ #define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */ #define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */ /* Buffer is ready, but the data contained within is corrupted. */ #define V4L2_BUF_FLAG_ERROR 0x0040 #define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */ #define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */ /* * O V E R L A Y P R E V I E W */ struct v4l2_framebuffer { __u32 capability; __u32 flags; /* FIXME: in theory we should pass something like PCI device + memory * region + offset instead of some physical address */ void *base; struct v4l2_pix_format fmt; }; /* Flags for the 'capability' field. Read only */ #define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001 #define V4L2_FBUF_CAP_CHROMAKEY 0x0002 #define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 #define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 #define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 #define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 #define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 #define V4L2_FBUF_CAP_SRC_CHROMAKEY 0x0080 /* Flags for the 'flags' field. */ #define V4L2_FBUF_FLAG_PRIMARY 0x0001 #define V4L2_FBUF_FLAG_OVERLAY 0x0002 #define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 #define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 #define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 #define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 #define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040 struct v4l2_clip { struct v4l2_rect c; struct v4l2_clip *next; }; struct v4l2_window { struct v4l2_rect w; enum v4l2_field field; __u32 chromakey; struct v4l2_clip *clips; __u32 clipcount; void *bitmap; __u8 global_alpha; }; /* * C A P T U R E P A R A M E T E R S */ struct v4l2_captureparm { __u32 capability; /* Supported modes */ __u32 capturemode; /* Current mode */ struct v4l2_fract timeperframe; /* Time per frame in .1us units */ __u32 extendedmode; /* Driver-specific extensions */ __u32 readbuffers; /* # of buffers for read */ __u32 reserved[4]; }; /* Flags for 'capability' and 'capturemode' fields */ #define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ #define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ struct v4l2_outputparm { __u32 capability; /* Supported modes */ __u32 outputmode; /* Current mode */ struct v4l2_fract timeperframe; /* Time per frame in seconds */ __u32 extendedmode; /* Driver-specific extensions */ __u32 writebuffers; /* # of buffers for write */ __u32 reserved[4]; }; /* * I N P U T I M A G E C R O P P I N G */ struct v4l2_cropcap { enum v4l2_buf_type type; struct v4l2_rect bounds; struct v4l2_rect defrect; struct v4l2_fract pixelaspect; }; struct v4l2_crop { enum v4l2_buf_type type; struct v4l2_rect c; }; /* * A N A L O G V I D E O S T A N D A R D */ typedef __u64 v4l2_std_id; /* one bit for each */ #define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) #define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) #define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) #define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) #define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) #define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) #define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) #define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) #define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) #define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) #define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) #define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) #define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) #define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) #define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) #define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) #define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) #define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) #define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) #define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000) /* ATSC/HDTV */ #define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) #define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) /* FIXME: Although std_id is 64 bits, there is an issue on PPC32 architecture that makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding this value to 32 bits. As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide), it should work fine. However, if needed to add more than two standards, v4l2-common.c should be fixed. */ /* some merged standards */ #define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC) #define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B) #define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H) #define V4L2_STD_DK (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK) /* some common needed stuff */ #define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ V4L2_STD_PAL_B1 |\ V4L2_STD_PAL_G) #define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\ V4L2_STD_PAL_D1 |\ V4L2_STD_PAL_K) #define V4L2_STD_PAL (V4L2_STD_PAL_BG |\ V4L2_STD_PAL_DK |\ V4L2_STD_PAL_H |\ V4L2_STD_PAL_I) #define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ V4L2_STD_NTSC_M_JP |\ V4L2_STD_NTSC_M_KR) #define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ V4L2_STD_SECAM_K |\ V4L2_STD_SECAM_K1) #define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\ V4L2_STD_SECAM_G |\ V4L2_STD_SECAM_H |\ V4L2_STD_SECAM_DK |\ V4L2_STD_SECAM_L |\ V4L2_STD_SECAM_LC) #define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ V4L2_STD_PAL_60 |\ V4L2_STD_NTSC |\ V4L2_STD_NTSC_443) #define V4L2_STD_625_50 (V4L2_STD_PAL |\ V4L2_STD_PAL_N |\ V4L2_STD_PAL_Nc |\ V4L2_STD_SECAM) #define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\ V4L2_STD_ATSC_16_VSB) #define V4L2_STD_UNKNOWN 0 #define V4L2_STD_ALL (V4L2_STD_525_60 |\ V4L2_STD_625_50) struct v4l2_standard { __u32 index; v4l2_std_id id; __u8 name[24]; struct v4l2_fract frameperiod; /* Frames, not fields */ __u32 framelines; __u32 reserved[4]; }; /* * V I D E O T I M I N G S D V P R E S E T */ struct v4l2_dv_preset { __u32 preset; __u32 reserved[4]; }; /* * D V P R E S E T S E N U M E R A T I O N */ struct v4l2_dv_enum_preset { __u32 index; __u32 preset; __u8 name[32]; /* Name of the preset timing */ __u32 width; __u32 height; __u32 reserved[4]; }; /* * D V P R E S E T V A L U E S */ #define V4L2_DV_INVALID 0 #define V4L2_DV_480P59_94 1 /* BT.1362 */ #define V4L2_DV_576P50 2 /* BT.1362 */ #define V4L2_DV_720P24 3 /* SMPTE 296M */ #define V4L2_DV_720P25 4 /* SMPTE 296M */ #define V4L2_DV_720P30 5 /* SMPTE 296M */ #define V4L2_DV_720P50 6 /* SMPTE 296M */ #define V4L2_DV_720P59_94 7 /* SMPTE 274M */ #define V4L2_DV_720P60 8 /* SMPTE 274M/296M */ #define V4L2_DV_1080I29_97 9 /* BT.1120/ SMPTE 274M */ #define V4L2_DV_1080I30 10 /* BT.1120/ SMPTE 274M */ #define V4L2_DV_1080I25 11 /* BT.1120 */ #define V4L2_DV_1080I50 12 /* SMPTE 296M */ #define V4L2_DV_1080I60 13 /* SMPTE 296M */ #define V4L2_DV_1080P24 14 /* SMPTE 296M */ #define V4L2_DV_1080P25 15 /* SMPTE 296M */ #define V4L2_DV_1080P30 16 /* SMPTE 296M */ #define V4L2_DV_1080P50 17 /* BT.1120 */ #define V4L2_DV_1080P60 18 /* BT.1120 */ /* * D V B T T I M I N G S */ /* BT.656/BT.1120 timing data */ struct v4l2_bt_timings { __u32 width; /* width in pixels */ __u32 height; /* height in lines */ __u32 interlaced; /* Interlaced or progressive */ __u32 polarities; /* Positive or negative polarity */ __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */ __u32 hfrontporch; /* Horizpontal front porch in pixels */ __u32 hsync; /* Horizontal Sync length in pixels */ __u32 hbackporch; /* Horizontal back porch in pixels */ __u32 vfrontporch; /* Vertical front porch in pixels */ __u32 vsync; /* Vertical Sync length in lines */ __u32 vbackporch; /* Vertical back porch in lines */ __u32 il_vfrontporch; /* Vertical front porch for bottom field of * interlaced field formats */ __u32 il_vsync; /* Vertical sync length for bottom field of * interlaced field formats */ __u32 il_vbackporch; /* Vertical back porch for bottom field of * interlaced field formats */ __u32 reserved[16]; } __attribute__ ((packed)); /* Interlaced or progressive format */ #define V4L2_DV_PROGRESSIVE 0 #define V4L2_DV_INTERLACED 1 /* Polarities. If bit is not set, it is assumed to be negative polarity */ #define V4L2_DV_VSYNC_POS_POL 0x00000001 #define V4L2_DV_HSYNC_POS_POL 0x00000002 /* DV timings */ struct v4l2_dv_timings { __u32 type; union { struct v4l2_bt_timings bt; __u32 reserved[32]; }; } __attribute__ ((packed)); /* Values for the type field */ #define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */ /* * V I D E O I N P U T S */ struct v4l2_input { __u32 index; /* Which input */ __u8 name[32]; /* Label */ __u32 type; /* Type of input */ __u32 audioset; /* Associated audios (bitfield) */ __u32 tuner; /* Associated tuner */ v4l2_std_id std; __u32 status; __u32 capabilities; __u32 reserved[3]; }; /* Values for the 'type' field */ #define V4L2_INPUT_TYPE_TUNER 1 #define V4L2_INPUT_TYPE_CAMERA 2 /* field 'status' - general */ #define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */ #define V4L2_IN_ST_NO_SIGNAL 0x00000002 #define V4L2_IN_ST_NO_COLOR 0x00000004 /* field 'status' - sensor orientation */ /* If sensor is mounted upside down set both bits */ #define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */ #define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */ /* field 'status' - analog */ #define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ #define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ /* field 'status' - digital */ #define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */ #define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */ #define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */ /* field 'status' - VCR and set-top box */ #define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */ #define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ #define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ /* capabilities flags */ #define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ #define V4L2_IN_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ #define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */ /* * V I D E O O U T P U T S */ struct v4l2_output { __u32 index; /* Which output */ __u8 name[32]; /* Label */ __u32 type; /* Type of output */ __u32 audioset; /* Associated audios (bitfield) */ __u32 modulator; /* Associated modulator */ v4l2_std_id std; __u32 capabilities; __u32 reserved[3]; }; /* Values for the 'type' field */ #define V4L2_OUTPUT_TYPE_MODULATOR 1 #define V4L2_OUTPUT_TYPE_ANALOG 2 #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 /* capabilities flags */ #define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ #define V4L2_OUT_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ #define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */ /* * C O N T R O L S */ struct v4l2_control { __u32 id; __s32 value; }; struct v4l2_ext_control { __u32 id; __u32 size; __u32 reserved2[1]; union { __s32 value; __s64 value64; char *string; }; } __attribute__ ((packed)); struct v4l2_ext_controls { __u32 ctrl_class; __u32 count; __u32 error_idx; __u32 reserved[2]; struct v4l2_ext_control *controls; }; /* Values for ctrl_class field */ #define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ #define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ #define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ #define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ #define V4L2_CTRL_ID_MASK (0x0fffffff) #define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) #define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) enum v4l2_ctrl_type { V4L2_CTRL_TYPE_INTEGER = 1, V4L2_CTRL_TYPE_BOOLEAN = 2, V4L2_CTRL_TYPE_MENU = 3, V4L2_CTRL_TYPE_BUTTON = 4, V4L2_CTRL_TYPE_INTEGER64 = 5, V4L2_CTRL_TYPE_CTRL_CLASS = 6, V4L2_CTRL_TYPE_STRING = 7, }; /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ struct v4l2_queryctrl { __u32 id; enum v4l2_ctrl_type type; __u8 name[32]; /* Whatever */ __s32 minimum; /* Note signedness */ __s32 maximum; __s32 step; __s32 default_value; __u32 flags; __u32 reserved[2]; }; /* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ struct v4l2_querymenu { __u32 id; __u32 index; __u8 name[32]; /* Whatever */ __u32 reserved; }; /* Control flags */ #define V4L2_CTRL_FLAG_DISABLED 0x0001 #define V4L2_CTRL_FLAG_GRABBED 0x0002 #define V4L2_CTRL_FLAG_READ_ONLY 0x0004 #define V4L2_CTRL_FLAG_UPDATE 0x0008 #define V4L2_CTRL_FLAG_INACTIVE 0x0010 #define V4L2_CTRL_FLAG_SLIDER 0x0020 #define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040 /* Query flag, to be ORed with the control ID */ #define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 /* User-class control IDs defined by V4L2 */ #define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900) #define V4L2_CID_USER_BASE V4L2_CID_BASE /* IDs reserved for driver specific controls */ #define V4L2_CID_PRIVATE_BASE 0x08000000 #define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1) #define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) #define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) #define V4L2_CID_SATURATION (V4L2_CID_BASE+2) #define V4L2_CID_HUE (V4L2_CID_BASE+3) #define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5) #define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6) #define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7) #define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8) #define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9) #define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10) #define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */ #define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12) #define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13) #define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14) #define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15) #define V4L2_CID_GAMMA (V4L2_CID_BASE+16) #define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */ #define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17) #define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18) #define V4L2_CID_GAIN (V4L2_CID_BASE+19) #define V4L2_CID_HFLIP (V4L2_CID_BASE+20) #define V4L2_CID_VFLIP (V4L2_CID_BASE+21) /* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */ #define V4L2_CID_HCENTER (V4L2_CID_BASE+22) #define V4L2_CID_VCENTER (V4L2_CID_BASE+23) #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) enum v4l2_power_line_frequency { V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0, V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1, V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2, }; #define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25) #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26) #define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27) #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) #define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29) #define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30) #define V4L2_CID_COLORFX (V4L2_CID_BASE+31) enum v4l2_colorfx { V4L2_COLORFX_NONE = 0, V4L2_COLORFX_BW = 1, V4L2_COLORFX_SEPIA = 2, V4L2_COLORFX_NEGATIVE = 3, V4L2_COLORFX_EMBOSS = 4, V4L2_COLORFX_SKETCH = 5, V4L2_COLORFX_SKY_BLUE = 6, V4L2_COLORFX_GRASS_GREEN = 7, V4L2_COLORFX_SKIN_WHITEN = 8, V4L2_COLORFX_VIVID = 9, }; #define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) #define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) #define V4L2_CID_ROTATE (V4L2_CID_BASE+34) #define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) #define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36) /* last CID + 1 */ #define V4L2_CID_LASTP1 (V4L2_CID_BASE+37) /* MPEG-class control IDs defined by V4L2 */ #define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) #define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1) /* MPEG streams */ #define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0) enum v4l2_mpeg_stream_type { V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */ V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */ V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */ V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */ V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */ V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */ }; #define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1) #define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2) #define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3) #define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4) #define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5) #define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6) #define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7) enum v4l2_mpeg_stream_vbi_fmt { V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */ V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */ }; /* MPEG audio */ #define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100) enum v4l2_mpeg_audio_sampling_freq { V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0, V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1, V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2, }; #define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101) enum v4l2_mpeg_audio_encoding { V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, V4L2_MPEG_AUDIO_ENCODING_AAC = 3, V4L2_MPEG_AUDIO_ENCODING_AC3 = 4, }; #define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) enum v4l2_mpeg_audio_l1_bitrate { V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0, V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1, V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2, V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3, V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4, V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5, V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6, V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7, V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8, V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9, V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10, V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11, V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12, V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13, }; #define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103) enum v4l2_mpeg_audio_l2_bitrate { V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0, V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1, V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2, V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3, V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4, V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5, V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6, V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7, V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8, V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9, V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10, V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11, V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12, V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13, }; #define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104) enum v4l2_mpeg_audio_l3_bitrate { V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0, V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1, V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2, V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3, V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4, V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5, V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6, V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7, V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8, V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9, V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10, V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11, V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12, V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13, }; #define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105) enum v4l2_mpeg_audio_mode { V4L2_MPEG_AUDIO_MODE_STEREO = 0, V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1, V4L2_MPEG_AUDIO_MODE_DUAL = 2, V4L2_MPEG_AUDIO_MODE_MONO = 3, }; #define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106) enum v4l2_mpeg_audio_mode_extension { V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3, }; #define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107) enum v4l2_mpeg_audio_emphasis { V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0, V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1, V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2, }; #define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108) enum v4l2_mpeg_audio_crc { V4L2_MPEG_AUDIO_CRC_NONE = 0, V4L2_MPEG_AUDIO_CRC_CRC16 = 1, }; #define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) #define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110) #define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111) enum v4l2_mpeg_audio_ac3_bitrate { V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0, V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1, V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2, V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3, V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4, V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5, V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6, V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7, V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8, V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9, V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10, V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11, V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12, V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13, V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14, V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15, V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16, V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, }; /* MPEG video */ #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) enum v4l2_mpeg_video_encoding { V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2, }; #define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) enum v4l2_mpeg_video_aspect { V4L2_MPEG_VIDEO_ASPECT_1x1 = 0, V4L2_MPEG_VIDEO_ASPECT_4x3 = 1, V4L2_MPEG_VIDEO_ASPECT_16x9 = 2, V4L2_MPEG_VIDEO_ASPECT_221x100 = 3, }; #define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202) #define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203) #define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204) #define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205) #define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206) enum v4l2_mpeg_video_bitrate_mode { V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0, V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1, }; #define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207) #define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208) #define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209) #define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210) #define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211) /* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ #define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) #define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0) enum v4l2_mpeg_cx2341x_video_spatial_filter_mode { V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0, V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1) #define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2) enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type { V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3) enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type { V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0, V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4) enum v4l2_mpeg_cx2341x_video_temporal_filter_mode { V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0, V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5) #define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6) enum v4l2_mpeg_cx2341x_video_median_filter_type { V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7) #define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8) #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9) #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) #define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11) /* Camera class control IDs */ #define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900) #define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1) #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1) enum v4l2_exposure_auto_type { V4L2_EXPOSURE_AUTO = 0, V4L2_EXPOSURE_MANUAL = 1, V4L2_EXPOSURE_SHUTTER_PRIORITY = 2, V4L2_EXPOSURE_APERTURE_PRIORITY = 3 }; #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2) #define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3) #define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4) #define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5) #define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6) #define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7) #define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8) #define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9) #define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10) #define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11) #define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) #define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13) #define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14) #define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15) #define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) #define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17) #define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18) /* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) #define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) #define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1) #define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2) #define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3) #define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5) #define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6) #define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64) #define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65) #define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66) #define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80) #define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81) #define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82) #define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83) #define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84) #define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96) #define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97) #define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98) #define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112) enum v4l2_preemphasis { V4L2_PREEMPHASIS_DISABLED = 0, V4L2_PREEMPHASIS_50_uS = 1, V4L2_PREEMPHASIS_75_uS = 2, }; #define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113) #define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114) /* * T U N I N G */ struct v4l2_tuner { __u32 index; __u8 name[32]; enum v4l2_tuner_type type; __u32 capability; __u32 rangelow; __u32 rangehigh; __u32 rxsubchans; __u32 audmode; __s32 signal; __s32 afc; __u32 reserved[4]; }; struct v4l2_modulator { __u32 index; __u8 name[32]; __u32 capability; __u32 rangelow; __u32 rangehigh; __u32 txsubchans; __u32 reserved[4]; }; /* Flags for the 'capability' field */ #define V4L2_TUNER_CAP_LOW 0x0001 #define V4L2_TUNER_CAP_NORM 0x0002 #define V4L2_TUNER_CAP_STEREO 0x0010 #define V4L2_TUNER_CAP_LANG2 0x0020 #define V4L2_TUNER_CAP_SAP 0x0020 #define V4L2_TUNER_CAP_LANG1 0x0040 #define V4L2_TUNER_CAP_RDS 0x0080 /* Flags for the 'rxsubchans' field */ #define V4L2_TUNER_SUB_MONO 0x0001 #define V4L2_TUNER_SUB_STEREO 0x0002 #define V4L2_TUNER_SUB_LANG2 0x0004 #define V4L2_TUNER_SUB_SAP 0x0004 #define V4L2_TUNER_SUB_LANG1 0x0008 #define V4L2_TUNER_SUB_RDS 0x0010 /* Values for the 'audmode' field */ #define V4L2_TUNER_MODE_MONO 0x0000 #define V4L2_TUNER_MODE_STEREO 0x0001 #define V4L2_TUNER_MODE_LANG2 0x0002 #define V4L2_TUNER_MODE_SAP 0x0002 #define V4L2_TUNER_MODE_LANG1 0x0003 #define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 struct v4l2_frequency { __u32 tuner; enum v4l2_tuner_type type; __u32 frequency; __u32 reserved[8]; }; struct v4l2_hw_freq_seek { __u32 tuner; enum v4l2_tuner_type type; __u32 seek_upward; __u32 wrap_around; __u32 reserved[8]; }; /* * R D S */ struct v4l2_rds_data { __u8 lsb; __u8 msb; __u8 block; } __attribute__ ((packed)); #define V4L2_RDS_BLOCK_MSK 0x7 #define V4L2_RDS_BLOCK_A 0 #define V4L2_RDS_BLOCK_B 1 #define V4L2_RDS_BLOCK_C 2 #define V4L2_RDS_BLOCK_D 3 #define V4L2_RDS_BLOCK_C_ALT 4 #define V4L2_RDS_BLOCK_INVALID 7 #define V4L2_RDS_BLOCK_CORRECTED 0x40 #define V4L2_RDS_BLOCK_ERROR 0x80 /* * A U D I O */ struct v4l2_audio { __u32 index; __u8 name[32]; __u32 capability; __u32 mode; __u32 reserved[2]; }; /* Flags for the 'capability' field */ #define V4L2_AUDCAP_STEREO 0x00001 #define V4L2_AUDCAP_AVL 0x00002 /* Flags for the 'mode' field */ #define V4L2_AUDMODE_AVL 0x00001 struct v4l2_audioout { __u32 index; __u8 name[32]; __u32 capability; __u32 mode; __u32 reserved[2]; }; /* * M P E G S E R V I C E S * * NOTE: EXPERIMENTAL API */ #if 1 #define V4L2_ENC_IDX_FRAME_I (0) #define V4L2_ENC_IDX_FRAME_P (1) #define V4L2_ENC_IDX_FRAME_B (2) #define V4L2_ENC_IDX_FRAME_MASK (0xf) struct v4l2_enc_idx_entry { __u64 offset; __u64 pts; __u32 length; __u32 flags; __u32 reserved[2]; }; #define V4L2_ENC_IDX_ENTRIES (64) struct v4l2_enc_idx { __u32 entries; __u32 entries_cap; __u32 reserved[4]; struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES]; }; #define V4L2_ENC_CMD_START (0) #define V4L2_ENC_CMD_STOP (1) #define V4L2_ENC_CMD_PAUSE (2) #define V4L2_ENC_CMD_RESUME (3) /* Flags for V4L2_ENC_CMD_STOP */ #define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0) struct v4l2_encoder_cmd { __u32 cmd; __u32 flags; union { struct { __u32 data[8]; } raw; }; }; #endif /* * D A T A S E R V I C E S ( V B I ) * * Data services API by Michael Schimek */ /* Raw VBI */ struct v4l2_vbi_format { __u32 sampling_rate; /* in 1 Hz */ __u32 offset; __u32 samples_per_line; __u32 sample_format; /* V4L2_PIX_FMT_* */ __s32 start[2]; __u32 count[2]; __u32 flags; /* V4L2_VBI_* */ __u32 reserved[2]; /* must be zero */ }; /* VBI flags */ #define V4L2_VBI_UNSYNC (1 << 0) #define V4L2_VBI_INTERLACED (1 << 1) /* Sliced VBI * * This implements is a proposal V4L2 API to allow SLICED VBI * required for some hardware encoders. It should change without * notice in the definitive implementation. */ struct v4l2_sliced_vbi_format { __u16 service_set; /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field (equals frame lines 313-336 for 625 line video standards, 263-286 for 525 line standards) */ __u16 service_lines[2][24]; __u32 io_size; __u32 reserved[2]; /* must be zero */ }; /* Teletext World System Teletext (WST), defined on ITU-R BT.653-2 */ #define V4L2_SLICED_TELETEXT_B (0x0001) /* Video Program System, defined on ETS 300 231*/ #define V4L2_SLICED_VPS (0x0400) /* Closed Caption, defined on EIA-608 */ #define V4L2_SLICED_CAPTION_525 (0x1000) /* Wide Screen System, defined on ITU-R BT1119.1 */ #define V4L2_SLICED_WSS_625 (0x4000) #define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) #define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) struct v4l2_sliced_vbi_cap { __u16 service_set; /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field (equals frame lines 313-336 for 625 line video standards, 263-286 for 525 line standards) */ __u16 service_lines[2][24]; enum v4l2_buf_type type; __u32 reserved[3]; /* must be 0 */ }; struct v4l2_sliced_vbi_data { __u32 id; __u32 field; /* 0: first field, 1: second field */ __u32 line; /* 1-23 */ __u32 reserved; /* must be 0 */ __u8 data[48]; }; /* * Sliced VBI data inserted into MPEG Streams */ /* * V4L2_MPEG_STREAM_VBI_FMT_IVTV: * * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI * data * * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header * definitions are not included here. See the MPEG-2 specifications for details * on these headers. */ /* Line type IDs */ #define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1) #define V4L2_MPEG_VBI_IVTV_CAPTION_525 (4) #define V4L2_MPEG_VBI_IVTV_WSS_625 (5) #define V4L2_MPEG_VBI_IVTV_VPS (7) struct v4l2_mpeg_vbi_itv0_line { __u8 id; /* One of V4L2_MPEG_VBI_IVTV_* above */ __u8 data[42]; /* Sliced VBI data for the line */ } __attribute__ ((packed)); struct v4l2_mpeg_vbi_itv0 { __le32 linemask[2]; /* Bitmasks of VBI service lines present */ struct v4l2_mpeg_vbi_itv0_line line[35]; } __attribute__ ((packed)); struct v4l2_mpeg_vbi_ITV0 { struct v4l2_mpeg_vbi_itv0_line line[36]; } __attribute__ ((packed)); #define V4L2_MPEG_VBI_IVTV_MAGIC0 "itv0" #define V4L2_MPEG_VBI_IVTV_MAGIC1 "ITV0" struct v4l2_mpeg_vbi_fmt_ivtv { __u8 magic[4]; union { struct v4l2_mpeg_vbi_itv0 itv0; struct v4l2_mpeg_vbi_ITV0 ITV0; }; } __attribute__ ((packed)); /* * A G G R E G A T E S T R U C T U R E S */ /* Stream data format */ struct v4l2_format { enum v4l2_buf_type type; union { struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */ struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */ struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */ __u8 raw_data[200]; /* user-defined */ } fmt; }; /* Stream type-dependent parameters */ struct v4l2_streamparm { enum v4l2_buf_type type; union { struct v4l2_captureparm capture; struct v4l2_outputparm output; __u8 raw_data[200]; /* user-defined */ } parm; }; /* * E V E N T S */ #define V4L2_EVENT_ALL 0 #define V4L2_EVENT_VSYNC 1 #define V4L2_EVENT_EOS 2 #define V4L2_EVENT_PRIVATE_START 0x08000000 /* Payload for V4L2_EVENT_VSYNC */ struct v4l2_event_vsync { /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */ __u8 field; } __attribute__ ((packed)); struct v4l2_event { __u32 type; union { struct v4l2_event_vsync vsync; __u8 data[64]; } u; __u32 pending; __u32 sequence; struct timespec timestamp; __u32 reserved[9]; }; struct v4l2_event_subscription { __u32 type; __u32 reserved[7]; }; /* * A D V A N C E D D E B U G G I N G * * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS! * FOR DEBUGGING, TESTING AND INTERNAL USE ONLY! */ /* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ #define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */ #define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */ #define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ #define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */ struct v4l2_dbg_match { __u32 type; /* Match type */ union { /* Match this chip, meaning determined by type */ __u32 addr; char name[32]; }; } __attribute__ ((packed)); struct v4l2_dbg_register { struct v4l2_dbg_match match; __u32 size; /* register size in bytes */ __u64 reg; __u64 val; } __attribute__ ((packed)); /* VIDIOC_DBG_G_CHIP_IDENT */ struct v4l2_dbg_chip_ident { struct v4l2_dbg_match match; __u32 ident; /* chip identifier as specified in */ __u32 revision; /* chip revision, chip specific */ } __attribute__ ((packed)); /* * I O C T L C O D E S F O R V I D E O D E V I C E S * */ #define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability) #define VIDIOC_RESERVED _IO('V', 1) #define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc) #define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format) #define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format) #define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers) #define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer) #define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer) #define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer) #define VIDIOC_OVERLAY _IOW('V', 14, int) #define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer) #define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer) #define VIDIOC_STREAMON _IOW('V', 18, int) #define VIDIOC_STREAMOFF _IOW('V', 19, int) #define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm) #define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm) #define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id) #define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id) #define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard) #define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input) #define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control) #define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control) #define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner) #define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner) #define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio) #define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio) #define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl) #define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu) #define VIDIOC_G_INPUT _IOR('V', 38, int) #define VIDIOC_S_INPUT _IOWR('V', 39, int) #define VIDIOC_G_OUTPUT _IOR('V', 46, int) #define VIDIOC_S_OUTPUT _IOWR('V', 47, int) #define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output) #define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout) #define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout) #define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator) #define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator) #define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency) #define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency) #define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap) #define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop) #define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop) #define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression) #define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression) #define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id) #define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format) #define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio) #define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout) #define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority) #define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority) #define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap) #define VIDIOC_LOG_STATUS _IO('V', 70) #define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls) #define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls) #define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls) #if 1 #define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum) #define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum) #define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx) #define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd) #define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd) #endif #if 1 /* Experimental, meant for debugging, testing and internal use. Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined. You must be root to use these ioctls. Never use these in applications! */ #define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register) #define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register) /* Experimental, meant for debugging, testing and internal use. Never use this ioctl in applications! */ #define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident) #endif #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) #define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset) #define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset) #define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset) #define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset) #define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) #define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) #define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event) #define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription) #define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription) /* Reminder: when adding new ioctls please add support for them to drivers/media/video/v4l2-compat-ioctl32.c as well! */ #ifdef __OLD_VIDIOC_ /* for compatibility, will go away some day */ #define VIDIOC_OVERLAY_OLD _IOWR('V', 14, int) #define VIDIOC_S_PARM_OLD _IOW('V', 22, struct v4l2_streamparm) #define VIDIOC_S_CTRL_OLD _IOW('V', 28, struct v4l2_control) #define VIDIOC_G_AUDIO_OLD _IOWR('V', 33, struct v4l2_audio) #define VIDIOC_G_AUDOUT_OLD _IOWR('V', 49, struct v4l2_audioout) #define VIDIOC_CROPCAP_OLD _IOR('V', 58, struct v4l2_cropcap) #endif #define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ #endif /* __LINUX_VIDEODEV2_H */ hamlib-1.2.15.3/tuner/v4l.c0000644000175000017500000002140612044564477012144 00000000000000/* * Hamlib Tuner backend - Video4Linux (v1) description * Copyright (c) 2004-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include "hamlib/rig.h" #include "tuner.h" /* include config.h */ #include "misc.h" #ifdef HAVE_SYS_IOCTL_H #include #endif #ifdef V4L_IOCTL #include #include "idx_builtin.h" #define V4L_FUNC (RIG_FUNC_MUTE) #define V4L_LEVEL_ALL (RIG_LEVEL_AF|RIG_LEVEL_RAWSTR) #define V4L_PARM_ALL (RIG_PARM_NONE) #define V4L_VFO (RIG_VFO_A) /* FIXME: per card measures? */ #define V4L_STR_CAL { 2, { \ { 0, -60 }, \ { 65535, 60 }, \ } } static int v4l_init(RIG *rig); static int v4l_open(RIG *rig); static int v4l_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int v4l_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int v4l_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static int v4l_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); static int v4l_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int v4l_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static const char *v4l_get_info(RIG *rig); /* * v4l (v1) rig capabilities. * * */ const struct rig_caps v4l_caps = { .rig_model = RIG_MODEL_V4L, .model_name = "SW/FM radio", .mfg_name = "Video4Linux", .version = "0.2.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_PCRECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_DEVICE, .write_delay = 0, .post_write_delay = 0, .timeout = 2000, .retry = 1, .has_get_func = V4L_FUNC, .has_set_func = V4L_FUNC, .has_get_level = V4L_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(V4L_LEVEL_ALL), .has_get_parm = V4L_PARM_ALL, .has_set_parm = RIG_PARM_SET(V4L_PARM_ALL), .vfo_ops = RIG_OP_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 65535 } }, }, .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, }, /* will be rewritten at runtime */ .rx_range_list1 = { {MHz(87.9),MHz(108.9),RIG_MODE_WFM,-1,-1,V4L_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {MHz(87.9),MHz(108.9),RIG_MODE_WFM,-1,-1,V4L_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_WFM,100}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_WFM, kHz(230)}, /* guess */ {RIG_MODE_AM, kHz(8)}, /* guess */ RIG_FLT_END, }, .str_cal = V4L_STR_CAL, .rig_init = v4l_init, .rig_open = v4l_open, .set_freq = v4l_set_freq, .get_freq = v4l_get_freq, .set_func = v4l_set_func, .get_func = v4l_get_func, .set_level = v4l_set_level, .get_level = v4l_get_level, .get_info = v4l_get_info, }; /* * Function definitions below */ #include "videodev.h" #define DEFAULT_V4L_PATH "/dev/radio0" int v4l_init(RIG *rig) { rig->state.rigport.type.rig = RIG_PORT_DEVICE; strncpy(rig->state.rigport.pathname, DEFAULT_V4L_PATH, FILPATHLEN - 1); return RIG_OK; } int v4l_open(RIG *rig) { int ret, i; struct video_tuner vt; struct rig_state *rs = &rig->state; double fact; for (i=0; i<8; i++) { vt.tuner = i; ret = ioctl(rig->state.rigport.fd, VIDIOCGTUNER, &vt); if (ret < 0) break; fact = (vt.flags & VIDEO_TUNER_LOW) == 0 ? 16 : 16000; rs->rx_range_list[i].start = vt.rangelow/fact; rs->rx_range_list[i].end = vt.rangehigh/fact; rs->rx_range_list[i].modes = vt.rangehigh/fact < MHz(30) ? RIG_MODE_AM : RIG_MODE_WFM; /* hack! hack! store the resolution in low_power! */ rs->rx_range_list[i].low_power = rint(fact); } return RIG_OK; } int v4l_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct rig_state *rs = &rig->state; struct video_tuner vt; const freq_range_t *range; unsigned long f; double fact; int ret; /* AM or WFM */ range = rig_get_range (rs->rx_range_list, freq, RIG_MODE_AM|RIG_MODE_WFM); if (!range) return -RIG_ECONF; /* at this point, we are trying to tune to a frequency */ vt.tuner = (rs->rx_range_list-range)/sizeof(freq_range_t); ret = ioctl(rig->state.rigport.fd, VIDIOCSTUNER, &vt); /* set tuner # */ if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOCSTUNER: %s\n", strerror(errno)); return -RIG_EIO; } fact = range->low_power; f = rint(freq * fact); /* rounding to nearest int */ ret = ioctl(rig->state.rigport.fd, VIDIOCSFREQ, &f); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOCSFREQ: %s\n", strerror(errno)); return -RIG_EIO; } return RIG_OK; } int v4l_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct rig_state *rs = &rig->state; const freq_range_t *range; unsigned long f; double fact; int ret; ret = ioctl(rig->state.rigport.fd, VIDIOCGFREQ, &f); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOCGFREQ: %s\n", strerror(errno)); return -RIG_EIO; } /* FIXME: remember tuner and current *fact* */ range = rig_get_range (rs->rx_range_list, f/16, RIG_MODE_AM|RIG_MODE_WFM); if (!range) return -RIG_ECONF; fact = range->low_power; *freq = f/fact; return RIG_OK; } int v4l_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { struct video_audio va; int ret; switch ( func ) { case RIG_FUNC_MUTE: ret = ioctl(rig->state.rigport.fd, VIDIOCGAUDIO, &va); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOCGAUDIO: %s\n", strerror(errno)); return -RIG_EIO; } va.flags = status ? VIDEO_AUDIO_MUTE : 0; ret = ioctl(rig->state.rigport.fd, VIDIOCSAUDIO, &va); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOCSAUDIO: %s\n", strerror(errno)); return -RIG_EIO; } break; default: return -RIG_EINVAL; } return RIG_OK; } int v4l_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { struct video_audio va; int ret; switch ( func ) { case RIG_FUNC_MUTE: ret = ioctl(rig->state.rigport.fd, VIDIOCGAUDIO, &va); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOCGAUDIO: %s\n", strerror(errno)); return -RIG_EIO; } *status = (va.flags & VIDEO_AUDIO_MUTE) == VIDEO_AUDIO_MUTE ; break; default: return -RIG_EINVAL; } return RIG_OK; } int v4l_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct video_audio va; int ret; ret = ioctl(rig->state.rigport.fd, VIDIOCGAUDIO, &va); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOCGAUDIO: %s\n", strerror(errno)); return -RIG_EIO; } switch ( level ) { case RIG_LEVEL_AF: va.volume = val.f * 65535; break; default: return -RIG_EINVAL; } ret = ioctl(rig->state.rigport.fd, VIDIOCSAUDIO, &va); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOCSAUDIO: %s\n", strerror(errno)); return -RIG_EIO; } return RIG_OK; } int v4l_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct video_audio va; struct video_tuner vt; int ret; switch ( level ) { case RIG_LEVEL_AF: ret = ioctl(rig->state.rigport.fd, VIDIOCGAUDIO, &va); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOCGAUDIO: %s\n", strerror(errno)); return -RIG_EIO; } val->f = (float)va.volume / 65535.; break; case RIG_LEVEL_RAWSTR: ret = ioctl(rig->state.rigport.fd, VIDIOCGTUNER, &vt); /* get info */ if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOCGTUNER: %s\n", strerror(errno)); return -RIG_EIO; } val->i = vt.signal; break; default: return -RIG_EINVAL; } return RIG_OK; } /* * FIXME: static buf does not allow reentrancy! */ const char *v4l_get_info(RIG *rig) { static struct video_tuner vt; int ret; vt.tuner = 0; ret = ioctl(rig->state.rigport.fd, VIDIOCGTUNER, &vt); if (ret < 0) { rig_debug(RIG_DEBUG_ERR, "ioctl VIDIOCGTUNER: %s\n", strerror(errno)); return "Get info failed"; } return vt.name; } #endif /* V4L_IOCTL */ hamlib-1.2.15.3/tuner/Makefile.in0000644000175000017500000004774012044564560013342 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = tuner DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_tuner_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = v4l.lo v4l2.lo am_hamlib_tuner_la_OBJECTS = $(am__objects_1) tuner.lo hamlib_tuner_la_OBJECTS = $(am_hamlib_tuner_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_tuner_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_tuner_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_tuner_la_SOURCES) DIST_SOURCES = $(hamlib_tuner_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ TUNERSRCLIST = v4l.c v4l2.c pkglib_LTLIBRARIES = hamlib-tuner.la hamlib_tuner_la_SOURCES = $(TUNERSRCLIST) tuner.c hamlib_tuner_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_tuner_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = tuner.h videodev.h videodev2.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tuner/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tuner/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-tuner.la: $(hamlib_tuner_la_OBJECTS) $(hamlib_tuner_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_tuner_la_LINK) -rpath $(pkglibdir) $(hamlib_tuner_la_OBJECTS) $(hamlib_tuner_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tuner.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v4l.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/v4l2.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/tuner/tuner.c0000644000175000017500000000220012044564477012563 00000000000000/* * Hamlib Tuner backend - main file * Copyright (C) 2004-2011 Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "tuner.h" /* config.h */ #include #include "hamlib/rig.h" #include "register.h" DECLARE_INITRIG_BACKEND(tuner) { rig_debug(RIG_DEBUG_VERBOSE, "tuner: _init called\n"); #ifdef V4L_IOCTL rig_register(&v4l_caps); rig_register(&v4l2_caps); #endif return RIG_OK; } hamlib-1.2.15.3/tuner/Makefile.am0000644000175000017500000000043612044564477013327 00000000000000TUNERSRCLIST = v4l.c v4l2.c pkglib_LTLIBRARIES = hamlib-tuner.la hamlib_tuner_la_SOURCES = $(TUNERSRCLIST) tuner.c hamlib_tuner_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_tuner_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = tuner.h videodev.h videodev2.h hamlib-1.2.15.3/src/0000755000175000017500000000000012044565001010762 500000000000000hamlib-1.2.15.3/src/cm108.h0000644000175000017500000000352712044564477011732 00000000000000/* * Hamlib Interface - CM108 GPIO communication header * Copyright (c) 2000-2003 by Frank Singleton * Copyright (c) 2000-2010 by Stephane Fillod * Copyright (c) 2011 by Andrew Errington * * 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 _CM108_H #define _CM108_H 1 #include #include "iofunc.h" __BEGIN_DECLS /* Hamlib internal use, see rig.c */ int cm108_open(hamlib_port_t *p); int cm108_close(hamlib_port_t *p); int cm108_ptt_set(hamlib_port_t *p, ptt_t pttx); int cm108_ptt_get(hamlib_port_t *p, ptt_t *pttx); int cm108_dcd_get(hamlib_port_t *p, dcd_t *dcdx); extern HAMLIB_EXPORT(int) cm108_write_data(hamlib_port_t *p, unsigned char data); extern HAMLIB_EXPORT(int) cm108_write_control(hamlib_port_t *p, unsigned char control); extern HAMLIB_EXPORT(int) cm108_read_data(hamlib_port_t *p, unsigned char *data); extern HAMLIB_EXPORT(int) cm108_read_control(hamlib_port_t *p, unsigned char *control); extern HAMLIB_EXPORT(int) cm108_read_status(hamlib_port_t *p, unsigned char *status); extern HAMLIB_EXPORT(int) cm108_lock(hamlib_port_t *p); extern HAMLIB_EXPORT(int) cm108_unlock(hamlib_port_t *p); __END_DECLS #endif /* _CM108_H */ hamlib-1.2.15.3/src/register.c0000644000175000017500000002161112044564477012713 00000000000000/* * Hamlib Interface - provides registering for dynamically loadable backends. * Copyright (c) 2000-2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * \brief Dynamic registration of backends * \file register.c * * doc todo: Let's explain what's going on here! */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include /* This is libtool's dl wrapper */ #include #include #ifndef PATH_MAX # define PATH_MAX 1024 #endif #define RIG_BACKEND_MAX 32 /* * RIG_BACKEND_LIST is defined in riglist.h, please keep it up to data, * ie. each time you give birth to a new backend * Also, it should be possible to register "external" backend, * that is backend that were not known by Hamlib at compile time. * Maybe, riglist.h should reserve some numbers for them? --SF */ static struct { int be_num; const char *be_name; rig_model_t (* be_probe_all)(hamlib_port_t*, rig_probe_func_t, rig_ptr_t); } rig_backend_list[RIG_BACKEND_MAX] = RIG_BACKEND_LIST; /* * This struct to keep track of known rig models. * It is chained, and used in a hash table, see below. */ struct rig_list { const struct rig_caps *caps; lt_dlhandle handle; /* handle returned by lt_dlopen() */ struct rig_list *next; }; #define RIGLSTHASHSZ 16 #define HASH_FUNC(a) ((a)%RIGLSTHASHSZ) /* * The rig_hash_table is a hash table pointing to a list of next==NULL * terminated caps. */ static struct rig_list *rig_hash_table[RIGLSTHASHSZ] = { NULL, }; static int rig_lookup_backend(rig_model_t rig_model); /* * Basically, this is a hash insert function that doesn't check for dup! */ int HAMLIB_API rig_register(const struct rig_caps *caps) { int hval; struct rig_list *p; if (!caps) return -RIG_EINVAL; rig_debug(RIG_DEBUG_VERBOSE, "rig_register (%d)\n",caps->rig_model); #ifndef DONT_WANT_DUP_CHECK if (rig_get_caps(caps->rig_model)!=NULL) return -RIG_EINVAL; #endif p = (struct rig_list*)malloc(sizeof(struct rig_list)); if (!p) return -RIG_ENOMEM; hval = HASH_FUNC(caps->rig_model); p->caps = caps; p->handle = NULL; p->next = rig_hash_table[hval]; rig_hash_table[hval] = p; return RIG_OK; } /* * Get rig capabilities. * ie. rig_hash_table lookup */ const struct rig_caps * HAMLIB_API rig_get_caps(rig_model_t rig_model) { struct rig_list *p; for (p = rig_hash_table[HASH_FUNC(rig_model)]; p; p=p->next) { if (p->caps->rig_model == rig_model) return p->caps; } return NULL; /* sorry, caps not registered! */ } /* * lookup for backend index in rig_backend_list table, * according to BACKEND_NUM * return -1 if not found. */ static int rig_lookup_backend(rig_model_t rig_model) { int i; for (i=0; inext) { if (p->caps->rig_model == rig_model) { if (q == NULL) rig_hash_table[hval] = p->next; else q->next = p->next; free(p); return RIG_OK; } q = p; } return -RIG_EINVAL; /* sorry, caps not registered! */ } /* * rig_list_foreach * executes cfunc on all the elements stored in the rig hash list */ int HAMLIB_API rig_list_foreach(int (*cfunc)(const struct rig_caps*, rig_ptr_t),rig_ptr_t data) { struct rig_list *p; int i; if (!cfunc) return -RIG_EINVAL; for (i=0; inext) if ((*cfunc)(p->caps,data) == 0) return RIG_OK; } return RIG_OK; } static int dummy_rig_probe(const hamlib_port_t *p, rig_model_t model, rig_ptr_t data) { rig_debug(RIG_DEBUG_TRACE, "Found rig, model %d\n", model); return RIG_OK; } /* * rig_probe_first * called straight by rig_probe */ rig_model_t rig_probe_first(hamlib_port_t *p) { int i; rig_model_t model; for (i=0; i #include #include /* Standard input/output definitions */ #include /* String function definitions */ #include /* UNIX standard function definitions */ #include /* File control definitions */ #include /* Error number definitions */ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif #include #include #include "misc.h" /** * \brief Convert from binary to 4-bit BCD digits, little-endian * \param bcd_data * \param freq * \param bcd_len * \return bcd_data * * Convert a long long (e.g. frequency in Hz) to 4-bit BCD digits, * packed two digits per octet, in little-endian order * (e.g. byte order 90 78 56 34 12 for 1234567890 Hz). * * bcd_len is the number of BCD digits, usually 10 or 8 in 1-Hz units, * and 6 digits in 100-Hz units for Tx offset data. * * Hope the compiler will do a good job optimizing it (esp. w/the 64bit freq) * * Returns a pointer to (unsigned char *)bcd_data. * * \sa to_bcd_be */ unsigned char * HAMLIB_API to_bcd(unsigned char bcd_data[], unsigned long long freq, unsigned bcd_len) { int i; unsigned char a; /* '450'/4-> 5,0;0,4 */ /* '450'/3-> 5,0;x,4 */ for (i=0; i < bcd_len/2; i++) { a = freq%10; freq /= 10; a |= (freq%10)<<4; freq /= 10; bcd_data[i] = a; } if (bcd_len&1) { bcd_data[i] &= 0xf0; bcd_data[i] |= freq%10; /* NB: high nibble is left uncleared */ } return bcd_data; } /** * \brief Convert BCD digits, little-endian, to a long long (e.g. frequency in Hz) * \param bcd_data * \param bcd_len * \return binary result (e.g. frequency) * * Convert BCD digits, little-endian, (byte order 90 78 56 34 12 * for 1234567890 Hz) to a long long (e.g. frequency in Hz) * * bcd_len is the number of BCD digits. * * Hope the compiler will do a good job optimizing it (esp. w/ the 64bit freq) * * Returns frequency in Hz an unsigned long long integer. * * \sa from_bcd_be */ unsigned long long HAMLIB_API from_bcd(const unsigned char bcd_data[], unsigned bcd_len) { int i; freq_t f = 0; if (bcd_len&1) f = bcd_data[bcd_len/2] & 0x0f; for (i=(bcd_len/2)-1; i >= 0; i--) { f *= 10; f += bcd_data[i]>>4; f *= 10; f += bcd_data[i] & 0x0f; } return f; } /** * \brief Convert from binary to 4-bit BCD digits, big-endian * \param bcd_data * \param freq * \param bcd_len * \return bcd_data * * Same as to_bcd, but in big-endian order * (e.g. byte order 12 34 56 78 90 for 1234567890 Hz) * * \sa to_bcd */ unsigned char * HAMLIB_API to_bcd_be(unsigned char bcd_data[], unsigned long long freq, unsigned bcd_len) { int i; unsigned char a; /* '450'/4 -> 0,4;5,0 */ /* '450'/3 -> 4,5;0,x */ if (bcd_len&1) { bcd_data[bcd_len/2] &= 0x0f; bcd_data[bcd_len/2] |= (freq%10)<<4; /* NB: low nibble is left uncleared */ freq /= 10; } for (i=(bcd_len/2)-1; i >= 0; i--) { a = freq%10; freq /= 10; a |= (freq%10)<<4; freq /= 10; bcd_data[i] = a; } return bcd_data; } /** * \brief Convert 4-bit BCD digits to binary, big-endian * \param bcd_data * \param bcd_len * \return binary result * * Same as from_bcd, but in big-endian order * (e.g. byte order 12 34 56 78 90 for 1234567890 Hz) * * \sa from_bcd */ unsigned long long HAMLIB_API from_bcd_be(const unsigned char bcd_data[], unsigned bcd_len) { int i; freq_t f = 0; for (i=0; i < bcd_len/2; i++) { f *= 10; f += bcd_data[i]>>4; f *= 10; f += bcd_data[i] & 0x0f; } if (bcd_len&1) { f *= 10; f += bcd_data[bcd_len/2]>>4; } return f; } #ifndef llabs #define llabs(a) ((a)<0?-(a):(a)) #endif /** * \brief Pretty print a frequency * \param str for result (may need up to 17 char) * \param freq input in Hz * * rig_freq_snprintf? * pretty print frequencies * str must be long enough. max can be as long as 17 chars */ int HAMLIB_API sprintf_freq(char *str, freq_t freq) { double f; char *hz; if (llabs(freq) >= GHz(1)) { hz = "GHz"; f = (double)freq/GHz(1); } else if (llabs(freq) >= MHz(1)) { hz = "MHz"; f = (double)freq/MHz(1); } else if (llabs(freq) >= kHz(1)) { hz = "kHz"; f = (double)freq/kHz(1); } else { hz = "Hz"; f = (double)freq; } return sprintf (str, "%g %s", f, hz); } /** * \brief Convert enum RIG_STATUS_... to printable string * \param status RIG_STATUS_?? * \return string */ const char * HAMLIB_API rig_strstatus(enum rig_status_e status) { switch (status) { case RIG_STATUS_ALPHA: return "Alpha"; case RIG_STATUS_UNTESTED: return "Untested"; case RIG_STATUS_BETA: return "Beta"; case RIG_STATUS_STABLE: return "Stable"; case RIG_STATUS_BUGGY: return "Buggy"; } return ""; } static struct { rmode_t mode; const char *str; } mode_str[] = { { RIG_MODE_AM, "AM" }, { RIG_MODE_CW, "CW" }, { RIG_MODE_USB, "USB" }, { RIG_MODE_LSB, "LSB" }, { RIG_MODE_RTTY, "RTTY" }, { RIG_MODE_FM, "FM" }, { RIG_MODE_WFM, "WFM" }, { RIG_MODE_CWR, "CWR" }, { RIG_MODE_RTTYR, "RTTYR" }, { RIG_MODE_AMS, "AMS" }, { RIG_MODE_PKTLSB, "PKTLSB" }, { RIG_MODE_PKTUSB, "PKTUSB" }, { RIG_MODE_PKTFM, "PKTFM" }, { RIG_MODE_ECSSUSB, "ECSSUSB" }, { RIG_MODE_ECSSLSB, "ECSSLSB" }, { RIG_MODE_FAX, "FAX" }, { RIG_MODE_SAM, "SAM" }, { RIG_MODE_SAL, "SAL" }, { RIG_MODE_SAH, "SAH" }, { RIG_MODE_DSB, "DSB"}, { RIG_MODE_NONE, "" }, }; /** * \brief Convert alpha string to enum RIG_MODE * \param s input alpha string * \return enum RIG_MODE_?? * * \sa rmode_t */ rmode_t HAMLIB_API rig_parse_mode(const char *s) { int i; for (i=0 ; mode_str[i].str[0] != '\0'; i++) if (!strcmp(s, mode_str[i].str)) return mode_str[i].mode; return RIG_MODE_NONE; } /** * \brief Convert enum RIG_MODE to alpha string * \param mode RIG_MODE_... * \return alpha string * * \sa rmode_t */ const char * HAMLIB_API rig_strrmode(rmode_t mode) { int i; if (mode == RIG_MODE_NONE) return ""; for (i=0 ; mode_str[i].str[0] != '\0'; i++) if (mode == mode_str[i].mode) return mode_str[i].str; return ""; } static struct { vfo_t vfo; const char *str; } vfo_str[] = { { RIG_VFO_A, "VFOA" }, { RIG_VFO_B, "VFOB" }, { RIG_VFO_C, "VFOC" }, { RIG_VFO_CURR, "currVFO" }, { RIG_VFO_MEM, "MEM" }, { RIG_VFO_VFO, "VFO" }, { RIG_VFO_TX, "TX" }, { RIG_VFO_RX, "RX" }, { RIG_VFO_MAIN, "Main" }, { RIG_VFO_SUB, "Sub" }, { RIG_VFO_NONE, "" }, }; /** * \brief Convert alpha string to enum RIG_VFO_... * \param s input alpha string * \return RIG_VFO_... * * \sa RIG_VFO_A RIG_VFO_B RIG_VFO_C RIG_VFO_MAIN RIG_VFO_SUB RIG_VFO_VFO RIG_VFO_CURR RIG_VFO_MEM RIG_VFO_TX RIG_VFO_RX RIG_VFO_NONE */ vfo_t HAMLIB_API rig_parse_vfo(const char *s) { int i; for (i=0 ; vfo_str[i].str[0] != '\0'; i++) if (!strcmp(s, vfo_str[i].str)) return vfo_str[i].vfo; return RIG_VFO_NONE; } /** * \brief Convert enum RIG_VFO_... to alpha string * \param vfo RIG_VFO_... * \return alpha string * * \sa RIG_VFO_A RIG_VFO_B RIG_VFO_C RIG_VFO_MAIN RIG_VFO_SUB RIG_VFO_VFO RIG_VFO_CURR RIG_VFO_MEM RIG_VFO_TX RIG_VFO_RX RIG_VFO_NONE */ const char * HAMLIB_API rig_strvfo(vfo_t vfo) { int i; if (vfo == RIG_VFO_NONE) return ""; for (i=0 ; vfo_str[i].str[0] != '\0'; i++) if (vfo == vfo_str[i].vfo) return vfo_str[i].str; return ""; } static struct { setting_t func; const char *str; } func_str[] = { { RIG_FUNC_FAGC, "FAGC" }, { RIG_FUNC_NB, "NB" }, { RIG_FUNC_COMP, "COMP" }, { RIG_FUNC_VOX, "VOX" }, { RIG_FUNC_TONE, "TONE" }, { RIG_FUNC_TSQL, "TSQL" }, { RIG_FUNC_SBKIN, "SBKIN" }, { RIG_FUNC_FBKIN, "FBKIN" }, { RIG_FUNC_ANF, "ANF" }, { RIG_FUNC_NR, "NR" }, { RIG_FUNC_AIP, "AIP" }, { RIG_FUNC_APF, "APF" }, { RIG_FUNC_MON, "MON" }, { RIG_FUNC_MN, "MN" }, { RIG_FUNC_RF, "RF" }, { RIG_FUNC_ARO, "ARO" }, { RIG_FUNC_LOCK, "LOCK" }, { RIG_FUNC_MUTE, "MUTE" }, { RIG_FUNC_VSC, "VSC" }, { RIG_FUNC_REV, "REV" }, { RIG_FUNC_SQL, "SQL" }, { RIG_FUNC_ABM, "ABM" }, { RIG_FUNC_BC, "BC" }, { RIG_FUNC_MBC, "MBC" }, { RIG_FUNC_AFC, "AFC" }, { RIG_FUNC_SATMODE, "SATMODE" }, { RIG_FUNC_SCOPE, "SCOPE" }, { RIG_FUNC_RESUME, "RESUME" }, { RIG_FUNC_TBURST, "TBURST" }, { RIG_FUNC_TUNER, "TUNER" }, { RIG_FUNC_NONE, "" }, }; /** * \brief Convert alpha string to enum RIG_FUNC_... * \param s input alpha string * \return RIG_FUNC_... * * \sa rig_func_e */ setting_t HAMLIB_API rig_parse_func(const char *s) { int i; for (i=0 ; func_str[i].str[0] != '\0'; i++) if (!strcmp(s, func_str[i].str)) return func_str[i].func; return RIG_FUNC_NONE; } /** * \brief Convert enum RIG_FUNC_... to alpha string * \param func RIG_FUNC_... * \return alpha string * * \sa rig_func_e */ const char * HAMLIB_API rig_strfunc(setting_t func) { int i; if (func == RIG_FUNC_NONE) return ""; for (i=0; func_str[i].str[0] != '\0'; i++) if (func == func_str[i].func) return func_str[i].str; return ""; } static struct { setting_t level; const char *str; } level_str[] = { { RIG_LEVEL_PREAMP, "PREAMP" }, { RIG_LEVEL_ATT, "ATT" }, { RIG_LEVEL_VOX, "VOX" }, { RIG_LEVEL_AF, "AF" }, { RIG_LEVEL_RF, "RF" }, { RIG_LEVEL_SQL, "SQL" }, { RIG_LEVEL_IF, "IF" }, { RIG_LEVEL_APF, "APF" }, { RIG_LEVEL_NR, "NR" }, { RIG_LEVEL_PBT_IN, "PBT_IN" }, { RIG_LEVEL_PBT_OUT, "PBT_OUT" }, { RIG_LEVEL_CWPITCH, "CWPITCH" }, { RIG_LEVEL_RFPOWER, "RFPOWER" }, { RIG_LEVEL_MICGAIN, "MICGAIN" }, { RIG_LEVEL_KEYSPD, "KEYSPD" }, { RIG_LEVEL_NOTCHF, "NOTCHF" }, { RIG_LEVEL_COMP, "COMP" }, { RIG_LEVEL_AGC, "AGC" }, { RIG_LEVEL_BKINDL, "BKINDL" }, { RIG_LEVEL_BALANCE, "BAL" }, { RIG_LEVEL_METER, "METER" }, { RIG_LEVEL_VOXGAIN, "VOXGAIN" }, { RIG_LEVEL_ANTIVOX, "ANTIVOX" }, { RIG_LEVEL_SLOPE_LOW, "SLOPE_LOW" }, { RIG_LEVEL_SLOPE_HIGH, "SLOPE_HIGH" }, { RIG_LEVEL_BKIN_DLYMS, "BKIN_DLYMS" }, { RIG_LEVEL_RAWSTR, "RAWSTR" }, { RIG_LEVEL_SQLSTAT, "SQLSTAT" }, { RIG_LEVEL_SWR, "SWR" }, { RIG_LEVEL_ALC, "ALC" }, { RIG_LEVEL_STRENGTH, "STRENGTH" }, { RIG_LEVEL_NONE, "" }, }; /** * \brief Convert alpha string to enum RIG_LEVEL_... * \param s input alpha string * \return RIG_LEVEL_... * * \sa rig_level_e */ setting_t HAMLIB_API rig_parse_level(const char *s) { int i; for (i=0 ; level_str[i].str[0] != '\0'; i++) if (!strcmp(s, level_str[i].str)) return level_str[i].level; return RIG_LEVEL_NONE; } /** * \brief Convert enum RIG_LEVEL_... to alpha string * \param level RIG_LEVEL_... * \return alpha string * * \sa rig_level_e */ const char * HAMLIB_API rig_strlevel(setting_t level) { int i; if (level == RIG_LEVEL_NONE) return ""; for (i=0; level_str[i].str[0] != '\0'; i++) if (level == level_str[i].level) return level_str[i].str; return ""; } static struct { setting_t parm; const char *str; } parm_str[] = { { RIG_PARM_ANN, "ANN" }, { RIG_PARM_APO, "APO" }, { RIG_PARM_BACKLIGHT, "BACKLIGHT" }, { RIG_PARM_BEEP, "BEEP" }, { RIG_PARM_TIME, "TIME" }, { RIG_PARM_BAT, "BAT" }, { RIG_PARM_KEYLIGHT, "KEYLIGHT"}, { RIG_PARM_NONE, "" }, }; /** * \brief Convert alpha string to RIG_PARM_... * \param s input alpha string * \return RIG_PARM_... * * \sa rig_parm_e */ setting_t HAMLIB_API rig_parse_parm(const char *s) { int i; for (i=0 ; parm_str[i].str[0] != '\0'; i++) if (!strcmp(s, parm_str[i].str)) return parm_str[i].parm; return RIG_PARM_NONE; } /** * \brief Convert enum RIG_PARM_... to alpha string * \param parm RIG_PARM_... * \return alpha string * * \sa rig_parm_e */ const char * HAMLIB_API rig_strparm(setting_t parm) { int i; if (parm == RIG_PARM_NONE) return ""; for (i=0; parm_str[i].str[0] != '\0'; i++) if (parm == parm_str[i].parm) return parm_str[i].str; return ""; } static struct { vfo_op_t vfo_op; const char *str; } vfo_op_str[] = { { RIG_OP_CPY, "CPY" }, { RIG_OP_XCHG, "XCHG" }, { RIG_OP_FROM_VFO, "FROM_VFO" }, { RIG_OP_TO_VFO, "TO_VFO" }, { RIG_OP_MCL, "MCL" }, { RIG_OP_UP, "UP" }, { RIG_OP_DOWN, "DOWN" }, { RIG_OP_BAND_UP, "BAND_UP" }, { RIG_OP_BAND_DOWN, "BAND_DOWN" }, { RIG_OP_LEFT, "LEFT" }, { RIG_OP_RIGHT, "RIGHT" }, { RIG_OP_TUNE, "TUNE" }, { RIG_OP_TOGGLE, "TOGGLE" }, { RIG_OP_NONE, "" }, }; /** * \brief Convert alpha string to enum RIG_OP_... * \param s alpha string * \return RIG_OP_... * * \sa vfo_op_t */ vfo_op_t HAMLIB_API rig_parse_vfo_op(const char *s) { int i; for (i=0 ; vfo_op_str[i].str[0] != '\0'; i++) if (!strcmp(s, vfo_op_str[i].str)) return vfo_op_str[i].vfo_op; return RIG_OP_NONE; } /** * \brief Convert enum RIG_OP_... to alpha string * \param op RIG_OP_... * \return alpha string * * \sa vfo_op_t */ const char * HAMLIB_API rig_strvfop(vfo_op_t op) { int i; if (op == RIG_OP_NONE) return ""; for (i=0; vfo_op_str[i].str[0] != '\0'; i++) if (op == vfo_op_str[i].vfo_op) return vfo_op_str[i].str; return ""; } static struct { scan_t rscan; const char *str; } scan_str[] = { { RIG_SCAN_STOP, "STOP" }, { RIG_SCAN_MEM, "MEM" }, { RIG_SCAN_SLCT, "SLCT" }, { RIG_SCAN_PRIO, "PRIO" }, { RIG_SCAN_PROG, "PROG" }, { RIG_SCAN_DELTA, "DELTA" }, { RIG_SCAN_VFO, "VFO" }, { RIG_SCAN_PLT, "PLT" }, { RIG_SCAN_NONE, "" }, }; /** * \brief Convert alpha string to enum RIG_SCAN_... * \param s alpha string * \return RIG_SCAN_... * * \sa scan_t */ scan_t HAMLIB_API rig_parse_scan(const char *s) { int i; for (i=0 ; scan_str[i].str[0] != '\0'; i++) { if (strcmp(s, scan_str[i].str) == 0) { return scan_str[i].rscan; } } return RIG_SCAN_NONE; } /** * \brief Convert enum RIG_SCAN_... to alpha string * \param rscan RIG_SCAN_... * \return alpha string * * \sa scan_t */ const char * HAMLIB_API rig_strscan(scan_t rscan) { int i; if (rscan == RIG_SCAN_NONE) return ""; for (i=0; scan_str[i].str[0] != '\0'; i++) if (rscan == scan_str[i].rscan) return scan_str[i].str; return ""; } /** * \brief convert enum RIG_RPT_SHIFT_... to printable character * \param shift RIG_RPT_SHIFT_?? * \return alpha character */ const char * HAMLIB_API rig_strptrshift(rptr_shift_t shift) { switch (shift) { case RIG_RPT_SHIFT_MINUS: return "-"; case RIG_RPT_SHIFT_PLUS: return "+"; case RIG_RPT_SHIFT_NONE: return "None"; } return NULL; } /** * \brief Convert alpha char to enum RIG_RPT_SHIFT_... * \param s alpha char * \return RIG_RPT_SHIFT_... */ rptr_shift_t HAMLIB_API rig_parse_rptr_shift(const char *s) { if (strcmp(s, "+") == 0) return RIG_RPT_SHIFT_PLUS; else if (strcmp(s, "-") == 0) return RIG_RPT_SHIFT_MINUS; else return RIG_RPT_SHIFT_NONE; } static struct { chan_type_t mtype; const char *str; } mtype_str[] = { { RIG_MTYPE_MEM, "MEM" }, { RIG_MTYPE_EDGE, "EDGE" }, { RIG_MTYPE_CALL, "CALL" }, { RIG_MTYPE_MEMOPAD, "MEMOPAD" }, { RIG_MTYPE_SAT, "SAT" }, { RIG_MTYPE_BAND, "BAND" }, { RIG_MTYPE_PRIO, "PRIO" }, { RIG_MTYPE_NONE, "" }, }; /** * \brief Convert alpha string to enum RIG_MTYPE_... * \param s alpha string * \return RIG_MTYPE_... * * \sa chan_type_t */ chan_type_t HAMLIB_API rig_parse_mtype(const char *s) { int i; for (i=0 ; mtype_str[i].str[0] != '\0'; i++) { if (strcmp(s, mtype_str[i].str) == 0) { return mtype_str[i].mtype; } } return RIG_MTYPE_NONE; } /** * \brief Convert enum RIG_MTYPE_... to alpha string * \param mtype RIG_MTYPE_... * \return alpha string * * \sa chan_type_t */ const char * HAMLIB_API rig_strmtype(chan_type_t mtype) { int i; if (mtype == RIG_MTYPE_NONE) return ""; for (i=0; mtype_str[i].str[0] != '\0'; i++) if (mtype == mtype_str[i].mtype) return mtype_str[i].str; return ""; } static long timediff(const struct timeval *tv1, const struct timeval *tv2) { struct timeval tv; tv.tv_usec = tv1->tv_usec - tv2->tv_usec; tv.tv_sec = tv1->tv_sec - tv2->tv_sec; return ((tv.tv_sec * 1000L) + (tv.tv_usec / 1000L)); } /** * \brief Helper for checking cache timeout * \param tv pointer to timeval, date of cache * \param timeout duration of cache validity, in millisec * \return 1 when timed out, 0 when cache shall be used */ int HAMLIB_API rig_check_cache_timeout(const struct timeval *tv, int timeout) { struct timeval curr; long t; if (tv->tv_sec == 0 && tv->tv_usec == 0) { rig_debug(RIG_DEBUG_VERBOSE, "forced cache timeout\n"); return 1; } gettimeofday(&curr, NULL); t = timediff(&curr, tv); if (t < timeout) { rig_debug(RIG_DEBUG_VERBOSE, "%s: using cache (%ld ms)\n", __func__, t); return 0; } else { rig_debug(RIG_DEBUG_VERBOSE, "%s: cache timed out (%ld ms)\n", __func__, t); return 1; } } /** * \brief Helper for forcing cache timeout next call * * This function is typically to be called in backend_set_* functions, * so that a sequence: * \code rig_get_freq(); rig_set_freq(); rig_get_freq(); \endcode * * doesn't return a bogus (cached) value in the last rig_get_freq(). * * \param tv pointer to timeval to be reset */ void HAMLIB_API rig_force_cache_timeout(struct timeval *tv) { tv->tv_sec = 0; tv->tv_usec = 0; } /** @} */ hamlib-1.2.15.3/src/event.c0000644000175000017500000004076012044564477012216 00000000000000/* * Hamlib Interface - event handling * Copyright (c) 2000-2010 by Stephane Fillod * Copyright (c) 2000-2003 by Frank Singleton * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* Doc todo: Verify assignment to rig group. Consider doc of internal rtns. */ /** * \addtogroup rig * @{ */ /** * \file event.c * \brief Event handling */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #ifdef HAVE_SYS_TIME_H #include #endif #include #ifdef HAVE_SYS_IOCTL_H #include #endif #include #include #include #include #include "event.h" #if defined(WIN32) && !defined(HAVE_TERMIOS_H) #include "win32termios.h" #define select win32_serial_select #endif #ifndef DOC_HIDDEN #define CHECK_RIG_ARG(r) (!(r) || !(r)->caps || !(r)->state.comm_state) #ifdef HAVE_SIGACTION static struct sigaction hamlib_trn_oldact, hamlib_trn_poll_oldact; #ifdef HAVE_SIGINFO_T static void sa_sigioaction(int signum, siginfo_t *si, void *data); static void sa_sigalrmaction(int signum, siginfo_t *si, void *data); #else static void sa_sigiohandler(int signum); static void sa_sigalrmhandler(int signum); #endif #endif /* This one should be in an include file */ extern int foreach_opened_rig(int (*cfunc)(RIG *, rig_ptr_t),rig_ptr_t data); /* * add_trn_rig * not exported in Hamlib API. * Assumes rig->caps->transceive == RIG_TRN_RIG */ int add_trn_rig(RIG *rig) { #ifdef HAVE_SIGACTION struct sigaction act; int status; /* * FIXME: multiple open will register several time SIGIO hndlr */ memset(&act, 0, sizeof(act)); #ifdef HAVE_SIGINFO_T act.sa_sigaction = sa_sigioaction; #else act.sa_handler = sa_sigiohandler; #endif sigemptyset(&act.sa_mask); #if defined(HAVE_SIGINFO_T) && defined(SA_SIGINFO) act.sa_flags = SA_SIGINFO|SA_RESTART; #else act.sa_flags = SA_RESTART; #endif status = sigaction(SIGIO, &act, &hamlib_trn_oldact); if (status < 0) rig_debug(RIG_DEBUG_ERR,"%s: sigaction failed: %s\n", __func__, strerror(errno)); status = fcntl(rig->state.rigport.fd, F_SETOWN, getpid()); if (status < 0) rig_debug(RIG_DEBUG_ERR,"%s: fcntl SETOWN failed: %s\n", __func__, strerror(errno)); #if defined(HAVE_SIGINFO_T) && defined(O_ASYNC) #ifdef F_SETSIG status = fcntl(rig->state.rigport.fd, F_SETSIG, SIGIO); if (status < 0) rig_debug(RIG_DEBUG_ERR,"%s: fcntl SETSIG failed: %s\n", __func__, strerror(errno)); #endif status = fcntl(rig->state.rigport.fd, F_SETFL, O_ASYNC); if (status < 0) rig_debug(RIG_DEBUG_ERR,"%s: fcntl SETASYNC failed: %s\n", __func__, strerror(errno)); #else return -RIG_ENIMPL; #endif return RIG_OK; #else return -RIG_ENIMPL; #endif /* !HAVE_SIGACTION */ } /* * remove_trn_rig * not exported in Hamlib API. * Assumes rig->caps->transceive == RIG_TRN_RIG */ int remove_trn_rig(RIG *rig) { #ifdef HAVE_SIGACTION int status; /* assert(rig->caps->transceive == RIG_TRN_RIG); */ #if defined(HAVE_SIGINFO_T) && defined(O_ASYNC) status = fcntl(rig->state.rigport.fd, F_SETFL, 0); if (status < 0) rig_debug(RIG_DEBUG_ERR,"%s: fcntl SETASYNC failed: %s\n", __func__, strerror(errno)); #endif status = sigaction(SIGIO, &hamlib_trn_oldact, NULL); if (status < 0) rig_debug(RIG_DEBUG_ERR,"%s: sigaction failed: %s\n", __func__, strerror(errno)); return RIG_OK; #else return -RIG_ENIMPL; #endif /* !HAVE_SIGACTION */ } #ifdef HAVE_SIGACTION /* * add_trn_poll_rig * not exported in Hamlib API. */ static int add_trn_poll_rig(RIG *rig) { #ifdef HAVE_SIGACTION struct sigaction act; int status; /* * FIXME: multiple open will register several time SIGALRM hndlr */ memset(&act, 0, sizeof(act)); #ifdef HAVE_SIGINFO_T act.sa_sigaction = sa_sigalrmaction; #else act.sa_handler = sa_sigalrmhandler; #endif act.sa_flags = SA_RESTART; sigemptyset(&act.sa_mask); status = sigaction(SIGALRM, &act, &hamlib_trn_poll_oldact); if (status < 0) rig_debug(RIG_DEBUG_ERR,"%s sigaction failed: %s\n", __func__, strerror(errno)); return RIG_OK; #else return -RIG_ENIMPL; #endif /* !HAVE_SIGINFO */ } /* * remove_trn_poll_rig * not exported in Hamlib API. */ static int remove_trn_poll_rig(RIG *rig) { #ifdef HAVE_SIGINFO int status; status = sigaction(SIGALRM, &hamlib_trn_poll_oldact, NULL); if (status < 0) rig_debug(RIG_DEBUG_ERR,"%s sigaction failed: %s\n", __func__, strerror(errno)); return RIG_OK; #else return -RIG_ENIMPL; #endif /* !HAVE_SIGINFO */ } /* * This is used by sa_sigio, the SIGIO handler * to find out which rig generated this event, * and decode/process it. * * assumes rig!=NULL */ static int search_rig_and_decode(RIG *rig, rig_ptr_t data) { fd_set rfds; struct timeval tv; int retval; /* * so far, only file oriented ports have event reporting support */ if (rig->state.rigport.type.rig != RIG_PORT_SERIAL || rig->state.rigport.fd == -1) return -1; /* FIXME: siginfo is not portable, however use it where available */ #if 0&&defined(HAVE_SIGINFO_T) siginfo_t *si = (siginfo_t*)data; if (rig->state.rigport.fd != si->si_fd) return -1; #else FD_ZERO(&rfds); FD_SET(rig->state.rigport.fd, &rfds); /* Read status immediately. */ tv.tv_sec = 0; tv.tv_usec = 0; /* don't use FIONREAD to detect activity * since it is less portable than select * REM: EINTR possible with 0sec timeout? retval==0? */ retval = select(rig->state.rigport.fd+1, &rfds, NULL, NULL, &tv); if (retval < 0) { rig_debug(RIG_DEBUG_ERR, "search_rig_and_decode: select: %s\n", strerror(errno)); return -1; } #endif /* * Do not disturb, the backend is currently receiving data */ if (rig->state.hold_decode) return -1; if (rig->caps->decode_event) rig->caps->decode_event(rig); return 1; /* process each opened rig */ } /* * This is used by sa_sigio, the SIGALRM handler * to poll each RIG in RIG_TRN_POLL mode. * * assumes rig!=NULL */ static int search_rig_and_poll(RIG *rig, rig_ptr_t data) { struct rig_state *rs = &rig->state; int retval; if (rig->state.transceive != RIG_TRN_POLL) return -1; /* * Do not disturb, the backend is currently receiving data */ if (rig->state.hold_decode) return -1; rig->state.hold_decode = 2; if (rig->caps->get_vfo && rig->callbacks.vfo_event) { vfo_t vfo = RIG_VFO_CURR; retval = rig->caps->get_vfo(rig, &vfo); if (retval == RIG_OK) { if (vfo != rs->current_vfo) { rig->callbacks.vfo_event(rig, vfo, rig->callbacks.vfo_arg); } rs->current_vfo = vfo; } } if (rig->caps->get_freq && rig->callbacks.freq_event) { freq_t freq; retval = rig->caps->get_freq(rig, RIG_VFO_CURR, &freq); if (retval == RIG_OK) { if (freq != rs->current_freq) { rig->callbacks.freq_event(rig, RIG_VFO_CURR, freq, rig->callbacks.freq_arg); } rs->current_freq = freq; } } if (rig->caps->get_mode && rig->callbacks.mode_event) { rmode_t rmode; pbwidth_t width; retval = rig->caps->get_mode(rig, RIG_VFO_CURR, &rmode, &width); if (retval == RIG_OK) { if (rmode != rs->current_mode || width != rs->current_width) { rig->callbacks.mode_event(rig, RIG_VFO_CURR, rmode, width, rig->callbacks.mode_arg); } rs->current_mode = rmode; rs->current_width = width; } } rig->state.hold_decode = 0; return 1; /* process each opened rig */ } /* * This is the SIGIO handler * * lookup in the list of open rigs, * check the rig is not holding SIGIO, * then call rig->caps->decode_event() (this is done by search_rig) */ #ifdef HAVE_SIGINFO_T static void sa_sigioaction(int signum, siginfo_t *si, rig_ptr_t data) { rig_debug(RIG_DEBUG_VERBOSE, "sa_sigioaction: activity detected\n"); foreach_opened_rig(search_rig_and_decode, si); } #else static void sa_sigiohandler(int signum) { rig_debug(RIG_DEBUG_VERBOSE, "sa_sigiohandler: activity detected\n"); foreach_opened_rig(search_rig_and_decode, NULL); } #endif /* * This is the SIGALRM handler * * lookup in the list of open rigs, * check the rig is not holding SIGALRM, * then call get_freq and check for changes (this is done by search_rig) */ #ifdef HAVE_SIGINFO_T static void sa_sigalrmaction(int signum, siginfo_t *si, rig_ptr_t data) { rig_debug(RIG_DEBUG_TRACE, "sa_sigalrmaction entered\n"); foreach_opened_rig(search_rig_and_poll, si); } #else static void sa_sigalrmhandler(int signum) { rig_debug(RIG_DEBUG_TRACE, "sa_sigalrmhandler entered\n"); foreach_opened_rig(search_rig_and_poll, NULL); } #endif /* !HAVE_SIGINFO_T */ #endif /* HAVE_SIGINFO */ #endif /* !DOC_HIDDEN */ /** * \brief set the callback for freq events * \param rig The rig handle * \param cb The callback to install * \param arg A Pointer to some private data to pass later on to the callback * * Install a callback for freq events, to be called when in transceive mode. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_trn() */ int HAMLIB_API rig_set_freq_callback(RIG *rig, freq_cb_t cb, rig_ptr_t arg) { if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; rig->callbacks.freq_event = cb; rig->callbacks.freq_arg = arg; return RIG_OK; } /** * \brief set the callback for mode events * \param rig The rig handle * \param cb The callback to install * \param arg A Pointer to some private data to pass later on to the callback * * Install a callback for mode events, to be called when in transceive mode. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_trn() */ int HAMLIB_API rig_set_mode_callback(RIG *rig, mode_cb_t cb, rig_ptr_t arg) { if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; rig->callbacks.mode_event = cb; rig->callbacks.mode_arg = arg; return RIG_OK; } /** * \brief set the callback for vfo events * \param rig The rig handle * \param cb The callback to install * \param arg A Pointer to some private data to pass later on to the callback * * Install a callback for vfo events, to be called when in transceive mode. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_trn() */ int HAMLIB_API rig_set_vfo_callback(RIG *rig, vfo_cb_t cb, rig_ptr_t arg) { if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; rig->callbacks.vfo_event = cb; rig->callbacks.vfo_arg = arg; return RIG_OK; } /** * \brief set the callback for ptt events * \param rig The rig handle * \param cb The callback to install * \param arg A Pointer to some private data to pass later on to the callback * * Install a callback for ptt events, to be called when in transceive mode. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_trn() */ int HAMLIB_API rig_set_ptt_callback(RIG *rig, ptt_cb_t cb, rig_ptr_t arg) { if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; rig->callbacks.ptt_event = cb; rig->callbacks.ptt_arg = arg; return RIG_OK; } /** * \brief set the callback for dcd events * \param rig The rig handle * \param cb The callback to install * \param arg A Pointer to some private data to pass later on to the callback * * Install a callback for dcd events, to be called when in transceive mode. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_trn() */ int HAMLIB_API rig_set_dcd_callback(RIG *rig, dcd_cb_t cb, rig_ptr_t arg) { if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; rig->callbacks.dcd_event = cb; rig->callbacks.dcd_arg = arg; return RIG_OK; } /** * \brief set the callback for pipelined tuning module * \param rig The rig handle * \param cb The callback to install * \param arg A Pointer to some private data to pass later on to the callback * used to maintain state during pipelined tuning. * * Install a callback for pipelined tuning module, to be called when the * rig_scan( SCAN_PLT ) loop needs a new frequency, mode and width. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_trn() */ int HAMLIB_API rig_set_pltune_callback(RIG *rig, pltune_cb_t cb, rig_ptr_t arg) { if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; rig->callbacks.pltune = cb; rig->callbacks.pltune_arg = arg; return RIG_OK; } /** * \brief control the transceive mode * \param rig The rig handle * \param trn The transceive status to set to * * Enable/disable the transceive handling of a rig and kick off async mode. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_trn() */ int HAMLIB_API rig_set_trn(RIG *rig, int trn) { const struct rig_caps *caps; int retcode = RIG_OK; #ifdef HAVE_SETITIMER struct itimerval value; #endif if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; /* detect whether tranceive is active already */ if (trn != RIG_TRN_OFF && rig->state.transceive != RIG_TRN_OFF) { if (trn == rig->state.transceive) { return RIG_OK; } else { /* when going POLL<->RIG, transtition to OFF */ retcode = rig_set_trn(rig, RIG_TRN_OFF); if (retcode != RIG_OK) return retcode; } } switch (trn) { case RIG_TRN_RIG: if (caps->transceive != RIG_TRN_RIG) return -RIG_ENAVAIL; retcode = add_trn_rig(rig); /* some protocols (e.g. CI-V's) offer no way * to turn on/off the transceive mode */ if (retcode == RIG_OK && caps->set_trn) { retcode = caps->set_trn(rig, RIG_TRN_RIG); } break; case RIG_TRN_POLL: #ifdef HAVE_SETITIMER add_trn_poll_rig(rig); /* install handler here */ value.it_value.tv_sec = 0; value.it_value.tv_usec = rig->state.poll_interval*1000; value.it_interval.tv_sec = 0; value.it_interval.tv_usec = rig->state.poll_interval*1000; retcode = setitimer(ITIMER_REAL, &value, NULL); if (retcode == -1) { rig_debug(RIG_DEBUG_ERR, "%s: setitimer: %s\n", __func__, strerror(errno)); remove_trn_poll_rig(rig); return -RIG_EINTERNAL; } #else return -RIG_ENAVAIL; #endif break; case RIG_TRN_OFF: if (rig->state.transceive == RIG_TRN_POLL) { #ifdef HAVE_SETITIMER retcode = remove_trn_poll_rig(rig); value.it_value.tv_sec = 0; value.it_value.tv_usec = 0; value.it_interval.tv_sec = 0; value.it_interval.tv_usec = 0; retcode = setitimer(ITIMER_REAL, &value, NULL); if (retcode == -1) { rig_debug(RIG_DEBUG_ERR, "%s: setitimer: %s\n", __func__, strerror(errno)); return -RIG_EINTERNAL; } #else return -RIG_ENAVAIL; #endif } else if (rig->state.transceive == RIG_TRN_RIG) { retcode = remove_trn_rig(rig); if (caps->set_trn && caps->transceive == RIG_TRN_RIG) { retcode = caps->set_trn(rig, RIG_TRN_OFF); } } break; default: return -RIG_EINVAL; } if (retcode == RIG_OK) rig->state.transceive = trn; return retcode; } /** * \brief get the current transceive mode * \param rig The rig handle * \param trn The location where to store the current transceive mode * * Retrieves the current status of the transceive mode, i.e. if radio * sends new status automatically when some changes happened on the radio. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_trn() */ int HAMLIB_API rig_get_trn(RIG *rig, int *trn) { if (CHECK_RIG_ARG(rig) || !trn) return -RIG_EINVAL; if (rig->caps->get_trn != NULL) return rig->caps->get_trn(rig, trn); *trn = rig->state.transceive; return RIG_OK; } /** @} */ hamlib-1.2.15.3/src/network.h0000644000175000017500000000217312044564477012567 00000000000000/* * Hamlib Interface - network communication header * Copyright (c) 2000-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _NETWORK_H #define _NETWORK_H 1 #include #include "iofunc.h" __BEGIN_DECLS /* Hamlib internal use, see rig.c */ int network_open(hamlib_port_t *p, int default_port); int network_close(hamlib_port_t *rp); __END_DECLS #endif /* _NETWORK_H */ hamlib-1.2.15.3/src/misc.h0000644000175000017500000000570112044564477012031 00000000000000/* * Hamlib Interface - toolbox header * Copyright (c) 2000-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _MISC_H #define _MISC_H 1 #include /* * Carefull!! These marcos are NOT reentrant! * ie. they may not be executed atomically, * thus not ensure mutual exclusion. * Fix it when making Hamlib reentrant! --SF */ #define Hold_Decode(rig) {(rig)->state.hold_decode = 1;} #define Unhold_Decode(rig) {(rig)->state.hold_decode = 0;} __BEGIN_DECLS /* * Do a hex dump of the unsigned char array. */ void dump_hex(const unsigned char ptr[], size_t size); /* * BCD conversion routines. * to_bcd converts a long long int to a little endian BCD array, * and return a pointer to this array. * from_bcd converts a little endian BCD array to long long int * reprensentation, and return it. * bcd_len is the number of digits in the BCD array. */ extern HAMLIB_EXPORT(unsigned char *) to_bcd(unsigned char bcd_data[], unsigned long long freq, unsigned bcd_len); extern HAMLIB_EXPORT(unsigned long long) from_bcd(const unsigned char bcd_data[], unsigned bcd_len); /* * same as to_bcd and from_bcd, but in Big Endian mode */ extern HAMLIB_EXPORT(unsigned char *) to_bcd_be(unsigned char bcd_data[], unsigned long long freq, unsigned bcd_len); extern HAMLIB_EXPORT(unsigned long long) from_bcd_be(const unsigned char bcd_data[], unsigned bcd_len); extern HAMLIB_EXPORT(int) sprintf_freq(char *str, freq_t); /* check if it's any of CR or LF */ #define isreturn(c) ((c) == 10 || (c) == 13) /* needs config.h included beforehand in .c file */ #ifdef HAVE_INTTYPES_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif extern HAMLIB_EXPORT(int) rig_check_cache_timeout(const struct timeval *tv, int timeout); extern HAMLIB_EXPORT(void) rig_force_cache_timeout(struct timeval *tv); #ifdef PRId64 /** \brief printf(3) format to be used for long long (64bits) type */ #define PRIll PRId64 #else #ifdef FBSD4 #define PRIll "qd" #else #define PRIll "lld" #endif #endif #ifdef SCNd64 /** \brief scanf(3) format to be used for long long (64bits) type */ #define SCNll SCNd64 #else #ifdef FBSD4 #define SCNll "qd" #else #define SCNll "lld" #endif #endif __END_DECLS #endif /* _MISC_H */ hamlib-1.2.15.3/src/usb_port.c0000644000175000017500000002105312044564477012724 00000000000000/* * Hamlib Interface - USB communication low-level support * Copyright (c) 2000-2011 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * \addtogroup rig_internal * @{ */ /** * \brief USB IO * \file usb_port.c * * doc todo: deal with defined(HAVE_LIBUSB)... quashing the doc process. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "hamlib/rig.h" /* * Compile only if libusb is available */ #if defined(HAVE_LIBUSB) && defined(HAVE_USB_H) #include #include /* Standard input/output definitions */ #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include #include #include "usb_port.h" /** * \brief Get ASCII string from USB descriptor * \param udh * \param index * \param langid * \param buf * \param buflen * \return status/len */ static int usbGetStringAscii(usb_dev_handle *udh, int index, int langid, char *buf, int buflen) { char buffer[256]; int rval, i; rval = usb_control_msg(udh, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) + index, langid, buffer, sizeof(buffer), 1000); if(rval < 0) return rval; if(buffer[1] != USB_DT_STRING) return 0; if((unsigned char)buffer[0] < rval) rval = (unsigned char)buffer[0]; rval /= 2; /* lossy conversion to ISO Latin1 */ for(i=1;i buflen) /* destination buffer overflow */ break; buf[i - 1] = buffer[2 * i]; if(buffer[2 * i + 1] != 0) /* outside of ISO Latin1 range */ buf[i - 1] = '?'; } buf[i - 1] = 0; return i - 1; } /** * \brief Find and open USB device * \param port * \return usb_handle */ static struct usb_dev_handle *find_and_open_device(const hamlib_port_t *port) { struct usb_bus *bus; struct usb_device *dev; struct usb_dev_handle *udh; char string[256]; int len; rig_debug(RIG_DEBUG_VERBOSE, "%s: looking for device %04x:%04x...", __func__, port->parm.usb.vid, port->parm.usb.pid); /* Generate libusb debugging along with Hamlib debugging levels */ if (rig_need_debug(RIG_DEBUG_TRACE)) usb_set_debug(4); /* libusb LOG_DEBUG */ else if (rig_need_debug(RIG_DEBUG_VERBOSE)) usb_set_debug(3); /* libusb LOG_INFO */ else if (rig_need_debug(RIG_DEBUG_WARN)) usb_set_debug(2); /* libusb LOG_WARNING */ else if (rig_need_debug(RIG_DEBUG_ERR) || rig_need_debug(RIG_DEBUG_BUG)) usb_set_debug(1); /* libusb LOG_ERROR */ else usb_set_debug(0); /* libusb LOG_OFF */ for (bus = usb_get_busses(); bus != NULL; bus = bus->next) { for (dev = bus->devices; dev != NULL; dev = dev->next) { rig_debug(RIG_DEBUG_VERBOSE, " %04x:%04x,", dev->descriptor.idVendor, dev->descriptor.idProduct); if (dev->descriptor.idVendor == port->parm.usb.vid && dev->descriptor.idProduct == port->parm.usb.pid) { /* we need to open the device in order to query strings */ udh = usb_open(dev); if (!udh) { rig_debug(RIG_DEBUG_WARN, "%s: Warning: Cannot open USB device: %s\n", __func__, usb_strerror()); continue; } /* now check whether the names match: */ if (port->parm.usb.vendor_name) { len = usbGetStringAscii(udh, dev->descriptor.iManufacturer, 0x0409, string, sizeof(string)); if (len < 0) { rig_debug(RIG_DEBUG_WARN, "Warning: cannot query manufacturer for USB device: %s\n", usb_strerror()); usb_close(udh); continue; } rig_debug(RIG_DEBUG_VERBOSE, " vendor >%s<", string); if (strcmp(string, port->parm.usb.vendor_name) != 0) { rig_debug(RIG_DEBUG_WARN, "%s: Warning: Vendor name string mismatch!\n", __func__); usb_close(udh); continue; } } if (port->parm.usb.product) { len = usbGetStringAscii(udh, dev->descriptor.iProduct, 0x0409, string, sizeof(string)); if (len < 0) { rig_debug(RIG_DEBUG_WARN, "Warning: cannot query product for USB device: %s\n", usb_strerror()); usb_close(udh); continue; } rig_debug(RIG_DEBUG_VERBOSE, " product >%s<", string); if (strcmp(string, port->parm.usb.product) != 0) { /* Now testing with strncasecmp() for case insensitive * match. Updating firmware on FUNcube Dongle to v18f resulted * in product string changing from "FunCube Dongle" to * "FUNcube Dongle". As new dongles are shipped with * older firmware, both product strings are valid. Sigh... */ if (strncasecmp(string, port->parm.usb.product, sizeof(port->parm.usb.product - 1)) != 0) { rig_debug(RIG_DEBUG_WARN, "%s: Warning: Product string mismatch!\n", __func__); usb_close(udh); continue; } } } rig_debug(RIG_DEBUG_VERBOSE, " -> found\n"); return udh; } } } rig_debug(RIG_DEBUG_VERBOSE, " -> not found\n"); return NULL; /* not found */ } /** * \brief Open hamlib_port of USB device * \param port * \return status */ int usb_port_open(hamlib_port_t *port) { struct usb_dev_handle *udh; char *p, *q; usb_init (); /* usb library init */ if (usb_find_busses () < 0) rig_debug(RIG_DEBUG_ERR, "%s: usb_find_busses failed %s\n", __func__, usb_strerror()); if (usb_find_devices() < 0) rig_debug(RIG_DEBUG_ERR, "%s: usb_find_devices failed %s\n", __func__, usb_strerror()); p = port->pathname; q = strchr(p, ':'); if (q) { if (q != p+1) port->parm.usb.vid = strtol(q, NULL, 16); p = q+1; q = strchr(p, ':'); if (q) { if (q != p+1) port->parm.usb.pid = strtol(q, NULL, 16); p = q+1; q = strchr(p, ':'); if (q) { if (q != p+1) port->parm.usb.vendor_name = q; p = q+1; q = strchr(p, ':'); if (q) { if (q != p+1) port->parm.usb.product = q; } } } } udh = find_and_open_device(port); if (udh == 0) return -RIG_EIO; #ifdef LIBUSB_HAS_GET_DRIVER_NP /* Try to detach ftdi_sio kernel module * This should be performed only for devices using * USB-serial converters (like FTDI chips), for other * devices this may cause problems, so do not do it. */ char dname[32] = {0}; int retval = usb_get_driver_np(udh, port->parm.usb.iface, dname, 31); if (!retval) { /* Try to detach ftdi_sio kernel module * Returns ENODATA if driver is not loaded. * Don't check return value, let it fail later. */ usb_detach_kernel_driver_np(udh, port->parm.usb.iface); } #endif if (port->parm.usb.iface >= 0) { #ifdef _WIN32 if (port->parm.usb.conf >= 0 && usb_set_configuration (udh, port->parm.usb.conf) < 0) { rig_debug(RIG_DEBUG_ERR, "%s: usb_set_configuration: failed conf %d: %s\n", __func__, port->parm.usb.conf, usb_strerror()); usb_close (udh); return -RIG_EIO; } #endif rig_debug(RIG_DEBUG_VERBOSE, "%s: claiming %d\n", __func__, port->parm.usb.iface); if (usb_claim_interface (udh, port->parm.usb.iface) < 0) { rig_debug(RIG_DEBUG_ERR, "%s:usb_claim_interface: failed interface %d: %s\n", __func__,port->parm.usb.iface, usb_strerror()); usb_close (udh); return -RIG_EIO; } #if 0 if (usb_set_altinterface (udh, port->parm.usb.alt) < 0) { fprintf (stderr, "%s:usb_set_alt_interface: failed: %s\n", __func__, usb_strerror()); usb_release_interface (udh, port->parm.usb.iface); usb_close (udh); return -RIG_EIO; } #endif } port->handle = (void*) udh; return RIG_OK; } /** * \brief Close hamlib_port of USB device * \param port * \return status */ int usb_port_close(hamlib_port_t *port) { struct usb_dev_handle *udh = port->handle; /* set debugging off before closing the port */ usb_set_debug(0); /* libusb LOG_OFF */ usb_release_interface (udh, port->parm.usb.iface); /* we're assuming that closing an interface automatically releases it. */ return usb_close (udh) == 0 ? RIG_OK : -RIG_EIO; } #else int usb_port_open(hamlib_port_t *port) { return -RIG_ENAVAIL; } int usb_port_close(hamlib_port_t *port) { return -RIG_ENAVAIL; } #endif /* defined(HAVE_LIBUSB) && defined(HAVE_USB_H) */ /** @} */ hamlib-1.2.15.3/src/locator.c0000644000175000017500000004225612044564477012542 00000000000000/** * \addtogroup utilities * @{ */ /** * \file src/locator.c * \brief locator and bearing conversion interface * \author Stephane Fillod and the Hamlib Group * \date 2000-2010 * * Hamlib Interface - locator, bearing, and conversion calls */ /* * Hamlib Interface - locator and bearing conversion calls * Copyright (c) 2001-2010 by Stephane Fillod * Copyright (c) 2003 by Nate Bargmann * Copyright (c) 2003 by Dave Hines * * * Code to determine bearing and range was taken from the Great Circle, * by S. R. Sampson, N5OWK. * Ref: "Air Navigation", Air Force Manual 51-40, 1 February 1987 * Ref: "ARRL Satellite Experimenters Handbook", August 1990 * * Code to calculate distance and azimuth between two Maidenhead locators, * taken from wwl, by IK0ZSN Mirko Caserta. * * New bearing code added by N0NB was found at: * http://williams.best.vwh.net/avform.htm#Crs * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /*! \page hamlib Hamlib general purpose API * * Here are grouped some often used functions, like locator conversion * routines. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #ifndef DOC_HIDDEN #define RADIAN (180.0 / M_PI) /* arc length for 1 degree, 60 Nautical Miles */ #define ARC_IN_KM 111.2 /* The following is contributed by Dave Hines M1CXW * * begin dph */ /* * These are the constants used when converting between Maidenhead grid * locators and longitude/latitude values. MAX_LOCATOR_PAIRS is the maximum * number of locator character pairs to convert. This number MUST NOT exceed * the number of pairs of values in loc_char_range[]. * Setting MAX_LOCATOR_PAIRS to 3 will convert the currently defined 6 * character locators. A value of 4 will convert the extended 8 character * locators described in section 3L of "The IARU region 1 VHF managers * handbook". Values of 5 and 6 will extent the format even more, to the * longest definition I have seen for locators, see * http://www.btinternet.com/~g8yoa/geog/non-ra.html * Beware that there seems to be no universally accepted standard for 10 & 12 * character locators. * * The ranges of characters which will be accepted by locator2longlat, and * generated by longlat2locator, are specified by the loc_char_range[] array. * This array may be changed without requiring any other code changes. * * For the fifth pair to range from aa to xx use: * const static int loc_char_range[] = { 18, 10, 24, 10, 24, 10 }; * * For the fifth pair to range from aa to yy use: * const static int loc_char_range[] = { 18, 10, 24, 10, 25, 10 }; * * MAX_LOCATOR_PAIRS now sets the limit locator2longlat() will convert and * sets the maximum length longlat2locator() will generate. Each function * properly handles any value from 1 to 6 so MAX_LOCATOR_PAIRS should be * left at 6. MIN_LOCATOR_PAIRS sets a floor on the shortest locator that * should be handled. -N0NB */ const static int loc_char_range[] = { 18, 10, 24, 10, 24, 10 }; #define MAX_LOCATOR_PAIRS 6 #define MIN_LOCATOR_PAIRS 1 /* end dph */ #endif /* !DOC_HIDDEN */ /** * \brief Convert DMS to decimal degrees * \param degrees Degrees, whole degrees * \param minutes Minutes, whole minutes * \param seconds Seconds, decimal seconds * \param sw South or West * * Convert degree/minute/second angle to decimal degrees angle. * \a degrees >360, \a minutes > 60, and \a seconds > 60.0 are allowed, * but resulting angle won't be normalized. * * When the variable sw is passed a value of 1, the returned decimal * degrees value will be negative (south or west). When passed a * value of 0 the returned decimal degrees value will be positive * (north or east). * * \return The angle in decimal degrees. * * \sa dec2dms() */ double HAMLIB_API dms2dec(int degrees, int minutes, double seconds, int sw) { double st; if (degrees < 0) degrees = abs(degrees); if (minutes < 0) minutes = abs(minutes); if (seconds < 0) seconds = fabs(seconds); st = (double)degrees + (double)minutes / 60. + seconds / 3600.; if (sw == 1) return -st; else return st; } /** * \brief Convert D M.MMM notation to decimal degrees * \param degrees Degrees, whole degrees * \param minutes Minutes, decimal minutes * \param sw South or West * * Convert a degrees, decimal minutes notation common on * many GPS units to its decimal degrees value. * * \a degrees > 360, \a minutes > 60.0 are allowed, but * resulting angle won't be normalized. * * When the variable sw is passed a value of 1, the returned decimal * degrees value will be negative (south or west). When passed a * value of 0 the returned decimal degrees value will be positive * (north or east). * * \return The angle in decimal degrees. * * \sa dec2dmmm() */ double HAMLIB_API dmmm2dec(int degrees, double minutes, int sw) { double st; if (degrees < 0) degrees = abs(degrees); if (minutes < 0) minutes = fabs(minutes); st = (double)degrees + minutes / 60.; if (sw == 1) return -st; else return st; } /** * \brief Convert decimal degrees angle into DMS notation * \param dec Decimal degrees * \param degrees Pointer for the calculated whole Degrees * \param minutes Pointer for the calculated whole Minutes * \param seconds Pointer for the calculated decimal Seconds * \param sw Pointer for the calculated SW flag * * Convert decimal degrees angle into its degree/minute/second * notation. * * When \a dec < -180 or \a dec > 180, the angle will be normalized * within these limits and the sign set appropriately. * * Upon return dec2dms guarantees 0 >= \a degrees <= 180, * 0 >= \a minutes < 60, and 0.0 >= \a seconds < 60.0. * * When \a dec is < 0.0 \a sw will be set to 1. When \a dec is * >= 0.0 \a sw will be set to 0. This flag allows the application * to determine whether the DMS angle should be treated as negative * (south or west). * * \retval -RIG_EINVAL if any of the pointers are NULL. * \retval RIG_OK if conversion went OK. * * \sa dms2dec() */ int HAMLIB_API dec2dms(double dec, int *degrees, int *minutes, double *seconds, int *sw) { int deg, min; double st; /* bail if NULL pointers passed */ if (!degrees || !minutes || !seconds || !sw) return -RIG_EINVAL; /* reverse the sign if dec has a magnitude greater * than 180 and factor out multiples of 360. * e.g. when passed 270 st will be set to -90 * and when passed -270 st will be set to 90. If * passed 361 st will be set to 1, etc. If passed * a value > -180 || < 180, value will be unchanged. */ if (dec >= 0.0) st = fmod(dec + 180, 360) - 180; else st = fmod(dec - 180, 360) + 180; /* if after all of that st is negative, we want deg * to be negative as well except for 180 which we want * to be positive. */ if (st < 0.0 && st != -180) *sw = 1; else *sw = 0; /* work on st as a positive value to remove a * bug introduced by the effect of floor() when * passed a negative value. e.g. when passed * -96.8333 floor() returns -95! Also avoids * a rounding error introduced on negative values. */ st = fabs(st); deg = (int)floor(st); st = 60. * (st - (double)deg); min = (int)floor(st); st = 60. * (st - (double)min); *degrees = deg; *minutes = min; *seconds = st; return RIG_OK; } /** * \brief Convert a decimal angle into D M.MMM notation * \param dec Decimal degrees * \param degrees Pointer for the calculated whole Degrees * \param minutes Pointer for the calculated decimal Minutes * \param sw Pointer for the calculated SW flag * * Convert a decimal angle into its degree, decimal minute * notation common on many GPS units. * * When passed a value < -180 or > 180, the value will be normalized * within these limits and the sign set apropriately. * * Upon return dec2dmmm guarantees 0 >= \a degrees <= 180, * 0.0 >= \a minutes < 60.0. * * When \a dec is < 0.0 \a sw will be set to 1. When \a dec is * >= 0.0 \a sw will be set to 0. This flag allows the application * to determine whether the D M.MMM angle should be treated as negative * (south or west). * * \retval -RIG_EINVAL if any of the pointers are NULL. * \retval RIG_OK if conversion went OK. * * \sa dmmm2dec() */ int HAMLIB_API dec2dmmm(double dec, int *degrees, double *minutes, int *sw) { int r, min; double sec; /* bail if NULL pointers passed */ if (!degrees || !minutes || !sw) return -RIG_EINVAL; r = dec2dms(dec, degrees, &min, &sec, sw); if (r != RIG_OK) return r; *minutes = (double)min + sec / 60; return RIG_OK; } /** * \brief Convert Maidenhead grid locator to Longitude/Latitude * \param longitude Pointer for the calculated Longitude * \param latitude Pointer for the calculated Latitude * \param locator The Maidenhead grid locator--2 through 12 char + nul string * * Convert Maidenhead grid locator to Longitude/Latitude (decimal degrees). * The locator should be in 2 through 12 chars long format. * \a locator2longlat is case insensitive, however it checks for * locator validity. * * Decimal long/lat is computed to center of grid square, i.e. given * EM19 will return coordinates equivalent to the southwest corner * of EM19mm. * * \retval -RIG_EINVAL if locator exceeds RR99xx99xx99 or exceeds length * limit--currently 1 to 6 lon/lat pairs. * \retval RIG_OK if conversion went OK. * * \bug The fifth pair ranges from aa to xx, there is another convention * that ranges from aa to yy. At some point both conventions should be * supported. * * \sa longlat2locator() */ /* begin dph */ int HAMLIB_API locator2longlat(double *longitude, double *latitude, const char *locator) { int x_or_y, paircount; int locvalue, pair; int divisions; double xy[2], ordinate; /* bail if NULL pointers passed */ if (!longitude || !latitude) return -RIG_EINVAL; paircount = strlen(locator) / 2; /* verify paircount is within limits */ if (paircount > MAX_LOCATOR_PAIRS) paircount = MAX_LOCATOR_PAIRS; else if (paircount < MIN_LOCATOR_PAIRS) return -RIG_EINVAL; /* For x(=longitude) and y(=latitude) */ for (x_or_y = 0; x_or_y < 2; ++x_or_y) { ordinate = -90.0; divisions = 1; for (pair = 0; pair < paircount; ++pair) { locvalue = locator[pair*2 + x_or_y]; /* Value of digit or letter */ locvalue -= (loc_char_range[pair] == 10) ? '0' : (isupper(locvalue)) ? 'A' : 'a'; /* Check range for non-letter/digit or out of range */ if ((locvalue < 0) || (locvalue >= loc_char_range[pair])) return -RIG_EINVAL; divisions *= loc_char_range[pair]; ordinate += locvalue * 180.0 / divisions; } /* Center ordinate in the Maidenhead "square" or "subsquare" */ ordinate += 90.0 / divisions; xy[x_or_y] = ordinate; } *longitude = xy[0] * 2.0; *latitude = xy[1]; return RIG_OK; } /* end dph */ /** * \brief Convert longitude/latitude to Maidenhead grid locator * \param longitude Longitude, decimal degrees * \param latitude Latitude, decimal degrees * \param locator Pointer for the Maidenhead Locator * \param pair_count Precision expressed as lon/lat pairs in the locator * * Convert longitude/latitude (decimal degrees) to Maidenhead grid locator. * \a locator must point to an array at least \a pair_count * 2 char + '\\0'. * * \retval -RIG_EINVAL if \a locator is NULL or \a pair_count exceeds * length limit. Currently 1 to 6 lon/lat pairs. * \retval RIG_OK if conversion went OK. * * \bug \a locator is not tested for overflow. * \bug The fifth pair ranges from aa to yy, there is another convention * that ranges from aa to xx. At some point both conventions should be * supported. * * \sa locator2longlat() */ /* begin dph */ int HAMLIB_API longlat2locator(double longitude, double latitude, char *locator, int pair_count) { int x_or_y, pair, locvalue, divisions; double square_size, ordinate; if (!locator) return -RIG_EINVAL; if (pair_count < MIN_LOCATOR_PAIRS || pair_count > MAX_LOCATOR_PAIRS) return -RIG_EINVAL; for (x_or_y = 0; x_or_y < 2; ++x_or_y) { ordinate = (x_or_y == 0) ? longitude / 2.0 : latitude; divisions = 1; /* The 1e-6 here guards against floating point rounding errors */ ordinate = fmod(ordinate + 270.000001, 180.0); for (pair = 0; pair < pair_count; ++pair) { divisions *= loc_char_range[pair]; square_size = 180.0 / divisions; locvalue = (int) (ordinate / square_size); ordinate -= square_size * locvalue; locvalue += (loc_char_range[pair] == 10) ? '0':'A'; locator[pair * 2 + x_or_y] = locvalue; } } locator[pair_count * 2] = '\0'; return RIG_OK; } /* end dph */ /** * \brief Calculate the distance and bearing between two points. * \param lon1 The local Longitude, decimal degrees * \param lat1 The local Latitude, decimal degrees * \param lon2 The remote Longitude, decimal degrees * \param lat2 The remote Latitude, decimal degrees * \param distance Pointer for the distance, km * \param azimuth Pointer for the bearing, decimal degrees * * Calculate the QRB between \a lon1, \a lat1 and \a lon2, \a lat2. * * This version will calculate the QRB to a precision sufficient * for 12 character locators. Antipodal points, which are easily * calculated, are considered equidistant and the bearing is * simply resolved to be true north (0.0°). * * \retval -RIG_EINVAL if NULL pointer passed or lat and lon values * exceed -90 to 90 or -180 to 180. * \retval RIG_OK if calculations are successful. * * \return The distance in kilometers and azimuth in decimal degrees * for the short path are stored in \a distance and \a azimuth. * * \sa distance_long_path(), azimuth_long_path() */ int HAMLIB_API qrb(double lon1, double lat1, double lon2, double lat2, double *distance, double *azimuth) { double delta_long, tmp, arc, az; /* bail if NULL pointers passed */ if (!distance || !azimuth) return -RIG_EINVAL; if ((lat1 > 90.0 || lat1 < -90.0) || (lat2 > 90.0 || lat2 < -90.0)) return -RIG_EINVAL; if ((lon1 > 180.0 || lon1 < -180.0) || (lon2 > 180.0 || lon2 < -180.0)) return -RIG_EINVAL; /* Prevent ACOS() Domain Error */ if (lat1 == 90.0) lat1 = 89.999999999; else if (lat1 == -90.0) lat1 = -89.999999999; if (lat2 == 90.0) lat2 = 89.999999999; else if (lat2 == -90.0) lat2 = -89.999999999; /* Convert variables to Radians */ lat1 /= RADIAN; lon1 /= RADIAN; lat2 /= RADIAN; lon2 /= RADIAN; delta_long = lon2 - lon1; tmp = sin(lat1) * sin(lat2) + cos(lat1) * cos(lat2) * cos(delta_long); if (tmp > .999999999999999) { /* Station points coincide, use an Omni! */ *distance = 0.0; *azimuth = 0.0; return RIG_OK; } if (tmp < -.999999) { /* * points are antipodal, it's straight down. * Station is equal distance in all Azimuths. * So take 180 Degrees of arc times 60 nm, * and you get 10800 nm, or whatever units... */ *distance = 180.0 * ARC_IN_KM; *azimuth = 0.0; return RIG_OK; } arc = acos(tmp); /* * One degree of arc is 60 Nautical miles * at the surface of the earth, 111.2 km, or 69.1 sm * This method is easier than the one in the handbook */ *distance = ARC_IN_KM * RADIAN * arc; /* Short Path */ /* Change to azimuth computation by Dave Freese, W1HKJ */ az = RADIAN * atan2(sin(lon2 - lon1) * cos(lat2), (cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(lon2 - lon1))); az = fmod(360.0 + az, 360.0); if (az < 0.0) az += 360.0; else if (az >= 360.0) az -= 360.0; *azimuth = floor(az + 0.5); return RIG_OK; } /** * \brief Calculate the long path distance between two points. * \param distance The shortpath distance * * Calculate the long path (respective of the short path) * of a given distance. * * \return the distance in kilometers for the opposite path. * * \sa qrb() */ double HAMLIB_API distance_long_path(double distance) { return (ARC_IN_KM * 360.0) - distance; } /** * \brief Calculate the long path bearing between two points. * \param azimuth The shortpath bearing--0.0 to 360.0 degrees * * Calculate the long path (respective of the short path) * of a given bearing. * * \return the azimuth in decimal degrees for the opposite path or * -RIG_EINVAL upon input error (outside the range of 0.0 to 360.0). * * \sa qrb() */ double HAMLIB_API azimuth_long_path(double azimuth) { if (azimuth == 0.0 || azimuth == 360.0) return 180.0; else if (azimuth > 0.0 && azimuth < 180.0) return 180.0 + azimuth; else if (azimuth == 180.0) return 0.0; else if (azimuth > 180.0 && azimuth < 360.0) return (180.0 - azimuth) * -1.0; else return -RIG_EINVAL; } /*! @} */ hamlib-1.2.15.3/src/event.h0000644000175000017500000000201412044564477012211 00000000000000/* * Hamlib Interface - event handling header * Copyright (c) 2000-2003 by Stephane Fillod and Frank Singleton * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _EVENT_H #define _EVENT_H 1 #include int add_trn_rig(RIG *rig); int remove_trn_rig(RIG *rig); #endif /* _EVENT_H */ hamlib-1.2.15.3/src/parallel.h0000644000175000017500000000502712044564477012673 00000000000000/* * Hamlib Interface - parallel communication header * Copyright (c) 2000-2003 by Frank Singleton * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _PARALLEL_H #define _PARALLEL_H 1 #include #include "iofunc.h" #ifdef HAVE_LINUX_PARPORT_H #include #endif #ifndef PARPORT_CONTROL_STROBE #define PARPORT_CONTROL_STROBE 0x1 #endif #ifndef PARPORT_CONTROL_AUTOFD #define PARPORT_CONTROL_AUTOFD 0x2 #endif #ifndef PARPORT_CONTROL_INIT #define PARPORT_CONTROL_INIT 0x4 #endif #ifndef PARPORT_CONTROL_SELECT #define PARPORT_CONTROL_SELECT 0x8 #endif #ifndef PARPORT_STATUS_ERROR #define PARPORT_STATUS_ERROR 0x8 #endif #ifndef PARPORT_STATUS_SELECT #define PARPORT_STATUS_SELECT 0x10 #endif #ifndef PARPORT_STATUS_PAPEROUT #define PARPORT_STATUS_PAPEROUT 0x20 #endif #ifndef PARPORT_STATUS_ACK #define PARPORT_STATUS_ACK 0x40 #endif #ifndef PARPORT_STATUS_BUSY #define PARPORT_STATUS_BUSY 0x80 #endif __BEGIN_DECLS /* Hamlib internal use, see rig.c */ int par_open(hamlib_port_t *p); int par_close(hamlib_port_t *p); int par_ptt_set(hamlib_port_t *p, ptt_t pttx); int par_ptt_get(hamlib_port_t *p, ptt_t *pttx); int par_dcd_get(hamlib_port_t *p, dcd_t *dcdx); extern HAMLIB_EXPORT(int) par_write_data(hamlib_port_t *p, unsigned char data); extern HAMLIB_EXPORT(int) par_write_control(hamlib_port_t *p, unsigned char control); extern HAMLIB_EXPORT(int) par_read_data(hamlib_port_t *p, unsigned char *data); extern HAMLIB_EXPORT(int) par_read_control(hamlib_port_t *p, unsigned char *control); extern HAMLIB_EXPORT(int) par_read_status(hamlib_port_t *p, unsigned char *status); extern HAMLIB_EXPORT(int) par_lock(hamlib_port_t *p); extern HAMLIB_EXPORT(int) par_unlock(hamlib_port_t *p); __END_DECLS #endif /* _PARALLEL_H */ hamlib-1.2.15.3/src/cal.h0000644000175000017500000000202512044564477011631 00000000000000/* * Hamlib Interface - calibration header * Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _CAL_H #define _CAL_H 1 #include extern HAMLIB_EXPORT(float) rig_raw2val(int rawval, const cal_table_t *cal); #endif /* _CAL_H */ hamlib-1.2.15.3/src/ext.c0000644000175000017500000001136712044564477011676 00000000000000/* * Hamlib Interface - extrq parameter interface * Copyright (c) 2000-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * \addtogroup rig * @{ */ /** * \file ext.c * \brief Extension request parameter interface * * An open-ended set of extension parameters and levels are available for each rig, * as provided in the rigcaps extparms and extlevels lists. These provide a way * to work with rig-specific functions that don't fit into the basic "virtual rig" of * Hamlib. See icom/ic746.c for an example. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* Standard input/output definitions */ #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "token.h" /** * \param rig The rig handle * \param cfunc callback function of each extlevel * \param data cookie to be passed to \a cfunc callback * \brief Executes cfunc on all the elements stored in the extlevels table * The callback \a cfunc is called until it returns a value which is not strictly positive. * A zero value means a normal end of iteration, and a negative value an abnormal end, * which will be the return value of rig_ext_level_foreach. */ int HAMLIB_API rig_ext_level_foreach(RIG *rig, int (*cfunc)(RIG *, const struct confparams *, rig_ptr_t), rig_ptr_t data) { const struct confparams *cfp; int ret; if (!rig || !rig->caps || !cfunc) return -RIG_EINVAL; for (cfp = rig->caps->extlevels; cfp && cfp->name; cfp++) { ret = (*cfunc)(rig, cfp, data); if (ret == 0) return RIG_OK; if (ret < 0) return ret; } return RIG_OK; } /** * \param rig The rig handle * \param cfunc callback function of each extparm * \param data cookie to be passed to \a cfunc callback * \brief Executes cfunc on all the elements stored in the extparms table * The callback \a cfunc is called until it returns a value which is not strictly positive. * A zero value means a normal end of iteration, and a negative value an abnormal end, * which will be the return value of rig_ext_parm_foreach. */ int HAMLIB_API rig_ext_parm_foreach(RIG *rig, int (*cfunc)(RIG *, const struct confparams *, rig_ptr_t), rig_ptr_t data) { const struct confparams *cfp; int ret; if (!rig || !rig->caps || !cfunc) return -RIG_EINVAL; for (cfp = rig->caps->extparms; cfp && cfp->name; cfp++) { ret = (*cfunc)(rig, cfp, data); if (ret == 0) return RIG_OK; if (ret < 0) return ret; } return RIG_OK; } /** * \param rig * \param name * \brief lookup ext token by its name, return pointer to confparams struct. * * Lookup extlevels table first, then fall back to extparms. * * Returns NULL if nothing found * * TODO: should use Lex to speed it up, strcmp hurts! */ const struct confparams * HAMLIB_API rig_ext_lookup(RIG *rig, const char *name) { const struct confparams *cfp; if (!rig || !rig->caps) return NULL; for (cfp = rig->caps->extlevels; cfp && cfp->name; cfp++) if (!strcmp(cfp->name, name)) return cfp; for (cfp = rig->caps->extparms; cfp && cfp->name; cfp++) if (!strcmp(cfp->name, name)) return cfp; return NULL; } /** * \param rig * \param token * \brief lookup ext token, return pointer to confparams struct. * * lookup extlevels table first, then fall back to extparms. * * Returns NULL if nothing found */ const struct confparams * HAMLIB_API rig_ext_lookup_tok(RIG *rig, token_t token) { const struct confparams *cfp; if (!rig || !rig->caps) return NULL; for (cfp = rig->caps->extlevels; cfp && cfp->token; cfp++) if (cfp->token == token) return cfp; for (cfp = rig->caps->extparms; cfp && cfp->token; cfp++) if (cfp->token == token) return cfp; return NULL; } /** * \param rig * \param name * \brief Simple lookup returning token id assicated with name */ token_t HAMLIB_API rig_ext_token_lookup(RIG *rig, const char *name) { const struct confparams *cfp; cfp = rig_ext_lookup(rig, name); if (!cfp) return RIG_CONF_END; return cfp->token; } /** @} */ hamlib-1.2.15.3/src/rot_reg.c0000644000175000017500000001756112044564477012541 00000000000000/* * Hamlib Interface - provides registering for dynamically loadable backends. * Copyright (c) 2000-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * \brief Dynamic registration of rotator backends * \file rot_reg.c * * Similar to register.c * doc todo: Let's explain what's going on here! */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include /* This is libtool's dl wrapper */ #include #include #ifndef PATH_MAX # define PATH_MAX 1024 #endif #define ROT_BACKEND_MAX 32 /* * ROT_BACKEND_LIST is defined in rotlist.h, please keep it up to data, * ie. each time you give birth to a new backend * Also, it should be possible to register "external" backend, * that is backend that were not known by Hamlib at compile time. * Maybe, rotlist.h should reserve some numbers for them? --SF */ static struct { int be_num; const char *be_name; rot_model_t (*be_probe)(hamlib_port_t *); } rot_backend_list[ROT_BACKEND_MAX] = ROT_BACKEND_LIST; /* * This struct to keep track of known rot models. * It is chained, and used in a hash table, see below. */ struct rot_list { const struct rot_caps *caps; lt_dlhandle handle; /* handle returned by lt_dlopen() */ struct rot_list *next; }; #define ROTLSTHASHSZ 16 #define HASH_FUNC(a) ((a)%ROTLSTHASHSZ) /* * The rot_hash_table is a hash table pointing to a list of next==NULL * terminated caps. */ static struct rot_list *rot_hash_table[ROTLSTHASHSZ] = { NULL, }; static int rot_lookup_backend(rot_model_t rot_model); /* * Basically, this is a hash insert function that doesn't check for dup! */ int HAMLIB_API rot_register(const struct rot_caps *caps) { int hval; struct rot_list *p; if (!caps) return -RIG_EINVAL; rot_debug(RIG_DEBUG_VERBOSE, "rot_register (%d)\n",caps->rot_model); #ifndef DONT_WANT_DUP_CHECK if (rot_get_caps(caps->rot_model)!=NULL) return -RIG_EINVAL; #endif p = (struct rot_list*)malloc(sizeof(struct rot_list)); if (!p) return -RIG_ENOMEM; hval = HASH_FUNC(caps->rot_model); p->caps = caps; p->handle = NULL; p->next = rot_hash_table[hval]; rot_hash_table[hval] = p; return RIG_OK; } /* * Get rot capabilities. * ie. rot_hash_table lookup */ const struct rot_caps * HAMLIB_API rot_get_caps(rot_model_t rot_model) { struct rot_list *p; for (p = rot_hash_table[HASH_FUNC(rot_model)]; p; p=p->next) { if (p->caps->rot_model == rot_model) return p->caps; } return NULL; /* sorry, caps not registered! */ } /* * lookup for backend index in rot_backend_list table, * according to BACKEND_NUM * return -1 if not found. */ static int rot_lookup_backend(rot_model_t rot_model) { int i; for (i=0; inext) { if (p->caps->rot_model == rot_model) { if (q == NULL) rot_hash_table[hval] = p->next; else q->next = p->next; free(p); return RIG_OK; } q = p; } return -RIG_EINVAL; /* sorry, caps not registered! */ } /* * rot_list_foreach * executes cfunc on all the elements stored in the rot hash list */ int HAMLIB_API rot_list_foreach(int (*cfunc)(const struct rot_caps*, rig_ptr_t),rig_ptr_t data) { struct rot_list *p; int i; if (!cfunc) return -RIG_EINVAL; for (i=0; inext) if ((*cfunc)(p->caps,data) == 0) return RIG_OK; } return RIG_OK; } /* * rot_probe_all * called straight by rot_probe */ rot_model_t HAMLIB_API rot_probe_all(hamlib_port_t *p) { int i; rot_model_t rot_model; for (i=0; i #include #include #include #include #include #include #include "hamlib/rig.h" #include "serial.h" #include "parallel.h" #include "usb_port.h" #include "network.h" #include "event.h" #include "cm108.h" /** * \brief Hamlib release number * The version number has the format x.y.z */ /* * Careful: The hamlib 1.2 ABI implicitly specifies a size of 21 bytes for * the hamlib_version string. Changing the size provokes a warning from the * dynamic loader. */ const char hamlib_version[21] = "Hamlib " PACKAGE_VERSION; /** * \brief Hamlib copyright notice */ const char hamlib_copyright[231] = /* hamlib 1.2 ABI specifies 231 bytes */ "Copyright (C) 2000-2012 Stephane Fillod\n" "Copyright (C) 2000-2003 Frank Singleton\n" "This is free software; see the source for copying conditions. There is NO\n" "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."; #ifndef DOC_HIDDEN #if defined(WIN32) && !defined(__CYGWIN__) #define DEFAULT_SERIAL_PORT "\\\\.\\COM1" #elif BSD #define DEFAULT_SERIAL_PORT "/dev/cuaa0" #elif MACOSX #define DEFAULT_SERIAL_PORT "/dev/cu.usbserial" #else #define DEFAULT_SERIAL_PORT "/dev/ttyS0" #endif #if defined(WIN32) #define DEFAULT_PARALLEL_PORT "\\\\.\\$VDMLPT1" #elif defined(HAVE_DEV_PPBUS_PPI_H) #define DEFAULT_PARALLEL_PORT "/dev/ppi0" #else #define DEFAULT_PARALLEL_PORT "/dev/parport0" #endif #if defined(WIN32) && !defined(__CYGWIN__) #define DEFAULT_CM108_PORT "fixme" #elif BSD #define DEFAULT_CM108_PORT "fixme" #else #define DEFAULT_CM108_PORT "/dev/hidraw0" #endif #if defined(WIN32) && !defined(__CYGWIN__) #define DEFAULT_CM108_PTT_BITNUM "fixme" #elif BSD #define DEFAULT_CM108_PTT_BITNUM "fixme" #else #define DEFAULT_CM108_PTT_BITNUM 2 #endif #define CHECK_RIG_ARG(r) (!(r) || !(r)->caps || !(r)->state.comm_state) /* * Data structure to track the opened rig (by rig_open) */ struct opened_rig_l { RIG *rig; struct opened_rig_l *next; }; static struct opened_rig_l *opened_rig_list = { NULL }; /* * Careful, the order must be the same as their RIG_E* counterpart! * TODO: localise the messages.. */ static const char *rigerror_table[] = { "Command completed successfully", "Invalid parameter", "Invalid configuration", "Memory shortage", "Feature not implemented", "Communication timed out", "IO error", "Internal Hamlib error", "Protocol error", "Command rejected by the rig", "Command performed, but arg truncated, result not guaranteed", "Feature not available", "Target VFO unaccessible", "Communication bus error", "Communication bus collision", "NULL RIG handle or invalid pointer parameter", "Invalid VFO", "Argument out of domain of func", NULL, }; #define ERROR_TBL_SZ (sizeof(rigerror_table)/sizeof(char *)) /* * track which rig is opened (with rig_open) * needed at least for transceive mode */ static int add_opened_rig(RIG *rig) { struct opened_rig_l *p; p = (struct opened_rig_l *)malloc(sizeof(struct opened_rig_l)); if (!p) return -RIG_ENOMEM; p->rig = rig; p->next = opened_rig_list; opened_rig_list = p; return RIG_OK; } static int remove_opened_rig(RIG *rig) { struct opened_rig_l *p,*q; q = NULL; for (p=opened_rig_list; p; p=p->next) { if (p->rig == rig) { if (q == NULL) { opened_rig_list = opened_rig_list->next; } else { q->next = p->next; } free(p); return RIG_OK; } q = p; } return -RIG_EINVAL; /* Not found in list ! */ } /** * \brief execs cfunc() on each opened rig * \param cfunc The function to be executed on each rig * \param data Data pointer to be passed to cfunc() * * Calls cfunc() function for each opened rig. * The contents of the opened rig table * is processed in random order according to a function * pointed to by \a cfunc, whic is called with two arguments, * the first pointing to the RIG handle, the second * to a data pointer \a data. * If \a data is not needed, then it can be set to NULL. * The processing of the opened rig table is stopped * when cfunc() returns 0. * \internal * * \return always RIG_OK. */ int foreach_opened_rig(int (*cfunc)(RIG *, rig_ptr_t), rig_ptr_t data) { struct opened_rig_l *p; for (p=opened_rig_list; p; p=p->next) { if ((*cfunc)(p->rig,data) == 0) return RIG_OK; } return RIG_OK; } #endif /* !DOC_HIDDEN */ /** * \brief get string describing the error code * \param errnum The error code * \return the appropriate description string, otherwise a NULL pointer * if the error code is unknown. * * Returns a string describing the error code passed in the argument \a errnum. * * \todo support gettext/localization */ const char * HAMLIB_API rigerror(int errnum) { errnum = abs(errnum); if (errnum > ERROR_TBL_SZ) return NULL; return rigerror_table[errnum]; } /** * \brief allocate a new RIG handle * \param rig_model The rig model for this new handle * * Allocates a new RIG handle and initializes the associated data * for \a rig_model. * * \return a pointer to the #RIG handle otherwise NULL if memory allocation * failed or \a rig_model is unknown (e.g. backend autoload failed). * * \sa rig_cleanup(), rig_open() */ RIG * HAMLIB_API rig_init(rig_model_t rig_model) { RIG *rig; const struct rig_caps *caps; struct rig_state *rs; int i, retcode; rig_debug(RIG_DEBUG_VERBOSE,"rig:rig_init called \n"); rig_check_backend(rig_model); caps = rig_get_caps(rig_model); if (!caps) return NULL; /* * okay, we've found it. Allocate some memory and set it to zeros, * and especially the callbacks */ rig = calloc(1, sizeof(RIG)); if (rig == NULL) { /* * FIXME: how can the caller know it's a memory shortage, * and not "rig not found" ? */ return NULL; } /* caps is const, so we need to tell compiler that we now what we are doing */ rig->caps = (struct rig_caps *) caps; /* * populate the rig->state * TODO: read the Preferences here! */ rs = &rig->state; rs->comm_state = 0; rs->rigport.type.rig = caps->port_type; /* default from caps */ switch (caps->port_type) { case RIG_PORT_SERIAL: strncpy(rs->rigport.pathname, DEFAULT_SERIAL_PORT, FILPATHLEN - 1); rs->rigport.parm.serial.rate = caps->serial_rate_max; /* fastest ! */ rs->rigport.parm.serial.data_bits = caps->serial_data_bits; rs->rigport.parm.serial.stop_bits = caps->serial_stop_bits; rs->rigport.parm.serial.parity = caps->serial_parity; rs->rigport.parm.serial.handshake = caps->serial_handshake; break; case RIG_PORT_PARALLEL: strncpy(rs->rigport.pathname, DEFAULT_PARALLEL_PORT, FILPATHLEN - 1); break; /* Adding support for CM108 GPIO. This is compatible with CM108 series * USB audio chips from CMedia and SSS1623 series USB audio chips from 3S */ case RIG_PORT_CM108: strncpy(rs->rigport.pathname, DEFAULT_CM108_PORT, FILPATHLEN); rs->rigport.parm.cm108.ptt_bitnum = DEFAULT_CM108_PTT_BITNUM; break; case RIG_PORT_NETWORK: case RIG_PORT_UDP_NETWORK: strncpy(rs->rigport.pathname, "127.0.0.1:4532", FILPATHLEN - 1); break; default: strncpy(rs->rigport.pathname, "", FILPATHLEN - 1); } rs->rigport.write_delay = caps->write_delay; rs->rigport.post_write_delay = caps->post_write_delay; rs->rigport.timeout = caps->timeout; rs->rigport.retry = caps->retry; rs->pttport.type.ptt = caps->ptt_type; rs->dcdport.type.dcd = caps->dcd_type; rs->vfo_comp = 0.0; /* override it with preferences */ rs->current_vfo = RIG_VFO_CURR; /* we don't know yet! */ rs->tx_vfo = RIG_VFO_CURR; /* we don't know yet! */ rs->transceive = RIG_TRN_OFF; rs->poll_interval = 500; /* should it be a parameter to rig_init ? --SF */ rs->itu_region = RIG_ITU_REGION2; switch(rs->itu_region) { case RIG_ITU_REGION1: memcpy(rs->tx_range_list, caps->tx_range_list1, sizeof(struct freq_range_list)*FRQRANGESIZ); memcpy(rs->rx_range_list, caps->rx_range_list1, sizeof(struct freq_range_list)*FRQRANGESIZ); break; case RIG_ITU_REGION2: case RIG_ITU_REGION3: default: memcpy(rs->tx_range_list, caps->tx_range_list2, sizeof(struct freq_range_list)*FRQRANGESIZ); memcpy(rs->rx_range_list, caps->rx_range_list2, sizeof(struct freq_range_list)*FRQRANGESIZ); break; } rs->vfo_list = 0; rs->mode_list = 0; for (i=0; irx_range_list[i]); i++) { rs->vfo_list |= rs->rx_range_list[i].vfo; rs->mode_list |= rs->rx_range_list[i].modes; } for (i=0; itx_range_list[i]); i++) { rs->vfo_list |= rs->tx_range_list[i].vfo; rs->mode_list |= rs->tx_range_list[i].modes; } memcpy(rs->preamp, caps->preamp, sizeof(int)*MAXDBLSTSIZ); memcpy(rs->attenuator, caps->attenuator, sizeof(int)*MAXDBLSTSIZ); memcpy(rs->tuning_steps, caps->tuning_steps, sizeof(struct tuning_step_list)*TSLSTSIZ); memcpy(rs->filters, caps->filters, sizeof(struct filter_list)*FLTLSTSIZ); memcpy(&rs->str_cal, &caps->str_cal, sizeof(cal_table_t)); memcpy(rs->chan_list, caps->chan_list, sizeof(chan_t)*CHANLSTSIZ); rs->has_get_func = caps->has_get_func; rs->has_set_func = caps->has_set_func; rs->has_get_level = caps->has_get_level; rs->has_set_level = caps->has_set_level; rs->has_get_parm = caps->has_get_parm; rs->has_set_parm = caps->has_set_parm; /* emulation by frontend */ if ((caps->has_get_level & RIG_LEVEL_STRENGTH) == 0 && (caps->has_get_level & RIG_LEVEL_RAWSTR) == RIG_LEVEL_RAWSTR) rs->has_get_level |= RIG_LEVEL_STRENGTH; memcpy(rs->level_gran, caps->level_gran, sizeof(gran_t)*RIG_SETTING_MAX); memcpy(rs->parm_gran, caps->parm_gran, sizeof(gran_t)*RIG_SETTING_MAX); rs->max_rit = caps->max_rit; rs->max_xit = caps->max_xit; rs->max_ifshift = caps->max_ifshift; rs->announces = caps->announces; rs->rigport.fd = rs->pttport.fd = rs->dcdport.fd = -1; /* * let the backend a chance to setup his private data * This must be done only once defaults are setup, * so the backend init can override rig_state. */ if (caps->rig_init != NULL) { retcode = caps->rig_init(rig); if (retcode != RIG_OK) { rig_debug(RIG_DEBUG_VERBOSE,"rig:backend_init failed!\n"); /* cleanup and exit */ free(rig); return NULL; } } return rig; } /** * \brief open the communication to the rig * \param rig The #RIG handle of the radio to be opened * * Opens communication to a radio which \a RIG handle has been passed * by argument. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \retval RIG_EINVAL \a rig is NULL or unconsistent. * \retval RIG_ENIMPL port type communication is not implemented yet. * * \sa rig_init(), rig_close() */ int HAMLIB_API rig_open(RIG *rig) { const struct rig_caps *caps; struct rig_state *rs; int status; rig_debug(RIG_DEBUG_VERBOSE,"rig:rig_open called \n"); if (!rig || !rig->caps) return -RIG_EINVAL; caps = rig->caps; rs = &rig->state; if (rs->comm_state) return -RIG_EINVAL; rs->rigport.fd = -1; if (rs->rigport.type.rig == RIG_PORT_SERIAL) { if (rs->rigport.parm.serial.rts_state != RIG_SIGNAL_UNSET && (rs->pttport.type.ptt == RIG_PTT_SERIAL_RTS || rs->rigport.parm.serial.handshake == RIG_HANDSHAKE_HARDWARE)) { rig_debug(RIG_DEBUG_ERR, "Cannot set RTS with PTT by RTS or hardware handshare \"%s\"\n", rs->rigport.pathname); return -RIG_ECONF; } if (rs->rigport.parm.serial.dtr_state != RIG_SIGNAL_UNSET && rs->pttport.type.ptt == RIG_PTT_SERIAL_DTR) { rig_debug(RIG_DEBUG_ERR, "Cannot set DTR with PTT by DTR\"%s\"\n", rs->rigport.pathname); return -RIG_ECONF; } } status = port_open(&rs->rigport); if (status < 0) return status; /* * FIXME: what to do if PTT open fails or PTT unsupported? * fail rig_open? remember unallocating.. */ switch(rs->pttport.type.ptt) { case RIG_PTT_NONE: case RIG_PTT_RIG: case RIG_PTT_RIG_MICDATA: break; case RIG_PTT_SERIAL_RTS: case RIG_PTT_SERIAL_DTR: if (rs->pttport.pathname[0] == '\0' && rs->rigport.type.rig == RIG_PORT_SERIAL) strcpy(rs->pttport.pathname, rs->rigport.pathname); rs->pttport.fd = ser_open(&rs->pttport); if (rs->pttport.fd < 0) rig_debug(RIG_DEBUG_ERR, "Cannot open PTT device \"%s\"\n", rs->pttport.pathname); else { /* Needed on Linux because the kernel forces RTS/DTR at open */ if (rs->pttport.type.ptt == RIG_PTT_SERIAL_DTR) ser_set_dtr(&rs->pttport, RIG_PTT_OFF); else if (rs->pttport.type.ptt == RIG_PTT_SERIAL_RTS) ser_set_rts(&rs->pttport, RIG_PTT_OFF); } break; case RIG_PTT_PARALLEL: rs->pttport.fd = par_open(&rs->pttport); if (rs->pttport.fd < 0) rig_debug(RIG_DEBUG_ERR, "Cannot open PTT device \"%s\"\n", rs->pttport.pathname); else par_ptt_set(&rs->pttport, RIG_PTT_OFF); break; case RIG_PTT_CM108: rs->pttport.fd = cm108_open(&rs->pttport); if (rs->pttport.fd < 0) rig_debug(RIG_DEBUG_ERR, "Cannot open PTT device \"%s\"\n", rs->pttport.pathname); else cm108_ptt_set(&rs->pttport, RIG_PTT_OFF); break; default: rig_debug(RIG_DEBUG_ERR, "Unsupported PTT type %d\n", rs->pttport.type.ptt); } switch(rs->dcdport.type.dcd) { case RIG_DCD_NONE: case RIG_DCD_RIG: break; case RIG_DCD_SERIAL_DSR: case RIG_DCD_SERIAL_CTS: case RIG_DCD_SERIAL_CAR: if (rs->dcdport.pathname[0] == '\0' && rs->rigport.type.rig == RIG_PORT_SERIAL) strcpy(rs->dcdport.pathname, rs->rigport.pathname); rs->dcdport.fd = ser_open(&rs->dcdport); if (rs->dcdport.fd < 0) rig_debug(RIG_DEBUG_ERR, "Cannot open DCD device \"%s\"\n", rs->dcdport.pathname); break; case RIG_DCD_PARALLEL: rs->dcdport.fd = par_open(&rs->dcdport); if (rs->dcdport.fd < 0) rig_debug(RIG_DEBUG_ERR, "Cannot open DCD device \"%s\"\n", rs->dcdport.pathname); break; default: rig_debug(RIG_DEBUG_ERR, "Unsupported DCD type %d\n", rs->dcdport.type.dcd); } add_opened_rig(rig); rs->comm_state = 1; /* * Maybe the backend has something to initialize * In case of failure, just close down and report error code. */ if (caps->rig_open != NULL) { status = caps->rig_open(rig); if (status != RIG_OK) { return status; } } /* * trigger state->current_vfo first retrieval */ if (rig_get_vfo(rig, &rs->current_vfo) == RIG_OK) rs->tx_vfo = rs->current_vfo; #if 0 /* * Check the current tranceive state of the rig */ if (rs->transceive == RIG_TRN_RIG) { int retval, trn; retval = rig_get_trn(rig, &trn); if (retval == RIG_OK && trn == RIG_TRN_RIG) add_trn_rig(rig); } #endif return RIG_OK; } /** * \brief close the communication to the rig * \param rig The #RIG handle of the radio to be closed * * Closes communication to a radio which \a RIG handle has been passed * by argument that was previously open with rig_open(). * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_cleanup(), rig_open() */ int HAMLIB_API rig_close(RIG *rig) { const struct rig_caps *caps; struct rig_state *rs; rig_debug(RIG_DEBUG_VERBOSE,"rig:rig_close called \n"); if (!rig || !rig->caps) return -RIG_EINVAL; caps = rig->caps; rs = &rig->state; if (!rs->comm_state) return -RIG_EINVAL; if (rs->transceive != RIG_TRN_OFF) { rig_set_trn(rig, RIG_TRN_OFF); } /* * Let the backend say 73s to the rig. * and ignore the return code. */ if (caps->rig_close) caps->rig_close(rig); /* * FIXME: what happens if PTT and rig ports are the same? * (eg. ptt_type = RIG_PTT_SERIAL) */ switch(rs->pttport.type.ptt) { case RIG_PTT_NONE: case RIG_PTT_RIG: case RIG_PTT_RIG_MICDATA: break; case RIG_PTT_SERIAL_RTS: ser_set_rts(&rs->pttport, RIG_PTT_OFF); port_close(&rs->pttport, RIG_PORT_SERIAL); break; case RIG_PTT_SERIAL_DTR: ser_set_dtr(&rs->pttport, RIG_PTT_OFF); port_close(&rs->pttport, RIG_PORT_SERIAL); break; case RIG_PTT_PARALLEL: par_ptt_set(&rs->pttport, RIG_PTT_OFF); port_close(&rs->pttport, RIG_PORT_PARALLEL); break; case RIG_PTT_CM108: cm108_ptt_set(&rs->pttport, RIG_PTT_OFF); port_close(&rs->pttport, RIG_PORT_CM108); break; default: rig_debug(RIG_DEBUG_ERR, "Unsupported PTT type %d\n", rs->pttport.type.ptt); } switch(rs->dcdport.type.dcd) { case RIG_DCD_NONE: case RIG_DCD_RIG: break; case RIG_DCD_SERIAL_DSR: case RIG_DCD_SERIAL_CTS: case RIG_DCD_SERIAL_CAR: port_close(&rs->dcdport, RIG_PORT_SERIAL); break; case RIG_DCD_PARALLEL: port_close(&rs->dcdport, RIG_PORT_PARALLEL); break; default: rig_debug(RIG_DEBUG_ERR, "Unsupported DCD type %d\n", rs->dcdport.type.dcd); } rs->dcdport.fd = rs->pttport.fd = -1; port_close(&rs->rigport, rs->rigport.type.rig); remove_opened_rig(rig); rs->comm_state = 0; return RIG_OK; } /** * \brief release a rig handle and free associated memory * \param rig The #RIG handle of the radio to be closed * * Releases a rig struct which port has eventualy been closed already * with rig_close(). * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_init(), rig_close() */ int HAMLIB_API rig_cleanup(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"rig:rig_cleanup called \n"); if (!rig || !rig->caps) return -RIG_EINVAL; /* * check if they forgot to close the rig */ if (rig->state.comm_state) rig_close(rig); /* * basically free up the priv struct */ if (rig->caps->rig_cleanup) rig->caps->rig_cleanup(rig); free(rig); return RIG_OK; } /** * \brief set the frequency of the target VFO * \param rig The rig handle * \param vfo The target VFO * \param freq The frequency to set to * * Sets the frequency of the target VFO. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_freq() */ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (rig->state.vfo_comp != 0.0) freq += (freq_t)((double)rig->state.vfo_comp * freq); if (caps->set_freq == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_FREQ) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { retcode = caps->set_freq(rig, vfo, freq); } else { if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_freq(rig, vfo, freq); caps->set_vfo(rig, curr_vfo); } if (retcode == RIG_OK && (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo)) rig->state.current_freq = freq; return retcode; } /** * \brief get the frequency of the target VFO * \param rig The rig handle * \param vfo The target VFO * \param freq The location where to store the current frequency * * Retrieves the frequency of the target VFO. * The value stored at \a freq location equals RIG_FREQ_NONE when the current * frequency of the VFO is not defined (e.g. blank memory). * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_freq() */ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !freq) return -RIG_EINVAL; caps = rig->caps; if (caps->get_freq == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_FREQ) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { retcode = caps->get_freq(rig, vfo, freq); } else { if (!caps->set_vfo) return -RIG_ENAVAIL; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_freq(rig, vfo, freq); caps->set_vfo(rig, curr_vfo); } /* VFO compensation */ if (rig->state.vfo_comp != 0.0) *freq += (freq_t)(rig->state.vfo_comp * (*freq)); if (retcode == RIG_OK && (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo)) rig->state.current_freq = *freq; return retcode; } /** * \brief set the mode of the target VFO * \param rig The rig handle * \param vfo The target VFO * \param mode The mode to set to * \param width The passband width to set to * * Sets the mode and associated passband of the target VFO. * The passband \a width must be supported by the backend of the rig. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_mode() */ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_mode == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_MODE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { retcode = caps->set_mode(rig, vfo, mode, width); } else { if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_mode(rig, vfo, mode, width); caps->set_vfo(rig, curr_vfo); } if (retcode == RIG_OK && (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo)) { rig->state.current_mode = mode; rig->state.current_width = width; } return retcode; } /** * \brief get the mode of the target VFO * \param rig The rig handle * \param vfo The target VFO * \param mode The location where to store the current mode * \param width The location where to store the current passband width * * Retrieves the mode and passband of the target VFO. * If the backend is unable to determine the width, the \a width * will be set to RIG_PASSBAND_NORMAL as a default. * The value stored at \a mode location equals RIG_MODE_NONE when the current * mode of the VFO is not defined (e.g. blank memory). * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_mode() */ int HAMLIB_API rig_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !mode || !width) return -RIG_EINVAL; caps = rig->caps; if (caps->get_mode == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_MODE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { retcode = caps->get_mode(rig, vfo, mode, width); } else { if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_mode(rig, vfo, mode, width); caps->set_vfo(rig, curr_vfo); } if (retcode == RIG_OK && (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo)) { rig->state.current_mode = *mode; rig->state.current_width = *width; } if (*width == RIG_PASSBAND_NORMAL && *mode != RIG_MODE_NONE) *width = rig_passband_normal (rig, *mode); return retcode; } /** * \brief get the normal passband of a mode * \param rig The rig handle * \param mode The mode to get the passband * * Returns the normal (default) passband for the given \a mode. * * \return the passband in Hz if the operation has been sucessful, * or a 0 if an error occured (passband not found, whatever). * * \sa rig_passband_narrow(), rig_passband_wide() */ pbwidth_t HAMLIB_API rig_passband_normal(RIG *rig, rmode_t mode) { const struct rig_state *rs; int i; if (!rig) return RIG_PASSBAND_NORMAL; /* huhu! */ rs = &rig->state; for (i=0; ifilters[i].modes; i++) { if (rs->filters[i].modes & mode) { return rs->filters[i].width; } } return RIG_PASSBAND_NORMAL; } /** * \brief get the narrow passband of a mode * \param rig The rig handle * \param mode The mode to get the passband * * Returns the narrow (closest) passband for the given \a mode. * EXAMPLE: rig_set_mode(my_rig, RIG_MODE_LSB, * rig_passband_narrow(my_rig, RIG_MODE_LSB) ); * * \return the passband in Hz if the operation has been sucessful, * or a 0 if an error occured (passband not found, whatever). * * \sa rig_passband_normal(), rig_passband_wide() */ pbwidth_t HAMLIB_API rig_passband_narrow(RIG *rig, rmode_t mode) { const struct rig_state *rs; pbwidth_t normal; int i; if (!rig) return 0; /* huhu! */ rs = &rig->state; for (i=0; ifilters[i].modes; i++) { if (rs->filters[i].modes & mode) { normal = rs->filters[i].width; for (i++; ifilters[i].modes; i++) { if ((rs->filters[i].modes & mode) && (rs->filters[i].width < normal)) { return rs->filters[i].width; } } return 0; } } return 0; } /** * \brief get the wide passband of a mode * \param rig The rig handle * \param mode The mode to get the passband * * Returns the wide (default) passband for the given \a mode. * EXAMPLE: rig_set_mode(my_rig, RIG_MODE_AM, * rig_passband_wide(my_rig, RIG_MODE_AM) ); * * \return the passband in Hz if the operation has been sucessful, * or a 0 if an error occured (passband not found, whatever). * * \sa rig_passband_narrow(), rig_passband_normal() */ pbwidth_t HAMLIB_API rig_passband_wide(RIG *rig, rmode_t mode) { const struct rig_state *rs; pbwidth_t normal; int i; if (!rig) return 0; /* huhu! */ rs = &rig->state; for (i=0; ifilters[i].modes; i++) { if (rs->filters[i].modes & mode) { normal = rs->filters[i].width; for (i++; ifilters[i].modes; i++) { if ((rs->filters[i].modes & mode) && (rs->filters[i].width > normal)) { return rs->filters[i].width; } } return 0; } } return 0; } /** * \brief set the current VFO * \param rig The rig handle * \param vfo The VFO to set to * * Sets the current VFO. The VFO can be RIG_VFO_A, RIG_VFO_B, RIG_VFO_C * for VFOA, VFOB, VFOC respectively or RIG_VFO_MEM for Memory mode. * Supported VFOs depends on rig capabilities. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_vfo() */ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo) { const struct rig_caps *caps; int retcode; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_vfo == NULL) return -RIG_ENAVAIL; retcode= caps->set_vfo(rig, vfo); if (retcode == RIG_OK) rig->state.current_vfo = vfo; return retcode; } /** * \brief get the current VFO * \param rig The rig handle * \param vfo The location where to store the current VFO * * Retrieves the current VFO. The VFO can be RIG_VFO_A, RIG_VFO_B, RIG_VFO_C * for VFOA, VFOB, VFOC respectively or RIG_VFO_MEM for Memory mode. * Supported VFOs depends on rig capabilities. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_vfo() */ int HAMLIB_API rig_get_vfo(RIG *rig, vfo_t *vfo) { const struct rig_caps *caps; int retcode; if (CHECK_RIG_ARG(rig) || !vfo) return -RIG_EINVAL; caps = rig->caps; if (caps->get_vfo == NULL) return -RIG_ENAVAIL; retcode= caps->get_vfo(rig, vfo); if (retcode == RIG_OK) rig->state.current_vfo = *vfo; return retcode; } /** * \brief set PTT on/off * \param rig The rig handle * \param vfo The target VFO * \param ptt The PTT status to set to * * Sets "Push-To-Talk" on/off. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_ptt() */ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; switch (rig->state.pttport.type.ptt) { case RIG_PTT_RIG: if (ptt == RIG_PTT_ON_MIC || ptt == RIG_PTT_ON_DATA) ptt = RIG_PTT_ON; /* fall through */ case RIG_PTT_RIG_MICDATA: if (caps->set_ptt == NULL) return -RIG_ENIMPL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_ptt(rig, vfo, ptt); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_ptt(rig, vfo, ptt); caps->set_vfo(rig, curr_vfo); return retcode; break; case RIG_PTT_SERIAL_DTR: return ser_set_dtr(&rig->state.pttport, ptt!=RIG_PTT_OFF); case RIG_PTT_SERIAL_RTS: return ser_set_rts(&rig->state.pttport, ptt!=RIG_PTT_OFF); case RIG_PTT_PARALLEL: return par_ptt_set(&rig->state.pttport, ptt); case RIG_PTT_CM108: return cm108_ptt_set(&rig->state.pttport, ptt); case RIG_PTT_NONE: return -RIG_ENAVAIL; /* not available */ default: return -RIG_EINVAL; } return RIG_OK; } /** * \brief get the status of the PTT * \param rig The rig handle * \param vfo The target VFO * \param ptt The location where to store the status of the PTT * * Retrieves the status of PTT (are we on the air?). * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_ptt() */ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { const struct rig_caps *caps; int retcode, status; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !ptt) return -RIG_EINVAL; caps = rig->caps; switch (rig->state.pttport.type.ptt) { case RIG_PTT_RIG: case RIG_PTT_RIG_MICDATA: if (caps->get_ptt == NULL) return -RIG_ENIMPL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_ptt(rig, vfo, ptt); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_ptt(rig, vfo, ptt); caps->set_vfo(rig, curr_vfo); return retcode; break; case RIG_PTT_SERIAL_RTS: if (caps->get_ptt) return caps->get_ptt(rig, vfo, ptt); retcode = ser_get_rts(&rig->state.pttport, &status); *ptt = status ? RIG_PTT_ON : RIG_PTT_OFF; return retcode; case RIG_PTT_SERIAL_DTR: if (caps->get_ptt) return caps->get_ptt(rig, vfo, ptt); retcode = ser_get_dtr(&rig->state.pttport, &status); *ptt = status ? RIG_PTT_ON : RIG_PTT_OFF; return retcode; case RIG_PTT_PARALLEL: if (caps->get_ptt) return caps->get_ptt(rig, vfo, ptt); return par_ptt_get(&rig->state.pttport, ptt); case RIG_PTT_CM108: if (caps->get_ptt) return caps->get_ptt(rig, vfo, ptt); return cm108_ptt_get(&rig->state.pttport, ptt); case RIG_PTT_NONE: return -RIG_ENAVAIL; /* not available */ default: return -RIG_EINVAL; } return RIG_OK; } /** * \brief get the status of the DCD * \param rig The rig handle * \param vfo The target VFO * \param dcd The location where to store the status of the DCD * * Retrieves the status of DCD (is squelch open?). * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * */ int HAMLIB_API rig_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { const struct rig_caps *caps; int retcode, status; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !dcd) return -RIG_EINVAL; caps = rig->caps; switch (rig->state.dcdport.type.dcd) { case RIG_DCD_RIG: if (caps->get_dcd == NULL) return -RIG_ENIMPL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_dcd(rig, vfo, dcd); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_dcd(rig, vfo, dcd); caps->set_vfo(rig, curr_vfo); return retcode; break; case RIG_DCD_SERIAL_CTS: retcode = ser_get_cts(&rig->state.dcdport, &status); *dcd = status ? RIG_DCD_ON : RIG_DCD_OFF; return retcode; case RIG_DCD_SERIAL_DSR: retcode = ser_get_dsr(&rig->state.dcdport, &status); *dcd = status ? RIG_DCD_ON : RIG_DCD_OFF; return retcode; case RIG_DCD_SERIAL_CAR: retcode = ser_get_car(&rig->state.dcdport, &status); *dcd = status ? RIG_DCD_ON : RIG_DCD_OFF; return retcode; case RIG_DCD_PARALLEL: return par_dcd_get(&rig->state.dcdport, dcd); case RIG_DCD_NONE: return -RIG_ENAVAIL; /* not available */ default: return -RIG_EINVAL; } return RIG_OK; } /** * \brief set the repeater shift * \param rig The rig handle * \param vfo The target VFO * \param rptr_shift The repeater shift to set to * * Sets the current repeater shift. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_rptr_shift() */ int HAMLIB_API rig_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_rptr_shift == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_rptr_shift(rig, vfo, rptr_shift); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_rptr_shift(rig, vfo, rptr_shift); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief get the current repeater shift * \param rig The rig handle * \param vfo The target VFO * \param rptr_shift The location where to store the current repeater shift * * Retrieves the current repeater shift. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_rptr_shift() */ int HAMLIB_API rig_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !rptr_shift) return -RIG_EINVAL; caps = rig->caps; if (caps->get_rptr_shift == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_rptr_shift(rig, vfo, rptr_shift); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_rptr_shift(rig, vfo, rptr_shift); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief set the repeater offset * \param rig The rig handle * \param vfo The target VFO * \param rptr_offs The VFO to set to * * Sets the current repeater offset. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_rptr_offs() */ int HAMLIB_API rig_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_rptr_offs == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_rptr_offs(rig, vfo, rptr_offs); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_rptr_offs(rig, vfo, rptr_offs); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief get the current repeater offset * \param rig The rig handle * \param vfo The target VFO * \param rptr_offs The location where to store the current repeater offset * * Retrieves the current repeater offset. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_rptr_offs() */ int HAMLIB_API rig_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !rptr_offs) return -RIG_EINVAL; caps = rig->caps; if (caps->get_rptr_offs == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_rptr_offs(rig, vfo, rptr_offs); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_rptr_offs(rig, vfo, rptr_offs); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief set the split frequencies * \param rig The rig handle * \param vfo The target VFO * \param tx_freq The transmit split frequency to set to * * Sets the split(TX) frequency. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_split_freq(), rig_set_split_vfo() */ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo, tx_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_split_freq && ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX || vfo == rig->state.current_vfo)) return caps->set_split_freq(rig, vfo, tx_freq); /* Assisted mode */ curr_vfo = rig->state.current_vfo; /* Use previously setup TxVFO */ if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX) tx_vfo = rig->state.tx_vfo; else tx_vfo = vfo; if (caps->set_freq && (caps->targetable_vfo&RIG_TARGETABLE_FREQ)) return caps->set_freq(rig, tx_vfo, tx_freq); if (caps->set_vfo) { retcode = caps->set_vfo(rig, tx_vfo); } else if (rig_has_vfo_op(rig, RIG_OP_TOGGLE) && caps->vfo_op) { retcode = caps->vfo_op(rig, vfo, RIG_OP_TOGGLE); } else { return -RIG_ENAVAIL; } if (retcode != RIG_OK) return retcode; if (caps->set_split_freq) retcode = caps->set_split_freq(rig, vfo, tx_freq); else retcode = caps->set_freq(rig, RIG_VFO_CURR, tx_freq); if (caps->set_vfo) { caps->set_vfo(rig, curr_vfo); } else { caps->vfo_op(rig, vfo, RIG_OP_TOGGLE); } return retcode; } /** * \brief get the current split frequencies * \param rig The rig handle * \param vfo The target VFO * \param tx_freq The location where to store the current transmit split frequency * * Retrieves the current split(TX) frequency. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_split_freq() */ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo, tx_vfo; if (CHECK_RIG_ARG(rig) || !tx_freq) return -RIG_EINVAL; caps = rig->caps; if (caps->get_split_freq && ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX || vfo == rig->state.current_vfo)) return caps->get_split_freq(rig, vfo, tx_freq); /* Assisted mode */ curr_vfo = rig->state.current_vfo; /* Use previously setup TxVFO */ if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX) tx_vfo = rig->state.tx_vfo; else tx_vfo = vfo; if (caps->get_freq && (caps->targetable_vfo&RIG_TARGETABLE_FREQ)) return caps->get_freq(rig, tx_vfo, tx_freq); if (caps->set_vfo) { retcode = caps->set_vfo(rig, tx_vfo); } else if (rig_has_vfo_op(rig, RIG_OP_TOGGLE) && caps->vfo_op) { retcode = caps->vfo_op(rig, vfo, RIG_OP_TOGGLE); } else { return -RIG_ENAVAIL; } if (retcode != RIG_OK) return retcode; if (caps->get_split_freq) retcode = caps->get_split_freq(rig, vfo, tx_freq); else retcode = caps->get_freq(rig, RIG_VFO_CURR, tx_freq); if (caps->set_vfo) { caps->set_vfo(rig, curr_vfo); } else { caps->vfo_op(rig, vfo, RIG_OP_TOGGLE); } return retcode; } /** * \brief set the split modes * \param rig The rig handle * \param vfo The target VFO * \param tx_mode The transmit split mode to set to * \param tx_width The transmit split width to set to * * Sets the split(TX) mode. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_split_mode() */ int HAMLIB_API rig_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo, tx_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_split_mode && ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX || vfo == rig->state.current_vfo)) return caps->set_split_mode(rig, vfo, tx_mode, tx_width); /* Assisted mode */ curr_vfo = rig->state.current_vfo; /* Use previously setup TxVFO */ if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX) tx_vfo = rig->state.tx_vfo; else tx_vfo = vfo; if (caps->set_mode && (caps->targetable_vfo&RIG_TARGETABLE_MODE)) return caps->set_mode(rig, tx_vfo, tx_mode, tx_width); if (caps->set_vfo) { retcode = caps->set_vfo(rig, tx_vfo); } else if (rig_has_vfo_op(rig, RIG_OP_TOGGLE) && caps->vfo_op) { retcode = caps->vfo_op(rig, vfo, RIG_OP_TOGGLE); } else { return -RIG_ENAVAIL; } if (retcode != RIG_OK) return retcode; if (caps->set_split_mode) retcode = caps->set_split_mode(rig, vfo, tx_mode, tx_width); else retcode = caps->set_mode(rig, RIG_VFO_CURR, tx_mode, tx_width); if (caps->set_vfo) { caps->set_vfo(rig, curr_vfo); } else { caps->vfo_op(rig, vfo, RIG_OP_TOGGLE); } return retcode; } /** * \brief get the current split modes * \param rig The rig handle * \param vfo The target VFO * \param tx_mode The location where to store the current transmit split mode * \param tx_width The location where to store the current transmit split width * * Retrieves the current split(TX) mode and passband. * If the backend is unable to determine the width, the \a tx_width * will be set to RIG_PASSBAND_NORMAL as a default. * The value stored at \a tx_mode location equals RIG_MODE_NONE * when the current mode of the VFO is not defined (e.g. blank memory). * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_split_mode() */ int HAMLIB_API rig_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo, tx_vfo; if (CHECK_RIG_ARG(rig) || !tx_mode || !tx_width) return -RIG_EINVAL; caps = rig->caps; if (caps->get_split_mode && ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX || vfo == rig->state.current_vfo)) return caps->get_split_mode(rig, vfo, tx_mode, tx_width); /* Assisted mode */ curr_vfo = rig->state.current_vfo; /* Use previously setup TxVFO */ if (vfo == RIG_VFO_CURR || vfo == RIG_VFO_TX) tx_vfo = rig->state.tx_vfo; else tx_vfo = vfo; if (caps->get_mode && (caps->targetable_vfo&RIG_TARGETABLE_MODE)) return caps->get_mode(rig, tx_vfo, tx_mode, tx_width); if (caps->set_vfo) { retcode = caps->set_vfo(rig, tx_vfo); } else if (rig_has_vfo_op(rig, RIG_OP_TOGGLE) && caps->vfo_op) { retcode = caps->vfo_op(rig, vfo, RIG_OP_TOGGLE); } else { return -RIG_ENAVAIL; } if (retcode != RIG_OK) return retcode; if (caps->get_split_mode) retcode = caps->get_split_mode(rig, vfo, tx_mode, tx_width); else retcode = caps->get_mode(rig, RIG_VFO_CURR, tx_mode, tx_width); if (caps->set_vfo) { caps->set_vfo(rig, curr_vfo); } else { caps->vfo_op(rig, vfo, RIG_OP_TOGGLE); } if (*tx_width == RIG_PASSBAND_NORMAL && *tx_mode != RIG_MODE_NONE) *tx_width = rig_passband_normal (rig, *tx_mode); return retcode; } /** * \brief set the split mode * \param rig The rig handle * \param vfo The target VFO * \param split The split mode to set to * \param tx_vfo The transmit VFO * * Sets the current split mode. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_split_vfo() */ int HAMLIB_API rig_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_split_vfo == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { retcode = caps->set_split_vfo(rig, vfo, split, tx_vfo); if (retcode == RIG_OK) rig->state.tx_vfo = tx_vfo; return retcode; } if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_split_vfo(rig, vfo, split, tx_vfo); caps->set_vfo(rig, curr_vfo); if (retcode == RIG_OK) rig->state.tx_vfo = tx_vfo; return retcode; } /** * \brief get the current split mode * \param rig The rig handle * \param vfo The target VFO * \param split The location where to store the current split mode * \param tx_vfo The transmit VFO * * Retrieves the current split mode. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_split_vfo() */ int HAMLIB_API rig_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !split || !tx_vfo) return -RIG_EINVAL; caps = rig->caps; if (caps->get_split_vfo == NULL) return -RIG_ENAVAIL; /* overidden by backend at will */ *tx_vfo = rig->state.tx_vfo; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_split_vfo(rig, vfo, split, tx_vfo); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_split_vfo(rig, vfo, split, tx_vfo); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief set the RIT * \param rig The rig handle * \param vfo The target VFO * \param rit The RIT offset to adjust to * * Sets the current RIT offset. A value of 0 for \a rit disables RIT. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_rit() */ int HAMLIB_API rig_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_rit == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_rit(rig, vfo, rit); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_rit(rig, vfo, rit); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief get the current RIT offset * \param rig The rig handle * \param vfo The target VFO * \param rit The location where to store the current RIT offset * * Retrieves the current RIT offset. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_rit() */ int HAMLIB_API rig_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !rit) return -RIG_EINVAL; caps = rig->caps; if (caps->get_rit == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_rit(rig, vfo, rit); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_rit(rig, vfo, rit); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief set the XIT * \param rig The rig handle * \param vfo The target VFO * \param xit The XIT offset to adjust to * * Sets the current XIT offset. A value of 0 for \a xit disables XIT. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_xit() */ int HAMLIB_API rig_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_xit == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_xit(rig, vfo, xit); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_xit(rig, vfo, xit); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief get the current XIT offset * \param rig The rig handle * \param vfo The target VFO * \param xit The location where to store the current XIT offset * * Retrieves the current XIT offset. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_xit() */ int HAMLIB_API rig_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !xit) return -RIG_EINVAL; caps = rig->caps; if (caps->get_xit == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_xit(rig, vfo, xit); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_xit(rig, vfo, xit); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief set the Tuning Step * \param rig The rig handle * \param vfo The target VFO * \param ts The tuning step to set to * * Sets the Tuning Step. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_ts() */ int HAMLIB_API rig_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_ts == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_ts(rig, vfo, ts); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_ts(rig, vfo, ts); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief get the current Tuning Step * \param rig The rig handle * \param vfo The target VFO * \param ts The location where to store the current tuning step * * Retrieves the current tuning step. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_ts() */ int HAMLIB_API rig_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !ts) return -RIG_EINVAL; caps = rig->caps; if (caps->get_ts == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_ts(rig, vfo, ts); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_ts(rig, vfo, ts); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief set the antenna * \param rig The rig handle * \param vfo The target VFO * \param ant The anntena to select * * Select the antenna connector. \code rig_set_ant(rig, RIG_VFO_CURR, RIG_ANT_1); // apply to both TX&RX rig_set_ant(rig, RIG_VFO_RX, RIG_ANT_2); \endcode * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_ant() */ int HAMLIB_API rig_set_ant(RIG *rig, vfo_t vfo, ant_t ant) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_ant == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_ant(rig, vfo, ant); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_ant(rig, vfo, ant); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief get the current antenna * \param rig The rig handle * \param vfo The target VFO * \param ant The location where to store the current antenna * * Retrieves the current antenna. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_ant() */ int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t *ant) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !ant) return -RIG_EINVAL; caps = rig->caps; if (caps->get_ant == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_ant(rig, vfo, ant); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_ant(rig, vfo, ant); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief conversion utility from relative range to absolute in mW * \param rig The rig handle * \param mwpower The location where to store the converted power in mW * \param power The relative power * \param freq The frequency where the conversion should take place * \param mode The mode where the conversion should take place * * Converts a power value expressed in a range on a [0.0 .. 1.0] relative * scale to the real transmit power in milli Watts the radio would emit. * The \a freq and \a mode where the conversion should take place must be * also provided since the relative power is peculiar to a specific * freq and mode range of the radio. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_mW2power() */ int HAMLIB_API rig_power2mW(RIG *rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode) { const freq_range_t *txrange; if (!rig || !rig->caps || !mwpower || power<0.0 || power>1.0) return -RIG_EINVAL; if (rig->caps->power2mW != NULL) return rig->caps->power2mW(rig, mwpower, power, freq, mode); txrange = rig_get_range(rig->state.tx_range_list, freq, mode); if (!txrange) { /* * freq is not on the tx range! */ return -RIG_ECONF; /* could be RIG_EINVAL ? */ } *mwpower = (unsigned int)(power * txrange->high_power); return RIG_OK; } /** * \brief conversion utility from absolute in mW to relative range * \param rig The rig handle * \param power The location where to store the converted relative power * \param mwpower The power in mW * \param freq The frequency where the conversion should take place * \param mode The mode where the conversion should take place * * Converts a power value expressed in the real transmit power in milli Watts * the radio would emit to a range on a [0.0 .. 1.0] relative scale. * The \a freq and \a mode where the conversion should take place must be * also provided since the relative power is peculiar to a specific * freq and mode range of the radio. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_power2mW() */ int HAMLIB_API rig_mW2power(RIG *rig, float *power, unsigned int mwpower, freq_t freq, rmode_t mode) { const freq_range_t *txrange; if (!rig || !rig->caps || !power || mwpower<=0) return -RIG_EINVAL; if (rig->caps->mW2power != NULL) return rig->caps->mW2power(rig, power, mwpower, freq, mode); txrange = rig_get_range(rig->state.tx_range_list, freq, mode); if (!txrange) { /* * freq is not on the tx range! */ return -RIG_ECONF; /* could be RIG_EINVAL ? */ } if (txrange->high_power == 0) { *power = 0.0; return RIG_OK; } *power = (float)mwpower / txrange->high_power; if (*power > 1.0) *power = 1.0; return (mwpower>txrange->high_power? RIG_OK : -RIG_ETRUNC); } /** * \brief get the best frequency resolution of the rig * \param rig The rig handle * \param mode The mode where the conversion should take place * * Returns the best frequency resolution of the rig, for a given \a mode. * * \return the frequency resolution in Hertz if the operation h * has been sucessful, otherwise a negative value if an error occured. * */ shortfreq_t HAMLIB_API rig_get_resolution(RIG *rig, rmode_t mode) { const struct rig_state *rs; int i; if (!rig || !rig->caps || !mode) return -RIG_EINVAL; rs = &rig->state; for (i=0; ituning_steps[i].ts; i++) { if (rs->tuning_steps[i].modes & mode) return rs->tuning_steps[i].ts; } return -RIG_EINVAL; } /** * \brief turn on/off the radio * \param rig The rig handle * \param status The status to set to * * turns on/off the radio. * See #RIG_POWER_ON, #RIG_POWER_OFF and #RIG_POWER_STANDBY defines * for the \a status. * * \return RIG_OK if the operation has been sucessful, ortherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_powerstat() */ int HAMLIB_API rig_set_powerstat(RIG *rig, powerstat_t status) { if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; if (rig->caps->set_powerstat == NULL) return -RIG_ENAVAIL; return rig->caps->set_powerstat(rig, status); } /** * \brief get the on/off status of the radio * \param rig The rig handle * \param status The locatation where to store the current status * * Retrieve the status of the radio. See RIG_POWER_ON, RIG_POWER_OFF and * RIG_POWER_STANDBY defines for the \a status. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_powerstat() */ int HAMLIB_API rig_get_powerstat(RIG *rig, powerstat_t *status) { if (CHECK_RIG_ARG(rig) || !status) return -RIG_EINVAL; if (rig->caps->get_powerstat == NULL) return -RIG_ENAVAIL; return rig->caps->get_powerstat(rig, status); } /** * \brief reset the radio * \param rig The rig handle * \param reset The reset operation to perform * * Resets the radio. * See RIG_RESET_NONE, RIG_RESET_SOFT and RIG_RESET_MCALL defines * for the \a reset. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * */ int HAMLIB_API rig_reset(RIG *rig, reset_t reset) { if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; if (rig->caps->reset == NULL) return -RIG_ENAVAIL; return rig->caps->reset(rig, reset); } extern int rig_probe_first(hamlib_port_t *p); extern int rig_probe_all_backends(hamlib_port_t *p, rig_probe_func_t cfunc, rig_ptr_t data); /** * \brief try to guess a rig * \param port A pointer describing a port linking the host to the rig * * Try to guess what is the model of the first rig attached to the port. * It can be very buggy, and mess up the radio at the other end. * (but fun if it works!) * * \warning this is really Experimental, It has been tested only * with IC-706MkIIG. any feedback welcome! --SF * * \return the rig model id according to the rig_model_t type if found, * otherwise RIG_MODEL_NONE if unable to determine rig model. */ rig_model_t HAMLIB_API rig_probe(hamlib_port_t *port) { if (!port) return RIG_MODEL_NONE; return rig_probe_first(port); } /** * \brief try to guess rigs * \param port A pointer describing a port linking the host to the rigs * \param cfunc Function to be called each time a rig is found * \param data Arbitrary data passed to cfunc * * Try to guess what are the model of all rigs attached to the port. * It can be very buggy, and mess up the radio at the other end. * (but fun if it works!) * * \warning this is really Experimental, It has been tested only * with IC-706MkIIG. any feedback welcome! --SF * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). */ int HAMLIB_API rig_probe_all(hamlib_port_t *port, rig_probe_func_t cfunc, rig_ptr_t data) { if (!port) return -RIG_EINVAL; return rig_probe_all_backends(port, cfunc, data); } /** * \brief check retrieval ability of VFO operations * \param rig The rig handle * \param op The VFO op * * Checks if a rig is capable of executing a VFO operation. * Since the \a op is an OR'ed bitmap argument, more than * one op can be checked at the same time. * * EXAMPLE: if (rig_has_vfo_op(my_rig, RIG_OP_CPY)) disp_VFOcpy_btn(); * * \return a bit map mask of supported op settings that can be retrieved, * otherwise 0 if none supported. * * \sa rig_vfo_op() */ vfo_op_t HAMLIB_API rig_has_vfo_op(RIG *rig, vfo_op_t op) { if (!rig || !rig->caps) return 0; return (rig->caps->vfo_ops & op); } /** * \brief perform Memory/VFO operations * \param rig The rig handle * \param vfo The target VFO * \param op The Memory/VFO operation to perform * * Performs Memory/VFO operation. * See #vfo_op_t for more information. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_has_vfo_op() */ int HAMLIB_API rig_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->vfo_op == NULL || !rig_has_vfo_op(rig,op)) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->vfo_op(rig, vfo, op); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->vfo_op(rig, vfo, op); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief check availability of scanning functions * \param rig The rig handle * \param scan The scan op * * Checks if a rig is capable of performing a scan operation. * Since the \a scan parameter is an OR'ed bitmap argument, more than * one op can be checked at the same time. * * EXAMPLE: if (rig_has_scan(my_rig, RIG_SCAN_PRIO)) disp_SCANprio_btn(); * * \return a bit map of supported scan settings that can be retrieved, * otherwise 0 if none supported. * * \sa rig_scan() */ scan_t HAMLIB_API rig_has_scan(RIG *rig, scan_t scan) { if (!rig || !rig->caps) return 0; return (rig->caps->scan_ops & scan); } /** * \brief perform Memory/VFO operations * \param rig The rig handle * \param vfo The target VFO * \param scan The scanning operation to perform * \param ch Optional channel argument used for the scan. * * Performs scanning operation. * See #scan_t for more information. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_has_scan() */ int HAMLIB_API rig_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->scan == NULL || (scan!=RIG_SCAN_STOP && !rig_has_scan(rig, scan))) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->scan(rig, vfo, scan, ch); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->scan(rig, vfo, scan, ch); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief send DTMF digits * \param rig The rig handle * \param vfo The target VFO * \param digits Digits to be send * * Sends DTMF digits. * See DTMF change speed, etc. (TODO). * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * */ int HAMLIB_API rig_send_dtmf(RIG *rig, vfo_t vfo, const char *digits) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !digits) return -RIG_EINVAL; caps = rig->caps; if (caps->send_dtmf == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->send_dtmf(rig, vfo, digits); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->send_dtmf(rig, vfo, digits); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief receive DTMF digits * \param rig The rig handle * \param vfo The target VFO * \param digits Location where the digits are to be stored * \param length in: max length of buffer, out: number really read. * * Receives DTMF digits (not blocking). * See DTMF change speed, etc. (TODO). * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * */ int HAMLIB_API rig_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !digits || !length) return -RIG_EINVAL; caps = rig->caps; if (caps->recv_dtmf == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->recv_dtmf(rig, vfo, digits, length); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->recv_dtmf(rig, vfo, digits, length); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief send morse code * \param rig The rig handle * \param vfo The target VFO * \param msg Message to be sent * * Sends morse message. * See keyer change speed, etc. (TODO). * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * */ int HAMLIB_API rig_send_morse(RIG *rig, vfo_t vfo, const char *msg) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !msg) return -RIG_EINVAL; caps = rig->caps; if (caps->send_morse == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->send_morse(rig, vfo, msg); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->send_morse(rig, vfo, msg); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief find the freq_range of freq/mode * \param range_list The range list to search from * \param freq The frequency that will be part of this range * \param mode The mode that will be part of this range * * Returns a pointer to the #freq_range_t including \a freq and \a mode. * Works for rx and tx range list as well. * * \return the location of the #freq_range_t if found, * otherwise NULL if not found or if \a range_list is invalid. * */ const freq_range_t * HAMLIB_API rig_get_range(const freq_range_t range_list[], freq_t freq, rmode_t mode) { int i; for (i=0; i= range_list[i].start && freq <= range_list[i].end && (range_list[i].modes & mode)) { return &range_list[i]; } } return NULL; } /** * \brief get general information from the radio * \param rig The rig handle * * Retrieves some general information from the radio. * This can include firmware revision, exact model name, or just nothing. * * \return a pointer to freshly allocated memory containing the ASCIIZ string * if the operation has been sucessful, otherwise NULL if an error occured * or get_info not part of capabilities. */ const char* HAMLIB_API rig_get_info(RIG *rig) { if (CHECK_RIG_ARG(rig)) return NULL; if (rig->caps->get_info == NULL) return NULL; return rig->caps->get_info(rig); } /*! @} */ hamlib-1.2.15.3/src/serial.c0000644000175000017500000002671712044564477012362 00000000000000/* * Hamlib Interface - serial communication low-level support * Copyright (c) 2000-2010 by Stephane Fillod * Copyright (c) 2000-2003 by Frank Singleton * Parts of the PTT handling are derived from soundmodem, an excellent * ham packet softmodem written by Thomas Sailer, HB9JNX. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * \addtogroup rig_internal * @{ */ /** * \brief Serial port IO * \file serial.c */ #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 #include #include #ifdef HAVE_SYS_IOCTL_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_TERMIOS_H #include /* POSIX terminal control definitions */ #else #ifdef HAVE_TERMIO_H #include #else /* sgtty */ #ifdef HAVE_SGTTY_H #include #endif #endif #endif #if defined(WIN32) && !defined(HAVE_TERMIOS_H) #include "win32termios.h" #define HAVE_TERMIOS_H 1 /* we have replacement */ #else #define OPEN open #define CLOSE close #define IOCTL ioctl #endif #include #include "serial.h" #include "misc.h" #ifdef HAVE_SYS_IOCCOM_H #include #endif /** * \brief Open serial port using rig.state data * \param rp port data structure (must spec port id eg /dev/ttyS1) * \return RIG_OK or < 0 if error */ int HAMLIB_API serial_open(hamlib_port_t *rp) { int fd; /* File descriptor for the port */ int err; if (!rp) return -RIG_EINVAL; /* * Open in Non-blocking mode. Watch for EAGAIN errors! */ fd = OPEN(rp->pathname, O_RDWR | O_NOCTTY | O_NDELAY); if (fd == -1) { /* Could not open the port. */ rig_debug(RIG_DEBUG_ERR, "%s: Unable to open %s - %s\n", __func__, rp->pathname, strerror(errno)); return -RIG_EIO; } rp->fd = fd; err = serial_setup(rp); if (err != RIG_OK) { CLOSE(fd); return err; } return RIG_OK; } /** * \brief Set up Serial port according to requests in port * \param rp * \return RIG_OK or < 0 */ int HAMLIB_API serial_setup(hamlib_port_t *rp) { int fd; /* There's a lib replacement for termios under Mingw */ #if defined(HAVE_TERMIOS_H) speed_t speed; /* serial comm speed */ struct termios options; #elif defined(HAVE_TERMIO_H) struct termio options; #elif defined(HAVE_SGTTY_H) struct sgttyb sg; #else #error "No term control supported!" #endif if (!rp) return -RIG_EINVAL; fd = rp->fd; /* * Get the current options for the port... */ #if defined(HAVE_TERMIOS_H) tcgetattr(fd, &options); #elif defined(HAVE_TERMIO_H) IOCTL (fd, TCGETA, &options); #else /* sgtty */ IOCTL (fd, TIOCGETP, &sg); #endif #ifdef HAVE_CFMAKERAW cfmakeraw(&options); /* Set serial port to RAW mode by default. */ #endif /* * Set the baud rates to requested values */ switch(rp->parm.serial.rate) { case 150: speed = B150; /* yikes... */ break; case 300: speed = B300; /* yikes... */ break; case 600: speed = B600; break; case 1200: speed = B1200; break; case 2400: speed = B2400; break; case 4800: speed = B4800; break; case 9600: speed = B9600; break; case 19200: speed = B19200; break; case 38400: speed = B38400; break; case 57600: speed = B57600; /* cool.. */ break; case 115200: speed = B115200; /* awsome! */ break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported rate specified: %d\n", __func__, rp->parm.serial.rate); CLOSE(fd); return -RIG_ECONF; } /* TODO */ cfsetispeed(&options, speed); cfsetospeed(&options, speed); /* * Enable the receiver and set local mode... */ options.c_cflag |= (CLOCAL | CREAD); /* * close doesn't change modem signals */ options.c_cflag &= ~HUPCL; /* * Set data to requested values. * */ switch(rp->parm.serial.data_bits) { case 7: options.c_cflag &= ~CSIZE; options.c_cflag |= CS7; break; case 8: options.c_cflag &= ~CSIZE; options.c_cflag |= CS8; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported serial_data_bits " "specified: %d\n", __func__, rp->parm.serial.data_bits); CLOSE(fd); return -RIG_ECONF; break; } /* * Set stop bits to requested values. * */ switch(rp->parm.serial.stop_bits) { case 1: options.c_cflag &= ~CSTOPB; break; case 2: options.c_cflag |= CSTOPB; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported serial_stop_bits " "specified: %d\n", __func__, rp->parm.serial.stop_bits); CLOSE(fd); return -RIG_ECONF; break; } /* * Set parity to requested values. * */ switch(rp->parm.serial.parity) { case RIG_PARITY_NONE: options.c_cflag &= ~PARENB; break; case RIG_PARITY_EVEN: options.c_cflag |= PARENB; options.c_cflag &= ~PARODD; break; case RIG_PARITY_ODD: options.c_cflag |= PARENB; options.c_cflag |= PARODD; break; /* CMSPAR is not POSIX */ #ifdef CMSPAR case RIG_PARITY_MARK: options.c_cflag |= PARENB | CMSPAR; options.c_cflag |= PARODD; break; case RIG_PARITY_SPACE: options.c_cflag |= PARENB | CMSPAR; options.c_cflag &= ~PARODD; break; #endif default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported serial_parity " "specified: %d\n", __func__, rp->parm.serial.parity); CLOSE(fd); return -RIG_ECONF; break; } /* * Set flow control to requested mode * */ switch(rp->parm.serial.handshake) { case RIG_HANDSHAKE_NONE: options.c_cflag &= ~CRTSCTS; options.c_iflag &= ~IXON; break; case RIG_HANDSHAKE_XONXOFF: options.c_cflag &= ~CRTSCTS; options.c_iflag |= IXON; /* Enable Xon/Xoff software handshaking */ break; case RIG_HANDSHAKE_HARDWARE: options.c_cflag |= CRTSCTS; /* Enable Hardware handshaking */ options.c_iflag &= ~IXON; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported flow_control " "specified: %d\n", __func__, rp->parm.serial.handshake); CLOSE(fd); return -RIG_ECONF; break; } /* * Choose raw input, no preprocessing please .. */ #if defined(HAVE_TERMIOS_H) || defined(HAVE_TERMIO_H) options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); /* * Choose raw output, no preprocessing please .. */ options.c_oflag &= ~OPOST; #else /* sgtty */ sg.sg_flags = RAW; #endif /* * Flush serial port */ tcflush(fd, TCIFLUSH); /* * Finally, set the new options for the port... */ #if defined(HAVE_TERMIOS_H) if (tcsetattr(fd, TCSANOW, &options) == -1) { rig_debug(RIG_DEBUG_ERR, "%s: tcsetattr failed: %s\n", __func__, strerror(errno)); CLOSE(fd); return -RIG_ECONF; /* arg, so close! */ } #elif defined(HAVE_TERMIO_H) if (IOCTL(fd, TCSETA, &options) == -1) { rig_debug(RIG_DEBUG_ERR, "%s: ioctl(TCSETA) failed: %s\n", __func__, strerror(errno)); CLOSE(fd); return -RIG_ECONF; /* arg, so close! */ } #else /* sgtty */ if (IOCTL(fd, TIOCSETP, &sg) == -1) { rig_debug(RIG_DEBUG_ERR, "%s: ioctl(TIOCSETP) failed: %s\n", __func__, strerror(errno)); CLOSE(fd); return -RIG_ECONF; /* arg, so close! */ } #endif return RIG_OK; } /** * \brief Flush all characters waiting in RX buffer. * \param p * \return RIG_OK */ int HAMLIB_API serial_flush(hamlib_port_t *p ) { tcflush(p->fd, TCIFLUSH); return RIG_OK; } /** * \brief Open serial port * \param p * \return fd */ int ser_open(hamlib_port_t *p) { return (p->fd = OPEN(p->pathname, O_RDWR | O_NOCTTY | O_NDELAY)); } /** * \brief Close serial port * \param p fd * \return RIG_OK or < 0 */ int ser_close(hamlib_port_t *p) { return CLOSE(p->fd); } /** * \brief Set Request to Send (RTS) bit * \param p * \param state true/false * \return RIG_OK or < 0 */ int HAMLIB_API ser_set_rts(hamlib_port_t *p, int state) { unsigned int y = TIOCM_RTS; #if defined(TIOCMBIS) && defined(TIOCMBIC) return IOCTL(p->fd, state ? TIOCMBIS : TIOCMBIC, &y) < 0 ? -RIG_EIO : RIG_OK; #else if (IOCTL(p->fd, TIOCMGET, &y) < 0) { return -RIG_EIO; } if (state) y |= TIOCM_RTS; else y &= ~TIOCM_RTS; return IOCTL(p->fd, TIOCMSET, &y) < 0 ? -RIG_EIO : RIG_OK; #endif } /** * \brief Get RTS bit * \param p supposed to be &rig->state.rigport * \param state non-NULL */ int HAMLIB_API ser_get_rts(hamlib_port_t *p, int *state) { int retcode; unsigned int y; retcode = IOCTL(p->fd, TIOCMGET, &y); *state = (y & TIOCM_RTS) == TIOCM_RTS; return retcode < 0 ? -RIG_EIO : RIG_OK; } /** * \brief Set Data Terminal Ready (DTR) bit * \param p * \param state true/false * \return RIG_OK or < 0 */ int HAMLIB_API ser_set_dtr(hamlib_port_t *p, int state) { unsigned int y = TIOCM_DTR; #if defined(TIOCMBIS) && defined(TIOCMBIC) return IOCTL(p->fd, state ? TIOCMBIS : TIOCMBIC, &y) < 0 ? -RIG_EIO : RIG_OK; #else if (IOCTL(p->fd, TIOCMGET, &y) < 0) { return -RIG_EIO; } if (state) y |= TIOCM_DTR; else y &= ~TIOCM_DTR; return IOCTL(p->fd, TIOCMSET, &y) < 0 ? -RIG_EIO : RIG_OK; #endif } /** * \brief Get DTR bit * \param p supposed to be &rig->state.rigport * \param state non-NULL */ int HAMLIB_API ser_get_dtr(hamlib_port_t *p, int *state) { int retcode; unsigned int y; retcode = IOCTL(p->fd, TIOCMGET, &y); *state = (y & TIOCM_DTR) == TIOCM_DTR; return retcode < 0 ? -RIG_EIO : RIG_OK; } /** * \brief Set Break * \param p * \param state (ignored?) * \return RIG_OK or < 0 */ int HAMLIB_API ser_set_brk(hamlib_port_t *p, int state) { #if defined(TIOCSBRK) && defined(TIOCCBRK) return IOCTL(p->fd, state ? TIOCSBRK : TIOCCBRK, 0 ) < 0 ? -RIG_EIO : RIG_OK; #else return -RIG_ENIMPL; #endif } /** * \brief Get Carrier (CI?) bit * \param p supposed to be &rig->state.rigport * \param state non-NULL */ int HAMLIB_API ser_get_car(hamlib_port_t *p, int *state) { int retcode; unsigned int y; retcode = IOCTL(p->fd, TIOCMGET, &y); *state = (y & TIOCM_CAR) == TIOCM_CAR; return retcode < 0 ? -RIG_EIO : RIG_OK; } /** * \brief Get Clear to Send (CTS) bit * \param p supposed to be &rig->state.rigport * \param state non-NULL */ int HAMLIB_API ser_get_cts(hamlib_port_t *p, int *state) { int retcode; unsigned int y; retcode = IOCTL(p->fd, TIOCMGET, &y); *state = (y & TIOCM_CTS) == TIOCM_CTS; return retcode < 0 ? -RIG_EIO : RIG_OK; } /** * \brief Get Data Set Ready (DSR) bit * \param p supposed to be &rig->state.rigport * \param state non-NULL */ int HAMLIB_API ser_get_dsr(hamlib_port_t *p, int *state) { int retcode; unsigned int y; retcode = IOCTL(p->fd, TIOCMGET, &y); *state = (y & TIOCM_DSR) == TIOCM_DSR; return retcode < 0 ? -RIG_EIO : RIG_OK; } /** @} */ hamlib-1.2.15.3/src/tones.h0000644000175000017500000000777412044564477012242 00000000000000/* * Hamlib Interface - CTCSS and DCS tables header * Copyright (c) 2000-2009 by Stephane Fillod and Frank Singleton * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _TONES_H #define _TONES_H 1 #include "hamlib/rig.h" /* and implicitly rig_dll.h */ /* * 52 CTCSS sub-audible tones */ #define FULL_CTCSS_LIST \ 600, 670, 693, 719, 744, 770, 797, 825, 854, 885, 915, \ 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1200, 1230, 1273, \ 1318, 1365, 1413, 1462, 1514, 1567, 1598, 1622, 1655, 1679, \ 1713, 1738, 1773, 1799, 1835, 1862, 1899, 1928, 1966, 1995, \ 2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541, \ 0, static const tone_t static_full_ctcss_list[] = { FULL_CTCSS_LIST }; /* * 50 CTCSS sub-audible tones, from 67.0Hz to 254.1Hz * * \note Don't even think about changing a bit of this array, several * backends depend on it. If you need to, create a copy for your * own caps. --SF */ #define COMMON_CTCSS_LIST \ 670, 693, 719, 744, 770, 797, 825, 854, 885, 915, \ 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, \ 1318, 1365, 1413, 1462, 1514, 1567, 1598, 1622, 1655, 1679, \ 1713, 1738, 1773, 1799, 1835, 1862, 1899, 1928, 1966, 1995, \ 2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541, \ 0, static const tone_t static_common_ctcss_list[] = { COMMON_CTCSS_LIST }; /* * 104 DCS codes */ #define COMMON_DCS_LIST \ 23, 25, 26, 31, 32, 36, 43, 47, 51, 53, \ 54, 65, 71, 72, 73, 74, 114, 115, 116, 122, 125, 131, \ 132, 134, 143, 145, 152, 155, 156, 162, 165, 172, 174, 205, \ 212, 223, 225, 226, 243, 244, 245, 246, 251, 252, 255, 261, \ 263, 265, 266, 271, 274, 306, 311, 315, 325, 331, 332, 343, \ 346, 351, 356, 364, 365, 371, 411, 412, 413, 423, 431, 432, \ 445, 446, 452, 454, 455, 462, 464, 465, 466, 503, 506, 516, \ 523, 526, 532, 546, 565, 606, 612, 624, 627, 631, 632, 654, \ 662, 664, 703, 712, 723, 731, 732, 734, 743, 754, \ 0, static const tone_t static_common_dcs_list[] = { COMMON_DCS_LIST }; /* * 106 DCS codes */ #define FULL_DCS_LIST \ 17, 23, 25, 26, 31, 32, 36, 43, 47, 50, 51, 53, \ 54, 65, 71, 72, 73, 74, 114, 115, 116, 122, 125, 131, \ 132, 134, 143, 145, 152, 155, 156, 162, 165, 172, 174, 205, \ 212, 223, 225, 226, 243, 244, 245, 246, 251, 252, 255, 261, \ 263, 265, 266, 271, 274, 306, 311, 315, 325, 331, 332, 343, \ 346, 351, 356, 364, 365, 371, 411, 412, 413, 423, 431, 432, \ 445, 446, 452, 454, 455, 462, 464, 465, 466, 503, 506, 516, \ 523, 526, 532, 546, 565, 606, 612, 624, 627, 631, 632, 654, \ 662, 664, 703, 712, 723, 731, 732, 734, 743, 754, \ 0, static const tone_t static_full_dcs_list[] = { FULL_DCS_LIST }; /* * These arrays cannot be shared on Win32 systems, * because DLL's vars don't have constant address. */ #if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(IN_HAMLIB) #define common_ctcss_list static_common_ctcss_list #define full_ctcss_list static_full_ctcss_list #define full_dcs_list static_full_dcs_list #define common_dcs_list static_common_dcs_list #else extern const HAMLIB_EXPORT_VAR(tone_t) full_ctcss_list[]; extern const HAMLIB_EXPORT_VAR(tone_t) common_ctcss_list[]; extern const HAMLIB_EXPORT_VAR(tone_t) full_dcs_list[]; extern const HAMLIB_EXPORT_VAR(tone_t) common_dcs_list[]; #endif #endif /* _TONES_H */ hamlib-1.2.15.3/src/register.h0000644000175000017500000000445612044564477012730 00000000000000/* * Hamlib Interface - plugin registration * Copyright (c) 2003-2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _REGISTER_H #define _REGISTER_H 1 #include #include #ifdef __cplusplus #define EXTERN_C extern "C" #else #define EXTERN_C extern #endif #define CONCAT4(w__, x__, y__, z__) w__ ## x__ ## y__ ## z__ #define MAKE_VERSIONED_FN(prefix__, version__, name_args__) CONCAT4(prefix__, version__, _, name_args__) /* void MAKE_VERSIONED_FN(foo, 42, bar(int i)) -> void foo42_bar(int i) */ #ifndef ABI_VERSION #error ABI_VERSION undefined! Did you include config.h? #endif #ifdef DECLARE_INITRIG_BACKEND #undef DECLARE_INITRIG_BACKEND #endif #define DECLARE_INITRIG_BACKEND(backend) EXTERN_C BACKEND_EXPORT(int) MAKE_VERSIONED_FN(initrigs, ABI_VERSION, backend(void *be_handle)) #ifdef DECLARE_PROBERIG_BACKEND #undef DECLARE_PROBERIG_BACKEND #endif #define DECLARE_PROBERIG_BACKEND(backend) EXTERN_C BACKEND_EXPORT(rig_model_t) MAKE_VERSIONED_FN(probeallrigs, ABI_VERSION, backend(hamlib_port_t *port, rig_probe_func_t cfunc, rig_ptr_t data)) #ifdef DECLARE_INITROT_BACKEND #undef DECLARE_INITROT_BACKEND #endif #define DECLARE_INITROT_BACKEND(backend) EXTERN_C BACKEND_EXPORT(int) MAKE_VERSIONED_FN(initrots, ABI_VERSION, backend(void *be_handle)) #ifdef DECLARE_PROBEROT_BACKEND #undef DECLARE_PROBEROT_BACKEND #endif #define DECLARE_PROBEROT_BACKEND(backend) EXTERN_C BACKEND_EXPORT(rot_model_t) MAKE_VERSIONED_FN(probeallrots, ABI_VERSION, backend(hamlib_port_t *port, rig_probe_func_t cfunc, rig_ptr_t data)) #endif /* _REGISTER_H */ hamlib-1.2.15.3/src/rot_conf.c0000644000175000017500000003025412044564477012703 00000000000000/* * Hamlib Interface - rotator configuration interface * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * \addtogroup rotator * @{ */ /** * \brief Rotator Configuration Interface * \file rot_conf.c */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* Standard input/output definitions */ #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "rot_conf.h" #include "token.h" /* * Configuration options available in the rot->state struct. */ static const struct confparams rotfrontend_cfg_params[] = { { TOK_PATHNAME, "rot_pathname", "Rig path name", "Path name to the device file of the rotator", "/dev/rotator", RIG_CONF_STRING, }, { TOK_WRITE_DELAY, "write_delay", "Write delay", "Delay in ms between each byte sent out", "0", RIG_CONF_NUMERIC, { .n = { 0, 1000, 1 } } }, { TOK_POST_WRITE_DELAY, "post_write_delay", "Post write delay", "Delay in ms between each command sent out", "0", RIG_CONF_NUMERIC, { .n = { 0, 1000, 1 } } }, { TOK_TIMEOUT, "timeout", "Timeout", "Timeout in ms", "0", RIG_CONF_NUMERIC, { .n = { 0, 10000, 1 } } }, { TOK_RETRY, "retry", "Retry", "Max number of retry", "0", RIG_CONF_NUMERIC, { .n = { 0, 10, 1 } } }, { TOK_MIN_AZ, "min_az", "Minimum azimuth", "Minimum rotator azimuth in degrees", "-180", RIG_CONF_NUMERIC, { .n = { -360, 360, .001 } } }, { TOK_MAX_AZ, "max_az", "Maximum azimuth", "Maximum rotator azimuth in degrees", "180", RIG_CONF_NUMERIC, { .n = { -360, 360, .001 } } }, { TOK_MIN_EL, "min_el", "Minimum elevation", "Minimum rotator elevation in degrees", "0", RIG_CONF_NUMERIC, { .n = { -90, 180, .001 } } }, { TOK_MAX_EL, "max_el", "Maximum elevation", "Maximum rotator elevation in degrees", "90", RIG_CONF_NUMERIC, { .n = { -90, 180, .001 } } }, { RIG_CONF_END, NULL, } }; static const struct confparams rotfrontend_serial_cfg_params[] = { { TOK_SERIAL_SPEED, "serial_speed", "Serial speed", "Serial port baud rate", "0", RIG_CONF_NUMERIC, { .n = { 300, 115200, 1 } } }, { TOK_DATA_BITS, "data_bits", "Serial data bits", "Serial port data bits", "8", RIG_CONF_NUMERIC, { .n = { 5, 8, 1 } } }, { TOK_STOP_BITS, "stop_bits", "Serial stop bits", "Serial port stop bits", "1", RIG_CONF_NUMERIC, { .n = { 0, 3, 1 } } }, { TOK_PARITY, "serial_parity", "Serial parity", "Serial port parity", "None", RIG_CONF_COMBO, { .c = {{ "None", "Odd", "Even", "Mark", "Space", NULL }} } }, { TOK_HANDSHAKE, "serial_handshake", "Serial handshake", "Serial port handshake", "None", RIG_CONF_COMBO, { .c = {{ "None", "XONXOFF", "Hardware", NULL }} } }, { RIG_CONF_END, NULL, } }; /** * \brief Set rotator state info from alpha input * \param rot * \param token TOK_... specifying which info to set * \param val input * \return RIG_OK or < 0 error * * assumes rot!=NULL, val!=NULL */ int frontrot_set_conf(ROT *rot, token_t token, const char *val) { struct rot_state *rs; int val_i; rs = &rot->state; switch(token) { case TOK_PATHNAME: strncpy(rs->rotport.pathname, val, FILPATHLEN-1); break; case TOK_WRITE_DELAY: if (1 != sscanf(val, "%d", &val_i)) return -RIG_EINVAL; rs->rotport.write_delay = val_i; break; case TOK_POST_WRITE_DELAY: if (1 != sscanf(val, "%d", &val_i)) return -RIG_EINVAL; rs->rotport.post_write_delay = val_i; break; case TOK_TIMEOUT: if (1 != sscanf(val, "%d", &val_i)) return -RIG_EINVAL; rs->rotport.timeout = val_i; break; case TOK_RETRY: if (1 != sscanf(val, "%d", &val_i)) return -RIG_EINVAL; rs->rotport.retry = val_i; break; case TOK_SERIAL_SPEED: if (rs->rotport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; if (1 != sscanf(val, "%d", &val_i)) return -RIG_EINVAL; rs->rotport.parm.serial.rate = val_i; break; case TOK_DATA_BITS: if (rs->rotport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; if (1 != sscanf(val, "%d", &val_i)) return -RIG_EINVAL; rs->rotport.parm.serial.data_bits = val_i; break; case TOK_STOP_BITS: if (rs->rotport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; if (1 != sscanf(val, "%d", &val_i)) return -RIG_EINVAL; rs->rotport.parm.serial.stop_bits = val_i; break; case TOK_PARITY: if (rs->rotport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; if (!strcmp(val, "None")) rs->rotport.parm.serial.parity = RIG_PARITY_NONE; else if (!strcmp(val, "Odd")) rs->rotport.parm.serial.parity = RIG_PARITY_ODD; else if (!strcmp(val, "Even")) rs->rotport.parm.serial.parity = RIG_PARITY_EVEN; else if (!strcmp(val, "Mark")) rs->rotport.parm.serial.parity = RIG_PARITY_MARK; else if (!strcmp(val, "Space")) rs->rotport.parm.serial.parity = RIG_PARITY_SPACE; else return -RIG_EINVAL; break; case TOK_HANDSHAKE: if (rs->rotport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; if (!strcmp(val, "None")) rs->rotport.parm.serial.handshake = RIG_HANDSHAKE_NONE; else if (!strcmp(val, "XONXOFF")) rs->rotport.parm.serial.handshake = RIG_HANDSHAKE_XONXOFF; else if (!strcmp(val, "Hardware")) rs->rotport.parm.serial.handshake = RIG_HANDSHAKE_HARDWARE; else return -RIG_EINVAL; break; case TOK_MIN_AZ: rs->min_az = atof(val); break; case TOK_MAX_AZ: rs->max_az = atof(val); break; case TOK_MIN_EL: rs->min_el = atof(val); break; case TOK_MAX_EL: rs->max_el = atof(val); break; default: return -RIG_EINVAL; } return RIG_OK; } /** * \brief Get data from rotator state in alpha form * \param rot non-null * \param token TOK_... specifying which data to get * \param val result non-null * \return RIG_OK or < 0 if error */ int frontrot_get_conf(ROT *rot, token_t token, char *val) { struct rot_state *rs; const char *s; rs = &rot->state; switch(token) { case TOK_PATHNAME: strcpy(val, rs->rotport.pathname); break; case TOK_WRITE_DELAY: sprintf(val, "%d", rs->rotport.write_delay); break; case TOK_POST_WRITE_DELAY: sprintf(val, "%d", rs->rotport.post_write_delay); break; case TOK_TIMEOUT: sprintf(val, "%d", rs->rotport.timeout); break; case TOK_RETRY: sprintf(val, "%d", rs->rotport.retry); break; case TOK_SERIAL_SPEED: if (rs->rotport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; sprintf(val, "%d", rs->rotport.parm.serial.rate); break; case TOK_DATA_BITS: if (rs->rotport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; sprintf(val, "%d", rs->rotport.parm.serial.data_bits); break; case TOK_STOP_BITS: if (rs->rotport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; sprintf(val, "%d", rs->rotport.parm.serial.stop_bits); break; case TOK_PARITY: if (rs->rotport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; switch (rs->rotport.parm.serial.parity) { case RIG_PARITY_NONE: s = "None"; break; case RIG_PARITY_ODD: s = "Odd"; break; case RIG_PARITY_EVEN: s = "Even"; break; case RIG_PARITY_MARK: s = "Mark"; break; case RIG_PARITY_SPACE: s = "Space"; break; default: return -RIG_EINVAL; } strcpy(val, s); break; case TOK_HANDSHAKE: if (rs->rotport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; switch (rs->rotport.parm.serial.handshake) { case RIG_HANDSHAKE_NONE: s = "None"; break; case RIG_HANDSHAKE_XONXOFF: s = "XONXOFF"; break; case RIG_HANDSHAKE_HARDWARE: s = "Hardware"; break; default: return -RIG_EINVAL; } strcpy(val, s); break; case TOK_MIN_AZ: sprintf(val, "%f", rs->min_az); break; case TOK_MAX_AZ: sprintf(val, "%f", rs->max_az); break; case TOK_MIN_EL: sprintf(val, "%f", rs->min_el); break; case TOK_MAX_EL: sprintf(val, "%f", rs->max_el); break; default: return -RIG_EINVAL; } return RIG_OK; } /** * \brief Executes cfunc on all the elements stored in the conf table * \param rot non-null * \param cfunc function(..) * \param data * * start first with backend conf table, then finish with frontend table */ int HAMLIB_API rot_token_foreach(ROT *rot, int (*cfunc)(const struct confparams *, rig_ptr_t), rig_ptr_t data) { const struct confparams *cfp; if (!rot || !rot->caps || !cfunc) return -RIG_EINVAL; for (cfp = rotfrontend_cfg_params; cfp->name; cfp++) if ((*cfunc)(cfp, data) == 0) return RIG_OK; if (rot->caps->port_type == RIG_PORT_SERIAL) { for (cfp = rotfrontend_serial_cfg_params; cfp->name; cfp++) if ((*cfunc)(cfp, data) == 0) return RIG_OK; } for (cfp = rot->caps->cfgparams; cfp && cfp->name; cfp++) if ((*cfunc)(cfp, data) == 0) return RIG_OK; return RIG_OK; } /** * \brief lookup conf token by its name, return pointer to confparams struct. * \param rot * \param name * \return confparams or NULL * * lookup backend config table first, then fall back to frontend. * TODO: should use Lex to speed it up, strcmp hurts! */ const struct confparams * HAMLIB_API rot_confparam_lookup(ROT *rot, const char *name) { const struct confparams *cfp; token_t token; if (!rot || !rot->caps) return NULL; /* 0 returned for invalid format */ token = strtol(name, NULL, 0); for (cfp = rot->caps->cfgparams; cfp && cfp->name; cfp++) if (!strcmp(cfp->name, name) || token == cfp->token) return cfp; for (cfp = rotfrontend_cfg_params; cfp->name; cfp++) if (!strcmp(cfp->name, name) || token == cfp->token) return cfp; if (rot->caps->port_type == RIG_PORT_SERIAL) { for (cfp = rotfrontend_serial_cfg_params; cfp->name; cfp++) if (!strcmp(cfp->name, name) || token == cfp->token) return cfp; } return NULL; } /** * \brief Simple lookup returning token id associated with name * \param rot * \param name * \return token enum */ token_t HAMLIB_API rot_token_lookup(ROT *rot, const char *name) { const struct confparams *cfp; cfp = rot_confparam_lookup(rot, name); if (!cfp) return RIG_CONF_END; return cfp->token; } /** * \brief set a rotator configuration parameter * \param rot The rot handle * \param token The parameter * \param val The value to set the parameter to * * Sets a configuration parameter. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rot_get_conf() */ int HAMLIB_API rot_set_conf(ROT *rot, token_t token, const char *val) { if (!rot || !rot->caps) return -RIG_EINVAL; if (rig_need_debug(RIG_DEBUG_VERBOSE)) { const struct confparams *cfp; char tokenstr[12]; sprintf(tokenstr, "%ld", token); cfp = rot_confparam_lookup(rot, tokenstr); if (!cfp) return -RIG_EINVAL; rig_debug(RIG_DEBUG_VERBOSE, "%s: %s='%s'\n", __func__, cfp->name, val); } if (IS_TOKEN_FRONTEND(token)) return frontrot_set_conf(rot, token, val); if (rot->caps->set_conf == NULL) return -RIG_ENAVAIL; return rot->caps->set_conf(rot, token, val); } /** * \brief get the value of a configuration parameter * \param rot The rot handle * \param token The parameter * \param val The location where to store the value of config \a token * * Retrieves the value of a configuration paramter associated with \a token. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rot_set_conf() */ int HAMLIB_API rot_get_conf(ROT *rot, token_t token, char *val) { if (!rot || !rot->caps || !val) return -RIG_EINVAL; if (IS_TOKEN_FRONTEND(token)) return frontrot_get_conf(rot, token, val); if (rot->caps->get_conf == NULL) return -RIG_ENAVAIL; return rot->caps->get_conf(rot, token, val); } /** @} */ hamlib-1.2.15.3/src/token.h0000644000175000017500000000733712044564477012225 00000000000000/* * Hamlib Interface - token header * Copyright (c) 2000-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * \addtogroup rig_internal * @{ */ /** * \brief Token definitions * \file token.h * */ #ifndef _TOKEN_H #define _TOKEN_H 1 #include /** \brief Create a backend token, \a t */ #define TOKEN_BACKEND(t) (t) /** \brief Create a frontend token, \a t */ #define TOKEN_FRONTEND(t) ((t)|(1<<30)) /** \brief Test for token - frontend? */ #define IS_TOKEN_FRONTEND(t) ((t)&(1<<30)) /** \brief Null frontend token */ #define TOK_FRONTEND_NONE TOKEN_FRONTEND(0) /** \brief Null backend token */ #define TOK_BACKEND_NONE TOKEN_BACKEND(0) /* * tokens shared among rig and rotator, * Numbers go from TOKEN_FRONTEND(1) to TOKEN_FRONTEND(99) */ /** \brief Pathname is device for rig control, e.g. /dev/ttyS0 */ #define TOK_PATHNAME TOKEN_FRONTEND(10) /** \brief Delay before serial output (units?) */ #define TOK_WRITE_DELAY TOKEN_FRONTEND(12) /** \brief Delay after serial output (units?) */ #define TOK_POST_WRITE_DELAY TOKEN_FRONTEND(13) /** \brief Timeout delay (units?) */ #define TOK_TIMEOUT TOKEN_FRONTEND(14) /** \brief Number of retries permitted */ #define TOK_RETRY TOKEN_FRONTEND(15) /** \brief Serial speed - "baud rate" */ #define TOK_SERIAL_SPEED TOKEN_FRONTEND(20) /** \brief No. data bits per serial character */ #define TOK_DATA_BITS TOKEN_FRONTEND(21) /** \brief No. stop bits per serial character */ #define TOK_STOP_BITS TOKEN_FRONTEND(22) /** \brief Serial parity (format?) */ #define TOK_PARITY TOKEN_FRONTEND(23) /** \brief Serial Handshake (format?) */ #define TOK_HANDSHAKE TOKEN_FRONTEND(24) /** \brief Serial Req. To Send status */ #define TOK_RTS_STATE TOKEN_FRONTEND(25) /** \brief Serial Data Terminal Ready status */ #define TOK_DTR_STATE TOKEN_FRONTEND(26) /** \brief PTT type override */ #define TOK_PTT_TYPE TOKEN_FRONTEND(30) /** \brief PTT pathname override */ #define TOK_PTT_PATHNAME TOKEN_FRONTEND(31) /** \brief DCD type override */ #define TOK_DCD_TYPE TOKEN_FRONTEND(32) /** \brief DCD pathname override */ #define TOK_DCD_PATHNAME TOKEN_FRONTEND(33) /** \brief CM108 GPIO bit number for PTT */ #define TOK_PTT_BITNUM TOKEN_FRONTEND(34) /* * rig specific tokens */ /* rx_range_list/tx_range_list, filters, announces, has(func,lvl,..) */ /** \brief rig: ?? */ #define TOK_VFO_COMP TOKEN_FRONTEND(110) /** \brief rig: polling interval (units?) */ #define TOK_POLL_INTERVAL TOKEN_FRONTEND(111) /** \brief rig: International Telecommunications Union region no. */ #define TOK_ITU_REGION TOKEN_FRONTEND(120) /* * rotator specific tokens * (strictly, should be documented as rotator_internal) */ /** \brief rot: Minimum Azimuth */ #define TOK_MIN_AZ TOKEN_FRONTEND(110) /** \brief rot: Maximum Azimuth */ #define TOK_MAX_AZ TOKEN_FRONTEND(111) /** \brief rot: Minimum Elevation */ #define TOK_MIN_EL TOKEN_FRONTEND(112) /** \brief rot: Maximum Elevation */ #define TOK_MAX_EL TOKEN_FRONTEND(113) #endif /* _TOKEN_H */ /** @} */ /* rig_internal definitions */ hamlib-1.2.15.3/src/cal.c0000644000175000017500000000534112044564477011630 00000000000000/* * Hamlib Interface - calibration routines * Copyright (c) 2000-2009 by Stephane Fillod * Copyright (c) 2000-2003 by Frank Singleton * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * \addtogroup rig_internal * @{ */ /** * \file cal.c * \brief Calibration routines */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "cal.h" /* add rig_set_cal(cal_table), rig_get_calstat(rawmin,rawmax,cal_table), */ /** * \brief Convert raw S-meter data to calibated value, according to table * \param rawval input value * \param cal calibration table * \return calibrated value * cal_table_t is a data type suited to hold linear calibration * cal_table_t.size tell the number of plot cal_table_t.table contains * If a value is below or equal to cal_table_t.table[0].raw, * rig_raw2val() will return cal_table_t.table[0].val * If a value is greater or equal to cal_table_t.table[cal_table_t.size-1].raw, * rig_raw2val() will return cal_table_t.table[cal_table_t.size-1].val */ float HAMLIB_API rig_raw2val(int rawval, const cal_table_t *cal) { #ifdef WANT_CHEAP_WNO_FP int interpolation; #else float interpolation; #endif int i; /* ASSERT(cal != NULL) */ /* ASSERT(cal->size <= MAX_CAL_LENGTH) */ if (cal->size == 0) return rawval; for (i=0; isize; i++) if (rawval < cal->table[i].raw) break; if (i==0) return cal->table[0].val; if (i>=cal->size) return cal->table[i-1].val; if (cal->table[i].raw == cal->table[i-1].raw) /* catch divide by 0 error */ return cal->table[i].val; #ifdef WANT_CHEAP_WNO_FP /* cheap, less accurate, but no fp needed */ interpolation = ((cal->table[i].raw - rawval) * (cal->table[i].val - cal->table[i-1].val)) / (cal->table[i].raw - cal->table[i-1].raw); return cal->table[i].val - interpolation; #else interpolation = ((cal->table[i].raw - rawval) * (float)(cal->table[i].val - cal->table[i-1].val)) / (float)(cal->table[i].raw - cal->table[i-1].raw); #endif return cal->table[i].val - interpolation; } /** @} */ hamlib-1.2.15.3/src/Makefile.in0000644000175000017500000012755212044564557013002 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = libhamlib_la_DEPENDENCIES = $(top_builddir)/lib/libmisc.la \ $(am__DEPENDENCIES_1) am__objects_1 = libhamlib_la-rig.lo libhamlib_la-serial.lo \ libhamlib_la-misc.lo libhamlib_la-register.lo \ libhamlib_la-event.lo libhamlib_la-cal.lo libhamlib_la-conf.lo \ libhamlib_la-tones.lo libhamlib_la-rotator.lo \ libhamlib_la-locator.lo libhamlib_la-rot_reg.lo \ libhamlib_la-rot_conf.lo libhamlib_la-iofunc.lo \ libhamlib_la-ext.lo libhamlib_la-mem.lo \ libhamlib_la-settings.lo libhamlib_la-parallel.lo \ libhamlib_la-usb_port.lo libhamlib_la-debug.lo \ libhamlib_la-network.lo libhamlib_la-cm108.lo am_libhamlib_la_OBJECTS = $(am__objects_1) libhamlib_la_OBJECTS = $(am_libhamlib_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent libhamlib_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libhamlib_la_CFLAGS) \ $(CFLAGS) $(libhamlib_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libhamlib_la_SOURCES) DIST_SOURCES = $(libhamlib_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ @INCLTDL@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ RIGSRC = rig.c serial.c misc.c register.c event.c cal.c conf.c tones.c \ rotator.c locator.c rot_reg.c rot_conf.c iofunc.c ext.c \ mem.c settings.c parallel.c usb_port.c debug.c network.c \ cm108.c lib_LTLIBRARIES = libhamlib.la libhamlib_la_SOURCES = $(RIGSRC) libhamlib_la_LDFLAGS = $(WINLDFLAGS) $(OSXLDFLAGS) -no-undefined -version-info @ABI_VERSION@:16:0 libhamlib_la_CFLAGS = -DIN_HAMLIB $(AM_CFLAGS) -DHAMLIB_MODULE_DIR=\"$(pkglibdir)\" libhamlib_la_LIBADD = @LIBLTDL@ $(top_builddir)/lib/libmisc.la \ @NET_LIBS@ @MATH_LIBS@ $(LIBUSB_LIBS) noinst_HEADERS = event.h misc.h serial.h iofunc.h cal.h tones.h \ rot_conf.h token.h idx_builtin.h register.h par_nt.h \ parallel.h usb_port.h network.h cm108.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libhamlib.la: $(libhamlib_la_OBJECTS) $(libhamlib_la_DEPENDENCIES) $(AM_V_CCLD)$(libhamlib_la_LINK) -rpath $(libdir) $(libhamlib_la_OBJECTS) $(libhamlib_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-cal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-cm108.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-conf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-debug.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-event.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-ext.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-iofunc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-locator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-mem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-misc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-network.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-parallel.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-register.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-rig.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-rot_conf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-rot_reg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-rotator.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-serial.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-settings.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-tones.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhamlib_la-usb_port.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< libhamlib_la-rig.lo: rig.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-rig.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-rig.Tpo -c -o libhamlib_la-rig.lo `test -f 'rig.c' || echo '$(srcdir)/'`rig.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-rig.Tpo $(DEPDIR)/libhamlib_la-rig.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rig.c' object='libhamlib_la-rig.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-rig.lo `test -f 'rig.c' || echo '$(srcdir)/'`rig.c libhamlib_la-serial.lo: serial.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-serial.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-serial.Tpo -c -o libhamlib_la-serial.lo `test -f 'serial.c' || echo '$(srcdir)/'`serial.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-serial.Tpo $(DEPDIR)/libhamlib_la-serial.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='serial.c' object='libhamlib_la-serial.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-serial.lo `test -f 'serial.c' || echo '$(srcdir)/'`serial.c libhamlib_la-misc.lo: misc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-misc.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-misc.Tpo -c -o libhamlib_la-misc.lo `test -f 'misc.c' || echo '$(srcdir)/'`misc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-misc.Tpo $(DEPDIR)/libhamlib_la-misc.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libhamlib_la-misc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-misc.lo `test -f 'misc.c' || echo '$(srcdir)/'`misc.c libhamlib_la-register.lo: register.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-register.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-register.Tpo -c -o libhamlib_la-register.lo `test -f 'register.c' || echo '$(srcdir)/'`register.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-register.Tpo $(DEPDIR)/libhamlib_la-register.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='register.c' object='libhamlib_la-register.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-register.lo `test -f 'register.c' || echo '$(srcdir)/'`register.c libhamlib_la-event.lo: event.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-event.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-event.Tpo -c -o libhamlib_la-event.lo `test -f 'event.c' || echo '$(srcdir)/'`event.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-event.Tpo $(DEPDIR)/libhamlib_la-event.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='event.c' object='libhamlib_la-event.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-event.lo `test -f 'event.c' || echo '$(srcdir)/'`event.c libhamlib_la-cal.lo: cal.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-cal.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-cal.Tpo -c -o libhamlib_la-cal.lo `test -f 'cal.c' || echo '$(srcdir)/'`cal.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-cal.Tpo $(DEPDIR)/libhamlib_la-cal.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cal.c' object='libhamlib_la-cal.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-cal.lo `test -f 'cal.c' || echo '$(srcdir)/'`cal.c libhamlib_la-conf.lo: conf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-conf.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-conf.Tpo -c -o libhamlib_la-conf.lo `test -f 'conf.c' || echo '$(srcdir)/'`conf.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-conf.Tpo $(DEPDIR)/libhamlib_la-conf.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='conf.c' object='libhamlib_la-conf.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-conf.lo `test -f 'conf.c' || echo '$(srcdir)/'`conf.c libhamlib_la-tones.lo: tones.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-tones.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-tones.Tpo -c -o libhamlib_la-tones.lo `test -f 'tones.c' || echo '$(srcdir)/'`tones.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-tones.Tpo $(DEPDIR)/libhamlib_la-tones.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tones.c' object='libhamlib_la-tones.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-tones.lo `test -f 'tones.c' || echo '$(srcdir)/'`tones.c libhamlib_la-rotator.lo: rotator.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-rotator.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-rotator.Tpo -c -o libhamlib_la-rotator.lo `test -f 'rotator.c' || echo '$(srcdir)/'`rotator.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-rotator.Tpo $(DEPDIR)/libhamlib_la-rotator.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rotator.c' object='libhamlib_la-rotator.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-rotator.lo `test -f 'rotator.c' || echo '$(srcdir)/'`rotator.c libhamlib_la-locator.lo: locator.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-locator.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-locator.Tpo -c -o libhamlib_la-locator.lo `test -f 'locator.c' || echo '$(srcdir)/'`locator.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-locator.Tpo $(DEPDIR)/libhamlib_la-locator.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='locator.c' object='libhamlib_la-locator.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-locator.lo `test -f 'locator.c' || echo '$(srcdir)/'`locator.c libhamlib_la-rot_reg.lo: rot_reg.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-rot_reg.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-rot_reg.Tpo -c -o libhamlib_la-rot_reg.lo `test -f 'rot_reg.c' || echo '$(srcdir)/'`rot_reg.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-rot_reg.Tpo $(DEPDIR)/libhamlib_la-rot_reg.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rot_reg.c' object='libhamlib_la-rot_reg.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-rot_reg.lo `test -f 'rot_reg.c' || echo '$(srcdir)/'`rot_reg.c libhamlib_la-rot_conf.lo: rot_conf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-rot_conf.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-rot_conf.Tpo -c -o libhamlib_la-rot_conf.lo `test -f 'rot_conf.c' || echo '$(srcdir)/'`rot_conf.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-rot_conf.Tpo $(DEPDIR)/libhamlib_la-rot_conf.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rot_conf.c' object='libhamlib_la-rot_conf.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-rot_conf.lo `test -f 'rot_conf.c' || echo '$(srcdir)/'`rot_conf.c libhamlib_la-iofunc.lo: iofunc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-iofunc.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-iofunc.Tpo -c -o libhamlib_la-iofunc.lo `test -f 'iofunc.c' || echo '$(srcdir)/'`iofunc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-iofunc.Tpo $(DEPDIR)/libhamlib_la-iofunc.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='iofunc.c' object='libhamlib_la-iofunc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-iofunc.lo `test -f 'iofunc.c' || echo '$(srcdir)/'`iofunc.c libhamlib_la-ext.lo: ext.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-ext.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-ext.Tpo -c -o libhamlib_la-ext.lo `test -f 'ext.c' || echo '$(srcdir)/'`ext.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-ext.Tpo $(DEPDIR)/libhamlib_la-ext.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ext.c' object='libhamlib_la-ext.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-ext.lo `test -f 'ext.c' || echo '$(srcdir)/'`ext.c libhamlib_la-mem.lo: mem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-mem.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-mem.Tpo -c -o libhamlib_la-mem.lo `test -f 'mem.c' || echo '$(srcdir)/'`mem.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-mem.Tpo $(DEPDIR)/libhamlib_la-mem.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mem.c' object='libhamlib_la-mem.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-mem.lo `test -f 'mem.c' || echo '$(srcdir)/'`mem.c libhamlib_la-settings.lo: settings.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-settings.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-settings.Tpo -c -o libhamlib_la-settings.lo `test -f 'settings.c' || echo '$(srcdir)/'`settings.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-settings.Tpo $(DEPDIR)/libhamlib_la-settings.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='settings.c' object='libhamlib_la-settings.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-settings.lo `test -f 'settings.c' || echo '$(srcdir)/'`settings.c libhamlib_la-parallel.lo: parallel.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-parallel.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-parallel.Tpo -c -o libhamlib_la-parallel.lo `test -f 'parallel.c' || echo '$(srcdir)/'`parallel.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-parallel.Tpo $(DEPDIR)/libhamlib_la-parallel.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='parallel.c' object='libhamlib_la-parallel.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-parallel.lo `test -f 'parallel.c' || echo '$(srcdir)/'`parallel.c libhamlib_la-usb_port.lo: usb_port.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-usb_port.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-usb_port.Tpo -c -o libhamlib_la-usb_port.lo `test -f 'usb_port.c' || echo '$(srcdir)/'`usb_port.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-usb_port.Tpo $(DEPDIR)/libhamlib_la-usb_port.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usb_port.c' object='libhamlib_la-usb_port.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-usb_port.lo `test -f 'usb_port.c' || echo '$(srcdir)/'`usb_port.c libhamlib_la-debug.lo: debug.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-debug.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-debug.Tpo -c -o libhamlib_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-debug.Tpo $(DEPDIR)/libhamlib_la-debug.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='debug.c' object='libhamlib_la-debug.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c libhamlib_la-network.lo: network.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-network.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-network.Tpo -c -o libhamlib_la-network.lo `test -f 'network.c' || echo '$(srcdir)/'`network.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-network.Tpo $(DEPDIR)/libhamlib_la-network.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='network.c' object='libhamlib_la-network.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-network.lo `test -f 'network.c' || echo '$(srcdir)/'`network.c libhamlib_la-cm108.lo: cm108.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -MT libhamlib_la-cm108.lo -MD -MP -MF $(DEPDIR)/libhamlib_la-cm108.Tpo -c -o libhamlib_la-cm108.lo `test -f 'cm108.c' || echo '$(srcdir)/'`cm108.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libhamlib_la-cm108.Tpo $(DEPDIR)/libhamlib_la-cm108.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cm108.c' object='libhamlib_la-cm108.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libhamlib_la_CFLAGS) $(CFLAGS) -c -o libhamlib_la-cm108.lo `test -f 'cm108.c' || echo '$(srcdir)/'`cm108.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am \ install-libLTLIBRARIES install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-libLTLIBRARIES # 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: hamlib-1.2.15.3/src/cm108.c0000644000175000017500000001440412044564477011721 00000000000000/* * Hamlib Interface - CM108 HID communication low-level support * Copyright (c) 2000-2012 by Stephane Fillod * Copyright (c) 2011 by Andrew Errington * CM108 detection code Copyright (c) Thomas Sailer used with permission * * 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. * */ /** * \addtogroup rig_internal * @{ */ /** * \brief CM108 GPIO * \file cm108.c */ #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 #include #include #ifdef HAVE_SYS_IOCTL_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_WINDOWS_H #include #include "par_nt.h" #endif #ifdef HAVE_WINIOCTL_H #include #endif #ifdef HAVE_WINBASE_H #include #endif #ifdef HAVE_LINUX_HIDRAW_H #include #endif #include "hamlib/rig.h" #include "cm108.h" /** * \brief Open CM108 HID port (/dev/hidrawX) * \param port * \return file descriptor */ int cm108_open(hamlib_port_t *port) { int fd; rig_debug(RIG_DEBUG_VERBOSE,"cm108:cm108_open called \n"); if (!port->pathname) return -RIG_EINVAL; fd = open(port->pathname, O_RDWR); if (fd < 0) { rig_debug(RIG_DEBUG_ERR, "cm108:Opening device \"%s\": %s\n", port->pathname, strerror(errno)); return -RIG_EIO; } #ifdef HAVE_LINUX_HIDRAW_H // CM108 detection copied from Thomas Sailer's soundmodem code rig_debug(RIG_DEBUG_VERBOSE,"cm108:Checking for cm108 (or compatible) device \n"); struct hidraw_devinfo hiddevinfo; if (!ioctl(fd, HIDIOCGRAWINFO, &hiddevinfo) && ( (hiddevinfo.vendor == 0x0d8c // CM108/109/119 && hiddevinfo.product >= 0x0008 && hiddevinfo.product <= 0x000f ) || (hiddevinfo.vendor == 0x0c76 && // SSS1621/23 (hiddevinfo.product == 0x1605 || hiddevinfo.product == 0x1607 || hiddevinfo.product == 0x160b) ) ) ) { rig_debug(RIG_DEBUG_VERBOSE,"cm108:cm108 compatible device detected \n"); } else { close(fd); rig_debug(RIG_DEBUG_VERBOSE,"cm108:No cm108 (or compatible) device detected \n"); return -RIG_EINVAL; } #endif port->fd = fd; return fd; } /** * \brief Close CM108 HID port * \param port */ int cm108_close(hamlib_port_t *port) { rig_debug(RIG_DEBUG_VERBOSE,"cm108:cm108_close called \n"); return close(port->fd); } /** * \brief Set or unset Push to talk bit on CM108 GPIO * \param p * \param pttx RIG_PTT_ON --> Set PTT * \return RIG_OK or < 0 error */ int cm108_ptt_set(hamlib_port_t *p, ptt_t pttx) { rig_debug(RIG_DEBUG_VERBOSE,"cm108:cm108_ptt_set called \n"); // For a CM108 USB audio device PTT is wired up to one of the GPIO // pins. Usually this is GPIO3 (bit 2 of the GPIO register) because it // is on the corner of the chip package (pin 13) so it's easily accessible. // Some CM108 chips are epoxy-blobbed onto the PCB, so no GPIO // pins are accessible. The SSS1623 chips have a different pinout, so // we make the GPIO bit number configurable. switch(p->type.ptt) { case RIG_PTT_CM108: { // Build a packet for CM108 HID to turn GPIO bit on or off. // Packet is 4 bytes, preceded by a 'report number' byte // 0x00 report number // Write data packet (from CM108 documentation) // byte 0: 00xx xxxx Write GPIO // byte 1: xxxx dcba GPIO3-0 output values (1=high) // byte 2: xxxx dcba GPIO3-0 data-direction register (1=output) // byte 3: xxxx xxxx SPDIF rig_debug(RIG_DEBUG_VERBOSE,"cm108:cm108_ptt_set bit number %d to state %d\n", p->parm.cm108.ptt_bitnum, (pttx == RIG_PTT_ON) ? 1 : 0); char out_rep[] = { 0x00, // report number // HID output report 0x00, (pttx == RIG_PTT_ON) ? (1 << p->parm.cm108.ptt_bitnum) : 0, // set GPIO 1 << p->parm.cm108.ptt_bitnum, // Data direction register (1=output) 0x00 }; ssize_t nw; if (p->fd == -1) return -RIG_EINVAL; // Send the HID packet nw = write(p->fd, out_rep, sizeof(out_rep)); if (nw < 0) { return -RIG_EIO; } return RIG_OK; } default: rig_debug(RIG_DEBUG_ERR,"Unsupported PTT type %d\n", p->type.ptt); return -RIG_EINVAL; } return RIG_OK; } /** * \brief Get state of Push to Talk from CM108 GPIO * \param p * \param pttx return value (must be non NULL) * \return RIG_OK or < 0 error */ int cm108_ptt_get(hamlib_port_t *p, ptt_t *pttx) { rig_debug(RIG_DEBUG_VERBOSE,"cm108:cm108_ptt_get called \n"); switch(p->type.ptt) { case RIG_PTT_CM108: { int status; return -RIG_ENIMPL; return status; } default: rig_debug(RIG_DEBUG_ERR,"Unsupported PTT type %d\n", p->type.ptt); return -RIG_ENAVAIL; } return RIG_OK; } /** * \brief get Data Carrier Detect (squelch) from CM108 GPIO * \param p * \param dcdx return value (Must be non NULL) * \return RIG_OK or < 0 error */ int cm108_dcd_get(hamlib_port_t *p, dcd_t *dcdx) { rig_debug(RIG_DEBUG_VERBOSE,"cm108:cm108_dcd_get called \n"); // On the CM108 and compatible chips the squelch line on the radio is // wired to Volume Down input pin. The state of this pin is reported // in HID messages from the CM108 device, but I am not sure how // to query this state on demand. switch(p->type.dcd) { case RIG_DCD_CM108: { int status; return -RIG_ENIMPL; return status; } default: rig_debug(RIG_DEBUG_ERR,"Unsupported DCD type %d\n", p->type.dcd); return -RIG_ENAVAIL; } return RIG_OK; } /** @} */ hamlib-1.2.15.3/src/settings.c0000644000175000017500000004116412044564477012734 00000000000000/** * \addtogroup rig * @{ */ /** * \file settings.c * \brief func/level/parm interface * \author Stephane Fillod * \date 2000-2010 * * Hamlib interface is a frontend implementing wrapper functions. */ /* * Hamlib Interface - func/level/parm * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include "hamlib/rig.h" #include "cal.h" #ifndef DOC_HIDDEN #define CHECK_RIG_ARG(r) (!(r) || !(r)->caps || !(r)->state.comm_state) #endif /* !DOC_HIDDEN */ /** * \brief set a radio level setting * \param rig The rig handle * \param vfo The target VFO * \param level The level setting * \param val The value to set the level setting to * * Sets the level of a setting. * The level value \a val can be a float or an integer. See #value_t * for more information. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_has_set_level(), rig_get_level() */ int HAMLIB_API rig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_level == NULL || !rig_has_set_level(rig,level)) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_level(rig, vfo, level, val); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_level(rig, vfo, level, val); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief get the value of a level * \param rig The rig handle * \param vfo The target VFO * \param level The level setting * \param val The location where to store the value of \a level * * Retrieves the value of a \a level. * The level value \a val can be a float or an integer. See #value_t * for more information. * * RIG_LEVEL_STRENGTH: \a val is an integer, representing the S Meter * level in dB relative to S9, according to the ideal S Meter scale. * The ideal S Meter scale is as follow: S0=-54, S1=-48, S2=-42, S3=-36, * S4=-30, S5=-24, S6=-18, S7=-12, S8=-6, S9=0, +10=10, +20=20, * +30=30, +40=40, +50=50 and +60=60. This is the responsability * of the backend to return values calibrated for this scale. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_has_get_level(), rig_set_level() */ int HAMLIB_API rig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !val) return -RIG_EINVAL; caps = rig->caps; if (caps->get_level == NULL || !rig_has_get_level(rig,level)) return -RIG_ENAVAIL; /* * Special case(frontend emulation): calibrated S-meter reading */ if (level == RIG_LEVEL_STRENGTH && (caps->has_get_level & RIG_LEVEL_STRENGTH) == 0 && rig_has_get_level(rig,RIG_LEVEL_RAWSTR) && rig->state.str_cal.size) { value_t rawstr; retcode = rig_get_level(rig, vfo, RIG_LEVEL_RAWSTR, &rawstr); if (retcode != RIG_OK) return retcode; val->i = (int)rig_raw2val(rawstr.i, &rig->state.str_cal); return RIG_OK; } if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_level(rig, vfo, level, val); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_level(rig, vfo, level, val); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief set a radio parameter * \param rig The rig handle * \param parm The parameter * \param val The value to set the parameter * * Sets a parameter. * The parameter value \a val can be a float or an integer. See #value_t * for more information. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_has_set_parm(), rig_get_parm() */ int HAMLIB_API rig_set_parm(RIG *rig, setting_t parm, value_t val) { if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; if (rig->caps->set_parm == NULL || !rig_has_set_parm(rig,parm)) return -RIG_ENAVAIL; return rig->caps->set_parm(rig, parm, val); } /** * \brief get the value of a parameter * \param rig The rig handle * \param parm The parameter * \param val The location where to store the value of \a parm * * Retrieves the value of a \a parm. * The parameter value \a val can be a float or an integer. See #value_t * for more information. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_has_get_parm(), rig_set_parm() */ int HAMLIB_API rig_get_parm(RIG *rig, setting_t parm, value_t *val) { if (CHECK_RIG_ARG(rig) || !val) return -RIG_EINVAL; if (rig->caps->get_parm == NULL || !rig_has_get_parm(rig,parm)) return -RIG_ENAVAIL; return rig->caps->get_parm(rig, parm, val); } /** * \brief check retrieval ability of level settings * \param rig The rig handle * \param level The level settings * * Checks if a rig is capable of *getting* a level setting. * Since the \a level is an OR'ed bitwise argument, more than * one level can be checked at the same time. * * EXAMPLE: if (rig_has_get_level(my_rig, RIG_LVL_STRENGTH)) disp_Smeter(); * * \return a bit map of supported level settings that can be retrieved, * otherwise 0 if none supported. * * \sa rig_has_set_level(), rig_get_level() */ setting_t HAMLIB_API rig_has_get_level(RIG *rig, setting_t level) { if (!rig || !rig->caps) return 0; return (rig->state.has_get_level & level); } /** * \brief check settable ability of level settings * \param rig The rig handle * \param level The level settings * * Checks if a rig can *set* a level setting. * Since the \a level is an OR'ed bitwise argument, more than * one level can be check at the same time. * * EXAMPLE: if (rig_has_set_level(my_rig, RIG_LVL_RFPOWER)) crank_tx(); * * \return a bit map of supported level settings that can be set, * otherwise 0 if none supported. * * \sa rig_has_get_level(), rig_set_level() */ setting_t HAMLIB_API rig_has_set_level(RIG *rig, setting_t level) { if (!rig || !rig->caps) return 0; return (rig->state.has_set_level & level); } /** * \brief check retrieval ability of parameter settings * \param rig The rig handle * \param parm The parameter settings * * Checks if a rig is capable of *getting* a parm setting. * Since the \a parm is an OR'ed bitwise argument, more than * one parameter can be checked at the same time. * * EXAMPLE: if (rig_has_get_parm(my_rig, RIG_PARM_ANN)) good4you(); * * \return a bit map of supported parameter settings that can be retrieved, * otherwise 0 if none supported. * * \sa rig_has_set_parm(), rig_get_parm() */ setting_t HAMLIB_API rig_has_get_parm(RIG *rig, setting_t parm) { if (!rig || !rig->caps) return 0; return (rig->state.has_get_parm & parm); } /** * \brief check settable ability of parameter settings * \param rig The rig handle * \param parm The parameter settings * * Checks if a rig can *set* a parameter setting. * Since the \a parm is an OR'ed bitwise argument, more than * one parameter can be check at the same time. * * EXAMPLE: if (rig_has_set_parm(my_rig, RIG_PARM_ANN)) announce_all(); * * \return a bit map of supported parameter settings that can be set, * otherwise 0 if none supported. * * \sa rig_has_get_parm(), rig_set_parm() */ setting_t HAMLIB_API rig_has_set_parm(RIG *rig, setting_t parm) { if (!rig || !rig->caps) return 0; return (rig->state.has_set_parm & parm); } /** * \brief check ability of radio functions * \param rig The rig handle * \param func The functions * * Checks if a rig supports a set of functions. * Since the \a func is an OR'ed bitwise argument, more than * one function can be checked at the same time. * * EXAMPLE: if (rig_has_get_func(my_rig,RIG_FUNC_FAGC)) disp_fagc_button(); * * \return a bit map of supported functions, * otherwise 0 if none supported. * * \sa rig_has_set_func(), rig_get_func() */ setting_t HAMLIB_API rig_has_get_func(RIG *rig, setting_t func) { if (!rig || !rig->caps) return 0; return (rig->state.has_get_func & func); } /** * \brief check ability of radio functions * \param rig The rig handle * \param func The functions * * Checks if a rig supports a set of functions. * Since the \a func is an OR'ed bitwise argument, more than * one function can be checked at the same time. * * EXAMPLE: if (rig_has_set_func(my_rig,RIG_FUNC_FAGC)) disp_fagc_button(); * * \return a bit map of supported functions, * otherwise 0 if none supported. * * \sa rig_set_func(), rig_has_get_func() */ setting_t HAMLIB_API rig_has_set_func(RIG *rig, setting_t func) { if (!rig || !rig->caps) return 0; return (rig->state.has_set_func & func); } /** * \brief activate/de-activate functions of radio * \param rig The rig handle * \param vfo The target VFO * \param func The functions to activate * \param status The status (on or off) to set to * * Activate/de-activate a function of the radio. * * The \a status argument is a non null value for "activate", * "de-activate" otherwise, much as TRUE/FALSE definitions in C language. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_func() */ int HAMLIB_API rig_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_func == NULL || !rig_has_set_func(rig,func)) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_FUNC) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_func(rig, vfo, func, status); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_func(rig, vfo, func, status); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief get the status of functions of the radio * \param rig The rig handle * \param vfo The target VFO * \param func The functions to get the status * \param status The location where to store the function status * * Retrieves the status (on/off) of a function of the radio. * Upon return, \a status will hold the status of the function, * The value pointer to by the \a status argument is a non null * value for "on", "off" otherwise, much as TRUE/FALSE * definitions in C language. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_func() */ int HAMLIB_API rig_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !func) return -RIG_EINVAL; caps = rig->caps; if (caps->get_func == NULL || !rig_has_get_func(rig,func)) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_FUNC) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_func(rig, vfo, func, status); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_func(rig, vfo, func, status); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief set a radio level extra parameter * \param rig The rig handle * \param vfo The target VFO * \param token The parameter * \param val The value to set the parameter to * * Sets an level extra parameter. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_ext_level() */ int HAMLIB_API rig_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_ext_level == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_ext_level(rig, vfo, token, val); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_ext_level(rig, vfo, token, val); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief get the value of a level extra parameter * \param rig The rig handle * \param vfo The target VFO * \param token The parameter * \param val The location where to store the value of \a token * * Retrieves the value of a level extra parameter associated with \a token. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_ext_level() */ int HAMLIB_API rig_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !val) return -RIG_EINVAL; caps = rig->caps; if (caps->get_ext_level == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_ext_level(rig, vfo, token, val); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_ext_level(rig, vfo, token, val); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief set a radio parm extra parameter * \param rig The rig handle * \param token The parameter * \param val The value to set the parameter to * * Sets an parm extra parameter. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_ext_parm() */ int HAMLIB_API rig_set_ext_parm(RIG *rig, token_t token, value_t val) { if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; if (rig->caps->set_ext_parm == NULL) return -RIG_ENAVAIL; return rig->caps->set_ext_parm(rig, token, val); } /** * \brief get the value of a parm extra parameter * \param rig The rig handle * \param token The parameter * \param val The location where to store the value of \a token * * Retrieves the value of a parm extra parameter associated with \a token. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_ext_parm() */ int HAMLIB_API rig_get_ext_parm(RIG *rig, token_t token, value_t *val) { if (CHECK_RIG_ARG(rig) || !val) return -RIG_EINVAL; if (rig->caps->get_ext_parm == NULL) return -RIG_ENAVAIL; return rig->caps->get_ext_parm(rig, token, val); } /** * \brief basically convert setting_t expressed 2^n to n * \param s The setting to convert to * * Converts a setting_t value expressed by 2^n to the value of n. * * \return the index such that 2^n is the setting, otherwise 0 * if the setting was not found. */ int HAMLIB_API rig_setting2idx(setting_t s) { int i; for (i = 0; i #include "iofunc.h" __BEGIN_DECLS extern HAMLIB_EXPORT(int) serial_open(hamlib_port_t *rs); extern HAMLIB_EXPORT(int) serial_setup(hamlib_port_t *rs); extern HAMLIB_EXPORT(int) serial_flush(hamlib_port_t *p); /* Hamlib internal use, see rig.c */ int ser_open(hamlib_port_t *p); int ser_close(hamlib_port_t *p); extern HAMLIB_EXPORT(int) ser_set_rts(hamlib_port_t *p, int state); extern HAMLIB_EXPORT(int) ser_get_rts(hamlib_port_t *p, int *state); extern HAMLIB_EXPORT(int) ser_set_brk(hamlib_port_t *p, int state); extern HAMLIB_EXPORT(int) ser_set_dtr(hamlib_port_t *p, int state); extern HAMLIB_EXPORT(int) ser_get_dtr(hamlib_port_t *p, int *state); extern HAMLIB_EXPORT(int) ser_get_cts(hamlib_port_t *p, int *state); extern HAMLIB_EXPORT(int) ser_get_dsr(hamlib_port_t *p, int *state); extern HAMLIB_EXPORT(int) ser_get_car(hamlib_port_t *p, int *state); __END_DECLS #endif /* _SERIAL_H */ hamlib-1.2.15.3/src/tones.c0000644000175000017500000002750612044564477012230 00000000000000/** * \addtogroup rig * @{ */ /** * \file src/tones.c * \brief CTCSS and DCS interface and tables * \author Stephane Fillod * \date 2000-2010 */ /* * Hamlib Interface - CTCSS and DCS interface and tables * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" #include "tones.h" #if !defined(_WIN32) && !defined(__CYGWIN__) /** * 52 CTCSS sub-audible tones */ const tone_t full_ctcss_list[] = { FULL_CTCSS_LIST }; /** * 50 CTCSS sub-audible tones, from 67.0Hz to 254.1Hz * * \note Don't even think about changing a bit of this array, several * backends depend on it. If you need to, create a copy for your * own caps. --SF */ const tone_t common_ctcss_list[] = { COMMON_CTCSS_LIST }; /** * 104 DCS codes */ const tone_t common_dcs_list[] = { COMMON_DCS_LIST }; /** * 106 DCS codes */ const tone_t full_dcs_list[] = { FULL_DCS_LIST }; #endif #ifndef DOC_HIDDEN #define CHECK_RIG_ARG(r) (!(r) || !(r)->caps || !(r)->state.comm_state) #endif /* !DOC_HIDDEN */ /** * \brief set CTCSS sub-tone frequency * \param rig The rig handle * \param vfo The target VFO * \param tone The tone to set to * * Sets the current Continuous Tone Controlled Squelch System (CTCSS) * sub-audible tone frequency. * \note the \a tone integer is NOT in Hz, but in tenth of Hz! This way, * if you want to set a subaudible tone of 88.5 Hz for example, * then pass 885 to this function. * * NB: CTCSS encoding has to be explicitly enabled or disabled through * a call to rig_set_func() with arg RIG_FUNC_TONE, unless it is * unavailable and the \a tone arg has to be set to 0. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_ctcss_tone(), rig_set_ctcss_sql() */ int HAMLIB_API rig_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_ctcss_tone == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_TONE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_ctcss_tone(rig, vfo, tone); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_ctcss_tone(rig, vfo, tone); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief get the current CTCSS sub-tone frequency * \param rig The rig handle * \param vfo The target VFO * \param tone The location where to store the current tone * * Retrieves the current Continuous Tone Controlled Squelch System (CTCSS) * sub-audible tone frequency. * \note the \a *tone integer is NOT in Hz, but in tenth of Hz! This way, * if the function rig_get_ctcss_tone() returns a subaudible tone of 885 * for example, then the real tone is 88.5 Hz. * Also, a value of 0 for \a *tone means the Tone encoding is disabled. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_ctcss_tone(), rig_get_ctcss_sql() */ int HAMLIB_API rig_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !tone) return -RIG_EINVAL; caps = rig->caps; if (caps->get_ctcss_tone == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_TONE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_ctcss_tone(rig, vfo, tone); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_ctcss_tone(rig, vfo, tone); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief set the current encoding DCS code * \param rig The rig handle * \param vfo The target VFO * \param code The tone to set to * * Sets the current encoding Digitally-Coded Squelch code. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_dcs_code(), rig_set_dcs_sql() */ int HAMLIB_API rig_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_dcs_code == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_TONE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_dcs_code(rig, vfo, code); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_dcs_code(rig, vfo, code); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief get the current encoding DCS code * \param rig The rig handle * \param vfo The target VFO * \param code The location where to store the current tone * * Retrieves the current encoding Digitally-Coded Squelch code. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_dcs_code(), rig_get_dcs_sql() */ int HAMLIB_API rig_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !code) return -RIG_EINVAL; caps = rig->caps; if (caps->get_dcs_code == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_TONE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_dcs_code(rig, vfo, code); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_dcs_code(rig, vfo, code); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief set CTCSS squelch * \param rig The rig handle * \param vfo The target VFO * \param tone The PL tone to set the squelch to * * Sets the current Continuous Tone Controlled Squelch System (CTCSS) * sub-audible *squelch* tone. * \note \a tone is NOT in Hz, but in tenth of Hz! This way, * if you want to set subaudible squelch tone of 88.5 Hz for example, * then pass 885 to this function. * * NB: the tone squelch has to be explicitly enabled or disabled through * a call to rig_set_func() with arg RIG_FUNC_TSQL, unless it is * unavailable and the \a tone arg has to be set to 0. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_ctcss_sql(), rig_set_ctcss_tone() */ int HAMLIB_API rig_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_ctcss_sql == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_TONE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_ctcss_sql(rig, vfo, tone); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_ctcss_sql(rig, vfo, tone); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief get the current CTCSS squelch * \param rig The rig handle * \param vfo The target VFO * \param tone The location where to store the current tone * * Retrieves the current Continuous Tone Controlled Squelch System (CTCSS) * sub-audible *squelch* tone. * \note \a *tone is NOT in Hz, but in tenth of Hz! This way, * if the function rig_get_ctcss_sql() returns a subaudible tone of 885 * for example, then the real tone is 88.5 Hz. * Also, a value of 0 for \a tone means the Tone squelch is disabled. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_ctcss_sql(), rig_get_ctcss_tone() */ int HAMLIB_API rig_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !tone) return -RIG_EINVAL; caps = rig->caps; if (caps->get_ctcss_sql == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_TONE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_ctcss_sql(rig, vfo, tone); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_ctcss_sql(rig, vfo, tone); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief set the current DCS code * \param rig The rig handle * \param vfo The target VFO * \param code The tone to set to * * Sets the current Digitally-Coded *Squelch* code. * * \return returns RIG_OK if the operation has been sucessful, ortherwise * a negative value if an error occured (in which case, cause is set * appropriately). * * \sa rig_get_dcs_sql(), rig_set_dcs_code() */ int HAMLIB_API rig_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_dcs_sql == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_TONE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_dcs_sql(rig, vfo, code); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_dcs_sql(rig, vfo, code); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief get the current DCS code * \param rig The rig handle * \param vfo The target VFO * \param code The location where to store the current tone * * Retrieves the current Digitally-Coded *Squelch* code. * * \return RIG_OK if the operation has been sucessful, ortherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_dcs_sql(), rig_get_dcs_code() */ int HAMLIB_API rig_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *code) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !code) return -RIG_EINVAL; caps = rig->caps; if (caps->get_dcs_sql == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_TONE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_dcs_sql(rig, vfo, code); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_dcs_sql(rig, vfo, code); caps->set_vfo(rig, curr_vfo); return retcode; } /*! @} */ hamlib-1.2.15.3/src/iofunc.h0000644000175000017500000000264012044564477012360 00000000000000/* * Hamlib Interface - io function header * Copyright (c) 2000-2005 by Stephane Fillod and Frank Singleton * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _IOFUNC_H #define _IOFUNC_H 1 #include #include extern HAMLIB_EXPORT(int) port_open(hamlib_port_t *p); extern HAMLIB_EXPORT(int) port_close(hamlib_port_t *p, rig_port_t port_type); extern HAMLIB_EXPORT(int) read_block(hamlib_port_t *p, char *rxbuffer, size_t count); extern HAMLIB_EXPORT(int) write_block(hamlib_port_t *p, const char *txbuffer, size_t count); extern HAMLIB_EXPORT(int) read_string(hamlib_port_t *p, char *rxbuffer, size_t rxmax, const char *stopset, int stopset_len); #endif /* _IOFUNC_H */ hamlib-1.2.15.3/src/rotator.c0000644000175000017500000003522612044564477012570 00000000000000/* * Hamlib Interface - main file * Copyright (c) 2000-2012 by Stephane Fillod * Copyright (c) 2000-2003 by Frank Singleton * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * \addtogroup rotator * @{ */ /** * \file src/rotator.c * \brief Rotator interface * \author Stephane Fillod * \date 2000-2012 * * Hamlib interface is a frontend implementing rotator wrapper functions. */ /*! \page rot Rotator interface * * Rotator can be any kind of azimuth or azimuth and elevation controlled * antenna system. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include "hamlib/rotator.h" #include "serial.h" #include "parallel.h" #include "usb_port.h" #include "network.h" #include "rot_conf.h" #include "token.h" #ifndef DOC_HIDDEN #if defined(WIN32) && !defined(__CYGWIN__) #define DEFAULT_SERIAL_PORT "\\\\.\\COM1" #elif BSD #define DEFAULT_SERIAL_PORT "/dev/cuaa0" #elif MACOSX #define DEFAULT_SERIAL_PORT "/dev/cu.usbserial" #else #define DEFAULT_SERIAL_PORT "/dev/ttyS0" #endif #if defined(WIN32) #define DEFAULT_PARALLEL_PORT "\\\\.\\$VDMLPT1" #elif defined(HAVE_DEV_PPBUS_PPI_H) #define DEFAULT_PARALLEL_PORT "/dev/ppi0" #else #define DEFAULT_PARALLEL_PORT "/dev/parport0" #endif #define CHECK_ROT_ARG(r) (!(r) || !(r)->caps || !(r)->state.comm_state) /* * Data structure to track the opened rot (by rot_open) */ struct opened_rot_l { ROT *rot; struct opened_rot_l *next; }; static struct opened_rot_l *opened_rot_list = { NULL }; /* * track which rot is opened (with rot_open) * needed at least for transceive mode */ static int add_opened_rot(ROT *rot) { struct opened_rot_l *p; p = (struct opened_rot_l *)malloc(sizeof(struct opened_rot_l)); if (!p) return -RIG_ENOMEM; p->rot = rot; p->next = opened_rot_list; opened_rot_list = p; return RIG_OK; } static int remove_opened_rot(ROT *rot) { struct opened_rot_l *p,*q; q = NULL; for (p=opened_rot_list; p; p=p->next) { if (p->rot == rot) { if (q == NULL) { opened_rot_list = opened_rot_list->next; } else { q->next = p->next; } free(p); return RIG_OK; } q = p; } return -RIG_EINVAL; /* Not found in list ! */ } #endif /* !DOC_HIDDEN */ /** * \brief execs cfunc() on each opened rot * \param cfunc The function to be executed on each rot * \param data Data pointer to be passed to cfunc() * * Calls cfunc() function for each opened rot. * The contents of the opened rot table * is processed in random order according to a function * pointed to by \a cfunc, whic is called with two arguments, * the first pointing to the #ROT handle, the second * to a data pointer \a data. * If \a data is not needed, then it can be set to NULL. * The processing of the opened rot table is stopped * when cfunc() returns 0. * \internal * * \return always RIG_OK. */ int foreach_opened_rot(int (*cfunc)(ROT *, rig_ptr_t), rig_ptr_t data) { struct opened_rot_l *p; for (p=opened_rot_list; p; p=p->next) { if ((*cfunc)(p->rot,data) == 0) return RIG_OK; } return RIG_OK; } /** * \brief allocate a new #ROT handle * \param rot_model The rot model for this new handle * * Allocates a new #ROT handle and initializes the associated data * for \a rot_model. * * \return a pointer to the #ROT handle otherwise NULL if memory allocation * failed or \a rot_model is unknown (e.g. backend autoload failed). * * \sa rot_cleanup(), rot_open() */ ROT * HAMLIB_API rot_init(rot_model_t rot_model) { ROT *rot; const struct rot_caps *caps; struct rot_state *rs; int retcode; rot_debug(RIG_DEBUG_VERBOSE,"rot:rot_init called \n"); rot_check_backend(rot_model); caps = rot_get_caps(rot_model); if (!caps) return NULL; /* * okay, we've found it. Allocate some memory and set it to zeros, * and especially the initialize the callbacks */ rot = calloc(1, sizeof(ROT)); if (rot == NULL) { /* * FIXME: how can the caller know it's a memory shortage, * and not "rot not found" ? */ return NULL; } /* caps is const, so we need to tell compiler that we now what we are doing */ rot->caps = (struct rot_caps *) caps; /* * populate the rot->state * TODO: read the Preferences here! */ rs = &rot->state; rs->comm_state = 0; rs->rotport.type.rig = caps->port_type; /* default from caps */ rs->rotport.write_delay = caps->write_delay; rs->rotport.post_write_delay = caps->post_write_delay; rs->rotport.timeout = caps->timeout; rs->rotport.retry = caps->retry; switch (caps->port_type) { case RIG_PORT_SERIAL: strncpy(rs->rotport.pathname, DEFAULT_SERIAL_PORT, FILPATHLEN - 1); rs->rotport.parm.serial.rate = caps->serial_rate_max; /* fastest ! */ rs->rotport.parm.serial.data_bits = caps->serial_data_bits; rs->rotport.parm.serial.stop_bits = caps->serial_stop_bits; rs->rotport.parm.serial.parity = caps->serial_parity; rs->rotport.parm.serial.handshake = caps->serial_handshake; break; case RIG_PORT_PARALLEL: strncpy(rs->rotport.pathname, DEFAULT_PARALLEL_PORT, FILPATHLEN - 1); break; case RIG_PORT_NETWORK: case RIG_PORT_UDP_NETWORK: strncpy(rs->rotport.pathname, "127.0.0.1:4533", FILPATHLEN - 1); break; default: strncpy(rs->rotport.pathname, "", FILPATHLEN - 1); } rs->min_el = caps->min_el; rs->max_el = caps->max_el; rs->min_az = caps->min_az; rs->max_az = caps->max_az; rs->rotport.fd = -1; /* * let the backend a chance to setup his private data * This must be done only once defaults are setup, * so the backend init can override rot_state. */ if (caps->rot_init != NULL) { retcode = caps->rot_init(rot); if (retcode != RIG_OK) { rot_debug(RIG_DEBUG_VERBOSE,"rot:backend_init failed!\n"); /* cleanup and exit */ free(rot); return NULL; } } return rot; } /** * \brief open the communication to the rot * \param rot The #ROT handle of the rotator to be opened * * Opens communication to a rotator which \a ROT handle has been passed * by argument. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \retval RIG_EINVAL \a rot is NULL or unconsistent. * \retval RIG_ENIMPL port type communication is not implemented yet. * * \sa rot_init(), rot_close() */ int HAMLIB_API rot_open(ROT *rot) { const struct rot_caps *caps; struct rot_state *rs; int status; rot_debug(RIG_DEBUG_VERBOSE,"rot:rot_open called \n"); if (!rot || !rot->caps) return -RIG_EINVAL; caps = rot->caps; rs = &rot->state; if (rs->comm_state) return -RIG_EINVAL; rs->rotport.fd = -1; switch(rs->rotport.type.rig) { case RIG_PORT_SERIAL: status = serial_open(&rs->rotport); if (status != 0) return status; break; case RIG_PORT_PARALLEL: status = par_open(&rs->rotport); if (status < 0) return status; break; case RIG_PORT_DEVICE: status = open(rs->rotport.pathname, O_RDWR, 0); if (status < 0) return -RIG_EIO; rs->rotport.fd = status; break; case RIG_PORT_USB: status = usb_port_open(&rs->rotport); if (status < 0) return status; break; case RIG_PORT_NONE: case RIG_PORT_RPC: break; /* ez :) */ case RIG_PORT_NETWORK: case RIG_PORT_UDP_NETWORK: /* FIXME: default port */ status = network_open(&rs->rotport, 4533); if (status < 0) return status; break; default: return -RIG_EINVAL; } add_opened_rot(rot); rs->comm_state = 1; /* * Maybe the backend has something to initialize * In case of failure, just close down and report error code. */ if (caps->rot_open != NULL) { status = caps->rot_open(rot); if (status != RIG_OK) { return status; } } return RIG_OK; } /** * \brief close the communication to the rot * \param rot The #ROT handle of the rotator to be closed * * Closes communication to a rotator which \a ROT handle has been passed * by argument that was previously open with rot_open(). * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rot_cleanup(), rot_open() */ int HAMLIB_API rot_close(ROT *rot) { const struct rot_caps *caps; struct rot_state *rs; rot_debug(RIG_DEBUG_VERBOSE,"rot:rot_close called \n"); if (!rot || !rot->caps) return -RIG_EINVAL; caps = rot->caps; rs = &rot->state; if (!rs->comm_state) return -RIG_EINVAL; /* * Let the backend say 73s to the rot. * and ignore the return code. */ if (caps->rot_close) caps->rot_close(rot); if (rs->rotport.fd != -1) { switch(rs->rotport.type.rig) { case RIG_PORT_SERIAL: ser_close(&rs->rotport); break; case RIG_PORT_PARALLEL: par_close(&rs->rotport); break; case RIG_PORT_USB: usb_port_close(&rs->rotport); break; case RIG_PORT_NETWORK: case RIG_PORT_UDP_NETWORK: network_close(&rs->rotport); break; default: close(rs->rotport.fd); } rs->rotport.fd = -1; } remove_opened_rot(rot); rs->comm_state = 0; return RIG_OK; } /** * \brief release a rot handle and free associated memory * \param rot The #ROT handle of the radio to be closed * * Releases a rot struct which port has eventualy been closed already * with rot_close(). * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rot_init(), rot_close() */ int HAMLIB_API rot_cleanup(ROT *rot) { rot_debug(RIG_DEBUG_VERBOSE,"rot:rot_cleanup called \n"); if (!rot || !rot->caps) return -RIG_EINVAL; /* * check if they forgot to close the rot */ if (rot->state.comm_state) rot_close(rot); /* * basically free up the priv struct */ if (rot->caps->rot_cleanup) rot->caps->rot_cleanup(rot); free(rot); return RIG_OK; } /** * \brief set the azimuth and elevation of the rotator * \param rot The rot handle * \param azimuth The azimuth to set to * \param elevation The elevation to set to * * Sets the azimuth and elevation of the rotator. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rot_get_position() */ int HAMLIB_API rot_set_position (ROT *rot, azimuth_t azimuth, elevation_t elevation) { const struct rot_caps *caps; const struct rot_state *rs; if (CHECK_ROT_ARG(rot)) return -RIG_EINVAL; caps = rot->caps; rs = &rot->state; if (azimuth < rs->min_az || azimuth > rs->max_az || elevation < rs->min_el || elevation > rs->max_el) return -RIG_EINVAL; if (caps->set_position == NULL) return -RIG_ENAVAIL; return caps->set_position(rot, azimuth, elevation); } /** * \brief get the azimuth and elevation of the rotator * \param rot The rot handle * \param azimuth The location where to store the current azimuth * \param elevation The location where to store the current elevation * * Retrieves the current azimuth and elevation of the rotator. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rot_set_position() */ int HAMLIB_API rot_get_position (ROT *rot, azimuth_t *azimuth, elevation_t *elevation) { const struct rot_caps *caps; if (CHECK_ROT_ARG(rot) || !azimuth || !elevation) return -RIG_EINVAL; caps = rot->caps; if (caps->get_position == NULL) return -RIG_ENAVAIL; return caps->get_position(rot, azimuth, elevation); } /** * \brief park the antenna * \param rot The rot handle * * Park the antenna. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * */ int HAMLIB_API rot_park (ROT *rot) { const struct rot_caps *caps; if (CHECK_ROT_ARG(rot)) return -RIG_EINVAL; caps = rot->caps; if (caps->park == NULL) return -RIG_ENAVAIL; return caps->park(rot); } /** * \brief stop the rotator * \param rot The rot handle * * Stop the rotator. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * */ int HAMLIB_API rot_stop (ROT *rot) { const struct rot_caps *caps; if (CHECK_ROT_ARG(rot)) return -RIG_EINVAL; caps = rot->caps; if (caps->stop == NULL) return -RIG_ENAVAIL; return caps->stop(rot); } /** * \brief reset the rotator * \param rot The rot handle * \param reset The reset operation to perform * * Resets the rotator. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * */ int HAMLIB_API rot_reset (ROT *rot, rot_reset_t reset) { const struct rot_caps *caps; if (CHECK_ROT_ARG(rot)) return -RIG_EINVAL; caps = rot->caps; if (caps->reset == NULL) return -RIG_ENAVAIL; return caps->reset(rot, reset); } /** * \brief move the rotator in the specified direction * \param rot The rot handle * \param direction Direction of movement * \param speed Speed of movement * * Move the rotator in the specified direction. The speed is a value * between 1 and 100. */ int HAMLIB_API rot_move (ROT *rot, int direction, int speed) { const struct rot_caps *caps; if (CHECK_ROT_ARG(rot)) return -RIG_EINVAL; caps = rot->caps; if (caps->move == NULL) return -RIG_ENAVAIL; return caps->move(rot, direction, speed); } /** * \brief get general information from the rotator * \param rot The rot handle * * Retrieves some general information from the rotator. * This can include firmware revision, exact model name, or just nothing. * * \return a pointer to static memory containing the ASCIIZ string * if the operation has been sucessful, otherwise NULL if an error occured * or get_info not part of capabilities. */ const char* HAMLIB_API rot_get_info(ROT *rot) { if (CHECK_ROT_ARG(rot)) return NULL; if (rot->caps->get_info == NULL) return NULL; return rot->caps->get_info(rot); } /*! @} */ hamlib-1.2.15.3/src/conf.c0000644000175000017500000005014112044564477012014 00000000000000/** * \addtogroup rig * @{ */ /** * \file src/conf.c * \brief Rig configuration interface * \author Stephane Fillod * \date 2000-2012 */ /* * Hamlib Interface - configuration interface * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* Standard input/output definitions */ #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "token.h" /* * Configuration options available in the rig->state struct. */ static const struct confparams frontend_cfg_params[] = { { TOK_PATHNAME, "rig_pathname", "Rig path name", "Path name to the device file of the rig", "/dev/rig", RIG_CONF_STRING, }, { TOK_WRITE_DELAY, "write_delay", "Write delay", "Delay in ms between each byte sent out", "0", RIG_CONF_NUMERIC, { .n = { 0, 1000, 1 } } }, { TOK_POST_WRITE_DELAY, "post_write_delay", "Post write delay", "Delay in ms between each command sent out", "0", RIG_CONF_NUMERIC, { .n = { 0, 1000, 1 } } }, { TOK_TIMEOUT, "timeout", "Timeout", "Timeout in ms", "0", RIG_CONF_NUMERIC, { .n = { 0, 10000, 1 } } }, { TOK_RETRY, "retry", "Retry", "Max number of retry", "0", RIG_CONF_NUMERIC, { .n = { 0, 10, 1 } } }, { TOK_ITU_REGION, "itu_region", "ITU region", "ITU region this rig has been manufactured for (freq. band plan)", "0", RIG_CONF_NUMERIC, { .n = { 1, 3, 1 } } }, { TOK_VFO_COMP, "vfo_comp", "VFO compensation", "VFO compensation in ppm", "0", RIG_CONF_NUMERIC, { .n = { 0.0, 1000.0, .001 } } }, { TOK_POLL_INTERVAL, "poll_interval", "Polling interval", "Polling interval in millisecond for transceive emulation", "500", RIG_CONF_NUMERIC, { .n = { 0, 1000000, 1 } } }, { TOK_PTT_TYPE, "ptt_type", "PTT type", "Push-To-Talk interface type override", "RIG", RIG_CONF_COMBO, { .c = {{ "RIG", "DTR", "RTS", "Parallel", "CM108", "None", NULL }} } }, { TOK_PTT_PATHNAME, "ptt_pathname", "PTT path name", "Path name to the device file of the Push-To-Talk", "/dev/rig", RIG_CONF_STRING, }, { TOK_PTT_BITNUM, "ptt_bitnum", "PTT bit [0-7]", "Push-To-Talk GPIO bit number", "2", RIG_CONF_NUMERIC, { .n = { 0, 7, 1 } } }, { TOK_DCD_TYPE, "dcd_type", "DCD type", "Data Carrier Detect (or squelch) interface type override", "RIG", RIG_CONF_COMBO, { .c = {{ "RIG", "DSR", "CTS", "CD", "Parallel", "CM108", "None", NULL }} } }, { TOK_DCD_PATHNAME, "dcd_pathname", "DCD path name", "Path name to the device file of the Data Carrier Detect (or squelch)", "/dev/rig", RIG_CONF_STRING, }, { RIG_CONF_END, NULL, } }; static const struct confparams frontend_serial_cfg_params[] = { { TOK_SERIAL_SPEED, "serial_speed", "Serial speed", "Serial port baud rate", "0", RIG_CONF_NUMERIC, { .n = { 300, 115200, 1 } } }, { TOK_DATA_BITS, "data_bits", "Serial data bits", "Serial port data bits", "8", RIG_CONF_NUMERIC, { .n = { 5, 8, 1 } } }, { TOK_STOP_BITS, "stop_bits", "Serial stop bits", "Serial port stop bits", "1", RIG_CONF_NUMERIC, { .n = { 0, 3, 1 } } }, { TOK_PARITY, "serial_parity", "Serial parity", "Serial port parity", "None", RIG_CONF_COMBO, { .c = {{ "None", "Odd", "Even", "Mark", "Space", NULL }} } }, { TOK_HANDSHAKE, "serial_handshake", "Serial handshake", "Serial port handshake", "None", RIG_CONF_COMBO, { .c = {{ "None", "XONXOFF", "Hardware", NULL }} } }, { TOK_RTS_STATE, "rts_state", "RTS state", "Serial port set state of RTS signal for external powering", "Unset", RIG_CONF_COMBO, { .c = {{ "Unset", "ON", "OFF", NULL }} } }, { TOK_DTR_STATE, "dtr_state", "DTR state", "Serial port set state of DTR signal for external powering", "Unset", RIG_CONF_COMBO, { .c = {{ "Unset", "ON", "OFF", NULL }} } }, { RIG_CONF_END, NULL, } }; /* * frontend_set_conf * assumes rig!=NULL, val!=NULL */ static int frontend_set_conf(RIG *rig, token_t token, const char *val) { const struct rig_caps *caps; struct rig_state *rs; int val_i; caps = rig->caps; rs = &rig->state; switch(token) { case TOK_PATHNAME: strncpy(rs->rigport.pathname, val, FILPATHLEN-1); break; case TOK_WRITE_DELAY: if (1 != sscanf(val, "%d", &val_i)){ return -RIG_EINVAL;//value format error } rs->rigport.write_delay = val_i; break; case TOK_POST_WRITE_DELAY: if (1 != sscanf(val, "%d", &val_i)){ return -RIG_EINVAL;//value format error } rs->rigport.post_write_delay = val_i; break; case TOK_TIMEOUT: if (1 != sscanf(val, "%d", &val_i)){ return -RIG_EINVAL;//value format error } rs->rigport.timeout = val_i; break; case TOK_RETRY: if (1 != sscanf(val, "%d", &val_i)){ return -RIG_EINVAL;//value format error } rs->rigport.retry = val_i; break; case TOK_SERIAL_SPEED: if (rs->rigport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; if (1 != sscanf(val, "%d", &val_i)){ return -RIG_EINVAL;//value format error } rs->rigport.parm.serial.rate = val_i; break; case TOK_DATA_BITS: if (rs->rigport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; if (1 != sscanf(val, "%d", &val_i)){ return -RIG_EINVAL;//value format error } rs->rigport.parm.serial.data_bits = val_i; break; case TOK_STOP_BITS: if (rs->rigport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; if (1 != sscanf(val, "%d", &val_i)){ return -RIG_EINVAL;//value format error } rs->rigport.parm.serial.stop_bits = val_i; break; case TOK_PARITY: if (rs->rigport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; if (!strcmp(val, "None")) rs->rigport.parm.serial.parity = RIG_PARITY_NONE; else if (!strcmp(val, "Odd")) rs->rigport.parm.serial.parity = RIG_PARITY_ODD; else if (!strcmp(val, "Even")) rs->rigport.parm.serial.parity = RIG_PARITY_EVEN; else if (!strcmp(val, "Mark")) rs->rigport.parm.serial.parity = RIG_PARITY_MARK; else if (!strcmp(val, "Space")) rs->rigport.parm.serial.parity = RIG_PARITY_SPACE; else return -RIG_EINVAL; break; case TOK_HANDSHAKE: if (rs->rigport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; if (!strcmp(val, "None")) rs->rigport.parm.serial.handshake = RIG_HANDSHAKE_NONE; else if (!strcmp(val, "XONXOFF")) rs->rigport.parm.serial.handshake = RIG_HANDSHAKE_XONXOFF; else if (!strcmp(val, "Hardware")) rs->rigport.parm.serial.handshake = RIG_HANDSHAKE_HARDWARE; else return -RIG_EINVAL; break; case TOK_RTS_STATE: if (rs->rigport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; if (!strcmp(val, "Unset")) rs->rigport.parm.serial.rts_state = RIG_SIGNAL_UNSET; else if (!strcmp(val, "ON")) rs->rigport.parm.serial.rts_state = RIG_SIGNAL_ON; else if (!strcmp(val, "OFF")) rs->rigport.parm.serial.rts_state = RIG_SIGNAL_OFF; else return -RIG_EINVAL; break; case TOK_DTR_STATE: if (rs->rigport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; if (!strcmp(val, "Unset")) rs->rigport.parm.serial.dtr_state = RIG_SIGNAL_UNSET; else if (!strcmp(val, "ON")) rs->rigport.parm.serial.dtr_state = RIG_SIGNAL_ON; else if (!strcmp(val, "OFF")) rs->rigport.parm.serial.dtr_state = RIG_SIGNAL_OFF; else return -RIG_EINVAL; break; case TOK_ITU_REGION: if (1 != sscanf(val, "%d", &val_i)){ return -RIG_EINVAL;//value format error } switch(val_i) { case RIG_ITU_REGION1: rs->itu_region = val_i; memcpy(rs->tx_range_list, caps->tx_range_list1, sizeof(struct freq_range_list)*FRQRANGESIZ); memcpy(rs->rx_range_list, caps->rx_range_list1, sizeof(struct freq_range_list)*FRQRANGESIZ); break; case RIG_ITU_REGION2: case RIG_ITU_REGION3: rs->itu_region = val_i; memcpy(rs->tx_range_list, caps->tx_range_list2, sizeof(struct freq_range_list)*FRQRANGESIZ); memcpy(rs->rx_range_list, caps->rx_range_list2, sizeof(struct freq_range_list)*FRQRANGESIZ); break; default: return -RIG_EINVAL; } break; case TOK_PTT_TYPE: if (!strcmp(val, "RIG")) rs->pttport.type.ptt = RIG_PTT_RIG; else if (!strcmp(val, "RIGMICDATA")) rs->pttport.type.ptt = RIG_PTT_RIG_MICDATA; else if (!strcmp(val, "DTR")) rs->pttport.type.ptt = RIG_PTT_SERIAL_DTR; else if (!strcmp(val, "RTS")) rs->pttport.type.ptt = RIG_PTT_SERIAL_RTS; else if (!strcmp(val, "Parallel")) rs->pttport.type.ptt = RIG_PTT_PARALLEL; else if (!strcmp(val, "CM108")) rs->pttport.type.ptt = RIG_PTT_CM108; else if (!strcmp(val, "None")) rs->pttport.type.ptt = RIG_PTT_NONE; else return -RIG_EINVAL; break; case TOK_PTT_PATHNAME: strncpy(rs->pttport.pathname, val, FILPATHLEN-1); break; case TOK_PTT_BITNUM: if (1 != sscanf(val, "%d", &val_i)){ return -RIG_EINVAL;//value format error } rs->pttport.parm.cm108.ptt_bitnum=val_i; break; case TOK_DCD_TYPE: if (!strcmp(val, "RIG")) rs->dcdport.type.dcd = RIG_DCD_RIG; else if (!strcmp(val, "DSR")) rs->dcdport.type.dcd = RIG_DCD_SERIAL_DSR; else if (!strcmp(val, "CTS")) rs->dcdport.type.dcd = RIG_DCD_SERIAL_CTS; else if (!strcmp(val, "CD")) rs->dcdport.type.dcd = RIG_DCD_SERIAL_CAR; else if (!strcmp(val, "Parallel")) rs->dcdport.type.dcd = RIG_DCD_PARALLEL; else if (!strcmp(val, "CM108")) rs->dcdport.type.dcd = RIG_DCD_CM108; else if (!strcmp(val, "None")) rs->dcdport.type.dcd = RIG_DCD_NONE; else return -RIG_EINVAL; break; case TOK_DCD_PATHNAME: strncpy(rs->dcdport.pathname, val, FILPATHLEN-1); break; case TOK_VFO_COMP: rs->vfo_comp = atof(val); break; case TOK_POLL_INTERVAL: rs->poll_interval = atof(val); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * frontend_get_conf * assumes rig!=NULL, val!=NULL */ static int frontend_get_conf(RIG *rig, token_t token, char *val) { struct rig_state *rs; const char *s; rs = &rig->state; switch(token) { case TOK_PATHNAME: strcpy(val, rs->rigport.pathname); break; case TOK_WRITE_DELAY: sprintf(val, "%d", rs->rigport.write_delay); break; case TOK_POST_WRITE_DELAY: sprintf(val, "%d", rs->rigport.post_write_delay); break; case TOK_TIMEOUT: sprintf(val, "%d", rs->rigport.timeout); break; case TOK_RETRY: sprintf(val, "%d", rs->rigport.retry); break; case TOK_ITU_REGION: sprintf(val, "%d", rs->itu_region == 1 ? RIG_ITU_REGION1 : RIG_ITU_REGION2); break; case TOK_SERIAL_SPEED: if (rs->rigport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; sprintf(val, "%d", rs->rigport.parm.serial.rate); break; case TOK_DATA_BITS: if (rs->rigport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; sprintf(val, "%d", rs->rigport.parm.serial.data_bits); break; case TOK_STOP_BITS: if (rs->rigport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; sprintf(val, "%d", rs->rigport.parm.serial.stop_bits); break; case TOK_PARITY: if (rs->rigport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; switch (rs->rigport.parm.serial.parity) { case RIG_PARITY_NONE: s = "None"; break; case RIG_PARITY_ODD: s = "Odd"; break; case RIG_PARITY_EVEN: s = "Even"; break; case RIG_PARITY_MARK: s = "Mark"; break; case RIG_PARITY_SPACE: s = "Space"; break; default: return -RIG_EINVAL; } strcpy(val, s); break; case TOK_HANDSHAKE: if (rs->rigport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; switch (rs->rigport.parm.serial.handshake) { case RIG_HANDSHAKE_NONE: s = "None"; break; case RIG_HANDSHAKE_XONXOFF: s = "XONXOFF"; break; case RIG_HANDSHAKE_HARDWARE: s = "Hardware"; break; default: return -RIG_EINVAL; } strcpy(val, s); break; case TOK_RTS_STATE: if (rs->rigport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; switch (rs->rigport.parm.serial.rts_state) { case RIG_SIGNAL_UNSET: s = "Unset"; break; case RIG_SIGNAL_ON: s = "ON"; break; case RIG_SIGNAL_OFF: s = "OFF"; break; default: return -RIG_EINVAL; } strcpy(val, s); break; case TOK_DTR_STATE: if (rs->rigport.type.rig != RIG_PORT_SERIAL) return -RIG_EINVAL; switch (rs->rigport.parm.serial.dtr_state) { case RIG_SIGNAL_UNSET: s = "Unset"; break; case RIG_SIGNAL_ON: s = "ON"; break; case RIG_SIGNAL_OFF: s = "OFF"; break; default: return -RIG_EINVAL; } strcpy(val, s); break; case TOK_VFO_COMP: sprintf(val, "%f", rs->vfo_comp); break; case TOK_POLL_INTERVAL: sprintf(val, "%d", rs->poll_interval); break; default: return -RIG_EINVAL; } return RIG_OK; } /** * \brief call a function against each configuration token of a rig * \param rig The rig handle * \param cfunc The function to perform on each token * \param data Any data to be passed to cfunc * * Executes \a cfunc on all the elements stored in the conf table. * rig_token_foreach starts first with backend conf table, then finish * with frontend table. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). */ int HAMLIB_API rig_token_foreach(RIG *rig, int (*cfunc)(const struct confparams *, rig_ptr_t), rig_ptr_t data) { const struct confparams *cfp; if (!rig || !rig->caps || !cfunc) return -RIG_EINVAL; for (cfp = frontend_cfg_params; cfp->name; cfp++) if ((*cfunc)(cfp, data) == 0) return RIG_OK; if (rig->caps->port_type == RIG_PORT_SERIAL) { for (cfp = frontend_serial_cfg_params; cfp->name; cfp++) if ((*cfunc)(cfp, data) == 0) return RIG_OK; } for (cfp = rig->caps->cfgparams; cfp && cfp->name; cfp++) if ((*cfunc)(cfp, data) == 0) return RIG_OK; return RIG_OK; } /** * \brief lookup a confparam struct * \param rig The rig handle * \param name The name of the configuration parameter * * Lookup conf token by its name. * * \return a pointer to the confparams struct if found, otherwise NULL. */ const struct confparams * HAMLIB_API rig_confparam_lookup(RIG *rig, const char *name) { const struct confparams *cfp; token_t token; if (!rig || !rig->caps) return NULL; /* 0 returned for invalid format */ token = strtol(name, NULL, 0); for (cfp = rig->caps->cfgparams; cfp && cfp->name; cfp++) if (!strcmp(cfp->name, name) || token == cfp->token) return cfp; for (cfp = frontend_cfg_params; cfp->name; cfp++) if (!strcmp(cfp->name, name) || token == cfp->token) return cfp; if (rig->caps->port_type == RIG_PORT_SERIAL) { for (cfp = frontend_serial_cfg_params; cfp->name; cfp++) if (!strcmp(cfp->name, name) || token == cfp->token) return cfp; } return NULL; } /** * \brief lookup a token id * \param rig The rig handle * \param name The name of the configuration parameter * * Simple lookup returning token id assicated with name. * * \return the token id if found, otherwise RIG_CONF_END */ token_t HAMLIB_API rig_token_lookup(RIG *rig, const char *name) { const struct confparams *cfp; cfp = rig_confparam_lookup(rig, name); if (!cfp) return RIG_CONF_END; return cfp->token; } /** * \brief set a radio configuration parameter * \param rig The rig handle * \param token The parameter * \param val The value to set the parameter to * * Sets a configuration parameter. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_conf() */ int HAMLIB_API rig_set_conf(RIG *rig, token_t token, const char *val) { if (!rig || !rig->caps) return -RIG_EINVAL; if (rig_need_debug(RIG_DEBUG_VERBOSE)) { const struct confparams *cfp; char tokenstr[12]; sprintf(tokenstr, "%ld", token); cfp = rig_confparam_lookup(rig, tokenstr); if (!cfp) return -RIG_EINVAL; rig_debug(RIG_DEBUG_VERBOSE, "%s: %s='%s'\n", __func__, cfp->name, val); } if (IS_TOKEN_FRONTEND(token)) return frontend_set_conf(rig, token, val); if (rig->caps->set_conf == NULL) return -RIG_ENAVAIL; return rig->caps->set_conf(rig, token, val); } /** * \brief get the value of a configuration parameter * \param rig The rig handle * \param token The parameter * \param val The location where to store the value of config \a token * * Retrieves the value of a configuration paramter associated with \a token. * The location pointed to by val must be large enough to hold the value of the config. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_conf() */ int HAMLIB_API rig_get_conf(RIG *rig, token_t token, char *val) { if (!rig || !rig->caps || !val) return -RIG_EINVAL; if (IS_TOKEN_FRONTEND(token)) return frontend_get_conf(rig, token, val); if (rig->caps->get_conf == NULL) return -RIG_ENAVAIL; return rig->caps->get_conf(rig, token, val); } /*! @} */ hamlib-1.2.15.3/src/parallel.c0000644000175000017500000003121712044564477012666 00000000000000/* * Hamlib Interface - parallel communication low-level support * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * \addtogroup rig_internal * @{ */ /** * \brief Parallel Port IO * \file parallel.c */ #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 #include #include #ifdef HAVE_SYS_IOCTL_H #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_WINDOWS_H #include #include "par_nt.h" #endif #ifdef HAVE_WINIOCTL_H #include #endif #ifdef HAVE_WINBASE_H #include #endif #include "hamlib/rig.h" #include "parallel.h" #ifdef HAVE_LINUX_PPDEV_H #include #include #endif #ifdef HAVE_DEV_PPBUS_PPI_H #include #include #endif /* * These control port bits are active low. * We toggle them so that this weirdness doesn't get propagated * through our interface. */ #define CP_ACTIVE_LOW_BITS 0x0B /* * These status port bits are active low. * We toggle them so that this weirdness doesn't get propagated * through our interface. */ #define SP_ACTIVE_LOW_BITS 0x80 /* Pinout table of parallel port from http://en.wikipedia.org/wiki/Parallel_port#Pinouts Pin No (DB25) Signal name Direction Register-bit Inverted 1 *Strobe In/Out Control-0 Yes 2 Data0 Out Data-0 No 3 Data1 Out Data-1 No 4 Data2 Out Data-2 No 5 Data3 Out Data-3 No 6 Data4 Out Data-4 No 7 Data5 Out Data-5 No 8 Data6 Out Data-6 No 9 Data7 Out Data-7 No 10 *Ack In Status-6 No 11 Busy In Status-7 Yes 12 Paper-Out In Status-5 No 13 Select In Status-4 No 14 Linefeed In/Out Control-1 Yes 15 *Error In Status-3 No 16 *Reset In/Out Control-2 No 17 *Select-Printer In/Out Control-3 Yes * means low true, e.g., *Strobe. */ /** * \brief Open Parallel Port * \param port * \return file descriptor * * TODO: to be called before exiting: atexit(parport_cleanup) * void parport_cleanup() { ioctl(fd, PPRELEASE); } */ int par_open(hamlib_port_t *port) { int fd; int mode; if (!port->pathname) return -RIG_EINVAL; #ifdef HAVE_LINUX_PPDEV_H /* TODO: open with O_NONBLOCK ? */ fd = open(port->pathname, O_RDWR); if (fd < 0) { rig_debug(RIG_DEBUG_ERR, "Opening device \"%s\": %s\n", port->pathname, strerror(errno)); return -RIG_EIO; } mode = IEEE1284_MODE_COMPAT; if (ioctl (fd, PPSETMODE, &mode) != 0) { rig_debug(RIG_DEBUG_ERR, "PPSETMODE \"%s\": %s\n", port->pathname, strerror(errno)); close(fd); return -RIG_EIO; } #elif defined(HAVE_DEV_PPBUS_PPI_H) fd = open(port->pathname, O_RDWR); if (fd < 0) { rig_debug(RIG_DEBUG_ERR, "Opening device \"%s\": %s\n", port->pathname, strerror(errno)); return -RIG_EIO; } #elif defined(WIN32) fd = (int)CreateFile(port->pathname, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if (fd == (int)INVALID_HANDLE_VALUE) { rig_debug(RIG_DEBUG_ERR, "Opening device \"%s\"\n", port->pathname); CloseHandle((HANDLE)fd); return -RIG_EIO; } #else return -RIG_ENIMPL; #endif port->fd = fd; return fd; } /** * \brief Close Parallel Port * \param port */ int par_close(hamlib_port_t *port) { #ifdef HAVE_LINUX_PPDEV_H #elif defined(HAVE_DEV_PPBUS_PPI_H) #elif defined(WIN32) CloseHandle((HANDLE)(port->fd)); return RIG_OK; #endif return close(port->fd); } /** * \brief Send data on Parallel port * \param port * \param data */ int HAMLIB_API par_write_data(hamlib_port_t *port, unsigned char data) { #ifdef HAVE_LINUX_PPDEV_H int status; status = ioctl(port->fd, PPWDATA, &data); return status == 0 ? RIG_OK : -RIG_EIO; #elif defined(HAVE_DEV_PPBUS_PPI_H) int status; status = ioctl(port->fd, PPISDATA, &data); return status == 0 ? RIG_OK : -RIG_EIO; #elif defined(WIN32) unsigned int dummy; if (!(DeviceIoControl((HANDLE)(port->fd), NT_IOCTL_DATA, &data, sizeof(data), NULL, 0, (LPDWORD)&dummy, NULL))) { rig_debug(RIG_DEBUG_ERR, "%s: DeviceIoControl failed!\n", __FUNCTION__); return -RIG_EIO; } return RIG_OK; #else return -RIG_ENIMPL; #endif } /** * \brief Receive data on Parallel port * \param port * \param data */ int HAMLIB_API par_read_data(hamlib_port_t *port, unsigned char *data) { #ifdef HAVE_LINUX_PPDEV_H int status; status = ioctl(port->fd, PPRDATA, data); return status == 0 ? RIG_OK : -RIG_EIO; #elif defined(HAVE_DEV_PPBUS_PPI_H) int status; status = ioctl(port->fd, PPIGDATA, &data); return status == 0 ? RIG_OK : -RIG_EIO; #elif defined(WIN32) unsigned char ret; unsigned int dummy; if (!(DeviceIoControl((HANDLE)(port->fd), NT_IOCTL_STATUS, NULL, 0, &ret, sizeof(ret), (LPDWORD)&dummy, NULL))) { rig_debug(RIG_DEBUG_ERR, "%s: DeviceIoControl failed!\n", __FUNCTION__); return -RIG_EIO; } *data = ret ^ S1284_INVERTED; return RIG_OK; #else return -RIG_ENIMPL; #endif } /** * \brief Set control data for Parallel Port * \param port * \param control */ int HAMLIB_API par_write_control(hamlib_port_t *port, unsigned char control) { #ifdef HAVE_LINUX_PPDEV_H int status; unsigned char ctrl = control ^ CP_ACTIVE_LOW_BITS; status = ioctl(port->fd, PPWCONTROL, &ctrl); if (status < 0) rig_debug(RIG_DEBUG_ERR,"ioctl(PPWCONTROL) failed: %s\n", strerror(errno)); return status == 0 ? RIG_OK : -RIG_EIO; #elif defined(HAVE_DEV_PPBUS_PPI_H) int status; unsigned char ctrl = control ^ CP_ACTIVE_LOW_BITS; status = ioctl(port->fd, PPISCTRL, &ctrl); return status == 0 ? RIG_OK : -RIG_EIO; #elif defined(WIN32) unsigned char ctr = control; unsigned char dummyc; unsigned int dummy; const unsigned char wm = (C1284_NSTROBE | C1284_NAUTOFD | C1284_NINIT | C1284_NSELECTIN); if (ctr & 0x20) { rig_debug (RIG_DEBUG_WARN, "use ieee1284_data_dir to change data line direction!\n"); } /* Deal with inversion issues. */ ctr ^= wm & C1284_INVERTED; ctr = (ctr & ~wm) ^ (ctr & wm); if (!(DeviceIoControl((HANDLE)(port->fd), NT_IOCTL_CONTROL, &ctr, sizeof(ctr), &dummyc, sizeof(dummyc), (LPDWORD)&dummy, NULL))) { rig_debug(RIG_DEBUG_ERR,"frob_control: DeviceIoControl failed!\n"); return -RIG_EIO; } return RIG_OK; #else return -RIG_ENIMPL; #endif } /** * \brief Read control data for Parallel Port * \param port * \param control */ int HAMLIB_API par_read_control(hamlib_port_t *port, unsigned char *control) { #ifdef HAVE_LINUX_PPDEV_H int status; unsigned char ctrl; status = ioctl(port->fd, PPRCONTROL, &ctrl); if (status < 0) rig_debug(RIG_DEBUG_ERR,"ioctl(PPRCONTROL) failed: %s\n", strerror(errno)); *control = ctrl ^ CP_ACTIVE_LOW_BITS; return status == 0 ? RIG_OK : -RIG_EIO; #elif defined(HAVE_DEV_PPBUS_PPI_H) int status; unsigned char ctrl; status = ioctl(port->fd, PPIGCTRL, &ctrl); *control = ctrl ^ CP_ACTIVE_LOW_BITS; return status == 0 ? RIG_OK : -RIG_EIO; #elif defined(WIN32) unsigned char ret; unsigned int dummy; if (!(DeviceIoControl((HANDLE)(port->fd), NT_IOCTL_CONTROL, NULL, 0, &ret, sizeof(ret), (LPDWORD)&dummy, NULL))) { rig_debug(RIG_DEBUG_ERR, "%s: DeviceIoControl failed!\n", __FUNCTION__); return -RIG_EIO; } *control = ret ^ S1284_INVERTED; return RIG_OK; #else return -RIG_ENIMPL; #endif } /** * \brief Get parallel port status * \param port * \param status * \return RIG_OK or < 0 for error */ int HAMLIB_API par_read_status(hamlib_port_t *port, unsigned char *status) { #ifdef HAVE_LINUX_PPDEV_H int ret; unsigned char sta; ret = ioctl(port->fd, PPRSTATUS, &sta); *status = sta ^ SP_ACTIVE_LOW_BITS; return ret == 0 ? RIG_OK : -RIG_EIO; #elif defined(HAVE_DEV_PPBUS_PPI_H) int ret; unsigned char sta; ret = ioctl(port->fd, PPIGSTATUS, &sta); *status = sta ^ SP_ACTIVE_LOW_BITS; return ret == 0 ? RIG_OK : -RIG_EIO; #elif defined(WIN32) unsigned char ret; unsigned int dummy; if (!(DeviceIoControl((HANDLE)(port->fd), NT_IOCTL_STATUS, NULL, 0, &ret, sizeof(ret), (LPDWORD)&dummy, NULL))) { rig_debug(RIG_DEBUG_ERR, "%s: DeviceIoControl failed!\n", __FUNCTION__); return -RIG_EIO; } *status = ret ^ S1284_INVERTED; return RIG_OK; #else return -RIG_ENIMPL; #endif } /** * \brief Get a lock on the Parallel Port * \param port * \return RIG_OK or < 0 */ int HAMLIB_API par_lock(hamlib_port_t *port) { #ifdef HAVE_LINUX_PPDEV_H if (ioctl(port->fd, PPCLAIM) < 0) { rig_debug(RIG_DEBUG_ERR, "Claiming device \"%s\": %s\n", port->pathname, strerror(errno)); return -RIG_EIO; } return RIG_OK; #elif defined(HAVE_DEV_PPBUS_PPI_H) return RIG_OK; #elif defined(WIN32) return RIG_OK; #else return -RIG_ENIMPL; #endif } /** * \brief Release lock on Parallel Port * \param port * \return RIG_OK or < 0 */ int HAMLIB_API par_unlock(hamlib_port_t *port) { #ifdef HAVE_LINUX_PPDEV_H if (ioctl(port->fd, PPRELEASE) < 0) { rig_debug(RIG_DEBUG_ERR, "Releasing device \"%s\": %s\n", port->pathname, strerror(errno)); return -RIG_EIO; } return RIG_OK; #elif defined(HAVE_DEV_PPBUS_PPI_H) return RIG_OK; #elif defined(WIN32) return RIG_OK; #else return -RIG_ENIMPL; #endif } #ifndef PARPORT_CONTROL_STROBE #define PARPORT_CONTROL_STROBE 0x1 #endif #ifndef PARPORT_CONTROL_INIT #define PARPORT_CONTROL_INIT 0x4 #endif /** * \brief Set or unset Push to talk bit on Parallel Port * \param p * \param pttx RIG_PTT_ON --> Set PTT * \return RIG_OK or < 0 error */ int par_ptt_set(hamlib_port_t *p, ptt_t pttx) { switch(p->type.ptt) { case RIG_PTT_PARALLEL: { unsigned char ctl; int status; par_lock (p); status = par_read_control(p, &ctl); if (status != RIG_OK) return status; /* Enable CW & PTT - /STROBE bit (pin 1) */ ctl &= ~PARPORT_CONTROL_STROBE; /* TODO: kill parm.parallel.pin? */ /* PTT keying - /INIT bit (pin 16) (inverted) */ if (pttx == RIG_PTT_ON) ctl |= PARPORT_CONTROL_INIT; else ctl &= ~PARPORT_CONTROL_INIT; status = par_write_control(p, ctl); par_unlock (p); return status; } default: rig_debug(RIG_DEBUG_ERR,"Unsupported PTT type %d\n", p->type.ptt); return -RIG_EINVAL; } return RIG_OK; } /** * \brief Get state of Push to Talk from Parallel Port * \param p * \param pttx return value (must be non NULL) * \return RIG_OK or < 0 error */ int par_ptt_get(hamlib_port_t *p, ptt_t *pttx) { switch(p->type.ptt) { case RIG_PTT_PARALLEL: { unsigned char ctl; int status; par_lock (p); status = par_read_control(p, &ctl); par_unlock (p); *pttx = (ctl & PARPORT_CONTROL_INIT) && !(ctl & PARPORT_CONTROL_STROBE) ? RIG_PTT_ON : RIG_PTT_OFF; return status; } default: rig_debug(RIG_DEBUG_ERR,"Unsupported PTT type %d\n", p->type.ptt); return -RIG_ENAVAIL; } return RIG_OK; } /** * \brief get Data Carrier Detect (squelch) from Parallel Port * \param p * \param dcdx return value (Must be non NULL) * \return RIG_OK or < 0 error */ int par_dcd_get(hamlib_port_t *p, dcd_t *dcdx) { switch(p->type.dcd) { case RIG_DCD_PARALLEL: { unsigned char reg; int status; status = par_read_data(p, ®); *dcdx = reg & (1<parm.parallel.pin) ? RIG_DCD_ON:RIG_DCD_OFF; return status; } default: rig_debug(RIG_DEBUG_ERR,"Unsupported DCD type %d\n", p->type.dcd); return -RIG_ENAVAIL; } return RIG_OK; } /** @} */ hamlib-1.2.15.3/src/par_nt.h0000644000175000017500000000253212044564477012360 00000000000000/* NT Parport Access stuff - Matthew Duggan (2002) */ /* * ParallelVdm Device (0x2C) is mostly undocumented, used by VDM for parallel * port compatibility. */ /* * Different from CTL_CODE in DDK, limited to ParallelVdm but makes this * code cleaner. */ #ifndef _PAR_NT_H #define _PAR_NT_H #define NT_CTL_CODE( Function ) ( (0x2C<<16) | ((Function) << 2) ) /* IOCTL codes */ #define NT_IOCTL_DATA NT_CTL_CODE(1) /* Write Only */ #define NT_IOCTL_CONTROL NT_CTL_CODE(2) /* Read/Write */ #define NT_IOCTL_STATUS NT_CTL_CODE(3) /* Read Only */ /* * Raw port access (PC-style port registers but within inversions) * Functions returning int may fail. */ /* The status pin functions operate in terms of these bits: */ enum ieee1284_status_bits { S1284_NFAULT = 0x08, S1284_SELECT = 0x10, S1284_PERROR = 0x20, S1284_NACK = 0x40, S1284_BUSY = 0x80, /* To convert those values into PC-style register values, use this: */ S1284_INVERTED = S1284_BUSY }; /* The control pin functions operate in terms of these bits: */ enum ieee1284_control_bits { C1284_NSTROBE = 0x01, C1284_NAUTOFD = 0x02, C1284_NINIT = 0x04, C1284_NSELECTIN = 0x08, /* To convert those values into PC-style register values, use this: */ C1284_INVERTED = (C1284_NSTROBE| C1284_NAUTOFD| C1284_NSELECTIN) }; #endif /* _PAR_NT_H */ hamlib-1.2.15.3/src/network.c0000644000175000017500000000773612044564477012574 00000000000000/* * Hamlib Interface - network communication low-level support * Copyright (c) 2000-2012 by Stephane Fillod * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * \addtogroup rig_internal * @{ */ /** * \brief Network port IO * \file network.c */ /* Forcing WINVER in MinGW yanks in getaddrinfo(), but locks out Win95/Win98 */ /* #define WINVER 0x0501 */ #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 #include #include #ifdef HAVE_NETINET_IN_H #include #endif #if HAVE_NETDB_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #elif HAVE_WS2TCPIP_H #include #endif #include "hamlib/rig.h" #include "network.h" #include "misc.h" #ifdef __MINGW32__ static int wsstarted; #endif /** * \brief Open network port using rig.state data * * Open Open network port using rig.state data. * NB: The signal PIPE will be ignored for the whole application. * * \param rp Port data structure (must spec port id eg hostname:port) * \param default_port Default network socket port * \return RIG_OK or < 0 if error */ int network_open(hamlib_port_t *rp, int default_port) { int fd; /* File descriptor for the port */ int status; struct addrinfo hints, *res; char *portstr; char hostname[FILPATHLEN] = "127.0.0.1"; char defaultportstr[8]; #ifdef __MINGW32__ WSADATA wsadata; if (!(wsstarted++) && WSAStartup(MAKEWORD(1,1), &wsadata) == SOCKET_ERROR) { rig_debug(RIG_DEBUG_ERR, "Error creating socket\n"); return -RIG_EIO; } #endif if (!rp) return -RIG_EINVAL; memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; if (rp->type.rig == RIG_PORT_UDP_NETWORK) hints.ai_socktype = SOCK_DGRAM; else hints.ai_socktype = SOCK_STREAM; if (rp->pathname[0] == ':') { portstr = rp->pathname+1; } else { strncpy(hostname, rp->pathname, FILPATHLEN-1); /* search last ':', because IPv6 may have some */ portstr = strrchr(hostname, ':'); if (portstr) { *portstr++ = '\0'; } else { sprintf(defaultportstr, "%d", default_port); portstr = defaultportstr; } } status=getaddrinfo(hostname, portstr, &hints, &res); if (status != 0) { rig_debug(RIG_DEBUG_ERR, "Cannot get host \"%s\": %s\n", rp->pathname, gai_strerror(errno)); return -RIG_ECONF; } /* we don't want a signal when connection get broken */ #ifdef SIGPIPE signal(SIGPIPE, SIG_IGN); #endif fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol); if (fd < 0) return -RIG_EIO; status = connect(fd, res->ai_addr, res->ai_addrlen); freeaddrinfo(res); if (status < 0) { rig_debug(RIG_DEBUG_ERR, "Cannot open NET device \"%s\": %s\n", rp->pathname, strerror(errno)); close(fd); return -RIG_EIO; } rp->fd = fd; return RIG_OK; } int network_close(hamlib_port_t *rp) { int ret; #ifdef __MINGW32__ ret = closesocket(rp->fd); if (--wsstarted) WSACleanup(); #else ret = close(rp->fd); #endif return ret; } /** @} */ hamlib-1.2.15.3/src/Makefile.am0000644000175000017500000000137112044564477012760 00000000000000INCLUDES = @INCLUDES@ @INCLTDL@ RIGSRC = rig.c serial.c misc.c register.c event.c cal.c conf.c tones.c \ rotator.c locator.c rot_reg.c rot_conf.c iofunc.c ext.c \ mem.c settings.c parallel.c usb_port.c debug.c network.c \ cm108.c lib_LTLIBRARIES = libhamlib.la libhamlib_la_SOURCES = $(RIGSRC) libhamlib_la_LDFLAGS = $(WINLDFLAGS) $(OSXLDFLAGS) -no-undefined -version-info @ABI_VERSION@:16:0 libhamlib_la_CFLAGS = -DIN_HAMLIB $(AM_CFLAGS) -DHAMLIB_MODULE_DIR=\"$(pkglibdir)\" libhamlib_la_LIBADD = @LIBLTDL@ $(top_builddir)/lib/libmisc.la \ @NET_LIBS@ @MATH_LIBS@ $(LIBUSB_LIBS) noinst_HEADERS = event.h misc.h serial.h iofunc.h cal.h tones.h \ rot_conf.h token.h idx_builtin.h register.h par_nt.h \ parallel.h usb_port.h network.h cm108.h hamlib-1.2.15.3/src/rot_conf.h0000644000175000017500000000213712044564477012707 00000000000000/* * Hamlib Interface - configuration header * Copyright (c) 2000,2001,2002 by Stephane Fillod and Frank Singleton * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROT_CONF_H #define _ROT_CONF_H 1 #include int frontrot_set_conf(ROT *rot, token_t token, const char *val); int frontrot_get_conf(ROT *rot, token_t token, char *val); #endif /* _ROT_CONF_H */ hamlib-1.2.15.3/src/usb_port.h0000644000175000017500000000214412044564477012731 00000000000000/* * Hamlib Interface - USB communication header * Copyright (c) 2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _USB_PORT_H #define _USB_PORT_H 1 #include #include "iofunc.h" __BEGIN_DECLS /* Hamlib internal use, see rig.c */ int usb_port_open(hamlib_port_t *p); int usb_port_close(hamlib_port_t *p); __END_DECLS #endif /* _USB_PORT_H */ hamlib-1.2.15.3/src/idx_builtin.h0000644000175000017500000001025612044564477013411 00000000000000/* * Hamlib Interface - setting2idx for builtin constants * Copyright (c) 2002-2005 by Stephane Fillod and Frank Singleton * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _IDX_BUILTIN_H #define _IDX_BUILTIN_H 1 #include /* * only for Hamlib internal use (backend caps) * This is a rig_setting2idx version that works for builtin_constant, * hence allowing its use in array initializers. The compiler simplifies * everything at compile time. * * struct rig_caps foo = { * .level_gran = { [LVL_PREAMP] = { .min = 0, .max = 20, .step = 10 } }, * } * * Of course, it can't work with setting2idx_builtin(RIG_LEVEL_XX|RIG_LEVEL_YY) */ #define setting2idx_builtin(s) ((s)==(1<<0)?0: \ (s)==(1<<1)?1: \ (s)==(1<<2)?2: \ (s)==(1<<3)?3: \ (s)==(1<<4)?4: \ (s)==(1<<5)?5: \ (s)==(1<<6)?6: \ (s)==(1<<7)?7: \ (s)==(1<<8)?8: \ (s)==(1<<9)?9: \ (s)==(1<<10)?10: \ (s)==(1<<11)?11: \ (s)==(1<<12)?12: \ (s)==(1<<13)?13: \ (s)==(1<<14)?14: \ (s)==(1<<15)?15: \ (s)==(1<<16)?16: \ (s)==(1<<17)?17: \ (s)==(1<<18)?18: \ (s)==(1<<19)?19: \ (s)==(1<<20)?20: \ (s)==(1<<21)?21: \ (s)==(1<<22)?22: \ (s)==(1<<23)?23: \ (s)==(1<<24)?24: \ (s)==(1<<25)?25: \ (s)==(1<<26)?26: \ (s)==(1<<27)?27: \ (s)==(1<<28)?28: \ (s)==(1<<29)?29: \ (s)==(1<<30)?30: \ (s)==(1<<31)?31: \ 0 \ ) #define LVL_PREAMP setting2idx_builtin(RIG_LEVEL_PREAMP) #define LVL_ATT setting2idx_builtin(RIG_LEVEL_ATT) #define LVL_VOX setting2idx_builtin(RIG_LEVEL_VOX) #define LVL_AF setting2idx_builtin(RIG_LEVEL_AF) #define LVL_RF setting2idx_builtin(RIG_LEVEL_RF) #define LVL_SQL setting2idx_builtin(RIG_LEVEL_SQL) #define LVL_IF setting2idx_builtin(RIG_LEVEL_IF) #define LVL_APF setting2idx_builtin(RIG_LEVEL_APF) #define LVL_NR setting2idx_builtin(RIG_LEVEL_NR) #define LVL_PBT_IN setting2idx_builtin(RIG_LEVEL_PBT_IN) #define LVL_PBT_OUT setting2idx_builtin(RIG_LEVEL_PBT_OUT) #define LVL_CWPITCH setting2idx_builtin(RIG_LEVEL_CWPITCH) #define LVL_RFPOWER setting2idx_builtin(RIG_LEVEL_RFPOWER) #define LVL_MICGAIN setting2idx_builtin(RIG_LEVEL_MICGAIN) #define LVL_KEYSPD setting2idx_builtin(RIG_LEVEL_KEYSPD) #define LVL_NOTCHF setting2idx_builtin(RIG_LEVEL_NOTCHF) #define LVL_COMP setting2idx_builtin(RIG_LEVEL_COMP) #define LVL_AGC setting2idx_builtin(RIG_LEVEL_AGC) #define LVL_BKINDL setting2idx_builtin(RIG_LEVEL_BKINDL) #define LVL_BALANCE setting2idx_builtin(RIG_LEVEL_BALANCE) #define LVL_METER setting2idx_builtin(RIG_LEVEL_METER) #define LVL_VOXGAIN setting2idx_builtin(RIG_LEVEL_VOXGAIN) #define LVL_VOXDELAY setting2idx_builtin(RIG_LEVEL_VOXDELAY) #define LVL_ANTIVOX setting2idx_builtin(RIG_LEVEL_ANTIVOX) #define LVL_RAWSTR setting2idx_builtin(RIG_LEVEL_RAWSTR) #define LVL_SQLSTAT setting2idx_builtin(RIG_LEVEL_SQLSTAT) #define LVL_SWR setting2idx_builtin(RIG_LEVEL_SWR) #define LVL_ALC setting2idx_builtin(RIG_LEVEL_ALC) #define LVL_STRENGTH setting2idx_builtin(RIG_LEVEL_STRENGTH) /*#define LVL_BWC setting2idx_builtin(RIG_LEVEL_BWC)*/ #define PARM_ANN setting2idx_builtin(RIG_PARM_ANN) #define PARM_APO setting2idx_builtin(RIG_PARM_APO) #define PARM_BACKLIGHT setting2idx_builtin(RIG_PARM_BACKLIGHT) #define PARM_BEEP setting2idx_builtin(RIG_PARM_BEEP) #define PARM_TIME setting2idx_builtin(RIG_PARM_TIME) #define PARM_BAT setting2idx_builtin(RIG_PARM_BAT) #define PARM_KEYLIGHT setting2idx_builtin(RIG_PARM_KEYLIGHT) #endif /* _IDX_BUILTIN_H */ hamlib-1.2.15.3/src/mem.c0000644000175000017500000007730412044564477011657 00000000000000/** \addtogroup rig * @{ */ /** * \file src/mem.c * \brief Memory and channel interface * \author Stephane Fillod * \date 2000-2011 * * Hamlib interface is a frontend implementing wrapper functions. * */ /* * Hamlib Interface - mem/channel calls * Copyright (c) 2000-2011 by Stephane Fillod * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #ifndef DOC_HIDDEN #define CHECK_RIG_ARG(r) (!(r) || !(r)->caps || !(r)->state.comm_state) #endif /* !DOC_HIDDEN */ /** * \brief set the current memory channel number * \param rig The rig handle * \param vfo The target VFO * \param ch The memory channel number * * Sets the current memory channel number. * It is not mandatory for the radio to be in memory mode. Actually * it depends on rigs. YMMV. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_mem() */ int HAMLIB_API rig_set_mem(RIG *rig, vfo_t vfo, int ch) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_mem == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_mem(rig, vfo, ch); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_mem(rig, vfo, ch); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief get the current memory channel number * \param rig The rig handle * \param vfo The target VFO * \param ch The location where to store the current memory channel number * * Retrieves the current memory channel number. * It is not mandatory for the radio to be in memory mode. Actually * it depends on rigs. YMMV. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_mem() */ int HAMLIB_API rig_get_mem(RIG *rig, vfo_t vfo, int *ch) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig) || !ch) return -RIG_EINVAL; caps = rig->caps; if (caps->get_mem == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->get_mem(rig, vfo, ch); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->get_mem(rig, vfo, ch); caps->set_vfo(rig, curr_vfo); return retcode; } /** * \brief set the current memory bank * \param rig The rig handle * \param vfo The target VFO * \param bank The memory bank * * Sets the current memory bank number. * It is not mandatory for the radio to be in memory mode. Actually * it depends on rigs. YMMV. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_mem() */ int HAMLIB_API rig_set_bank(RIG *rig, vfo_t vfo, int bank) { const struct rig_caps *caps; int retcode; vfo_t curr_vfo; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; caps = rig->caps; if (caps->set_bank == NULL) return -RIG_ENAVAIL; if ((caps->targetable_vfo&RIG_TARGETABLE_PURE) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) return caps->set_bank(rig, vfo, bank); if (!caps->set_vfo) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; retcode = caps->set_bank(rig, vfo, bank); caps->set_vfo(rig, curr_vfo); return retcode; } #ifndef DOC_HIDDEN /* * call on every ext_levels of a rig */ static int generic_retr_extl(RIG *rig, const struct confparams *cfp, rig_ptr_t ptr) { channel_t *chan = (channel_t *)ptr; struct ext_list *p; unsigned el_size = 0; if (chan->ext_levels == NULL) p = chan->ext_levels = malloc(2*sizeof(struct ext_list)); else { for (p = chan->ext_levels; !RIG_IS_EXT_END(*p); p++) el_size += sizeof(struct ext_list); chan->ext_levels = realloc(chan->ext_levels, el_size+sizeof(struct ext_list)); } if (!chan->ext_levels) { rig_debug(RIG_DEBUG_ERR, "%s:%d memory allocation error!\n", __FUNCTION__, __LINE__); return -RIG_ENOMEM; } p->token = cfp->token; rig_get_ext_level(rig, RIG_VFO_CURR, p->token, &p->val); p++; p->token = 0; /* RIG_EXT_END */ return 1; /* process them all */ } static const channel_cap_t mem_cap_all = { .bank_num = 1, .vfo = 1, .ant = 1, .freq = 1, .mode = 1, .width = 1, .tx_freq = 1, .tx_mode = 1, .tx_width = 1, .split = 1, .tx_vfo = 1, .rptr_shift = 1, .rptr_offs = 1, .tuning_step = 1, .rit = 1, .xit = 1, .funcs = (setting_t)-1, .levels = (setting_t)-1, .ctcss_tone = 1, .ctcss_sql = 1, .dcs_code = 1, .dcs_sql = 1, .scan_group = 1, .flags = 1, .channel_desc = 1, .ext_levels = 1, }; static int rig_mem_caps_empty(const channel_cap_t *mem_cap) { return !( mem_cap->bank_num || mem_cap->vfo || mem_cap->ant || mem_cap->freq || mem_cap->mode || mem_cap->width || mem_cap->tx_freq || mem_cap->tx_mode || mem_cap->tx_width || mem_cap->split || mem_cap->tx_vfo || mem_cap->rptr_shift || mem_cap->rptr_offs || mem_cap->tuning_step || mem_cap->rit || mem_cap->xit || mem_cap->funcs || mem_cap->levels || mem_cap->ctcss_tone || mem_cap->ctcss_sql || mem_cap->dcs_code || mem_cap->dcs_sql || mem_cap->scan_group || mem_cap->flags || mem_cap->channel_desc || mem_cap->ext_levels ); } /* * stores current VFO state into chan by emulating rig_get_channel */ static int generic_save_channel(RIG *rig, channel_t *chan) { int i, retval; int chan_num; vfo_t vfo; setting_t setting; const channel_cap_t *mem_cap = NULL; chan_num = chan->channel_num; vfo = chan->vfo; memset(chan, 0, sizeof(channel_t)); chan->channel_num = chan_num; chan->vfo = vfo; if (vfo == RIG_VFO_MEM) { const chan_t *chan_cap; chan_cap = rig_lookup_mem_caps(rig, chan_num); if (chan_cap) mem_cap = &chan_cap->mem_caps; } /* If vfo!=RIG_VFO_MEM or incomplete backend, try all properties */ if (mem_cap == NULL || rig_mem_caps_empty(mem_cap)) { mem_cap = &mem_cap_all; } if (mem_cap->freq) { retval = rig_get_freq(rig, RIG_VFO_CURR, &chan->freq); /* empty channel ? */ if (retval == -RIG_ENAVAIL || chan->freq == RIG_FREQ_NONE) return -RIG_ENAVAIL; } if (mem_cap->vfo) rig_get_vfo(rig, &chan->vfo); if (mem_cap->mode || mem_cap->width) rig_get_mode(rig, RIG_VFO_CURR, &chan->mode, &chan->width); chan->split = RIG_SPLIT_OFF; if (mem_cap->split) rig_get_split_vfo(rig, RIG_VFO_CURR, &chan->split, &chan->tx_vfo); if (chan->split != RIG_SPLIT_OFF) { if (mem_cap->tx_freq) rig_get_split_freq(rig, RIG_VFO_CURR, &chan->tx_freq); if (mem_cap->tx_mode || mem_cap->tx_width) rig_get_split_mode(rig, RIG_VFO_CURR, &chan->tx_mode, &chan->tx_width); } else { chan->tx_freq = chan->freq; chan->tx_mode = chan->mode; chan->tx_width = chan->width; } if (mem_cap->rptr_shift) rig_get_rptr_shift(rig, RIG_VFO_CURR, &chan->rptr_shift); if (mem_cap->rptr_offs) rig_get_rptr_offs(rig, RIG_VFO_CURR, &chan->rptr_offs); if (mem_cap->ant) rig_get_ant(rig, RIG_VFO_CURR, &chan->ant); if (mem_cap->tuning_step) rig_get_ts(rig, RIG_VFO_CURR, &chan->tuning_step); if (mem_cap->rit) rig_get_rit(rig, RIG_VFO_CURR, &chan->rit); if (mem_cap->xit) rig_get_xit(rig, RIG_VFO_CURR, &chan->xit); for (i=0; ilevels) && RIG_LEVEL_SET(setting)) rig_get_level(rig, RIG_VFO_CURR, setting, &chan->levels[i]); } for (i=0; ifuncs) && (rig_get_func(rig, RIG_VFO_CURR, setting, &fstatus) == RIG_OK)) chan->funcs |= fstatus ? setting : 0; } if (mem_cap->ctcss_tone) rig_get_ctcss_tone(rig, RIG_VFO_CURR, &chan->ctcss_tone); if (mem_cap->ctcss_sql) rig_get_ctcss_sql(rig, RIG_VFO_CURR, &chan->ctcss_sql); if (mem_cap->dcs_code) rig_get_dcs_code(rig, RIG_VFO_CURR, &chan->dcs_code); if (mem_cap->dcs_sql) rig_get_dcs_sql(rig, RIG_VFO_CURR, &chan->dcs_sql); /* * TODO: (missing calls) * - channel_desc * - bank_num * - scan_group * - flags */ rig_ext_level_foreach(rig, generic_retr_extl, (rig_ptr_t)chan); return RIG_OK; } /* * Restores chan into current VFO state by emulating rig_set_channel */ static int generic_restore_channel(RIG *rig, const channel_t *chan) { int i; struct ext_list *p; setting_t setting; const channel_cap_t *mem_cap = NULL; if (chan->vfo == RIG_VFO_MEM) { const chan_t *chan_cap; chan_cap = rig_lookup_mem_caps(rig, chan->channel_num); if (chan_cap) mem_cap = &chan_cap->mem_caps; } /* If vfo!=RIG_VFO_MEM or incomplete backend, try all properties */ if (mem_cap == NULL || rig_mem_caps_empty(mem_cap)) { mem_cap = &mem_cap_all; } rig_set_vfo(rig, chan->vfo); if (mem_cap->freq) rig_set_freq(rig, RIG_VFO_CURR, chan->freq); if (mem_cap->mode || mem_cap->width) rig_set_mode(rig, RIG_VFO_CURR, chan->mode, chan->width); rig_set_split_vfo(rig, RIG_VFO_CURR, chan->split, chan->tx_vfo); if (chan->split != RIG_SPLIT_OFF) { if (mem_cap->tx_freq) rig_set_split_freq(rig, RIG_VFO_CURR, chan->tx_freq); if (mem_cap->tx_mode || mem_cap->tx_width) rig_set_split_mode(rig, RIG_VFO_CURR, chan->tx_mode, chan->tx_width); } if (mem_cap->rptr_shift) rig_set_rptr_shift(rig, RIG_VFO_CURR, chan->rptr_shift); if (mem_cap->rptr_offs) rig_set_rptr_offs(rig, RIG_VFO_CURR, chan->rptr_offs); for (i=0; ilevels) rig_set_level(rig, RIG_VFO_CURR, setting, chan->levels[i]); } if (mem_cap->ant) rig_set_ant(rig, RIG_VFO_CURR, chan->ant); if (mem_cap->tuning_step) rig_set_ts(rig, RIG_VFO_CURR, chan->tuning_step); if (mem_cap->rit) rig_set_rit(rig, RIG_VFO_CURR, chan->rit); if (mem_cap->xit) rig_set_xit(rig, RIG_VFO_CURR, chan->xit); for (i=0; ifuncs) rig_set_func(rig, RIG_VFO_CURR, setting, chan->funcs & rig_idx2setting(i)); } if (mem_cap->ctcss_tone) rig_set_ctcss_tone(rig, RIG_VFO_CURR, chan->ctcss_tone); if (mem_cap->ctcss_sql) rig_set_ctcss_sql(rig, RIG_VFO_CURR, chan->ctcss_sql); if (mem_cap->dcs_code) rig_set_dcs_code(rig, RIG_VFO_CURR, chan->dcs_code); if (mem_cap->dcs_sql) rig_set_dcs_sql(rig, RIG_VFO_CURR, chan->dcs_sql); /* * TODO: (missing calls) * - channel_desc * - bank_num * - scan_group * - flags */ for (p = chan->ext_levels; p && !RIG_IS_EXT_END(*p); p++) rig_set_ext_level(rig, RIG_VFO_CURR, p->token, p->val); return RIG_OK; } #endif /* !DOC_HIDDEN */ /** * \brief set channel data * \param rig The rig handle * \param chan The location of data to set for this channel * * Sets the data associated with a channel. This channel can either * be the state of a VFO specified by \a chan->vfo, or a memory channel * specified with \a chan->vfo = RIG_VFO_MEM and \a chan->channel_num. * See #channel_t for more information. * * The rig_set_channel is supposed to have no impact on the current VFO * and memory number selected. Depending on backend and rig capabilities, * the chan struct may not be set completely. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_channel() */ int HAMLIB_API rig_set_channel(RIG *rig, const channel_t *chan) { struct rig_caps *rc; int curr_chan_num, get_mem_status = RIG_OK; vfo_t curr_vfo; vfo_t vfo; /* requested vfo */ int retcode; int can_emulate_by_vfo_mem, can_emulate_by_vfo_op; #ifdef PARANOID_CHANNEL_HANDLING channel_t curr_chan; #endif if (CHECK_RIG_ARG(rig) || !chan) return -RIG_EINVAL; /* * TODO: check validity of chan->channel_num */ rc = rig->caps; if (rc->set_channel) return rc->set_channel(rig, chan); /* * if not available, emulate it * Optional: get_vfo, set_vfo, */ vfo = chan->vfo; if (vfo == RIG_VFO_CURR) return generic_restore_channel(rig, chan); /* any emulation requires set_mem() */ if (vfo == RIG_VFO_MEM && !rc->set_mem) return -RIG_ENAVAIL; can_emulate_by_vfo_mem = rc->set_vfo && ((rig->state.vfo_list & RIG_VFO_MEM) == RIG_VFO_MEM); can_emulate_by_vfo_op = rc->vfo_op && rig_has_vfo_op(rig, RIG_OP_FROM_VFO); if (!can_emulate_by_vfo_mem && !can_emulate_by_vfo_op) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; /* may be needed if the restore_channel has some side effects */ #ifdef PARANOID_CHANNEL_HANDLING generic_save_channel(rig, &curr_chan); #endif if (vfo == RIG_VFO_MEM) get_mem_status = rig_get_mem(rig, RIG_VFO_CURR, &curr_chan_num); if (can_emulate_by_vfo_mem && curr_vfo != vfo) { retcode = rig_set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; } if (vfo == RIG_VFO_MEM) rig_set_mem(rig, RIG_VFO_CURR, chan->channel_num); retcode = generic_restore_channel(rig, chan); if (!can_emulate_by_vfo_mem && can_emulate_by_vfo_op) { retcode = rig_vfo_op(rig, RIG_VFO_CURR, RIG_OP_FROM_VFO); if (retcode != RIG_OK) return retcode; } /* restore current memory number */ if (vfo == RIG_VFO_MEM && get_mem_status == RIG_OK) rig_set_mem(rig, RIG_VFO_CURR, curr_chan_num); if (can_emulate_by_vfo_mem) rig_set_vfo(rig, curr_vfo); #ifdef PARANOID_CHANNEL_HANDLING generic_restore_channel(rig, &curr_chan); #endif return retcode; } /** * \brief get channel data * \param rig The rig handle * \param chan The location where to store the channel data * * Retrieves the data associated with a channel. This channel can either * be the state of a VFO specified by \a chan->vfo, or a memory channel * specified with \a chan->vfo = RIG_VFO_MEM and \a chan->channel_num. * See #channel_t for more information. * * Example: \code channel_t chan; int err; chan->vfo = RIG_VFO_MEM; chan->channel_num = 10; err = rig_get_channel(rig, &chan); if (err != RIG_OK) error("get_channel failed: %s", rigerror(err)); \endcode * * The rig_get_channel is supposed to have no impact on the current VFO * and memory number selected. Depending on backend and rig capabilities, * the chan struct may not be filled in completely. * * Note: chan->ext_levels is a pointer to a newly mallocated memory. * This is the responsability of the caller to manage and eventually * free it. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_channel() */ int HAMLIB_API rig_get_channel(RIG *rig, channel_t *chan) { struct rig_caps *rc; int curr_chan_num, get_mem_status = RIG_OK; vfo_t curr_vfo; vfo_t vfo; /* requested vfo */ int retcode; int can_emulate_by_vfo_mem, can_emulate_by_vfo_op; #ifdef PARANOID_CHANNEL_HANDLING channel_t curr_chan; #endif if (CHECK_RIG_ARG(rig) || !chan) return -RIG_EINVAL; /* * TODO: check validity of chan->channel_num */ rc = rig->caps; if (rc->get_channel) return rc->get_channel(rig, chan); /* * if not available, emulate it * Optional: get_vfo, set_vfo * TODO: check return codes */ vfo = chan->vfo; if (vfo == RIG_VFO_CURR) return generic_save_channel(rig, chan); /* any emulation requires set_mem() */ if (vfo == RIG_VFO_MEM && !rc->set_mem) return -RIG_ENAVAIL; can_emulate_by_vfo_mem = rc->set_vfo && ((rig->state.vfo_list & RIG_VFO_MEM) == RIG_VFO_MEM); can_emulate_by_vfo_op = rc->vfo_op && rig_has_vfo_op(rig, RIG_OP_TO_VFO); if (!can_emulate_by_vfo_mem && !can_emulate_by_vfo_op) return -RIG_ENTARGET; curr_vfo = rig->state.current_vfo; /* may be needed if the restore_channel has some side effects */ #ifdef PARANOID_CHANNEL_HANDLING generic_save_channel(rig, &curr_chan); #endif if (vfo == RIG_VFO_MEM) get_mem_status = rig_get_mem(rig, RIG_VFO_CURR, &curr_chan_num); if (can_emulate_by_vfo_mem && curr_vfo != vfo) { retcode = rig_set_vfo(rig, vfo); if (retcode != RIG_OK) return retcode; } if (vfo == RIG_VFO_MEM) rig_set_mem(rig, RIG_VFO_CURR, chan->channel_num); if (!can_emulate_by_vfo_mem && can_emulate_by_vfo_op) { retcode = rig_vfo_op(rig, RIG_VFO_CURR, RIG_OP_TO_VFO); if (retcode != RIG_OK) return retcode; } retcode = generic_save_channel(rig, chan); /* restore current memory number */ if (vfo == RIG_VFO_MEM && get_mem_status == RIG_OK) rig_set_mem(rig, RIG_VFO_CURR, curr_chan_num); if (can_emulate_by_vfo_mem) rig_set_vfo(rig, curr_vfo); #ifdef PARANOID_CHANNEL_HANDLING generic_restore_channel(rig, &curr_chan); #endif return retcode; } #ifndef DOC_HIDDEN int get_chan_all_cb_generic (RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) { int i,j,retval; chan_t *chan_list = rig->state.chan_list; channel_t *chan; for (i=0; !RIG_IS_CHAN_END(chan_list[i]) && i < CHANLSTSIZ; i++) { /* * setting chan to NULL means the application * has to provide a struct where to store data * future data for channel channel_num */ chan = NULL; retval = chan_cb(rig, &chan, chan_list[i].start, chan_list, arg); if (retval != RIG_OK) return retval; if (chan == NULL) return -RIG_ENOMEM; for (j = chan_list[i].start; j <= chan_list[i].end; j++) { int chan_next; chan->vfo = RIG_VFO_MEM; chan->channel_num = j; /* * TODO: if doesn't have rc->get_channel, special generic */ retval = rig_get_channel(rig, chan); if (retval == -RIG_ENAVAIL) { /* * empty channel * * Should it continue or call chan_cb with special arg? */ continue; } if (retval != RIG_OK) return retval; chan_next = j < chan_list[i].end ? j+1 : j; chan_cb(rig, &chan, chan_next, chan_list, arg); } } return RIG_OK; } int set_chan_all_cb_generic (RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) { int i,j,retval; chan_t *chan_list = rig->state.chan_list; channel_t *chan; for (i=0; !RIG_IS_CHAN_END(chan_list[i]) && i < CHANLSTSIZ; i++) { for (j = chan_list[i].start; j <= chan_list[i].end; j++) { chan_cb(rig, &chan, j, chan_list, arg); chan->vfo = RIG_VFO_MEM; retval = rig_set_channel(rig, chan); if (retval != RIG_OK) return retval; } } return RIG_OK; } struct map_all_s { channel_t *chans; const struct confparams *cfgps; value_t *vals; }; /* * chan_cb_t to be used for non cb get/set_all */ static int map_chan (RIG *rig, channel_t **chan, int channel_num, const chan_t *chan_list, rig_ptr_t arg) { struct map_all_s *map_arg = (struct map_all_s*)arg; /* TODO: check channel_num within start-end of chan_list */ *chan = &map_arg->chans[channel_num]; return RIG_OK; } #endif /* DOC_HIDDEN */ /** * \brief set all channel data, by callback * \param rig The rig handle * \param chan_cb Pointer to a callback function to provide channel data * \param arg Arbitrary argument passed back to \a chan_cb * * Write the data associated with a all the memory channels. * This is the preferred method to support clonable rigs. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_chan_all(), rig_get_chan_all_cb() */ int HAMLIB_API rig_set_chan_all_cb (RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) { struct rig_caps *rc; int retval; if (CHECK_RIG_ARG(rig) || !chan_cb) return -RIG_EINVAL; rc = rig->caps; if (rc->set_chan_all_cb) return rc->set_chan_all_cb(rig, chan_cb, arg); /* if not available, emulate it */ retval = set_chan_all_cb_generic (rig, chan_cb, arg); return retval; } /** * \brief get all channel data, by callback * \param rig The rig handle * \param chan_cb Pointer to a callback function to retrieve channel data * \param arg Arbitrary argument passed back to \a chan_cb * * Retrieves the data associated with a all the memory channels. * This is the preferred method to support clonable rigs. * * \a chan_cb is called first with no data in chan (chan equals NULL). * This means the application has to provide a struct where to store * future data for channel channel_num. If channel_num == chan->channel_num, * the application does not need to provide a new allocated structure. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_chan_all(), rig_set_chan_all_cb() */ int HAMLIB_API rig_get_chan_all_cb (RIG *rig, chan_cb_t chan_cb, rig_ptr_t arg) { struct rig_caps *rc; int retval; if (CHECK_RIG_ARG(rig) || !chan_cb) return -RIG_EINVAL; rc = rig->caps; if (rc->get_chan_all_cb) return rc->get_chan_all_cb(rig, chan_cb, arg); /* if not available, emulate it */ retval = get_chan_all_cb_generic (rig, chan_cb, arg); return retval; } /** * \brief set all channel data * \param rig The rig handle * \param chans The location of data to set for all channels * * Write the data associated with all the memory channels. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_set_chan_all_cb(), rig_get_chan_all() */ int HAMLIB_API rig_set_chan_all (RIG *rig, const channel_t chans[]) { struct rig_caps *rc; struct map_all_s map_arg; int retval; if (CHECK_RIG_ARG(rig) || !chans) return -RIG_EINVAL; rc = rig->caps; map_arg.chans = (channel_t *) chans; if (rc->set_chan_all_cb) return rc->set_chan_all_cb(rig, map_chan, (rig_ptr_t)&map_arg); /* if not available, emulate it */ retval = set_chan_all_cb_generic (rig, map_chan, (rig_ptr_t)&map_arg); return retval; } /** * \brief get all channel data * \param rig The rig handle * \param chans The location where to store all the channel data * * Retrieves the data associated with all the memory channels. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_chan_all_cb(), rig_set_chan_all() */ int HAMLIB_API rig_get_chan_all (RIG *rig, channel_t chans[]) { struct rig_caps *rc; struct map_all_s map_arg; int retval; if (CHECK_RIG_ARG(rig) || !chans) return -RIG_EINVAL; rc = rig->caps; map_arg.chans = chans; if (rc->get_chan_all_cb) return rc->get_chan_all_cb(rig, map_chan, (rig_ptr_t)&map_arg); /* * if not available, emulate it * * TODO: save_current_state, restore_current_state */ retval = get_chan_all_cb_generic (rig, map_chan, (rig_ptr_t)&map_arg); return retval; } int HAMLIB_API rig_copy_channel(RIG *rig, channel_t *dest, const channel_t *src) { struct ext_list *saved_ext_levels; int i; /* TODO: ext_levels[] of different sizes */ for (i=0; !RIG_IS_EXT_END(src->ext_levels[i]) && !RIG_IS_EXT_END(dest->ext_levels[i]); i++) { dest->ext_levels[i] = src->ext_levels[i]; } saved_ext_levels = dest->ext_levels; memcpy(dest, src, sizeof(channel_t)); dest->ext_levels = saved_ext_levels; return RIG_OK; } #ifndef DOC_HIDDEN static int map_parm (RIG *rig, const struct confparams *cfgps, value_t *value, rig_ptr_t arg) { return -RIG_ENIMPL; } int get_parm_all_cb_generic (RIG *rig, confval_cb_t parm_cb, rig_ptr_t cfgps, rig_ptr_t vals) { return -RIG_ENIMPL; } int set_parm_all_cb_generic (RIG *rig, confval_cb_t parm_cb, rig_ptr_t cfgps, rig_ptr_t vals) { return -RIG_ENIMPL; } #endif /* DOC_HIDDEN */ /** * \brief set all channel and non-channel data by call-back * \param rig The rig handle * \param chan_cb The callback for channel data * \param parm_cb The callback for non-channel(aka parm) data * \param arg Cookie passed to \a chan_cb and \a parm_cb * * Writes the data associated with all the memory channels, * and rigs memory parameters, by callback. * This is the preferred method to support clonable rigs. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_mem_all_cb(), rig_set_mem_all() * \todo finish coding and testing of mem_all functions */ int HAMLIB_API rig_set_mem_all_cb (RIG *rig, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t arg) { struct rig_caps *rc; int retval; if (CHECK_RIG_ARG(rig) || !chan_cb) return -RIG_EINVAL; rc = rig->caps; if (rc->set_mem_all_cb) return rc->set_mem_all_cb(rig, chan_cb, parm_cb, arg); /* if not available, emulate it */ retval = rig_set_chan_all_cb (rig, chan_cb, arg); if (retval != RIG_OK) return retval; #if 0 retval = rig_set_parm_all_cb (rig, parm_cb, arg); if (retval != RIG_OK) return retval; #else return -RIG_ENIMPL; #endif return retval; } /** * \brief get all channel and non-channel data by call-back * \param rig The rig handle * \param chan_cb The callback for channel data * \param parm_cb The callback for non-channel(aka parm) data * \param arg Cookie passed to \a chan_cb and \a parm_cb * * Retrieves the data associated with all the memory channels, * and rigs memory parameters, by callback. * This is the preferred method to support clonable rigs. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_mem_all_cb(), rig_set_mem_all() * * \todo get all parm's * \todo finish coding and testing of mem_all functions */ int HAMLIB_API rig_get_mem_all_cb (RIG *rig, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t arg) { struct rig_caps *rc; int retval; if (CHECK_RIG_ARG(rig) || !chan_cb) return -RIG_EINVAL; rc = rig->caps; if (rc->get_mem_all_cb) return rc->get_mem_all_cb(rig, chan_cb, parm_cb, arg); /* if not available, emulate it */ retval = rig_get_chan_all_cb (rig, chan_cb, arg); if (retval != RIG_OK) return retval; #if 0 retval = rig_get_parm_cb (rig, parm_cb, arg); if (retval != RIG_OK) return retval; #else return -RIG_ENIMPL; #endif return retval; } /** * \brief set all channel and non-channel data * \param rig The rig handle * \param chans Channel data * \param cfgps ?? * \param vals ?? * * Writes the data associated with all the memory channels, * and rigs memory parameters. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_mem_all(), rig_set_mem_all_cb() * * \todo set all parm's * \todo finish coding and testing of mem_all functions */ int HAMLIB_API rig_set_mem_all (RIG *rig, const channel_t chans[], const struct confparams cfgps[], const value_t vals[]) { struct rig_caps *rc; int retval; struct map_all_s mem_all_arg; if (CHECK_RIG_ARG(rig) || !chans || !cfgps || !vals) return -RIG_EINVAL; rc = rig->caps; mem_all_arg.chans = (channel_t *) chans; mem_all_arg.cfgps = cfgps; mem_all_arg.vals = (value_t *) vals; if (rc->set_mem_all_cb) return rc->set_mem_all_cb(rig, map_chan, map_parm, (rig_ptr_t)&mem_all_arg); /* if not available, emulate it */ retval = rig_set_chan_all (rig, chans); if (retval != RIG_OK) return retval; #if 0 retval = rig_set_parm_all (rig, parms); if (retval != RIG_OK) return retval; #else return -RIG_ENIMPL; #endif return retval; } /** * \brief get all channel and non-channel data * \param rig The rig handle * \param chans Array of channels where to store the data * \param cfgps Array of config parameters to retrieve * \param vals Array of values where to store the data * * Retrieves the data associated with all the memory channels, * and rigs memory parameters. * This is the preferred method to support clonable rigs. * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause is * set appropriately). * * \sa rig_get_mem_all(), rig_set_mem_all_cb() * \todo finish coding and testing of mem_all functions */ int HAMLIB_API rig_get_mem_all (RIG *rig, channel_t chans[], const struct confparams cfgps[], value_t vals[]) { struct rig_caps *rc; int retval; struct map_all_s mem_all_arg; if (CHECK_RIG_ARG(rig) || !chans || !cfgps || !vals) return -RIG_EINVAL; rc = rig->caps; mem_all_arg.chans = chans; mem_all_arg.cfgps = cfgps; mem_all_arg.vals = vals; if (rc->get_mem_all_cb) return rc->get_mem_all_cb(rig, map_chan, map_parm, (rig_ptr_t)&mem_all_arg); /* * if not available, emulate it * * TODO: save_current_state, restore_current_state */ retval = rig_get_chan_all (rig, chans); if (retval != RIG_OK) return retval; retval = get_parm_all_cb_generic (rig, map_parm, (rig_ptr_t)cfgps, (rig_ptr_t)vals); return retval; } /** * \brief lookup the memory type and capabilities * \param rig The rig handle * \param ch The memory channel number * * Lookup the memory type and capabilities associated with a channel number. * If \a ch equals RIG_MEM_CAPS_ALL, then a union of all the mem_caps sets * is returned (pointer to static memory). * * \return a pointer to a chan_t structure if the operation has been sucessful, * otherwise a NULL pointer, most probably because of incorrect channel number * or buggy backend. */ const chan_t * HAMLIB_API rig_lookup_mem_caps(RIG *rig, int ch) { chan_t *chan_list; static chan_t chan_list_all; int i, j; if (CHECK_RIG_ARG(rig)) return NULL; if (ch == RIG_MEM_CAPS_ALL) { memset (&chan_list_all, 0, sizeof(chan_list_all)); chan_list = rig->state.chan_list; chan_list_all.start = chan_list[0].start; chan_list_all.type = RIG_MTYPE_NONE; /* meaningless */ for (i=0; istate.chan_list; for (i=0; i= chan_list[i].start && ch <= chan_list[i].end) { return &chan_list[i]; } } return NULL; } /** * \brief get memory channel count * \param rig The rig handle * * Get the total memory channel count, computed from the rig caps * * \return the memory count */ int HAMLIB_API rig_mem_count(RIG *rig) { const chan_t *chan_list; int i, count; if (CHECK_RIG_ARG(rig)) return -RIG_EINVAL; chan_list = rig->state.chan_list; count = 0; for (i=0; i #include /* Standard input/output definitions */ #include /* String function definitions */ #include /* UNIX standard function definitions */ #include /* File control definitions */ #include /* Error number definitions */ #include #include #include #include "hamlib/rig.h" #include "iofunc.h" #include "misc.h" #include "serial.h" #include "parallel.h" #include "usb_port.h" #include "network.h" #include "cm108.h" /** * \brief Open a hamlib_port based on its rig port type * \param p rig port descriptor * \return status */ int HAMLIB_API port_open(hamlib_port_t *p) { int status; int want_state_delay = 0; p->fd = -1; switch(p->type.rig) { case RIG_PORT_SERIAL: status = serial_open(p); if (status < 0) return status; if (p->parm.serial.rts_state != RIG_SIGNAL_UNSET && p->parm.serial.handshake != RIG_HANDSHAKE_HARDWARE) { status = ser_set_rts(p, p->parm.serial.rts_state == RIG_SIGNAL_ON); want_state_delay = 1; } if (status != 0) return status; if (p->parm.serial.dtr_state != RIG_SIGNAL_UNSET) { status = ser_set_dtr(p, p->parm.serial.dtr_state == RIG_SIGNAL_ON); want_state_delay = 1; } if (status != 0) return status; /* * Wait whatever electrolytics in the circuit come up to voltage. * Is 100ms enough? Too much? */ if (want_state_delay) usleep(100*1000); break; case RIG_PORT_PARALLEL: status = par_open(p); if (status < 0) return status; break; case RIG_PORT_CM108: status = cm108_open(p); if (status < 0) return status; break; case RIG_PORT_DEVICE: status = open(p->pathname, O_RDWR, 0); if (status < 0) return -RIG_EIO; p->fd = status; break; case RIG_PORT_USB: status = usb_port_open(p); if (status < 0) return status; break; case RIG_PORT_NONE: case RIG_PORT_RPC: break; /* ez :) */ case RIG_PORT_NETWORK: case RIG_PORT_UDP_NETWORK: /* FIXME: hardcoded network port */ status = network_open(p, 4532); if (status < 0) return status; break; default: return -RIG_EINVAL; } return RIG_OK; } /** * \brief Close a hamlib_port * \param p rig port descriptor * \param port_type equivalent rig port type * \return status * * This function may also be used with ptt and dcd ports. */ int HAMLIB_API port_close(hamlib_port_t *p, rig_port_t port_type) { int ret = RIG_OK; if (p->fd != -1) { switch (port_type) { case RIG_PORT_SERIAL: ret = ser_close(p); break; case RIG_PORT_PARALLEL: ret = par_close(p); break; case RIG_PORT_CM108: ret = cm108_close(p); break; case RIG_PORT_USB: ret = usb_port_close(p); break; case RIG_PORT_NETWORK: case RIG_PORT_UDP_NETWORK: ret = network_close(p); break; default: rig_debug(RIG_DEBUG_ERR, "%s(): Unknown port type %d\n", __func__, port_type); /* fall through */ case RIG_PORT_DEVICE: ret = close(p->fd); } p->fd = -1; } return ret; } #if defined(WIN32) && !defined(HAVE_TERMIOS_H) #include "win32termios.h" /* On MinGW32/MSVC/.. the appropriate accessor must be used * depending on the port type, sigh. */ static ssize_t port_read(hamlib_port_t *p, void *buf, size_t count) { int i; ssize_t ret; if (p->type.rig == RIG_PORT_SERIAL) { ret = win32_serial_read(p->fd, buf, count); if (p->parm.serial.data_bits == 7) { unsigned char *pbuf = buf; /* clear MSB */ for (i=0; itype.rig == RIG_PORT_NETWORK || p->type.rig == RIG_PORT_UDP_NETWORK) return recv(p->fd, buf, count, 0); else return read(p->fd, buf, count); } static ssize_t port_write(hamlib_port_t *p, const void *buf, size_t count) { if (p->type.rig == RIG_PORT_SERIAL) return win32_serial_write(p->fd, buf, count); else if (p->type.rig == RIG_PORT_NETWORK || p->type.rig == RIG_PORT_UDP_NETWORK) return send(p->fd, buf, count, 0); else return write(p->fd, buf, count); } static int port_select(hamlib_port_t *p, int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) { #if 1 /* select does not work very well with writefds/exceptfds * So let's pretend there's none of them */ if (exceptfds) FD_ZERO(exceptfds); if (writefds) FD_ZERO(writefds); writefds = NULL; exceptfds = NULL; #endif if (p->type.rig == RIG_PORT_SERIAL) return win32_serial_select(n, readfds, writefds, exceptfds, timeout); else return select(n, readfds, writefds, exceptfds, timeout); } #else /* POSIX */ static ssize_t port_read(hamlib_port_t *p, void *buf, size_t count) { int i; ssize_t ret; if (p->type.rig == RIG_PORT_SERIAL && p->parm.serial.data_bits == 7) { unsigned char *pbuf = buf; ret = read(p->fd, buf, count); /* clear MSB */ for (i=0; ifd, buf, count); } } #define port_write(p,b,c) write((p)->fd,(b),(c)) #define port_select(p,n,r,w,e,t) select((n),(r),(w),(e),(t)) #endif /** * \brief Write a block of characters to an fd. * \param p rig port descriptor * \param txbuffer command sequence to be sent * \param count number of bytes to send * \return 0 = OK, <0 = NOK * * Write a block of count characters to port file descriptor, * with a pause between each character if write_delay is > 0 * * The write_delay is for Yaesu type rigs..require 5 character * sequence to be sent with 50-200msec between each char. * * Also, post_write_delay is for some Yaesu rigs (eg: FT747) that * get confused with sequential fast writes between cmd sequences. * * input: * * fd - file descriptor to write to * txbuffer - pointer to a command sequence array * count - count of byte to send from the txbuffer * write_delay - write delay in ms between 2 chars * post_write_delay - minimum delay between two writes * post_write_date - timeval of last write * * Actually, this function has nothing specific to serial comm, * it could work very well also with any file handle, like a socket. */ int HAMLIB_API write_block(hamlib_port_t *p, const char *txbuffer, size_t count) { int i, ret; #ifdef WANT_NON_ACTIVE_POST_WRITE_DELAY if (p->post_write_date.tv_sec != 0) { signed int date_delay; /* in us */ struct timeval tv; /* FIXME in Y2038 ... */ gettimeofday(&tv, NULL); date_delay = p->post_write_delay*1000 - ((tv.tv_sec - p->post_write_date.tv_sec)*1000000 + (tv.tv_usec - p->post_write_date.tv_usec)); if (date_delay > 0) { /* * optional delay after last write */ usleep(date_delay); } p->post_write_date.tv_sec = 0; } #endif if (p->write_delay > 0) { for (i=0; i < count; i++) { ret = port_write(p, txbuffer+i, 1); if (ret != 1) { rig_debug(RIG_DEBUG_ERR,"%s():%d failed %d - %s\n", __func__, __LINE__, ret, strerror(errno)); return -RIG_EIO; } usleep(p->write_delay*1000); } } else { ret = port_write(p, txbuffer, count); if (ret != count) { rig_debug(RIG_DEBUG_ERR,"%s():%d failed %d - %s\n", __func__, __LINE__, ret, strerror(errno)); return -RIG_EIO; } } if (p->post_write_delay > 0) { #ifdef WANT_NON_ACTIVE_POST_WRITE_DELAY #define POST_WRITE_DELAY_TRSHLD 10 if (p->post_write_delay > POST_WRITE_DELAY_TRSHLD) { struct timeval tv; gettimeofday(&tv, NULL); p->post_write_date.tv_sec = tv.tv_sec; p->post_write_date.tv_usec = tv.tv_usec; } else #endif usleep(p->post_write_delay*1000); /* optional delay after last write */ /* otherwise some yaesu rigs get confused */ /* with sequential fast writes*/ } rig_debug(RIG_DEBUG_TRACE,"%s(): TX %d bytes\n", __func__, count); dump_hex((unsigned char *) txbuffer,count); return RIG_OK; } /** * \brief Read bytes from an fd * \param p rig port descriptor * \param rxbuffer buffer to receive text * \param count number of bytes * \return count of bytes received * * Read "num" bytes from "fd" and put results into * an array of unsigned char pointed to by "rxbuffer" * * Blocks on read until timeout hits. * * It then reads "num" bytes into rxbuffer. * * Actually, this function has nothing specific to serial comm, * it could work very well also with any file handle, like a socket. */ int HAMLIB_API read_block(hamlib_port_t *p, char *rxbuffer, size_t count) { fd_set rfds, efds; struct timeval tv, tv_timeout, start_time, end_time, elapsed_time; int rd_count, total_count = 0; int retval; /* * Wait up to timeout ms. */ tv_timeout.tv_sec = p->timeout/1000; tv_timeout.tv_usec = (p->timeout%1000)*1000; /* Store the time of the read loop start */ gettimeofday(&start_time, NULL); while (count > 0) { tv = tv_timeout; /* select may have updated it */ FD_ZERO(&rfds); FD_SET(p->fd, &rfds); efds = rfds; retval = port_select(p, p->fd+1, &rfds, NULL, &efds, &tv); if (retval == 0) { /* Record timeout time and caculate elapsed time */ gettimeofday(&end_time, NULL); timersub(&end_time, &start_time, &elapsed_time); dump_hex((unsigned char *) rxbuffer, total_count); rig_debug(RIG_DEBUG_WARN, "%s(): Timed out %d.%d seconds after %d chars\n", __func__, elapsed_time.tv_sec, elapsed_time.tv_usec, total_count); return -RIG_ETIMEOUT; } if (retval < 0) { dump_hex((unsigned char *) rxbuffer, total_count); rig_debug(RIG_DEBUG_ERR,"%s(): select() error after %d chars: %s\n", __func__, total_count, strerror(errno)); return -RIG_EIO; } if (FD_ISSET(p->fd, &efds)) { rig_debug(RIG_DEBUG_ERR, "%s(): fd error after %d chars\n", __func__, total_count); return -RIG_EIO; } /* * grab bytes from the rig * The file descriptor must have been set up non blocking. */ rd_count = port_read(p, rxbuffer+total_count, count); if (rd_count < 0) { rig_debug(RIG_DEBUG_ERR, "%s(): read() failed - %s\n", __func__, strerror(errno)); return -RIG_EIO; } total_count += rd_count; count -= rd_count; } rig_debug(RIG_DEBUG_TRACE,"%s(): RX %d bytes\n", __func__, total_count); dump_hex((unsigned char *) rxbuffer, total_count); return total_count; /* return bytes count read */ } /** * \brief Read a string from an fd * \param p Hamlib port descriptor * \param rxbuffer buffer to receive string * \param rxmax maximum string size + 1 * \param stopset string of recognized end of string characters * \param stopset_len length of stopset * \return number of characters read if the operation has been sucessful, * otherwise a negative value if an error occured (in which case, cause is * set appropriately). * * Read a string from "fd" and put result into * an array of unsigned char pointed to by "rxbuffer" * * Blocks on read until timeout hits. * * It then reads characters until one of the characters in * "stopset" is found, or until "rxmax-1" characters was copied * into rxbuffer. String termination character is added at the end. * * Actually, this function has nothing specific to serial comm, * it could work very well also with any file handle, like a socket. * * Assumes rxbuffer!=NULL */ int HAMLIB_API read_string(hamlib_port_t *p, char *rxbuffer, size_t rxmax, const char *stopset, int stopset_len) { fd_set rfds, efds; struct timeval tv, tv_timeout, start_time, end_time, elapsed_time; int rd_count, total_count = 0; int retval; /* * Wait up to timeout ms. */ tv_timeout.tv_sec = p->timeout/1000; tv_timeout.tv_usec = (p->timeout%1000)*1000; /* Store the time of the read loop start */ gettimeofday(&start_time, NULL); while (total_count < rxmax-1) { tv = tv_timeout; /* select may have updated it */ FD_ZERO(&rfds); FD_SET(p->fd, &rfds); efds = rfds; retval = port_select(p, p->fd+1, &rfds, NULL, &efds, &tv); if (retval == 0) /* Timed out */ break; if (retval < 0) { dump_hex((unsigned char *) rxbuffer, total_count); rig_debug(RIG_DEBUG_ERR, "%s(): select() error after %d chars: %s\n", __func__, total_count, strerror(errno)); return -RIG_EIO; } if (FD_ISSET(p->fd, &efds)) { rig_debug(RIG_DEBUG_ERR, "%s(): fd error after %d chars\n", __func__, total_count); return -RIG_EIO; } /* * read 1 character from the rig, (check if in stop set) * The file descriptor must have been set up non blocking. */ rd_count = port_read(p, &rxbuffer[total_count], 1); if (rd_count < 0) { dump_hex((unsigned char *) rxbuffer, total_count); rig_debug(RIG_DEBUG_ERR, "%s(): read() failed - %s\n", __func__, strerror(errno)); return -RIG_EIO; } ++total_count; if (stopset && memchr(stopset, rxbuffer[total_count-1], stopset_len)) break; } /* * Doesn't hurt anyway. But be aware, some binary protocols may have * null chars within th received buffer. */ rxbuffer[total_count] = '\000'; if (total_count == 0) { /* Record timeout time and caculate elapsed time */ gettimeofday(&end_time, NULL); timersub(&end_time, &start_time, &elapsed_time); rig_debug(RIG_DEBUG_WARN, "%s(): Timed out %d.%d seconds without reading a character.\n", __func__, elapsed_time.tv_sec, elapsed_time.tv_usec); return -RIG_ETIMEOUT; } rig_debug(RIG_DEBUG_TRACE,"%s(): RX %d characters\n", __func__, total_count); dump_hex((unsigned char *) rxbuffer, total_count); return total_count; /* return bytes count read */ } /** @} */ hamlib-1.2.15.3/src/debug.c0000644000175000017500000001202712044564477012156 00000000000000/* * Hamlib Interface - debug * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * \addtogroup rig_internal * @{ */ /** * \file debug.c * \brief control hamlib debugging functions */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* Standard input/output definitions */ #include /* String function definitions */ #include /* UNIX standard function definitions */ #include /* File control definitions */ #include /* Error number definitions */ #include #include #include #include "misc.h" static int rig_debug_level = RIG_DEBUG_TRACE; static FILE *rig_debug_stream; static vprintf_cb_t rig_vprintf_cb; static rig_ptr_t rig_vprintf_arg; #define DUMP_HEX_WIDTH 16 /** * \param ptr Pointer to memory area * \param size Number of chars to words to dump * \brief Do a hex dump of the unsigned char array. */ void dump_hex(const unsigned char ptr[], size_t size) { /* example * 0000 4b 30 30 31 34 35 30 30 30 30 30 30 30 35 30 32 K001450000000502 * 0010 30 30 0d 0a 00.. */ char line[4 + 4 + 3 * DUMP_HEX_WIDTH + 4 + DUMP_HEX_WIDTH + 1]; unsigned char c; int i; if (!rig_need_debug(RIG_DEBUG_TRACE)) return; line[sizeof(line) - 1] = '\0'; for (i = 0; i < size; ++i) { if (i % DUMP_HEX_WIDTH == 0) { /* new line */ sprintf(line + 0, "%04x", i); memset(line + 4, ' ', sizeof(line) - 4 - 1); } c = ptr[i]; /* hex print */ sprintf(line + 8 + 3 * (i % DUMP_HEX_WIDTH), "%02x", c); line[8 + 3 * (i % DUMP_HEX_WIDTH) + 2] = ' '; /* no \0 */ /* ascii print */ line[8 + 3 * DUMP_HEX_WIDTH + 4 + (i % DUMP_HEX_WIDTH)] = (c >= ' ' && c < 0x7f) ? c : '.'; /* actually print the line */ if (i + 1 == size || (i && i % DUMP_HEX_WIDTH == DUMP_HEX_WIDTH - 1)) rig_debug(RIG_DEBUG_TRACE, "%s\n", line); } } /** * \param debug_level * \brief Change the current debug level */ void HAMLIB_API rig_set_debug(enum rig_debug_level_e debug_level) { rig_debug_level = debug_level; } /** * \param debug_level * \brief Useful for dump_hex, etc. * * This function compares the "needed" debug level to the level * set by rig_set_debug(). * * For example, rig_debug() calls this function and tests its return * value. If the return is false, the needed level for debugging output * to the console is higher than the set level and the debugging message * is supressed. * * \sa rig_set_debug */ int HAMLIB_API rig_need_debug(enum rig_debug_level_e debug_level) { return (debug_level <= rig_debug_level); } /** * \param debug_level * \param fmt * \brief Default is debugging messages are done through stderr */ void HAMLIB_API rig_debug(enum rig_debug_level_e debug_level, const char *fmt, ...) { va_list ap; if (!rig_need_debug(debug_level)) return; va_start(ap, fmt); if (rig_vprintf_cb) { rig_vprintf_cb(debug_level, rig_vprintf_arg, fmt, ap); } else { if (!rig_debug_stream) rig_debug_stream = stderr; vfprintf (rig_debug_stream, fmt, ap); } va_end(ap); } /** * \brief set callback to handle debug messages * \param cb The callback to install * \param arg A Pointer to some private data to pass later on to the callback * * Install a callback for \a rig_debug messages. \code int rig_message_cb (enum rig_debug_level_e debug_level, rig_ptr_t user_data, const char *fmt, va_list ap) { char buf[1024]; sprintf (buf, "Message(%s) ", (char*)user_data); syslog (LOG_USER, buf); vsprintf (buf, fmt, ap); syslog (LOG_USER, buf); return RIG_OK; } . . . char *cookie = "Foo"; rig_set_debug_callback (rig_message_cb, (rig_ptr_t)cookie); \endcode * * \return RIG_OK if the operation has been sucessful, otherwise * a negative value if an error occured (in which case, cause * is set appropriately). * * \sa rig_debug() */ vprintf_cb_t HAMLIB_API rig_set_debug_callback(vprintf_cb_t cb, rig_ptr_t arg) { vprintf_cb_t prev_cb = rig_vprintf_cb; rig_vprintf_cb = cb; rig_vprintf_arg = arg; return prev_cb; } /** * \brief change stderr to some different output * \param stream The stream to set output to */ FILE* HAMLIB_API rig_set_debug_file(FILE *stream) { FILE *prev_stream = rig_debug_stream; rig_debug_stream = stream; return prev_stream; } /** @} */ hamlib-1.2.15.3/README0000644000175000017500000001471012044564477011016 00000000000000Hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com) (C) Stephane Fillod 2000-2011 (C) The Hamlib Group 2000-2011 The purpose of this project is to provide stable, flexible, shared libraries that enable quicker development of Amateur Radio Equipment Control Applications. Many Amateur Radio Transceivers come with serial interfaces that allows software to control the radio. This project will endeavour to provide shared libraries that greatly simplify the application programmer's interaction with radio equipment and other controllable devices such as rotators, switches, etc. Supported Radios ---------------- The Hamlib Wiki page, Supported Radios, contains a snapshot of the supported radios at the time of the last Hamlib release. Go to http://www.hamlib.org to reach the Wiki. Hamlib Design ------------- The shared libs will provide functions for both radio control, and data retrieval from the radio. The structure of the libraries will be as follows. (1) There will be 1 frontend library "libhamlib" that provides the generic API for user applications. (2) There will be "n" backend libraries that "wrap" rig specific communications inside frontend API. (3) Frontend lib will load (on demand) the appropriate backend lib as required. Frontend Library ---------------- libhamlib.so - frontend lib that provides generic API for all RIG types. This is what Application programmers will "see". Backend Examples are: --------------------- 1.hamlib-yaesu.so will provide connectivity to Yaesu FT 747GX Transceiver, FT 847 "Earth Station", etc. via a standard API. 2. hamlib-xxxx.so will provide connectivity to the Wiz-bang moon-melter 101A (yikes..) Hamlib will also enable developers to develop professional looking GUI's towards a standard control library API, and they would not have to worry about the underlying connection towards physical hardware. Initially serial (RS232) connectivity will be handled, but we expect that IP (and other) connectivity will follow afterwards. Connection via a USB port is accomplished via the Linux kernel support. USB to serial converters are well supported. Other such devices may be supported as long as they present a serial (RS-232) interface to Hamlib. Availability ------------ Most distributions have the latest Hamlib release in their testing or alpha versions of their distribution. Check your package manager for the Hamlib version included in your distribution. Developing with Hamlib API -------------------------- C language API documentation is at: http://www.hamlib.org/index.php?title=Documentation Take a look at tests/README for more info on simple programming examples and test programs. C++ programming is supported and language bindings are available for Perl, Python, and TCL. A network daemon utility is also available for any programming language that supports network sockets (even netcat!). Recompiling ----------- Hamlib is entirely developed using GNU tools, under various Linux systems. The library may be recompiled by the familiar "three step": ./configure make sudo make install See the INSTALL file for more information. Contributing ------------ Consult the README.betatester and README.developer files in this directory if you feel like testing or helping with Hamlib development. Contributions of rig specifications and protocol documentation are highly encouraged. Do keep in mind that in some cases the manufacturer may not provide complete control information or it is only available under a Non-Disclosure Agreement (NDA). Any documentation *must* be publicly available so we can legally write and distribute Free Software supporting a given device. The Hamlib team is very interested to hear from you, how Hamlib builds and works on your system, especially on non-Linux system or non-PC systems. We try to make Hamlib as portable as possible. Please report in case of problems at hamlib-developer@lists.sourceforge.net Git email formatted patches or in unified diff format are welcome! Also, take a look at http://sourceforge.net/projects/hamlib/ Here you will find a mail list, link to the Wiki, and the latest releases. Feedback, questions, etc. about Hamlib are very welcome at the mail list: Hamlib Version Numbers ---------------------- Like other software projects, Hamlib uses a version numbering scheme to help program authors and users understand which releases are compatible and which are not. Hamlib releases now follow the format of: Major.minor.release.incremental Where Major: Equals 1 for this C language API implementation of rig control and won't change. Any successor that is a major code rewrite or differing implementation would have this number advanced (not too likely). Minor: Currently at 2, but can be advanced when changes to the API require client programs to be rewritten to continue to use Hamlib. This number has advanced a couple of times throughout the life of Hamlib. Advancement of the minor number is only for frontend API changes that require modification of client source. Also indicates ABI compatibility so that a program linked to an earlier 1.X.Y release will work with a later 1.X.Y release without recompiling. Release: This number advances when either new backend(s) or new rig model(s) to existing backend(s) are added. Advancing this number informs client program authors (and users of those programs) that new model/backend support has been added. Will also include bug fixes since the last Incremental release. Incremental: May be undefined (e.g. Hamlib 1.2.14) and would advance to 1 (e.g. Hamlib 1.2.14.1) for any bug fixes or feature additions to existing model(s) or backend(s), then to 2, etc. New rig models or backends are not included in Incremental. When Release is advanced, Incremental will reset to undefined and will not be included as part of the version number. Release schedule ---------------- Hamlib has in the past maintained a "ready when it's ready" philosophy. However, given that much of the Linux user base is now influenced by the Ubuntu distribution and its timed six month release schedule, Hamlib releases will be scheduled in advance of Ubuntu releases. Planned release dates for Hamlib are now 1 February and 1 August of each calendar year. Between those dates various Incremental releases will occur as development warrants. Have Fun / Frank S / Stephane F / The Hamlib Group 73's de vk3fcs/km5ws / f8cfe hamlib-1.2.15.3/pcr/0000755000175000017500000000000012044565017010766 500000000000000hamlib-1.2.15.3/pcr/pcr.h0000644000175000017500000000700412044564477011655 00000000000000/* * Hamlib PCR backend - main header * Copyright (c) 2001-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _PCR_H #define _PCR_H 1 #include "hamlib/rig.h" #include "token.h" /* ext_level's tokens */ #define TOK_EL_ANL TOKEN_BACKEND(1) #define TOK_EL_DIVERSITY TOKEN_BACKEND(2) #define BACKEND_VER "0.8" #define PCR_MAX_CMD_LEN 32 struct pcr_priv_data { struct pcr_rcvr { freq_t last_freq; int last_mode; int last_filter; int last_shift; int last_att; int last_agc; tone_t last_ctcss_sql; tone_t last_dcs_sql; float volume; float squelch; int raw_level; int squelch_status; } main_rcvr, sub_rcvr; vfo_t current_vfo; int auto_update; char info[100]; char cmd_buf[PCR_MAX_CMD_LEN]; char reply_buf[PCR_MAX_CMD_LEN]; int protocol; int firmware; int country; int options; int sync; powerstat_t power; }; struct pcr_priv_caps { unsigned int reply_size; unsigned int reply_offset; unsigned int always_sync; }; #define pcr_caps(rig) ((struct pcr_priv_caps *)(rig)->caps->priv) extern const tone_t pcr_ctcss_list[]; extern const tone_t pcr_dcs_list[]; int pcr_init(RIG *rig); int pcr_cleanup(RIG *rig); int pcr_open(RIG *rig); int pcr_close(RIG *rig); int pcr_set_vfo(RIG * rig, vfo_t vfo); int pcr_get_vfo(RIG * rig, vfo_t *vfo); int pcr_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int pcr_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int pcr_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int pcr_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); const char *pcr_get_info(RIG *rig); /* Added - G0WCW */ int pcr_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int pcr_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int pcr_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); int pcr_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int pcr_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val); int pcr_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone); int pcr_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone); int pcr_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *tone); int pcr_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t tone); int pcr_set_trn(RIG * rig, int trn); int pcr_decode_event(RIG *rig); int pcr_set_powerstat(RIG * rig, powerstat_t status); int pcr_get_powerstat(RIG * rig, powerstat_t *status); int pcr_get_dcd(RIG * rig, vfo_t vfo, dcd_t *dcd); /* ------------------------------------------------------------------ */ // int pcr_get_param(RIG *rig, setting_t parm, value_t *val); // int pcr_set_param(RIG *rig, setting_t parm, value_t *val); extern const struct rig_caps pcr1000_caps; extern const struct rig_caps pcr100_caps; extern const struct rig_caps pcr1500_caps; extern const struct rig_caps pcr2500_caps; #endif /* _PCR_H */ hamlib-1.2.15.3/pcr/pcr1500.c0000644000175000017500000001141712044564477012161 00000000000000/* * Hamlib PCR backend - PCR-1500 description * Copyright (c) 2001-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "pcr.h" #include "idx_builtin.h" #define PCR1500_MODES_WIDE ( RIG_MODE_AM | RIG_MODE_FM | RIG_MODE_WFM ) #define PCR1500_MODES_NAR ( RIG_MODE_CW | RIG_MODE_SSB ) #define PCR1500_MODES ( PCR1500_MODES_NAR | PCR1500_MODES_WIDE ) #define PCR1500_FUNC ( RIG_FUNC_NB | RIG_FUNC_TSQL | RIG_FUNC_NB | \ RIG_FUNC_ANF | RIG_FUNC_NR | RIG_FUNC_AFC ) #define PCR1500_LEVEL ( \ RIG_LEVEL_ATT | RIG_LEVEL_AF | RIG_LEVEL_SQL | RIG_LEVEL_IF | \ RIG_LEVEL_AGC | RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR | \ RIG_LEVEL_NR ) static const struct pcr_priv_caps pcr1500_priv = { .reply_size = 6, .reply_offset = 0, .always_sync = 0, }; /* * IC PCR1500 rigs capabilities. */ const struct rig_caps pcr1500_caps = { .rig_model = RIG_MODEL_PCR1500, .model_name = "IC-PCR1500", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_PCRECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 9600, /* lower speeds gave troubles */ .serial_rate_max = 38400, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 12, .post_write_delay = 2, .timeout = 400, .retry = 3, .has_get_func = PCR1500_FUNC, .has_set_func = PCR1500_FUNC, .has_get_level = PCR1500_LEVEL, .has_set_level = RIG_LEVEL_SET(PCR1500_LEVEL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, /* XXX check this */ [LVL_IF] = { .min = { .i = -1270 }, .max = { .i = 1270 }, .step = { .i = 10 } }, }, .parm_gran = {}, .ctcss_list = pcr_ctcss_list, .dcs_list = NULL, .preamp = { RIG_DBLST_END }, .attenuator = { 20, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = kHz(1.2), .targetable_vfo = 0, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END }, .rx_range_list1 = { { kHz(495), GHz(1.3), PCR1500_MODES_NAR, -1, -1, RIG_VFO_A}, { kHz(10), GHz(3.3)-kHz(1), PCR1500_MODES_WIDE, -1, -1, RIG_VFO_A}, RIG_FRNG_END }, .tx_range_list1 = { RIG_FRNG_END }, .rx_range_list2 = { { kHz(495), MHz(824) - 10, PCR1500_MODES_NAR, -1, -1, RIG_VFO_A }, { MHz(849) + 10, MHz(869) - 10, PCR1500_MODES_NAR, -1, -1, RIG_VFO_A }, { MHz(894) + 10, GHz(1.3), PCR1500_MODES_NAR, -1, -1, RIG_VFO_A }, { kHz(10), MHz(824) - 10, PCR1500_MODES_WIDE, -1, -1, RIG_VFO_A }, { MHz(849) + 10, MHz(869) - 10, PCR1500_MODES_WIDE, -1, -1, RIG_VFO_A }, { MHz(894) + 10, GHz(3.3)-kHz(1), PCR1500_MODES_WIDE, -1, -1, RIG_VFO_A }, RIG_FRNG_END }, .tx_range_list2 = { RIG_FRNG_END }, /* no TX ranges, this is a receiver */ .tuning_steps = { { PCR1500_MODES, Hz(1) }, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { { RIG_MODE_FM | RIG_MODE_AM, kHz(15) }, { RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_AM, kHz(2.8)}, { RIG_MODE_FM | RIG_MODE_AM, kHz(6) }, { RIG_MODE_WFM, kHz(230) }, { RIG_MODE_WFM | RIG_MODE_FM | RIG_MODE_AM, kHz(50) }, RIG_FLT_END, }, .priv = (void *) &pcr1500_priv, /* XXX fake */ .str_cal = { 3, { { 0, -60 }, { 127, 0 }, { 255, 60 } } }, .rig_init = pcr_init, .rig_cleanup = pcr_cleanup, .rig_open = pcr_open, .rig_close = pcr_close, .set_freq = pcr_set_freq, .get_freq = pcr_get_freq, .set_mode = pcr_set_mode, .get_mode = pcr_get_mode, .get_info = pcr_get_info, .set_level = pcr_set_level, .get_level = pcr_get_level, .set_func = pcr_set_func, .get_func = pcr_get_func, .set_ctcss_sql = pcr_set_ctcss_sql, .get_ctcss_sql = pcr_get_ctcss_sql, .set_trn = pcr_set_trn, .decode_event = pcr_decode_event, .set_powerstat = pcr_set_powerstat, .get_powerstat = pcr_get_powerstat, }; hamlib-1.2.15.3/pcr/pcr100.c0000644000175000017500000001117012044564477012070 00000000000000/* * Hamlib PCR backend - PCR-100 description * Copyright (c) 2001-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "pcr.h" #include "idx_builtin.h" #define PCR100_MODES ( RIG_MODE_AM | RIG_MODE_FM | RIG_MODE_WFM ) #define PCR100_FUNC ( RIG_FUNC_TSQL ) #define PCR100_LEVEL ( \ RIG_LEVEL_ATT | RIG_LEVEL_AF | RIG_LEVEL_SQL | RIG_LEVEL_IF | \ RIG_LEVEL_AGC | RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR ) static const struct confparams pcr_ext_levels[] = { { TOK_EL_ANL, "ANL", "Auto Noise Limiter", "Auto Noise Limiter", NULL, RIG_CONF_CHECKBUTTON }, { RIG_CONF_END, NULL, } }; static const struct pcr_priv_caps pcr100_priv = { .reply_size = 6, .reply_offset = 0, .always_sync = 0, }; /* * IC PCR100 rigs capabilities. */ const struct rig_caps pcr100_caps = { .rig_model = RIG_MODEL_PCR100, .model_name = "IC-PCR100", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_PCRECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 9600, /* slower speeds gave troubles */ .serial_rate_max = 38400, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 12, .post_write_delay = 2, .timeout = 400, .retry = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = PCR100_FUNC, .has_get_level = PCR100_LEVEL, .has_set_level = RIG_LEVEL_SET(PCR100_LEVEL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, /* XXX check this */ [LVL_IF] = { .min = { .i = -1270 }, .max = { .i = 1270 }, .step = { .i = 10 } }, }, .parm_gran = { }, .ctcss_list = pcr_ctcss_list, .dcs_list = NULL, .preamp = { RIG_DBLST_END }, .attenuator = { 20, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END }, .rx_range_list1 = { { kHz(10), GHz(1.3), PCR100_MODES, -1, -1, RIG_VFO_A }, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END }, .rx_range_list2 = { { kHz(10), MHz(824) - 10, PCR100_MODES, -1, -1, RIG_VFO_A }, { MHz(849) + 10, MHz(869) - 10, PCR100_MODES, -1, -1, RIG_VFO_A }, { MHz(894) + 10, GHz(1.3), PCR100_MODES, -1, -1, RIG_VFO_A }, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END }, /* no TX ranges, this is a receiver */ .tuning_steps = { { PCR100_MODES, Hz(1) }, RIG_TS_END, }, /* mode/filter list, remember: order matters! * first one is the default mode, the one given back * by rig_mode_normal(), the others must be sorted. */ .filters = { { RIG_MODE_AM | RIG_MODE_FM, kHz(15) }, { RIG_MODE_AM, kHz(2.8) }, { RIG_MODE_AM | RIG_MODE_FM, kHz(6) }, { RIG_MODE_AM | RIG_MODE_FM, kHz(50) }, { RIG_MODE_WFM, kHz(230) }, { RIG_MODE_WFM, kHz(50) }, RIG_FLT_END, }, .priv = (void *) &pcr100_priv, /* XXX verify */ .str_cal = { 7, { { 0, -60 }, { 160, 0 }, { 176, 20 }, { 192, 30 }, { 208, 40 }, { 224, 50 }, { 240, 60 }, } }, .extlevels = pcr_ext_levels, .rig_init = pcr_init, .rig_cleanup = pcr_cleanup, .rig_open = pcr_open, .rig_close = pcr_close, .set_freq = pcr_set_freq, .get_freq = pcr_get_freq, .set_mode = pcr_set_mode, .get_mode = pcr_get_mode, .get_info = pcr_get_info, .set_level = pcr_set_level, .get_level = pcr_get_level, .set_func = pcr_set_func, .get_func = pcr_get_func, .set_ext_level = pcr_set_ext_level, .set_ctcss_sql = pcr_set_ctcss_sql, .get_ctcss_sql = pcr_get_ctcss_sql, .set_trn = pcr_set_trn, .decode_event = pcr_decode_event, .set_powerstat = pcr_set_powerstat, .get_powerstat = pcr_get_powerstat, }; hamlib-1.2.15.3/pcr/Makefile.in0000644000175000017500000005025112044564554012763 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = pcr DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_pcr_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la \ $(top_builddir)/lib/libmisc.la am__objects_1 = pcr1000.lo pcr100.lo pcr1500.lo pcr2500.lo am_hamlib_pcr_la_OBJECTS = $(am__objects_1) pcr.lo hamlib_pcr_la_OBJECTS = $(am_hamlib_pcr_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_pcr_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(hamlib_pcr_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_pcr_la_SOURCES) DIST_SOURCES = $(hamlib_pcr_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ PCRSRCLIST = pcr1000.c pcr100.c pcr1500.c pcr2500.c pkglib_LTLIBRARIES = hamlib-pcr.la hamlib_pcr_la_SOURCES = $(PCRSRCLIST) pcr.c hamlib_pcr_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_pcr_la_LIBADD = $(top_builddir)/src/libhamlib.la \ $(top_builddir)/lib/libmisc.la noinst_HEADERS = pcr.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu pcr/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu pcr/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-pcr.la: $(hamlib_pcr_la_OBJECTS) $(hamlib_pcr_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_pcr_la_LINK) -rpath $(pkglibdir) $(hamlib_pcr_la_OBJECTS) $(hamlib_pcr_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcr100.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcr1000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcr1500.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcr2500.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/pcr/pcr1000.c0000644000175000017500000001062012044564477012147 00000000000000/* * Hamlib PCR backend - PCR-1000 description * Copyright (c) 2001-2009 by Stephane Fillod and Darren Hatcher * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "pcr.h" #include "idx_builtin.h" #define PCR1000_MODES ( RIG_MODE_AM | RIG_MODE_FM | RIG_MODE_WFM | RIG_MODE_CW | RIG_MODE_SSB ) #define PCR1000_FUNC ( RIG_FUNC_NB | RIG_FUNC_TSQL | RIG_FUNC_NB | \ RIG_FUNC_ANF | RIG_FUNC_NR | RIG_FUNC_AFC ) #define PCR1000_LEVEL ( \ RIG_LEVEL_ATT | RIG_LEVEL_AF | RIG_LEVEL_SQL | RIG_LEVEL_IF | \ RIG_LEVEL_AGC | RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR | \ RIG_LEVEL_NR ) static const struct pcr_priv_caps pcr1000_priv = { .reply_size = 6, .reply_offset = 1, .always_sync = 0, }; /* * IC PCR1000 rigs capabilities. */ const struct rig_caps pcr1000_caps = { .rig_model = RIG_MODEL_PCR1000, .model_name = "IC-PCR1000", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_PCRECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 9600, /* slower speeds gave troubles */ .serial_rate_max = 38400, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 12, .post_write_delay = 2, .timeout = 400, .retry = 3, .has_get_func = PCR1000_FUNC, .has_set_func = PCR1000_FUNC, .has_get_level = PCR1000_LEVEL, .has_set_level = RIG_LEVEL_SET(PCR1000_LEVEL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, /* XXX check this */ [LVL_IF] = { .min = { .i = -1270 }, .max = { .i = 1270 }, .step = { .i = 10 } }, }, .parm_gran = {}, .ctcss_list = pcr_ctcss_list, .dcs_list = NULL, .preamp = { RIG_DBLST_END }, .attenuator = { 20, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = kHz(1.2), .targetable_vfo = 0, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END }, .rx_range_list1 = { { kHz(10), GHz(1.3), PCR1000_MODES, -1, -1, RIG_VFO_A}, RIG_FRNG_END }, .tx_range_list1 = { RIG_FRNG_END }, .rx_range_list2 = { { kHz(10), MHz(824) - 10, PCR1000_MODES, -1, -1, RIG_VFO_A }, { MHz(849) + 10, MHz(869) - 10, PCR1000_MODES, -1, -1, RIG_VFO_A }, { MHz(894) + 10, GHz(1.3), PCR1000_MODES, -1, -1, RIG_VFO_A }, RIG_FRNG_END }, .tx_range_list2 = { RIG_FRNG_END }, /* no TX ranges, this is a receiver */ .tuning_steps = { { PCR1000_MODES, Hz(1) }, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { { RIG_MODE_FM | RIG_MODE_AM, kHz(15) }, { RIG_MODE_FM | RIG_MODE_AM, kHz(6) }, { RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_AM, kHz(2.8)}, { RIG_MODE_WFM, kHz(230) }, { RIG_MODE_WFM | RIG_MODE_FM | RIG_MODE_AM, kHz(50) }, RIG_FLT_END, }, .priv = (void *) &pcr1000_priv, /* XXX fake */ .str_cal = { 3, { { 0, -60 }, { 127, 0 }, { 255, 60 } } }, .rig_init = pcr_init, .rig_cleanup = pcr_cleanup, .rig_open = pcr_open, .rig_close = pcr_close, .set_freq = pcr_set_freq, .get_freq = pcr_get_freq, .set_mode = pcr_set_mode, .get_mode = pcr_get_mode, .get_info = pcr_get_info, .set_level = pcr_set_level, .get_level = pcr_get_level, .set_func = pcr_set_func, .get_func = pcr_get_func, .set_ctcss_sql = pcr_set_ctcss_sql, .get_ctcss_sql = pcr_get_ctcss_sql, .set_trn = pcr_set_trn, .decode_event = pcr_decode_event, .set_powerstat = pcr_set_powerstat, .get_powerstat = pcr_get_powerstat, }; hamlib-1.2.15.3/pcr/Makefile.am0000644000175000017500000000047312044564477012757 00000000000000PCRSRCLIST = pcr1000.c pcr100.c pcr1500.c pcr2500.c pkglib_LTLIBRARIES = hamlib-pcr.la hamlib_pcr_la_SOURCES = $(PCRSRCLIST) pcr.c hamlib_pcr_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_pcr_la_LIBADD = $(top_builddir)/src/libhamlib.la \ $(top_builddir)/lib/libmisc.la noinst_HEADERS = pcr.h hamlib-1.2.15.3/pcr/pcr.c0000644000175000017500000012164712044564477011662 00000000000000/* * Hamlib PCR backend - main file * Copyright (c) 2001-2005 by Darren Hatcher * Copyright (c) 2001-2010 by Stephane Fillod * Copyright (C) 2007-09 by Alessandro Zummo * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * Tested on * * (402) PCR100 fw 1.2, proto 1.0 (usb-to-serial) by IZ1PRB * (401) PCR1000 fw 1.0, proto 1.0 (serial) by KM3T * (403) PCR1500 fw 2.0, proto 2.0 (usb) by KM3T * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "register.h" #include "cal.h" #include "pcr.h" /* * modes in use by the "MD" command */ #define MD_LSB '0' #define MD_USB '1' #define MD_AM '2' #define MD_CW '3' #define MD_FM '5' #define MD_WFM '6' #define MD_DSTAR '7' /* PCR-2500 Only */ #define MD_P25 '8' /* PCR-2500 Only */ /* define 2.8kHz, 6kHz, 15kHz, 50kHz, and 230kHz */ #define FLT_2_8kHz '0' #define FLT_6kHz '1' #define FLT_15kHz '2' #define FLT_50kHz '3' #define FLT_230kHz '4' /* as returned by GD? */ #define OPT_UT106 (1 << 0) #define OPT_UT107 (1 << 4) /* * CTCSS sub-audible tones for PCR100 and PCR1000 * Don't even touch a single bit! indexes will be used in the protocol! * 51 tones, the 60.0 Hz tone is missing. */ const tone_t pcr_ctcss_list[] = { 670, 693, 710, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, 1365, 1413, 1462, 1514, 1567, 1598, 1622, 1655, 1679, 1713, 1738, 1773, 1799, 1835, 1862, 1899, 1928, 1966, 1995, 2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541, 0, }; /* * DTCS SQL code list * Don't even touch a single bit! indexes will be used in the protocol! * 104 codes */ const tone_t pcr_dcs_list[] = { 23, 25, 26, 31, 32, 36, 43, 47, 51, 53, 54, 65, 71, 72, 73, 74, 114, 115, 116, 122, 125, 131, 132, 134, 143, 145, 152, 155, 156, 162, 165, 172, 174, 205, 212, 223, 225, 226, 243, 244, 245, 246, 251, 252, 255, 261, 263, 265, 266, 271, 274, 306, 311, 315, 325, 331, 332, 343, 346, 351, 356, 364, 365, 371, 411, 412, 413, 423, 431, 432, 445, 446, 452, 454, 455, 462, 464, 465, 466, 503, 506, 516, 523, 526, 532, 546, 565, 606, 612, 624, 627, 631, 632, 654, 662, 664, 703, 712, 723, 731, 732, 734, 743, 754, 0, }; struct pcr_country { int id; char *name; }; struct pcr_country pcr_countries[] = { { 0x00, "Japan" }, { 0x01, "USA" }, { 0x02, "EUR/AUS" }, { 0x03, "FRA" }, { 0x04, "DEN" }, { 0x05, "CAN" }, { 0x06, "Generic 1" }, { 0x07, "Generic 2" }, { 0x08, "FCC Japan" }, { 0x09, "FCC USA" }, { 0x0A, "FCC EUR/AUS" }, { 0x0B, "FCC FRA" }, { 0x0C, "FCC DEN" }, { 0x0D, "FCC CAN" }, { 0x0E, "FCC Generic 1" }, { 0x0F, "FCC Generic 2" }, }; static int pcr_set_volume(RIG *rig, vfo_t vfo, float level); static int pcr_set_squelch(RIG *rig, vfo_t vfo, float level); static int pcr_set_if_shift(RIG *rig, vfo_t vfo, int level); static int pcr_set_agc(RIG *rig, vfo_t vfo, int status); // J45xx static int pcr_set_afc(RIG *rig, vfo_t vfo, int status); // LD820xx static int pcr_set_nb(RIG *rig, vfo_t vfo, int status); // J46xx static int pcr_set_attenuator(RIG *rig, vfo_t vfo, int status); // J47xx static int pcr_set_anl(RIG *rig, vfo_t vfo, int status); // J4Dxx static int pcr_set_diversity(RIG * rig, vfo_t vfo, int status); // J00xx on PCR-2500 static int pcr_set_bfo_shift(RIG *rig, vfo_t vfo, int level); // J4Axx static int pcr_set_vsc(RIG *rig, vfo_t vfo, int level); // J50xx static int pcr_set_dsp(RIG *rig, vfo_t vfo, int level); // J80xx static int pcr_set_dsp_state(RIG *rig, vfo_t vfo, int level); // J8100=off J8101=on #if 0 /* unused; re-enabled as needed. */ static int pcr_set_dsp_noise_reducer(RIG *rig, vfo_t vfo, int level); // J82xx #endif /* unused */ static int pcr_set_dsp_auto_notch(RIG *rig, vfo_t vfo, int level); // J83xx static int pcr_check_ok(RIG * rig); static int is_sub_rcvr(RIG * rig, vfo_t vfo); #define PCR_COUNTRIES (sizeof(pcr_countries) / sizeof(struct pcr_country)) #define is_valid_answer(x) \ ((x) == 'I' || (x) == 'G' || (x) == 'N' || (x) == 'H') static int pcr_read_block(RIG *rig, char *rxbuffer, size_t count) { int err; int read = 0, tries = 4; struct rig_state *rs = &rig->state; struct pcr_priv_caps *caps = pcr_caps(rig); struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv; rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); /* already in sync? */ if (priv->sync && !caps->always_sync) return read_block(&rs->rigport, rxbuffer, count); /* read first char */ do { char *p = &rxbuffer[0]; /* read first char */ err = read_block(&rs->rigport, p, 1); if (err < 0) return err; if (err != 1) return -RIG_EPROTO; /* validate */ if (*p != 0x0a && !is_valid_answer(*p)) continue; /* sync ok, read remaining chars */ read++; count--; p++; err = read_block(&rs->rigport, p, count); if (err < 0) { rig_debug(RIG_DEBUG_ERR, "%s: read failed - %s\n", __func__, strerror(errno)); return err; } if (err == count) { read += err; priv->sync = 1; } rig_debug(RIG_DEBUG_TRACE, "%s: RX %d bytes\n", __func__, read); return read; } while (--tries > 0); return -RIG_EPROTO; } /* expects a 4 byte buffer to parse */ static int pcr_parse_answer(RIG *rig, char *buf, int len) { struct rig_state *rs = &rig->state; struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv; rig_debug(RIG_DEBUG_TRACE, "%s: len = %d\n", __func__, len); if (len < 4) { priv->sync = 0; return -RIG_EPROTO; } if (strncmp("G000", buf, 4) == 0) return RIG_OK; if (strncmp("G001", buf, 4) == 0) return -RIG_ERJCTED; if (strncmp("H101", buf, 4) == 0) return RIG_OK; if (strncmp("H100", buf, 4) == 0) return -RIG_ERJCTED; if (buf[0] == 'I') { switch (buf[1]) { /* Main receiver */ case '0': sscanf(buf, "I0%02X", &priv->main_rcvr.squelch_status); return RIG_OK; case '1': sscanf(buf, "I1%02X", &priv->main_rcvr.raw_level); return RIG_OK; case '2': rig_debug(RIG_DEBUG_VERBOSE, "%s: Signal centering %c%c\n", __func__, buf[2], buf[3]); return RIG_OK; case '3': rig_debug(RIG_DEBUG_WARN, "%s: DTMF %c\n", __func__, buf[3]); return RIG_OK; /* Sub receiver (on PCR-2500..) - TBC */ case '4': sscanf(buf, "I4%02X", &priv->sub_rcvr.squelch_status); return RIG_OK; case '5': sscanf(buf, "I5%02X", &priv->sub_rcvr.raw_level); return RIG_OK; case '6': rig_debug(RIG_DEBUG_VERBOSE, "%s: Signal centering %c%c (Sub)\n", __func__, buf[2], buf[3]); return RIG_OK; case '7': rig_debug(RIG_DEBUG_WARN, "%s: DTMF %c (Sub)\n", __func__, buf[3]); return RIG_OK; } } else if (buf[0] == 'G') { switch (buf[1]) { case '2': /* G2 */ sscanf((char *) buf, "G2%d", &priv->protocol); return RIG_OK; case '4': /* G4 */ sscanf((char *) buf, "G4%d", &priv->firmware); return RIG_OK; case 'D': /* GD */ sscanf((char *) buf, "GD%d", &priv->options); return RIG_OK; case 'E': /* GE */ sscanf((char *) buf, "GE%d", &priv->country); return RIG_OK; } } priv->sync = 0; return -RIG_EPROTO; /* XXX bandscope */ } static int pcr_send(RIG * rig, const char *cmd) { int err; struct rig_state *rs = &rig->state; struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv; int len = strlen(cmd); rig_debug(RIG_DEBUG_TRACE, "%s: cmd = %s, len = %d\n", __func__, cmd, len); /* XXX check max len */ memcpy(priv->cmd_buf, cmd, len); /* append cr */ /* XXX not required in auto update mode? (should not harm) */ priv->cmd_buf[len+0] = 0x0a; rs->hold_decode = 1; err = write_block(&rs->rigport, priv->cmd_buf, len + 1); rs->hold_decode = 0; return err; } static int pcr_transaction(RIG * rig, const char *cmd) { int err; struct rig_state *rs = &rig->state; struct pcr_priv_caps *caps = pcr_caps(rig); struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv; rig_debug(RIG_DEBUG_TRACE, "%s: cmd = %s\n", __func__, cmd); if (!priv->auto_update) serial_flush(&rs->rigport); pcr_send(rig, cmd); /* the pcr does not give ack in auto update mode */ if (priv->auto_update) return RIG_OK; err = pcr_read_block(rig, priv->reply_buf, caps->reply_size); if (err < 0) { rig_debug(RIG_DEBUG_ERR, "%s: read error, %s\n", __func__, strerror(errno)); return err; } if (err != caps->reply_size) { priv->sync = 0; return -RIG_EPROTO; } return pcr_parse_answer(rig, &priv->reply_buf[caps->reply_offset], err); } static int pcr_set_comm_speed(RIG *rig, int rate) { int err; const char *rate_cmd; /* limit maximum rate */ if (rate > 38400) rate = 38400; switch (rate) { case 300: rate_cmd = "G100"; break; case 1200: rate_cmd = "G101"; break; case 2400: rate_cmd = "G102"; break; case 9600: default: rate_cmd = "G103"; break; case 19200: rate_cmd = "G104"; break; case 38400: rate_cmd = "G105"; break; } rig_debug(RIG_DEBUG_VERBOSE, "%s: setting speed to %d with %s\n", __func__, rate, rate_cmd); /* the answer will be sent at the new baudrate, * so we do not use pcr_transaction */ err = pcr_send(rig, rate_cmd); if (err != RIG_OK) return err; rig->state.rigport.parm.serial.rate = rate; serial_setup(&rig->state.rigport); /* check if the pcr is still alive */ return pcr_check_ok(rig); } /* Basically, it sets up *priv */ int pcr_init(RIG * rig) { struct pcr_priv_data *priv; if (!rig) return -RIG_EINVAL; priv = (struct pcr_priv_data *) malloc(sizeof(struct pcr_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } memset(priv, 0x00, sizeof(struct pcr_priv_data)); /* * FIXME: how can we retrieve initial status? * The protocol doesn't allow this. */ /* Some values are already at zero due to the memset above, * but we reinitialize here for sake of completeness */ priv->country = -1; priv->sync = 0; priv->power = RIG_POWER_OFF; priv->main_rcvr.last_att = 0; priv->main_rcvr.last_agc = 0; priv->main_rcvr.last_ctcss_sql = 0; priv->main_rcvr.last_freq = MHz(145); priv->main_rcvr.last_mode = MD_FM; priv->main_rcvr.last_filter = FLT_15kHz; priv->main_rcvr.volume = 0.25; priv->main_rcvr.squelch = 0.00; priv->sub_rcvr = priv->main_rcvr; priv->current_vfo = RIG_VFO_MAIN; rig->state.priv = (rig_ptr_t) priv; rig->state.transceive = RIG_TRN_OFF; return RIG_OK; } /* * PCR Generic pcr_cleanup routine * the serial port is closed by the frontend */ int pcr_cleanup(RIG * rig) { if (!rig) return -RIG_EINVAL; free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * pcr_open * - send power on * - set auto update off * * Assumes rig!=NULL */ int pcr_open(RIG * rig) { struct rig_state *rs = &rig->state; struct pcr_priv_data *priv = (struct pcr_priv_data *) rs->priv; int err; int wanted_serial_rate; int startup_serial_rate; /* * initial communication is at 9600bps for PCR 100/1000 * once the power is on, the serial speed can be changed with G1xx */ if (rig->caps->rig_model == RIG_MODEL_PCR1500 || rig->caps->rig_model == RIG_MODEL_PCR2500) startup_serial_rate = 38400; else startup_serial_rate = 9600; wanted_serial_rate = rs->rigport.parm.serial.rate; rs->rigport.parm.serial.rate = startup_serial_rate; serial_setup(&rs->rigport); /* let the pcr settle and flush any remaining data*/ usleep(100*1000); serial_flush(&rs->rigport); /* try powering on twice, sometimes the pcr answers H100 (off) */ pcr_send(rig, "H101"); usleep(100*250); pcr_send(rig, "H101"); usleep(100*250); serial_flush(&rs->rigport); /* return RIG_ERJCTED if power is off */ err = pcr_transaction(rig, "H1?"); if (err != RIG_OK) return err; priv->power = RIG_POWER_ON; /* turn off auto update (just to be sure) */ err = pcr_transaction(rig, "G300"); if (err != RIG_OK) return err; /* set squelch and volume */ err = pcr_set_squelch(rig, RIG_VFO_MAIN, priv->main_rcvr.squelch); if (err != RIG_OK) return err; err = pcr_set_volume(rig, RIG_VFO_MAIN, priv->main_rcvr.volume); if (err != RIG_OK) return err; /* get device features */ pcr_get_info(rig); /* tune to last freq */ err = pcr_set_freq(rig, RIG_VFO_MAIN, priv->main_rcvr.last_freq); if (err != RIG_OK) return err; if ((rig->state.vfo_list & RIG_VFO_SUB) == RIG_VFO_SUB) { err = pcr_set_squelch(rig, RIG_VFO_SUB, priv->sub_rcvr.squelch); if (err != RIG_OK) return err; err = pcr_set_volume(rig, RIG_VFO_SUB, priv->sub_rcvr.volume); if (err != RIG_OK) return err; err = pcr_set_freq(rig, RIG_VFO_SUB, priv->sub_rcvr.last_freq); if (err != RIG_OK) return err; pcr_set_vfo(rig, RIG_VFO_MAIN); } /* switch to different speed if requested */ if (wanted_serial_rate != startup_serial_rate && wanted_serial_rate >= 300) return pcr_set_comm_speed(rig, wanted_serial_rate); return RIG_OK; } /* * pcr_close - send power off * Assumes rig!=NULL */ int pcr_close(RIG * rig) { struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; /* when the pcr turns itself off sometimes we receive * a malformed answer, so don't check for it. */ priv->power = RIG_POWER_OFF; return pcr_send(rig, "H100"); } /* * pcr_set_vfo * * Only useful on PCR-2500 which is a double receiver. * Simply remember what the current VFO is for RIG_VFO_CURR. */ int pcr_set_vfo(RIG * rig, vfo_t vfo) { struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo = %s\n", __func__, rig_strvfo(vfo)); switch (vfo) { case RIG_VFO_MAIN: case RIG_VFO_SUB: break; default: return -RIG_EINVAL; } priv->current_vfo = vfo; return RIG_OK; } int pcr_get_vfo(RIG * rig, vfo_t *vfo) { struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; *vfo = priv->current_vfo; return RIG_OK; } /* * pcr_set_freq * Assumes rig!=NULL * * K0GMMMKKKHHHmmff00 * GMMMKKKHHH is frequency GHz.MHz.KHz.Hz * mm is the mode setting * 00 = LSB * 01 = USB * 02 = AM * 03 = CW * 04 = Not used or Unknown * 05 = NFM * 06 = WFM * ff is the filter setting * 00 = 2.8 Khz (CW USB LSB AM) * 01 = 6.0 Khz (CW USB LSB AM NFM) * 02 = 15 Khz (AM NFM) * 03 = 50 Khz (AM NFM WFM) * 04 = 230 Khz (WFM) * */ int pcr_set_freq(RIG * rig, vfo_t vfo, freq_t freq) { struct pcr_priv_data *priv; struct pcr_rcvr *rcvr; unsigned char buf[20]; int freq_len, err; rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo = %s, freq = %.0f\n", __func__, rig_strvfo(vfo), freq); priv = (struct pcr_priv_data *) rig->state.priv; rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; freq_len = sprintf((char *) buf, "K%c%010" PRIll "0%c0%c00", is_sub_rcvr(rig, vfo) ? '1':'0', (int64_t) freq, rcvr->last_mode, rcvr->last_filter); buf[freq_len] = '\0'; err = pcr_transaction(rig, (char *) buf); if (err != RIG_OK) return err; rcvr->last_freq = freq; return RIG_OK; } /* * pcr_get_freq * frequency can't be read back, so report the last one that was set. * Assumes rig != NULL, freq != NULL */ int pcr_get_freq(RIG * rig, vfo_t vfo, freq_t * freq) { struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; struct pcr_rcvr *rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; *freq = rcvr->last_freq; return RIG_OK; } /* * pcr_set_mode * Assumes rig != NULL */ int pcr_set_mode(RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; struct pcr_rcvr *rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; unsigned char buf[20]; int buf_len, err; int pcrmode, pcrfilter; rig_debug(RIG_DEBUG_VERBOSE, "%s: mode = %d (%s), width = %d\n", __func__, mode, rig_strrmode(mode), width); /* XXX? */ if (mode == RIG_MODE_NONE) mode = RIG_MODE_FM; /* * not so sure about modes and filters * as I write this from manual (no testing) --SF */ switch (mode) { case RIG_MODE_CW: pcrmode = MD_CW; break; case RIG_MODE_USB: pcrmode = MD_USB; break; case RIG_MODE_LSB: pcrmode = MD_LSB; break; case RIG_MODE_AM: pcrmode = MD_AM; break; case RIG_MODE_WFM: pcrmode = MD_WFM; break; case RIG_MODE_FM: pcrmode = MD_FM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %d\n", __func__, mode); return -RIG_EINVAL; } if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); rig_debug(RIG_DEBUG_VERBOSE, "%s: will set to %d\n", __func__, width); switch (width) { /* nop, pcrfilter already set * TODO: use rig_passband_normal instead? */ case s_kHz(2.8): pcrfilter = FLT_2_8kHz; break; case s_kHz(6): pcrfilter = FLT_6kHz; break; case s_kHz(15): pcrfilter = FLT_15kHz; break; case s_kHz(50): pcrfilter = FLT_50kHz; break; case s_kHz(230): pcrfilter = FLT_230kHz; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported width %d\n", __func__, width); return -RIG_EINVAL; } rig_debug(RIG_DEBUG_VERBOSE, "%s: filter set to %d (%c)\n", __func__, width, pcrfilter); buf_len = sprintf((char *) buf, "K%c%010" PRIll "0%c0%c00", is_sub_rcvr(rig, vfo) ? '1':'0', (int64_t) rcvr->last_freq, pcrmode, pcrfilter); if (buf_len < 0) return -RIG_ETRUNC; err = pcr_transaction(rig, (char *) buf); if (err != RIG_OK) return err; rig_debug(RIG_DEBUG_VERBOSE, "%s: saving values\n", __func__); rcvr->last_mode = pcrmode; rcvr->last_filter = pcrfilter; return RIG_OK; } /* * hack! pcr_get_mode * Assumes rig!=NULL, mode!=NULL */ int pcr_get_mode(RIG * rig, vfo_t vfo, rmode_t * mode, pbwidth_t * width) { struct pcr_priv_data *priv; struct pcr_rcvr *rcvr; priv = (struct pcr_priv_data *) rig->state.priv; rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; rig_debug(RIG_DEBUG_VERBOSE, "%s, last_mode = %c, last_filter = %c\n", __func__, rcvr->last_mode, rcvr->last_filter); switch (rcvr->last_mode) { case MD_CW: *mode = RIG_MODE_CW; break; case MD_USB: *mode = RIG_MODE_USB; break; case MD_LSB: *mode = RIG_MODE_LSB; break; case MD_AM: *mode = RIG_MODE_AM; break; case MD_WFM: *mode = RIG_MODE_WFM; break; case MD_FM: *mode = RIG_MODE_FM; break; default: rig_debug(RIG_DEBUG_ERR, "pcr_get_mode: unsupported mode %d\n", rcvr->last_mode); return -RIG_EINVAL; } switch (rcvr->last_filter) { case FLT_2_8kHz: *width = kHz(2.8); break; case FLT_6kHz: *width = kHz(6); break; case FLT_15kHz: *width = kHz(15); break; case FLT_50kHz: *width = kHz(50); break; case FLT_230kHz: *width = kHz(230); break; default: rig_debug(RIG_DEBUG_ERR, "pcr_get_mode: unsupported " "width %d\n", rcvr->last_filter); return -RIG_EINVAL; } return RIG_OK; } /* * pcr_get_info * Assumes rig!=NULL */ const char * pcr_get_info(RIG * rig) { struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; char *country = NULL; pcr_transaction(rig, "G2?"); /* protocol */ pcr_transaction(rig, "G4?"); /* firmware */ pcr_transaction(rig, "GD?"); /* options */ pcr_transaction(rig, "GE?"); /* country */ /* translate country id to name */ if (priv->country > -1) { int i; for (i = 0; i < PCR_COUNTRIES; i++) { if (pcr_countries[i].id == priv->country) { country = pcr_countries[i].name; break; } } if (country == NULL) { country = "Unknown"; rig_debug(RIG_DEBUG_ERR, "%s: unknown country code %#x, " "please report to Hamlib maintainer\n", __func__, priv->country); } } else { country = "Not queried yet"; } sprintf(priv->info, "Firmware v%d.%d, Protocol v%d.%d, " "Optional devices:%s%s%s, Country: %s", priv->firmware / 10, priv->firmware % 10, priv->protocol / 10, priv->protocol % 10, priv->options & OPT_UT106 ? " DSP" : "", priv->options & OPT_UT107 ? " DARC" : "", priv->options ? "" : " none", country); rig_debug(RIG_DEBUG_VERBOSE, "%s: Firmware v%d.%d, Protocol v%d.%d, " "Optional devices:%s%s%s, Country: %s\n", __func__, priv->firmware / 10, priv->firmware % 10, priv->protocol / 10, priv->protocol % 10, priv->options & OPT_UT106 ? " DSP" : "", priv->options & OPT_UT107 ? " DARC" : "", priv->options ? "" : " none", country); return priv->info; } /* *********************************************************************** */ /* load of new stuff added in by Darren Hatcher - G0WCW */ /* *********************************************************************** */ /* * pcr_set_level called by generic set level handler * * We are missing a way to set the BFO on/off here, */ int pcr_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val) { int err = -RIG_ENIMPL; if (RIG_LEVEL_IS_FLOAT(level)) rig_debug(RIG_DEBUG_VERBOSE, "%s: level = %d, val = %f\n", __func__, level, val.f); else rig_debug(RIG_DEBUG_VERBOSE, "%s: level = %d, val = %d\n", __func__, level, val.i); switch (level) { case RIG_LEVEL_ATT: /* This is only on or off, but hamlib forces to use set level * and pass as a float. Here we'll use 0 for off and 1 for on. * If someone finds out how to set the ATT for the PCR in dB, let us * know and the function can be changed to allow a true set level. * * Experiment shows it seems to have an effect, but unsure by how many db */ return pcr_set_attenuator(rig, vfo, val.i); case RIG_LEVEL_IF: return pcr_set_if_shift(rig, vfo, val.i); case RIG_LEVEL_CWPITCH: /* BFO */ return pcr_set_bfo_shift(rig, vfo, val.i); case RIG_LEVEL_AGC: /* Only AGC on/off supported by PCR's */ return pcr_set_agc(rig, vfo, val.i==RIG_AGC_OFF ? 0 : 1); /* floats */ case RIG_LEVEL_AF: /* "val" can be 0.0 to 1.0 float which is 0 to 255 levels * 0.3 seems to be ok in terms of loudness */ return pcr_set_volume(rig, vfo, val.f); case RIG_LEVEL_SQL: /* "val" can be 0.0 to 1.0 float * .... rig supports 0 to FF - look at function for * squelch "bands" */ return pcr_set_squelch(rig, vfo, val.f); case RIG_LEVEL_NR: /* This selectss the DSP unit - this isn't a level per se, * but in the manual it says that we have to switch it on first * we'll assume 1 is for the UT-106, and anything else as off * * Later on we can set if the DSP features are on or off in set_func */ return pcr_set_dsp(rig, vfo, (int) val.f); } return err; } /* * pcr_get_level * * This needs a set of stored variables as the PCR doesn't return the current status of settings. * So we'll need to store them as we go along and keep them in sync. */ int pcr_get_level(RIG * rig, vfo_t vfo, setting_t level, value_t * val) { int err; struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; struct pcr_rcvr *rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; // rig_debug(RIG_DEBUG_TRACE, "%s: level = %d\n", __func__, level); switch (level) { case RIG_LEVEL_SQL: val->f = rcvr->squelch; return RIG_OK; case RIG_LEVEL_AF: val->f = rcvr->volume; return RIG_OK; case RIG_LEVEL_STRENGTH: if (priv->auto_update == 0) { err = pcr_transaction(rig, is_sub_rcvr(rig, vfo) ? "I5?" : "I1?"); if (err != RIG_OK) return err; } val->i = rig_raw2val(rcvr->raw_level, &rig->state.str_cal); /* rig_debug(RIG_DEBUG_TRACE, "%s, raw = %d, converted = %d\n", __func__, rcvr->raw_level, val->i); */ return RIG_OK; case RIG_LEVEL_RAWSTR: if (priv->auto_update == 0) { err = pcr_transaction(rig, is_sub_rcvr(rig, vfo) ? "I5?" : "I1?"); if (err != RIG_OK) return err; } val->i = rcvr->raw_level; return RIG_OK; case RIG_LEVEL_IF: val->i = rcvr->last_shift; return RIG_OK; case RIG_LEVEL_ATT: val->i = rcvr->last_att; return RIG_OK; case RIG_LEVEL_AGC: val->i = rcvr->last_agc; return RIG_OK; } return -RIG_ENIMPL; } /* * pcr_set_func * Assumes rig!=NULL, rig->state.priv!=NULL * * This is missing a way to call the set DSP noise reducer, as we don't have a func to call it * based on the flags in rig.h -> see also missing a flag for setting the BFO. */ int pcr_set_func(RIG * rig, vfo_t vfo, setting_t func, int status) { struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; struct pcr_rcvr *rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; rig_debug(RIG_DEBUG_VERBOSE, "%s: status = %ld, func = %d\n", __func__, status, func); switch (func) { case RIG_FUNC_NR: /* sets DSP noise reduction on or off */ /* status = 00 for off or 01 for on * Note that the user should switch the DSP unit on first * using the set level function RIG_LEVEL_NR */ if (status == 1) return pcr_set_dsp_state(rig, vfo, 1); else return pcr_set_dsp_state(rig, vfo, 0); break; case RIG_FUNC_ANF: /* DSP auto notch filter */ if (status == 1) return pcr_set_dsp_auto_notch(rig, vfo, 1); else return pcr_set_dsp_auto_notch(rig, vfo, 0); break; case RIG_FUNC_NB: /* noise blanker */ if (status == 0) return pcr_set_nb(rig, vfo, 0); else return pcr_set_nb(rig, vfo, 1); break; case RIG_FUNC_AFC: /* Tracking Filter */ if (status == 0) return pcr_set_afc(rig, vfo, 0); else return pcr_set_afc(rig, vfo, 1); break; case RIG_FUNC_TSQL: if (rcvr->last_mode != MD_FM) return -RIG_ERJCTED; if (status == 0) return pcr_set_ctcss_sql(rig, vfo, 0); else return pcr_set_ctcss_sql(rig, vfo, rcvr->last_ctcss_sql); case RIG_FUNC_VSC: /* Voice Scan Control */ if (status == 0) return pcr_set_vsc(rig, vfo, 0); else return pcr_set_vsc(rig, vfo, 1); break; default: rig_debug(RIG_DEBUG_VERBOSE, "%s: default\n", __func__); return -RIG_EINVAL; } } /* * pcr_get_func * Assumes rig!=NULL, rig->state.priv!=NULL * * This will need similar variables/flags as get_level. The PCR doesn't offer much in the way of * confirmation of current settings (according to the docs). */ int pcr_get_func(RIG * rig, vfo_t vfo, setting_t func, int *status) { /* stub here ... */ return -RIG_ENIMPL; } int pcr_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val) { rig_debug(RIG_DEBUG_VERBOSE, "%s: tok = %d\n", __func__, token); switch (token) { case TOK_EL_ANL: /* automatic noise limiter */ return pcr_set_anl(rig, vfo, (0 == val.i) ? 0 : 1); case TOK_EL_DIVERSITY: /* antenna diversity */ return pcr_set_diversity(rig, vfo, (0 == val.i) ? 0 : 2); default: rig_debug(RIG_DEBUG_VERBOSE, "%s: unknown token: %d\n", __func__, token); return -RIG_EINVAL; } return RIG_OK; } /* --------------------------------------------------------------------------------------- */ /* The next functions are all "helper types". These are called by the base functions above */ /* --------------------------------------------------------------------------------------- */ /* * Asks if the rig is ok = G0? response is G000 if ok or G001 if not * * Is only useful in fast transfer mode (when the CR/LF is stripped off all commands) ... * but also works on standard mode. */ static int pcr_check_ok(RIG * rig) { rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); return pcr_transaction(rig, "G0?"); } static int is_sub_rcvr(RIG * rig, vfo_t vfo) { struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; return vfo == RIG_VFO_SUB || (vfo == RIG_VFO_CURR && priv->current_vfo == RIG_VFO_SUB); } static int pcr_set_level_cmd(RIG * rig, const char *base, int level) { char buf[12]; rig_debug(RIG_DEBUG_TRACE, "%s: base is %s, level is %d\n", __func__, base, level); if (level < 0x0) { rig_debug(RIG_DEBUG_ERR, "%s: too low: %d\n", __func__, level); return -RIG_EINVAL; } else if (level > 0xff) { rig_debug(RIG_DEBUG_ERR, "%s: too high: %d\n", __func__, level); return -RIG_EINVAL; } snprintf(buf, 12, "%s%02X", base, level); buf[11] = '\0'; return pcr_transaction(rig, buf); } /* * Sets the volume of the rig to the level specified in the level integer. * Format is J40xx - where xx is 00 to FF in hex, and specifies 255 volume levels */ static int pcr_set_volume(RIG * rig, vfo_t vfo, float level) { int err; struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; struct pcr_rcvr *rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; rig_debug(RIG_DEBUG_TRACE, "%s: level = %f\n", __func__, level); err = pcr_set_level_cmd(rig, is_sub_rcvr(rig, vfo) ? "J60":"J40", level * 0xff); if (err == RIG_OK) rcvr->volume = level; return err; } /* * pcr_set_squelch * Assumes rig!=NULL, rig->state.priv!=NULL * * Format is J41xx - where xx is 00 to FF in hex, and specifies 255 squelch levels * * Sets the squelch of the rig to the level specified in the level integer. * There are some bands though ... * 00 Tone squelch clear and squelch open * 01-3f Squelch open * 40-7f Noise squelch * 80-ff Noise squelch + S meter squelch ... * Comparative S level = (squelch setting - 128) X 2 * * Could do with some constatnts to add together to allow better (and more accurate) * use of Hamlib API. Otherwise may get unexpected squelch settings if have to do by hand. */ static int pcr_set_squelch(RIG * rig, vfo_t vfo, float level) { int err; struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; struct pcr_rcvr *rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; rig_debug(RIG_DEBUG_TRACE, "%s: level = %f\n", __func__, level); err = pcr_set_level_cmd(rig, is_sub_rcvr(rig, vfo) ? "J61":"J41", level * 0xff); if (err == RIG_OK) rcvr->squelch = level; return err; } /* * pcr_set_if_shift * Assumes rig!=NULL, rig->state.priv!=NULL * * Sets the IF shift of the rig to the level specified in the level integer. * IF-SHIFT position (in 256 stages, 80 = centre): * * < 80 Minus shift (in 10 Hz steps) * > 80 Plus shift (in 10 Hz steps) * 80 Centre * * Format is J43xx - where xx is 00 to FF in hex * */ int pcr_set_if_shift(RIG * rig, vfo_t vfo, int level) { int err; struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; struct pcr_rcvr *rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; rig_debug(RIG_DEBUG_TRACE, "%s: level is %d\n", __func__, level); err = pcr_set_level_cmd(rig, is_sub_rcvr(rig, vfo) ? "J63":"J43", (level / 10) + 0x80); if (err == RIG_OK) rcvr->last_shift = level; return err; } /* * pcr_set_agc * Assumes rig!=NULL, rig->state.priv!=NULL * * Sets the AGC on or off based on the level specified in the level integer. * 00 = off, 01 (non zero) is on * * Format is J45xx - where xx is 00 to 01 in hex * */ int pcr_set_agc(RIG * rig, vfo_t vfo, int status) { int err; struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; struct pcr_rcvr *rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; rig_debug(RIG_DEBUG_VERBOSE, "%s: status = %d\n", __func__, status); err = pcr_set_level_cmd(rig, is_sub_rcvr(rig, vfo) ? "J65":"J45", status ? 1 : 0); if (err == RIG_OK) rcvr->last_agc = status ? 1 : 0; return err; } /* * pcr_set_afc(RIG *rig, vfo_t vfo, int level); * Assumes rig!=NULL, rig->state.priv!=NULL * * Sets the Tracking Filter on or off based on the status argument. * 00 = on, 01 (non zero) is off * * Format is LD820xx - where xx is 00 to ff in hex * */ int pcr_set_afc(RIG * rig, vfo_t vfo, int status) { rig_debug(RIG_DEBUG_VERBOSE, "%s: status = %d\n", __func__, status); return pcr_set_level_cmd(rig, "LD820", status ? 0 : 1); } /* * pcr_set_nb(RIG *rig, vfo_t vfo, int level); * Assumes rig!=NULL, rig->state.priv!=NULL * * Sets the noise blanker on or off based on the level specified in the level integer. * 00 = off, 01 (non zero) is on * * Format is J46xx - where xx is 00 to 01 in hex * */ int pcr_set_nb(RIG * rig, vfo_t vfo, int status) { rig_debug(RIG_DEBUG_VERBOSE, "%s: status = %d\n", __func__, status); return pcr_set_level_cmd(rig, is_sub_rcvr(rig, vfo) ? "J66":"J46", status ? 1 : 0); } /* Automatic Noise Limiter - J4Dxx - 00 off, 01 on */ int pcr_set_anl(RIG * rig, vfo_t vfo, int status) { rig_debug(RIG_DEBUG_VERBOSE, "%s: status = %d\n", __func__, status); return pcr_set_level_cmd(rig, "J4D", status ? 1 : 0); } /* Antenna Diversity/Tuners - J00xx - * 02=Dual Diversity ON, 1 display using 2 tuners * 01=Single Diversity OFF, 1 display using 1 tuner * 00=OFF Diversity OFF, 2 displays using 2 tuners */ int pcr_set_diversity(RIG * rig, vfo_t vfo, int status) { rig_debug(RIG_DEBUG_VERBOSE, "%s: status = %d\n", __func__, status); if (status < 0 || status > 2) return -RIG_EINVAL; return pcr_set_level_cmd(rig, "J00", status); } /* * pcr_set_attenuator(RIG *rig, vfo_t vfo, int level); * Assumes rig!=NULL, rig->state.priv!=NULL * * Sets the attenuator on or off based on the level specified in the level integer. * 00 = off, 01 (non zero) is on * The attenuator seems to be fixed at ~ -20dB * * Format is J47xx - where xx is 00 to 01 in hex * */ int pcr_set_attenuator(RIG * rig, vfo_t vfo, int status) { int err; struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; struct pcr_rcvr *rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; rig_debug(RIG_DEBUG_VERBOSE, "%s: status = %d\n", __func__, status); err = pcr_set_level_cmd(rig, is_sub_rcvr(rig, vfo) ? "J67":"J47", status ? 1 : 0); if (err == RIG_OK) rcvr->last_att = status; return err; } /* * pcr_set_bfo_shift * Assumes rig!=NULL, rig->state.priv!=NULL * * Sets the BFO of the rig to the level specified in the level integer. * BFO-SHIFT position (in 256 stages, 80 = centre): * * < 80 Minus shift (in 10 Hz steps) * > 80 Plus shift (in 10 Hz steps) * 80 Centre * * Format is J4Axx - where xx is 00 to FF in hex, and specifies 255 levels * XXX command undocumented? */ int pcr_set_bfo_shift(RIG * rig, vfo_t vfo, int level) { rig_debug(RIG_DEBUG_TRACE, "%s: level is %d\n", __func__, level); return pcr_set_level_cmd(rig, is_sub_rcvr(rig, vfo) ? "J6A":"J4A", 0x80 + level/10); } /* * pcr_set_dsp(RIG *rig, vfo_t vfo, int level); * Assumes rig!=NULL, rig->state.priv!=NULL * * Sets the DSP to UT106 (01) or off (non 01) * */ int pcr_set_dsp(RIG * rig, vfo_t vfo, int level) { rig_debug(RIG_DEBUG_TRACE, "%s: level is %d\n", __func__, level); if (is_sub_rcvr(rig, vfo)) return -RIG_ENAVAIL; return pcr_set_level_cmd(rig, "J80", level); } /* * pcr_set_dsp_state(RIG *rig, vfo_t vfo, int level); * Assumes rig!=NULL, rig->state.priv!=NULL * * Sets the DSP on or off (> 0 = on, 0 = off) * */ int pcr_set_dsp_state(RIG * rig, vfo_t vfo, int level) { rig_debug(RIG_DEBUG_TRACE, "%s: level is %d\n", __func__, level); if (is_sub_rcvr(rig, vfo)) return -RIG_ENAVAIL; return pcr_set_level_cmd(rig, "J81", level); } /* * pcr_set_dsp_noise_reducer(RIG *rig, vfo_t vfo, int level); * Assumes rig!=NULL, rig->state.priv!=NULL * * Sets the DSP noise reducer on or off (0x01 = on, 0x00 = off) * the level of NR set by values 0x01 to 0x10 (1 to 16 inclusive) */ #if 0 /* unused; re-enabled as needed. */ int pcr_set_dsp_noise_reducer(RIG * rig, vfo_t vfo, int level) { rig_debug(RIG_DEBUG_TRACE, "%s: level is %d\n", __func__, level); if (is_sub_rcvr(rig, vfo)) return -RIG_ENAVAIL; return pcr_set_level_cmd(rig, "J82", level); } #endif /* unused */ /* * pcr_set_dsp_auto_notch(RIG *rig, vfo_t vfo, int level); * Assumes rig!=NULL, rig->state.priv!=NULL * * Sets the auto notch on or off (1 = on, 0 = off) */ int pcr_set_dsp_auto_notch(RIG * rig, vfo_t vfo, int status) // J83xx { rig_debug(RIG_DEBUG_TRACE, "%s: level is %d\n", __func__, status); if (is_sub_rcvr(rig, vfo)) return -RIG_ENAVAIL; return pcr_set_level_cmd(rig, "J83", status ? 1 : 0); } int pcr_set_vsc(RIG * rig, vfo_t vfo, int status) // J50xx { /* Not sure what VSC for so skipping the function here ... */ return pcr_set_level_cmd(rig, is_sub_rcvr(rig, vfo) ? "J70":"J50", status ? 1 : 0); } int pcr_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone) { struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; struct pcr_rcvr *rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; *tone = rcvr->last_ctcss_sql; return RIG_OK; } int pcr_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone) { int i, err; struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; struct pcr_rcvr *rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; rig_debug(RIG_DEBUG_VERBOSE, "%s: tone = %d\n", __func__, tone); if (tone == 0) return pcr_transaction(rig, is_sub_rcvr(rig, vfo) ? "J7100":"J5100"); for (i = 0; rig->caps->ctcss_list[i] != 0; i++) { if (rig->caps->ctcss_list[i] == tone) break; } rig_debug(RIG_DEBUG_TRACE, "%s: index = %d, tone = %d\n", __func__, i, rig->caps->ctcss_list[i]); if (rig->caps->ctcss_list[i] != tone) return -RIG_EINVAL; err = pcr_set_level_cmd(rig, is_sub_rcvr(rig, vfo) ? "J71":"J51", i + 1); if (err == RIG_OK) rcvr->last_ctcss_sql = tone; return RIG_OK; } int pcr_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *tone) { struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; struct pcr_rcvr *rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; *tone = rcvr->last_dcs_sql; return RIG_OK; } int pcr_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t tone) { int i, err; struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; struct pcr_rcvr *rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; rig_debug(RIG_DEBUG_VERBOSE, "%s: tone = %d\n", __func__, tone); if (tone == 0) return pcr_transaction(rig, is_sub_rcvr(rig, vfo) ? "J720000":"J520000"); for (i = 0; rig->caps->dcs_list[i] != 0; i++) { if (rig->caps->dcs_list[i] == tone) break; } rig_debug(RIG_DEBUG_TRACE, "%s: index = %d, tone = %d\n", __func__, i, rig->caps->dcs_list[i]); if (rig->caps->dcs_list[i] != tone) return -RIG_EINVAL; err = pcr_set_level_cmd(rig, is_sub_rcvr(rig, vfo) ? "J7200":"J5200", i + 1); if (err == RIG_OK) rcvr->last_dcs_sql = tone; return RIG_OK; } int pcr_set_trn(RIG * rig, int trn) { struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s: trn = %d\n", __func__, trn); if (trn == RIG_TRN_OFF) { priv->auto_update = 0; return pcr_transaction(rig, "G300"); } else if (trn == RIG_TRN_RIG) { priv->auto_update = 1; return pcr_send(rig, "G301"); } else return -RIG_EINVAL; } int pcr_decode_event(RIG *rig) { int err; char buf[4]; /* XXX check this */ err = pcr_read_block(rig, buf, 4); if (err == 4) return pcr_parse_answer(rig, buf, 4); return RIG_OK; } int pcr_set_powerstat(RIG * rig, powerstat_t status) { struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; if (status == priv->power) return RIG_OK; if (status == RIG_POWER_ON) return pcr_open(rig); else if (status == RIG_POWER_OFF) return pcr_close(rig); return -RIG_ENIMPL; } int pcr_get_powerstat(RIG * rig, powerstat_t *status) { struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; int err; /* return RIG_ERJCTED if power is off */ err = pcr_transaction(rig, "H1?"); if (err != RIG_OK && err != -RIG_ERJCTED) return err; priv->power = err == RIG_OK ? RIG_POWER_ON : RIG_POWER_OFF; *status = priv->power; return RIG_OK; } int pcr_get_dcd(RIG * rig, vfo_t vfo, dcd_t *dcd) { struct pcr_priv_data *priv = (struct pcr_priv_data *) rig->state.priv; struct pcr_rcvr *rcvr = is_sub_rcvr(rig, vfo) ? &priv->sub_rcvr : &priv->main_rcvr; int err; if (priv->auto_update == 0) { err = pcr_transaction(rig, is_sub_rcvr(rig, vfo) ? "I4?" : "I0?"); if (err != RIG_OK) return err; } /* 04 = Closed, 07 = Open * * Bit 0: busy * Bit 1: AF open (CTCSS open) * Bit 2: VSC open * Bit 3: RX error (not ready to receive) */ *dcd = rcvr->squelch_status & 0x02 ? RIG_DCD_ON : RIG_DCD_OFF; return RIG_OK; } /* ********************************************************************************************* * int pcr_set_comm_mode(RIG *rig, int mode_type); // Set radio to fast/diagnostic mode G3xx * int pcr_soft_reset(RIG *rig); // Ask rig to reset itself H0xx ********************************************************************************************* */ DECLARE_INITRIG_BACKEND(pcr) { rig_debug(RIG_DEBUG_VERBOSE, "pcr: init called\n"); rig_register(&pcr100_caps); rig_register(&pcr1000_caps); rig_register(&pcr1500_caps); rig_register(&pcr2500_caps); return RIG_OK; } hamlib-1.2.15.3/pcr/pcr2500.c0000644000175000017500000001300612044564477012156 00000000000000/* * Hamlib PCR backend - PCR-2500 description * Copyright (c) 2001-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "pcr.h" #include "idx_builtin.h" #define PCR2500_MODES_WIDE ( RIG_MODE_AM | RIG_MODE_FM | RIG_MODE_WFM ) #define PCR2500_MODES_NAR ( RIG_MODE_CW | RIG_MODE_SSB ) #define PCR2500_MODES ( PCR2500_MODES_NAR | PCR2500_MODES_WIDE ) #define PCR2500_FUNC ( RIG_FUNC_NB | RIG_FUNC_TSQL | RIG_FUNC_NB | \ RIG_FUNC_ANF | RIG_FUNC_NR | RIG_FUNC_AFC ) #define PCR2500_LEVEL ( \ RIG_LEVEL_ATT | RIG_LEVEL_AF | RIG_LEVEL_SQL | RIG_LEVEL_IF | \ RIG_LEVEL_AGC | RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR | \ RIG_LEVEL_NR ) static const struct confparams pcr2500_ext_levels[] = { { TOK_EL_DIVERSITY, "DIV", "Diversity", "Antenna/tuner diversity", NULL, RIG_CONF_CHECKBUTTON }, { RIG_CONF_END, NULL, } }; static const struct pcr_priv_caps pcr2500_priv = { .reply_size = 6, .reply_offset = 0, .always_sync = 0, }; /* * IC PCR2500 rigs capabilities. */ const struct rig_caps pcr2500_caps = { .rig_model = RIG_MODEL_PCR2500, .model_name = "IC-PCR2500", .mfg_name = "Icom", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_PCRECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 9600, /* lower speeds gave troubles */ .serial_rate_max = 38400, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 12, .post_write_delay = 2, .timeout = 400, .retry = 3, .has_get_func = PCR2500_FUNC, .has_set_func = PCR2500_FUNC, .has_get_level = PCR2500_LEVEL, .has_set_level = RIG_LEVEL_SET(PCR2500_LEVEL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, /* XXX check this */ [LVL_IF] = { .min = { .i = -1270 }, .max = { .i = 1270 }, .step = { .i = 10 } }, }, .parm_gran = {}, .ctcss_list = pcr_ctcss_list, .dcs_list = pcr_dcs_list, .preamp = { RIG_DBLST_END }, .attenuator = { 20, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = kHz(1.2), .targetable_vfo = RIG_TARGETABLE_ALL, .transceive = RIG_TRN_RIG, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END }, .rx_range_list1 = { { kHz(100), GHz(1.3), PCR2500_MODES_NAR, -1, -1, RIG_VFO_MAIN, RIG_ANT_1 }, { kHz(10), GHz(3.3)-kHz(1), PCR2500_MODES_WIDE, -1, -1, RIG_VFO_MAIN, RIG_ANT_1 }, { MHz(50), GHz(1.3), PCR2500_MODES_WIDE, -1, -1, RIG_VFO_SUB, RIG_ANT_2 }, RIG_FRNG_END }, .tx_range_list1 = { RIG_FRNG_END }, .rx_range_list2 = { { kHz(495), MHz(824) - 10, PCR2500_MODES_NAR, -1, -1, RIG_VFO_MAIN, RIG_ANT_1 }, { MHz(849) + 10, MHz(869) - 10, PCR2500_MODES_NAR, -1, -1, RIG_VFO_MAIN, RIG_ANT_1 }, { MHz(894) + 10, GHz(1.3), PCR2500_MODES_NAR, -1, -1, RIG_VFO_MAIN, RIG_ANT_1 }, { kHz(10), MHz(824) - 10, PCR2500_MODES_WIDE, -1, -1, RIG_VFO_MAIN, RIG_ANT_1 }, { MHz(849) + 10, MHz(869) - 10, PCR2500_MODES_WIDE, -1, -1, RIG_VFO_MAIN, RIG_ANT_1 }, { MHz(894) + 10, GHz(3.3)-kHz(1), PCR2500_MODES_WIDE, -1, -1, RIG_VFO_MAIN, RIG_ANT_1 }, { MHz(50), GHz(1.3), PCR2500_MODES_WIDE, -1, -1, RIG_VFO_SUB, RIG_ANT_2 }, RIG_FRNG_END }, .tx_range_list2 = { RIG_FRNG_END }, /* no TX ranges, this is a receiver */ .tuning_steps = { { PCR2500_MODES, Hz(1) }, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { { RIG_MODE_FM | RIG_MODE_AM, kHz(15) }, { RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_AM, kHz(2.8)}, { RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_AM | RIG_MODE_FM, kHz(6) }, { RIG_MODE_WFM, kHz(230) }, { RIG_MODE_WFM | RIG_MODE_FM | RIG_MODE_AM, kHz(50) }, RIG_FLT_END, }, .extlevels = pcr2500_ext_levels, .priv = (void *) &pcr2500_priv, /* XXX fake */ .str_cal = { 3, { { 0, -60 }, { 127, 0 }, { 255, 60 } } }, .rig_init = pcr_init, .rig_cleanup = pcr_cleanup, .rig_open = pcr_open, .rig_close = pcr_close, .set_vfo = pcr_set_vfo, .get_vfo = pcr_get_vfo, .set_freq = pcr_set_freq, .get_freq = pcr_get_freq, .set_mode = pcr_set_mode, .get_mode = pcr_get_mode, .get_info = pcr_get_info, .set_level = pcr_set_level, .get_level = pcr_get_level, .set_ext_level = pcr_set_ext_level, .set_func = pcr_set_func, .get_func = pcr_get_func, .set_ctcss_sql = pcr_set_ctcss_sql, .get_ctcss_sql = pcr_get_ctcss_sql, .set_dcs_sql = pcr_set_dcs_sql, .get_dcs_sql = pcr_get_dcs_sql, .set_trn = pcr_set_trn, .decode_event = pcr_decode_event, .get_dcd = pcr_get_dcd, .set_powerstat = pcr_set_powerstat, .get_powerstat = pcr_get_powerstat, }; hamlib-1.2.15.3/PLAN0000644000175000017500000000722012044564477010611 00000000000000 Here is a non-exhaustive list of things IMO to keep in mind while developping the Hamlib library. Plan: ---- o Hamlib is intended to provide the means to control any capable rig o develop the library as a shared/static library o portable (not only Linux, but UN*X, Win32 using cygwin, etc. -> autoconf?) o be good, be generic (any rig made, any model) o uniform data types/units (eg. for power, use Watts, not rig specific val) o wrappable (Java, C++, perl module, Python module, etc.) o support serial ports, IrDA ports, USB ports, network ports (w/ a daemon) o thread safe (reentrant) would be a must o support preference file (eg. /etc/hamlibrc, ~/.hamlibrc ) o written in C (C++ would have been much more appropriate, but C is okay) o support more than one rig per application (ie. generic code) o support more than one rig per serial port (ie. Icoms) o handle nicely serial retransmission and timeouts o i18n support if applicable o software compensation for the actual radio oscillator frequency errors(mode?) o if avail., support events sent by the rig (eg. main freq has been changed,..) o maybe add some misc functions like PTT signaling (through serial/parallel..) o Well documented API, and Howto write a new rig backend o ... Good inspiration: ---------------- o SANE, with frontend/backend scheme, dynamic loading, autoconf, etc. o struct net_device (Linux kernel) for the "void *priv" idea o any rigctrl sources out there ? Applications: ------------ o control your rig from your computer, can be handy if you've relocated your UHF transceiver in the attic, to reduce cable loss. o edit/backup/restore/extend the memory capacity of your rig o software scanning (and huristics) o s/w squelch o real time spectral analysis and digital modes ( Frank has written some working code for this) it does 40 frames / sec and no load, really cool to see time and spectral info !! He has based it on generic data engine and plugins !! output also to small gtk window. o doppler compensation in tracking mode (using mtrack satellite tracker?) o let real time signal analysis drive freq/modes/etc.... (eg. PSK31 tuning) o networked rigs, provides realtime (global) spectral analysis to find (a common) quiet part of the band for a qso between 2 parties o software controlled hopping (poor mans GSM frequency hopping) also, must output hopping sequence to other rig to be useful o computer assisted scanner o Capabilities: ------------ We have to find a way to code capabilities in the hamlib in order to let the application know what this rig is able to do (before attempting to do it and crash :). I think some features can be coded using bit fields and masking. Maybe we can distinguish between 3 states : - Don't have this feature, - Have it, - Have it and can control (r/w) it remotly using the backend in hamlib o freq ranges supported: rx/mode, tx/modes/power o number of VFO, operations (set VFO separately, VFO A=B, switch, ..) o freq granularity, tuning steps (-> array) o SCAN functions (start, stop, ..) o Split (cross band, duplex, ...) o RIT (+- KHz) o Memory scheme, what is stored in, quantity, call channels, scan edges o ATT, P.AMP, AGC, NB, TONE, TSQL, COMP, VOX, BK-IN, ... o Tuner control (internal, external, can control) o Meter indication: Squelch condition, S-meter level, ALC, SWR o Number of antennas (which band ?) and selection o available "set mode" items (ie. rig setup), and provide a way to modify them o DSP ? o max memory channel o per rig timeout/retry (can be overriden) o Write some memory channel handling (name, mode, freq/vfo, duplex, split, ..) Any other ideas? Frank Singleton Stephane Fillod hamlib-1.2.15.3/m2/0000755000175000017500000000000012044565040010514 500000000000000hamlib-1.2.15.3/m2/rc2800.h0000644000175000017500000000167712044564477011553 00000000000000/* * Hamlib Rotator backend - M2 RC2800 interface protocol * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROT_RC2800_H #define _ROT_RC2800_H 1 extern const struct rot_caps rc2800_rot_caps; #endif /* _ROT_RC2800_H */ hamlib-1.2.15.3/m2/Makefile.in0000644000175000017500000004724612044564554012527 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = m2 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_m2_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am_hamlib_m2_la_OBJECTS = rc2800.lo hamlib_m2_la_OBJECTS = $(am_hamlib_m2_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_m2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(hamlib_m2_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_m2_la_SOURCES) DIST_SOURCES = $(hamlib_m2_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = hamlib-m2.la hamlib_m2_la_SOURCES = rc2800.c hamlib_m2_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_m2_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = rc2800.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu m2/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu m2/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-m2.la: $(hamlib_m2_la_OBJECTS) $(hamlib_m2_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_m2_la_LINK) -rpath $(pkglibdir) $(hamlib_m2_la_OBJECTS) $(hamlib_m2_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rc2800.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/m2/rc2800.c0000644000175000017500000001762212044564477011543 00000000000000/* * Hamlib Rotator backend - M2 RC2800 * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include "hamlib/rotator.h" #include "serial.h" #include "misc.h" #include "register.h" #include "num_stdio.h" #include "rc2800.h" #define CR "\r" #define LF "\x0a" #define BUFSZ 128 /* The continuous output of some of the RC2800 models can be a nuisance. Even if we flush the input stream before sending the command, there may be partial sentence in the stream ahead of the data we want. */ /* rc2800_parse Parse output from the rotator controller We want to recognize the following sentences: A ERR= E ERR= A P= S= E P= S= A= S= E= S= */ static int rc2800_parse (char *s, char *device, float *value) { int i, msgtype=0, errcode=0; rig_debug(RIG_DEBUG_TRACE, "%s: device return->%s", __func__, s); int len = strlen(s); if (len == 0) return -RIG_EPROTO; if (len > 7) { if (*s == 'A' || *s == 'E') { *device = *s; if (!strncmp(s+2, "ERR=", 4)) { msgtype=1; i = sscanf(s+6, "%d", &errcode); if (i == EOF) return -RIG_EINVAL; } else if (!strncmp(s+2, "P=", 2)) { msgtype=2; i = num_sscanf(s+5, "%f", value); if (i == EOF) return -RIG_EINVAL; } else if (s[1] == '=') { msgtype=2; i = num_sscanf(s+2, "%f", value); if (i == EOF) return -RIG_EINVAL; } } } if (msgtype == 2) { rig_debug(RIG_DEBUG_TRACE, "%s: device=%c value=%3.1f\n", __func__, *device, *value); return RIG_OK; } else if (msgtype == 1) { rig_debug(RIG_DEBUG_TRACE, "%s: driver error code %d\n", __func__, errcode); *device = ' '; return RIG_OK; } return -RIG_EPROTO; } #if 0 int testmain () { rc2800_parse("A P= 98.1 S=9 MV"); rc2800_parse("A P= 100.0 S=9 MV"); rc2800_parse("E=43.7 S=9 M"); rc2800_parse("E=42.8 S=9 S"); rc2800_parse("E ERR=05"); return 0; } #endif /** * rc2800_transaction * * cmdstr - Command to be sent to the rig. * data - Buffer for reply string. Can be NULL, indicating that no reply is * is needed, but answer will still be read. * data_len - in: Size of buffer. It is the caller's responsibily to provide * a large enough buffer for all possible replies for a command. * * returns: * RIG_OK - if no error occured. * RIG_EIO - if an I/O error occured while sending/receiving data. * RIG_ETIMEOUT - if timeout expires without any characters received. */ static int rc2800_transaction (ROT *rot, const char *cmdstr, char *data, size_t data_len) { struct rot_state *rs; int retval; int retry_read = 0; char replybuf[BUFSZ]; rs = &rot->state; transaction_write: serial_flush(&rs->rotport); if (cmdstr) { retval = write_block(&rs->rotport, cmdstr, strlen(cmdstr)); if (retval != RIG_OK) goto transaction_quit; } /* Always read the reply to know whether the cmd went OK */ if (!data) data = replybuf; if (!data_len) data_len = BUFSZ; /* first reply is an echo */ memset(data,0,data_len); retval = read_string(&rs->rotport, data, data_len, LF, strlen(LF)); if (retval < 0) { if (retry_read++ < rot->state.rotport.retry) goto transaction_write; goto transaction_quit; } /* then comes the answer */ memset(data,0,data_len); retval = read_string(&rs->rotport, data, data_len, LF, strlen(LF)); if (retval < 0) { if (retry_read++ < rot->state.rotport.retry) goto transaction_write; goto transaction_quit; } retval = RIG_OK; transaction_quit: return retval; } static int rc2800_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) { char cmdstr[64]; int retval1, retval2; rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __func__, az, el); num_sprintf(cmdstr, "A%3.1f"CR, az); retval1 = rc2800_transaction(rot, cmdstr, NULL, 0); /* do not overwhelm the MCU? */ usleep(200*1000); num_sprintf(cmdstr, "E%3.1f"CR, el); retval2 = rc2800_transaction(rot, cmdstr, NULL, 0); if (retval1 == retval2) return retval1; return (retval1 != RIG_OK ? retval1 : retval2); } static int rc2800_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { char posbuf[32]; int retval; char device; float value; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); retval = rc2800_transaction(rot, "A" CR, posbuf, sizeof(posbuf)); if (retval != RIG_OK || strlen(posbuf) < 5) { return retval < 0 ? retval : -RIG_EPROTO; } if (rc2800_parse(posbuf, &device, &value) == RIG_OK) { if (device == 'A') *az = (azimuth_t) value; else return -RIG_EPROTO; } retval = rc2800_transaction(rot, "E" CR, posbuf, sizeof(posbuf)); if (retval != RIG_OK || strlen(posbuf) < 5) { return retval < 0 ? retval : -RIG_EPROTO; } if (rc2800_parse(posbuf, &device, &value) == RIG_OK) { if (device == 'E') *el = (elevation_t) value; else return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: (az, el) = (%.1f, %.1f)\n", __func__, *az, *el); return RIG_OK; } static int rc2800_rot_stop(ROT *rot) { int retval; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); /* TODO: check each return value (do we care?) */ /* Stop AZ*/ retval = rc2800_transaction(rot, "A" CR, NULL, 0); /* select AZ */ retval = rc2800_transaction(rot, "S" CR, NULL, 0); /* STOP */ /* do not overwhelm the MCU? */ usleep(200*1000); /* Stop EL*/ retval = rc2800_transaction(rot, "E" CR, NULL, 0); /* select EL */ retval = rc2800_transaction(rot, "S" CR, NULL, 0); /* STOP */ return retval; } /* ************************************************************************* */ /* * M2 RC2800 rotator capabilities. * * Protocol documentation: http://www.confluentdesigns.com/files/PdfFiles/devguide_24.pdf */ const struct rot_caps rc2800_rot_caps = { .rot_model = ROT_MODEL_RC2800, .model_name = "RC2800", .mfg_name = "M2", .version = "0.1.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_AZEL, .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 = 1000, .retry = 3, .min_az = 0.0, .max_az = 360.0, .min_el = 0.0, .max_el = 180.0, .get_position = rc2800_rot_get_position, .set_position = rc2800_rot_set_position, .stop = rc2800_rot_stop, }; /* ************************************************************************* */ DECLARE_INITROT_BACKEND(m2) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); rot_register(&rc2800_rot_caps); return RIG_OK; } /* ************************************************************************* */ /* end of file */ hamlib-1.2.15.3/m2/Makefile.am0000644000175000017500000000032112044564477012501 00000000000000 pkglib_LTLIBRARIES = hamlib-m2.la hamlib_m2_la_SOURCES = rc2800.c hamlib_m2_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_m2_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = rc2800.h hamlib-1.2.15.3/hamlib.m40000644000175000017500000000601212044564477011630 00000000000000dnl Configure Paths for Hamlib dnl Cloned from Alsa project http://www.alsa-project.org dnl AM_PATH_HAMLIB([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for libhamlib, and define HAMLIB_LTDL, dnl HAMLIB_CFLAGS and HAMLIB_LIBS as appropriate. dnl enables arguments --with-hamlib-prefix= dnl --with-hamlib-inc-prefix= dnl --disable-hamlibtest (this has no effect, as yet) dnl dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified, dnl and the hamlib libraries are not found, a fatal AC_MSG_ERROR() will result. dnl AC_DEFUN([AM_PATH_HAMLIB], [dnl Save the original CFLAGS, LDFLAGS, and LIBS hamlib_save_CFLAGS="$CFLAGS" hamlib_save_LDFLAGS="$LDFLAGS" hamlib_save_LIBS="$LIBS" hamlib_found=yes dnl dnl Get the cflags and libraries for hamlib dnl AC_ARG_WITH(hamlib-prefix, [ --with-hamlib-prefix=PFX Prefix where Hamlib library is installed(optional)], [hamlib_prefix="$withval"], [hamlib_prefix=""]) AC_ARG_WITH(hamlib-inc-prefix, [ --with-hamlib-inc-prefix=PFX Prefix where include libraries are (optional)], [hamlib_inc_prefix="$withval"], [hamlib_inc_prefix=""]) dnl FIXME: this is not yet implemented AC_ARG_ENABLE(hamlibtest, [ --disable-hamlibtest Do not try to compile and run a test Hamlib program], [enable_hamlibtest=no], [enable_hamlibtest=yes]) dnl Add any special include directories AC_MSG_CHECKING(for HAMLIB CFLAGS) if test "$hamlib_inc_prefix" != "" ; then HAMLIB_CFLAGS="$HAMLIB_CFLAGS -I$hamlib_inc_prefix" CFLAGS="$CFLAGS -I$hamlib_inc_prefix" fi AC_MSG_RESULT($HAMLIB_CFLAGS) dnl add any special lib dirs AC_MSG_CHECKING(for HAMLIB LDFLAGS) if test "$hamlib_prefix" != "" ; then HAMLIB_LIBS="$HAMLIB_LIBS -L$hamlib_prefix -Wl,--rpath -Wl,$hamlib_prefix" LDFLAGS="$LDFLAGS $HAMLIB_LIBS" fi dnl add the hamlib library HAMLIB_LIBS="$HAMLIB_LIBS -lhamlib -lm -ldl" LIBS=`echo $LIBS | sed 's/-lm//'` LIBS=`echo $LIBS | sed 's/-ldl//'` LIBS=`echo $LIBS | sed 's/ //'` #LIBS="$HAMLIB_LIBS $LIBS" AC_MSG_RESULT($HAMLIB_LIBS) dnl add any special LTDL file AC_MSG_CHECKING(for HAMLIB LTDL) if test "$hamlib_prefix" != "" ; then HAMLIB_LTDL="$HAMLIB_LTDL $hamlib_prefix/libhamlib.la" fi AC_MSG_RESULT($HAMLIB_LTDL) dnl Check for a working version of libhamlib that is of the right version. dnl FIXME: not implemented yet! dnl Now that we know that we have the right version, let's see if we have the library and not just the headers. #AC_CHECK_LIB([hamlib], [rig_init],, # [ifelse([$3], , [AC_MSG_ERROR(No linkable libhamlib was found.)]) # hamlib_found=no] #) if test "x$hamlib_found" = "xyes" ; then ifelse([$2], , :, [$2]) LIBS=`echo $LIBS | sed 's/-lhamlib//g'` LIBS=`echo $LIBS | sed 's/ //'` LIBS="-lhamlib $LIBS" fi if test "x$hamlib_found" = "xno" ; then ifelse([$3], , :, [$3]) CFLAGS="$hamlib_save_CFLAGS" LDFLAGS="$hamlib_save_LDFLAGS" LIBS="$hamlib_save_LIBS" HAMLIB_CFLAGS="" HAMLIB_LIBS="" fi dnl That should be it. Now just export out symbols: AC_SUBST(HAMLIB_CFLAGS) AC_SUBST(HAMLIB_LIBS) AC_SUBST(HAMLIB_LTDL) ]) hamlib-1.2.15.3/racal/0000755000175000017500000000000012044565035011264 500000000000000hamlib-1.2.15.3/racal/ra6790.c0000644000175000017500000000702712044564477012317 00000000000000/* * Hamlib Racal backend - RA6790 description * Copyright (c) 2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "idx_builtin.h" #include "racal.h" /* FIXME: ISB */ #define RA6790_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AMS|RIG_MODE_FM) #define RA6790_FUNC (RIG_FUNC_NONE) #define RA6790_LEVEL_ALL (RIG_LEVEL_RF|RIG_LEVEL_AGC|RIG_LEVEL_IF) #define RA6790_PARM_ALL (RIG_PARM_NONE) #define RA6790_VFO (RIG_VFO_A) /* * ra6790 rig capabilities. * * Required A6A1 serial asynchronous interface * */ const struct rig_caps ra6790_caps = { .rig_model = RIG_MODEL_RA6790, .model_name = "RA6790/GM", .mfg_name = "Racal", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 9600, .serial_data_bits = 7, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_EVEN, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 10, .timeout = 2000, .retry = 3, .has_get_func = RA6790_FUNC, .has_set_func = RA6790_FUNC, .has_get_level = RA6790_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(RA6790_LEVEL_ALL), .has_get_parm = RA6790_PARM_ALL, .has_set_parm = RIG_PARM_SET(RA6790_PARM_ALL), .vfo_ops = RIG_OP_NONE, .preamp = { RIG_DBLST_END }, .attenuator = { RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = kHz(8), .targetable_vfo = 0, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, .rx_range_list1 = { {kHz(500),MHz(30)-1,RA6790_MODES,-1,-1,RA6790_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30)-1,RA6790_MODES,-1,-1,RA6790_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {RA6790_MODES,1}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { /* at -3dB */ {RIG_MODE_SSB, kHz(2.55)}, /* BW2 */ {RA6790_MODES, Hz(300)}, /* BW1 */ {RA6790_MODES, kHz(1)}, /* BW2 */ {RA6790_MODES, kHz(3.2)}, /* BW3 */ {RA6790_MODES, kHz(6)}, /* BW4 */ {RA6790_MODES, kHz(20)}, /* BW5 */ {RA6790_MODES, 0}, /* accept any BW */ RIG_FLT_END, }, .cfgparams = racal_cfg_params, .rig_init = racal_init, .rig_cleanup = racal_cleanup, .rig_open = racal_open, .rig_close = racal_close, .set_conf = racal_set_conf, .get_conf = racal_get_conf, .set_freq = racal_set_freq, .get_freq = racal_get_freq, .set_mode = racal_set_mode, .get_mode = racal_get_mode, .set_level = racal_set_level, .get_level = racal_get_level, .reset = racal_reset, .get_info = racal_get_info, }; /* * Function definitions below */ hamlib-1.2.15.3/racal/ra3702.c0000644000175000017500000001017012044564477012276 00000000000000/* * Hamlib Racal backend - RA3702 description * Copyright (c) 2010 by Stephane Fillod * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "idx_builtin.h" #include "ra37xx.h" /* TODO: ISB */ #define RA3702_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY) #define RA3702_FUNC (RIG_FUNC_MUTE) #define RA3702_LEVEL_ALL (RIG_LEVEL_RF|RIG_LEVEL_AF|RIG_LEVEL_AGC|\ RIG_LEVEL_CWPITCH|RIG_LEVEL_PREAMP|RIG_LEVEL_SQL|RIG_LEVEL_RAWSTR) #define RA3702_PARM_ALL (RIG_PARM_NONE) #define RA3702_VFO (RIG_VFO_A) #define RA3702_VFO_OPS (RIG_OP_FROM_VFO|RIG_OP_TO_VFO) #define RA3702_SCAN_OPS (RIG_SCAN_STOP|RIG_SCAN_VFO|RIG_SCAN_MEM) /* * ra3702 rig capabilities. * * Required A6A1 serial asynchronous interface * */ const struct rig_caps ra3702_caps = { .rig_model = RIG_MODEL_RA3702, .model_name = "RA3702", .mfg_name = "Racal", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 50, .serial_rate_max = 9600, .serial_data_bits = 7, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_EVEN, .serial_handshake = RIG_HANDSHAKE_XONXOFF, .write_delay = 0, .post_write_delay = 0, .timeout = RA37XX_TIMEOUT, .retry = 2, .has_get_func = RA3702_FUNC, .has_set_func = RA3702_FUNC, .has_get_level = RA3702_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(RA3702_LEVEL_ALL), .has_get_parm = RA3702_PARM_ALL, .has_set_parm = RIG_PARM_SET(RA3702_PARM_ALL), .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .vfo_ops = RA3702_VFO_OPS, .scan_ops = RA3702_SCAN_OPS, .preamp = { 20, RIG_DBLST_END }, /* FIXME */ .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, .str_cal = RA37XX_STR_CAL, .chan_list = { { 0, 99, RIG_MTYPE_MEM, RA37XX_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(15),MHz(30)-1,RA3702_MODES,-1,-1,RA3702_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(15),MHz(30)-1,RA3702_MODES,-1,-1,RA3702_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {RA3702_MODES,1}, {RA3702_MODES,10}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { /* at -3dB */ {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.7)}, {RA3702_MODES, kHz(12)}, {RA3702_MODES, kHz(6)}, {RA3702_MODES, Hz(300)}, {RA3702_MODES, kHz(1)}, {RA3702_MODES, kHz(2.7)}, //{RA3702_MODES, 0}, /* accept any BW */ RIG_FLT_END, }, .cfgparams = ra37xx_cfg_params, .rig_init = ra37xx_init, .rig_cleanup = ra37xx_cleanup, .rig_open = ra37xx_open, .rig_close = ra37xx_close, .set_conf = ra37xx_set_conf, .get_conf = ra37xx_get_conf, .set_freq = ra37xx_set_freq, .get_freq = ra37xx_get_freq, .set_mode = ra37xx_set_mode, .get_mode = ra37xx_get_mode, .set_func = ra37xx_set_func, .get_func = ra37xx_get_func, .set_level = ra37xx_set_level, .get_level = ra37xx_get_level, .set_ant = ra37xx_set_ant, .get_ant = ra37xx_get_ant, .set_mem = ra37xx_set_mem, .get_mem = ra37xx_get_mem, .scan = ra37xx_scan, .vfo_op = ra37xx_vfo_op, .get_info = ra37xx_get_info, }; /* * Function definitions below */ hamlib-1.2.15.3/racal/ra37xx.c0000644000175000017500000003724512044564477012530 00000000000000/* * Hamlib Racal backend - RA37XX main file * Copyright (c) 2004-2010 by Stephane Fillod * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "cal.h" #include "register.h" #include "token.h" #include "ra37xx.h" const struct confparams ra37xx_cfg_params[] = { { TOK_RIGID, "receiver_id", "receiver ID", "receiver ID, -1 to disable addressing", "-1", RIG_CONF_NUMERIC, { .n = { -1, 9, 1 } } }, { RIG_CONF_END, NULL, } }; /* packet framing, 5-8 */ #define BUFSZ 256 #define SOM "\x0a" /* LF */ #define EOM "\x0d" /* CR */ /* * modes */ #define MD_USB 1 #define MD_LSB 2 #define MD_AM 3 #define MD_FM 4 #define MD_CW 5 #define MD_FSK 6 /* option */ #define MD_ISB_USB 7 #define MD_ISB_LSB 8 #define MD_FSK_NAR 13 /* option */ #define MD_FSK_MED 14 /* option */ #define MD_FSK_WID 15 /* option */ /* * retries are handled by ra37xx_transaction() */ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data, int *data_len) { struct ra37xx_priv_data *priv = (struct ra37xx_priv_data*)rig->state.priv; struct rig_state *rs = &rig->state; char cmdbuf[BUFSZ]; char respbuf[BUFSZ]; int cmd_len; int retval; int pkt_header_len; struct timeval tv; gettimeofday(&tv, NULL); /* Packet Framing: - no Link Control Character - (optional) 1 Address Character - no Check Character */ if (priv->receiver_id != -1) { pkt_header_len = 2; cmd_len = sprintf(cmdbuf, SOM "%d%s" EOM, priv->receiver_id, cmd); } else { pkt_header_len = 1; cmd_len = sprintf(cmdbuf, SOM "%s" EOM, cmd); } serial_flush(&rs->rigport); retval = write_block(&rs->rigport, cmdbuf, cmd_len); if (retval != RIG_OK) return retval; /* forward COMMAND frame? no data expected */ if (!data || !data_len) { return retval; } do { retval = read_string(&rs->rigport, respbuf, BUFSZ, EOM, strlen(EOM)); if (retval < 0) return retval; /* drop short/invalid packets */ if (retval <= pkt_header_len+1 || respbuf[0] != '\x0a') { if (!rig_check_cache_timeout(&tv, rs->rigport.timeout)) continue; else return -RIG_EPROTO; } /* drop other receiver id, and "pause" (empty) packets */ if ((priv->receiver_id != -1 && (respbuf[1]-'0') != priv->receiver_id) || retval == pkt_header_len+1) { if (!rig_check_cache_timeout(&tv, rs->rigport.timeout)) continue; else return -RIG_ETIMEOUT; } if (retval >= pkt_header_len+3 && !memcmp(respbuf+pkt_header_len, "ERR", 3)) return -RIG_ERJCTED; if (retval >= pkt_header_len+5 && !memcmp(respbuf+pkt_header_len, "FAULT", 5)) return -RIG_ERJCTED; if (cmd[0] == 'Q' && (retval+pkt_header_len+1 < strlen(cmd) || cmd[1] != respbuf[pkt_header_len])) { rig_debug(RIG_DEBUG_WARN, "%s: unexpected revertive frame\n", __func__); if (!rig_check_cache_timeout(&tv, rs->rigport.timeout)) continue; else return -RIG_ETIMEOUT; } } while (retval < 0); /* Strip starting LF and ending CR */ memcpy(data, respbuf+pkt_header_len, retval-pkt_header_len-1); *data_len = retval; return RIG_OK; } static int ra37xx_transaction(RIG *rig, const char *cmd, char *data, int *data_len) { int retval, retry; retry = rig->state.rigport.retry; do { retval = ra37xx_one_transaction(rig, cmd, data, data_len); if (retval == RIG_OK) break; } while (retry-- > 0); return retval; } int ra37xx_init(RIG *rig) { struct ra37xx_priv_data *priv; if (!rig || !rig->caps) return -RIG_EINVAL; priv = (struct ra37xx_priv_data*)malloc(sizeof(struct ra37xx_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } rig->state.priv = (void*)priv; priv->receiver_id = -1; return RIG_OK; } /* */ int ra37xx_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * Assumes rig!=NULL, rig->state.priv!=NULL */ int ra37xx_set_conf(RIG *rig, token_t token, const char *val) { struct ra37xx_priv_data *priv = (struct ra37xx_priv_data*)rig->state.priv; int receiver_id; switch (token) { case TOK_RIGID: receiver_id = atoi(val); if (receiver_id < -1 || receiver_id > 9) return -RIG_EINVAL; priv->receiver_id = receiver_id; break; default: return -RIG_EINVAL; } return RIG_OK; } /* * assumes rig!=NULL, * Assumes rig!=NULL, rig->state.priv!=NULL * and val points to a buffer big enough to hold the conf value. */ int ra37xx_get_conf(RIG *rig, token_t token, char *val) { struct ra37xx_priv_data *priv = (struct ra37xx_priv_data*)rig->state.priv; switch(token) { case TOK_RIGID: sprintf(val, "%d", priv->receiver_id); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * ra37xx_open * Assumes rig!=NULL */ int ra37xx_open(RIG *rig) { /* Set Receiver to remote control */ return ra37xx_transaction (rig, "REM1", NULL, NULL); } /* * ra37xx_close * Assumes rig!=NULL */ int ra37xx_close(RIG *rig) { /* Set Receiver to local control */ return ra37xx_transaction (rig, "REM0", NULL, NULL); } /* * ra37xx_set_freq * Assumes rig!=NULL */ int ra37xx_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char freqbuf[BUFSZ]; int freq_len; freq_len = sprintf(freqbuf, "F%ld", (unsigned long)freq); if (freq_len < 0) return -RIG_ETRUNC; return ra37xx_transaction (rig, freqbuf, NULL, NULL); } int ra37xx_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { char freqbuf[BUFSZ]; int retval, len; double f; retval = ra37xx_transaction (rig, "QF", freqbuf, &len); if (retval != RIG_OK) return retval; sscanf(freqbuf+1, "%lf", &f); *freq = (freq_t)f; return RIG_OK; } /* * ra37xx_set_mode * Assumes rig!=NULL */ int ra37xx_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { //struct ra37xx_priv_data *priv = (struct ra37xx_priv_data*)rig->state.priv; int ra_mode, widthtype, widthnum; char buf[BUFSZ]; switch (mode) { case RIG_MODE_CW: widthtype = 1; ra_mode = MD_CW; break; case RIG_MODE_CWR: widthtype = 2; ra_mode = MD_CW; break; case RIG_MODE_USB: widthtype = 1; ra_mode = MD_USB; break; case RIG_MODE_LSB: widthtype = 2; ra_mode = MD_LSB; break; case RIG_MODE_AM: widthtype = 3; ra_mode = MD_AM; break; case RIG_MODE_FM: widthtype = 3; ra_mode = MD_FM; break; case RIG_MODE_RTTY: widthtype = 3; ra_mode = MD_FSK; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %d\n", __FUNCTION__, mode); return -RIG_EINVAL; } if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); widthtype = 0; /* FIXME: no bandwidth for now */ widthnum = 0; /* width set using 'B', QBCON must be queried firsthand */ #if 0 sprintf(buf, "M%d;B%d,%d", ra_mode, widthtype, widthnum); #else sprintf(buf, "M%d", ra_mode); #endif rig_debug(RIG_DEBUG_TRACE, "%s: widthtype = %i, widthnum = %i\n", __func__, widthtype, widthnum); return ra37xx_transaction (rig, buf, NULL, NULL); } int ra37xx_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char buf[BUFSZ], resbuf[BUFSZ]; int retval, len, ra_mode, widthtype, widthnum; retval = ra37xx_transaction (rig, "QM", resbuf, &len); if (retval != RIG_OK) return retval; sscanf(resbuf+1, "%d", &ra_mode); switch (ra_mode) { case MD_CW: widthtype = 1; *mode = RIG_MODE_CW; break; case MD_ISB_LSB: case MD_LSB: widthtype = 2; *mode = RIG_MODE_LSB; break; case MD_ISB_USB: case MD_USB: widthtype = 1; *mode = RIG_MODE_USB; break; case MD_FSK_NAR: case MD_FSK_MED: case MD_FSK_WID: case MD_FSK: widthtype = 3; *mode = RIG_MODE_RTTY; break; case MD_FM: widthtype = 3; *mode = RIG_MODE_FM; break; case MD_AM: widthtype = 3; *mode = RIG_MODE_AM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %d\n", __FUNCTION__, mode); return -RIG_EPROTO; } retval = ra37xx_transaction (rig, "QB", resbuf, &len); if (retval != RIG_OK) return retval; /* FIXME */ widthnum = 0; sprintf(buf, "QBCON%d,%d", widthtype, widthnum); retval = ra37xx_transaction (rig, buf, resbuf, &len); if (retval != RIG_OK) return retval; /* TODO: width */ *width = 0; return RIG_OK; } int ra37xx_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { char cmdbuf[BUFSZ]; switch (func) { case RIG_FUNC_MUTE: sprintf(cmdbuf, "MUTE%d", status ? 1 : 0); break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported %d\n", __FUNCTION__, func); return -RIG_EINVAL; } return ra37xx_transaction (rig, cmdbuf, NULL, NULL); } int ra37xx_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { char resbuf[BUFSZ]; int retval, len, i; switch (func) { case RIG_FUNC_MUTE: retval = ra37xx_transaction (rig, "QMUTE", resbuf, &len); if (retval != RIG_OK) return retval; sscanf(resbuf+4, "%d", &i); *status = i == 0 ? 0 : 1; break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported %d\n", __FUNCTION__, func); return -RIG_EINVAL; } return RIG_OK; } /* * ra37xx_set_level * Assumes rig!=NULL */ int ra37xx_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { char cmdbuf[BUFSZ]; int agc; switch (level) { case RIG_LEVEL_AF: sprintf(cmdbuf, "AFL%d", (int)(val.f*255)); break; case RIG_LEVEL_PREAMP: sprintf(cmdbuf, "RFAMP%d", val.i ? 1 : 0); break; case RIG_LEVEL_CWPITCH: /* BFO */ sprintf(cmdbuf, "BFO%d", val.i); break; case RIG_LEVEL_SQL: sprintf(cmdbuf, "CORL%d", (int)(val.f*255)); break; case RIG_LEVEL_RF: sprintf(cmdbuf, "G%d", (int)(val.f*255)); break; case RIG_LEVEL_AGC: switch (val.i) { case RIG_AGC_FAST: agc = 0; break; case RIG_AGC_MEDIUM: agc = 1; break; case RIG_AGC_SLOW: agc = 2; break; case RIG_AGC_USER: agc = 0; break; default: return -RIG_EINVAL; } sprintf(cmdbuf, "AGC%d,%d", val.i==RIG_AGC_USER ? 1:0, agc); break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported %d\n", __FUNCTION__, level); return -RIG_EINVAL; } return ra37xx_transaction (rig, cmdbuf, NULL, NULL); } /* * ra37xx_get_level * Assumes rig!=NULL */ int ra37xx_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { char resbuf[BUFSZ]; int retval, len, i; switch (level) { case RIG_LEVEL_AF: retval = ra37xx_transaction (rig, "QAFL", resbuf, &len); if (retval != RIG_OK) return retval; sscanf(resbuf+3, "%d", &i); val->f = ((float)i)/255; break; case RIG_LEVEL_CWPITCH: retval = ra37xx_transaction (rig, "QBFO", resbuf, &len); if (retval != RIG_OK) return retval; sscanf(resbuf+3, "%d", &val->i); break; case RIG_LEVEL_PREAMP: retval = ra37xx_transaction (rig, "QRFAMP", resbuf, &len); if (retval != RIG_OK) return retval; sscanf(resbuf+5, "%d", &i); val->i = i ? rig->state.preamp[0] : 0; break; case RIG_LEVEL_RAWSTR: retval = ra37xx_transaction (rig, "QRFL", resbuf, &len); if (retval != RIG_OK) return retval; sscanf(resbuf+3, "%d", &val->i); break; case RIG_LEVEL_SQL: retval = ra37xx_transaction (rig, "QCORL", resbuf, &len); if (retval != RIG_OK) return retval; sscanf(resbuf+4, "%d", &i); val->f = ((float)i)/255; break; case RIG_LEVEL_RF: retval = ra37xx_transaction (rig, "QG", resbuf, &len); if (retval != RIG_OK) return retval; sscanf(resbuf+1, "%d", &i); val->f = ((float)i)/255; break; case RIG_LEVEL_AGC: retval = ra37xx_transaction (rig, "QAGC", resbuf, &len); if (retval != RIG_OK) return retval; if (resbuf[3] != '0') { val->i = RIG_AGC_USER; break; } switch (resbuf[5]) { case '0': val->i = RIG_AGC_FAST; break; case '1': val->i = RIG_AGC_MEDIUM; break; case '2': val->i = RIG_AGC_SLOW; break; default: return -RIG_EPROTO; } break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported %d\n", __FUNCTION__, level); return -RIG_EINVAL; } return RIG_OK; } const char* ra37xx_get_info(RIG *rig) { static char infobuf[BUFSZ]; int res_len, retval; retval = ra37xx_transaction (rig, "QID", infobuf, &res_len); if (retval != RIG_OK || res_len < 2 || res_len >= BUFSZ) return NULL; infobuf[res_len] = '\0'; /* TODO: "QSW"? c.f. 5-43 */ /* skip "ID" */ return infobuf+2; } int ra37xx_set_ant(RIG *rig, vfo_t vfo, ant_t ant) { char buf[BUFSZ]; int i_ant; switch (ant) { case RIG_ANT_1: i_ant = 1<<0; break; case RIG_ANT_2: i_ant = 1<<1; break; case RIG_ANT_3: i_ant = 1<<2; break; case RIG_ANT_4: i_ant = 1<<3; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported ant %#x", ant); return -RIG_EINVAL; } sprintf(buf, "ANT%d", i_ant); return ra37xx_transaction (rig, buf, NULL, NULL); } int ra37xx_get_ant(RIG *rig, vfo_t vfo, ant_t *ant) { char buf[BUFSZ]; int retval, buflen, ra_ant; retval = ra37xx_transaction (rig, "QANT", buf, &buflen); if (retval != RIG_OK) return retval; sscanf(buf+3, "%d", &ra_ant); if (ra_ant < 0 || ra_ant > 15) return -RIG_EPROTO; *ant = ((ra_ant & (1<<0)) ? RIG_ANT_1 : 0) | ((ra_ant & (1<<1)) ? RIG_ANT_2 : 0) | ((ra_ant & (1<<2)) ? RIG_ANT_3 : 0) | ((ra_ant & (1<<3)) ? RIG_ANT_4 : 0); return RIG_OK; } int ra37xx_set_mem(RIG *rig, vfo_t vfo, int ch) { char buf[BUFSZ]; /* NB: does a RIG_OP_TO_VFO!*/ sprintf(buf, "CHAN%d", ch); return ra37xx_transaction (rig, buf, NULL, NULL); } int ra37xx_get_mem(RIG *rig, vfo_t vfo, int *ch) { char buf[BUFSZ]; int retval, buflen; retval = ra37xx_transaction (rig, "QCHAN", buf, &buflen); if (retval != RIG_OK) return retval; *ch = atoi(buf+4); return RIG_OK; } int ra37xx_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) { char buf[BUFSZ]; int scantype; switch (scan) { case RIG_SCAN_STOP: scantype = 0; break; case RIG_SCAN_VFO: scantype = 1; break; case RIG_SCAN_MEM: scantype = 2; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported scan %#x", scan); return -RIG_EINVAL; } sprintf(buf, "SCAN%d,0", scantype); return ra37xx_transaction (rig, buf, NULL, NULL); } int ra37xx_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { char buf[BUFSZ]; int ret, ch; switch (op) { case RIG_OP_FROM_VFO: ret = rig_get_mem(rig, vfo, &ch); if (ret < 0) return ret; sprintf(buf, "STRE%d", ch); return ra37xx_transaction (rig, buf, NULL, NULL); case RIG_OP_TO_VFO: ret = rig_get_mem(rig, vfo, &ch); if (ret < 0) return ret; sprintf(buf, "CHAN%d", ch); return ra37xx_transaction (rig, buf, NULL, NULL); default: rig_debug(RIG_DEBUG_ERR,"Unsupported op %#x", op); return -RIG_EINVAL; } return RIG_OK; } hamlib-1.2.15.3/racal/racal.h0000644000175000017500000000361212044564477012452 00000000000000/* * Hamlib Racal backend - main header * Copyright (c) 2004-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _RACAL_H #define _RACAL_H 1 #include "hamlib/rig.h" #define TOK_RIGID TOKEN_BACKEND(1) extern const struct confparams racal_cfg_params[]; struct racal_priv_data { unsigned receiver_id; int bfo; float threshold; /* attenuation */ }; int racal_set_conf(RIG *rig, token_t token, const char *val); int racal_get_conf(RIG *rig, token_t token, char *val); int racal_init(RIG *rig); int racal_cleanup(RIG *rig); int racal_open(RIG *rig); int racal_close(RIG *rig); int racal_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int racal_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int racal_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int racal_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int racal_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int racal_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int racal_reset(RIG *rig, reset_t reset); const char* racal_get_info(RIG *rig); extern const struct rig_caps ra6790_caps; extern const struct rig_caps ra3702_caps; #endif /* _RACAL_H */ hamlib-1.2.15.3/racal/Makefile.in0000644000175000017500000005020612044564555013262 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = racal DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_racal_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la \ $(top_builddir)/lib/libmisc.la am__objects_1 = ra6790.lo ra3702.lo am_hamlib_racal_la_OBJECTS = $(am__objects_1) racal.lo ra37xx.lo hamlib_racal_la_OBJECTS = $(am_hamlib_racal_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_racal_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_racal_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_racal_la_SOURCES) DIST_SOURCES = $(hamlib_racal_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ RACALSRCLIST = ra6790.c ra3702.c pkglib_LTLIBRARIES = hamlib-racal.la hamlib_racal_la_SOURCES = $(RACALSRCLIST) racal.c ra37xx.c hamlib_racal_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_racal_la_LIBADD = $(top_builddir)/src/libhamlib.la \ $(top_builddir)/lib/libmisc.la noinst_HEADERS = racal.h ra37xx.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu racal/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu racal/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-racal.la: $(hamlib_racal_la_OBJECTS) $(hamlib_racal_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_racal_la_LINK) -rpath $(pkglibdir) $(hamlib_racal_la_OBJECTS) $(hamlib_racal_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ra3702.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ra37xx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ra6790.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/racal.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/racal/racal.c0000644000175000017500000002347712044564477012460 00000000000000/* * Hamlib Racal backend - main file * Copyright (c) 2004-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "cal.h" #include "register.h" #include "token.h" #include "racal.h" const struct confparams racal_cfg_params[] = { { TOK_RIGID, "receiver_id", "receiver ID", "receiver ID", "0", RIG_CONF_NUMERIC, { .n = { 0, 99, 1 } } }, { RIG_CONF_END, NULL, } }; #define BUFSZ 32 #define SOM "$" #define EOM "\x0d" /* CR */ /* * modes */ #define MD_AM 1 #define MD_FM 2 #define MD_MCW 3 /* variable BFO */ #define MD_CW 4 /* BFO center */ #define MD_ISB 5 /* option */ #define MD_LSB 6 #define MD_USB 7 /* * racal_transaction * We assume that rig!=NULL, rig->state!= NULL * * TODO: Status Response handling with G/T commands */ static int racal_transaction(RIG *rig, const char *cmd, char *data, int *data_len) { struct racal_priv_data *priv = (struct racal_priv_data*)rig->state.priv; struct rig_state *rs = &rig->state; char cmdbuf[BUFSZ+1]; int cmd_len; int retval; cmd_len = sprintf(cmdbuf, SOM "%d%s" EOM, priv->receiver_id, cmd); serial_flush(&rs->rigport); retval = write_block(&rs->rigport, cmdbuf, cmd_len); if (retval != RIG_OK) return retval; /* no data expected */ if (!data || !data_len) { return retval; } retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM)); if (retval <= 0) return retval; /* strip CR from string */ if (data[retval-1] == '\x0d') { data[--retval] = '\0'; /* chomp */ } *data_len = retval; return RIG_OK; } int racal_init(RIG *rig) { struct racal_priv_data *priv; if (!rig || !rig->caps) return -RIG_EINVAL; priv = (struct racal_priv_data*)malloc(sizeof(struct racal_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } rig->state.priv = (void*)priv; priv->receiver_id = 0; priv->bfo = 0; priv->threshold = 0; return RIG_OK; } /* */ int racal_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * Assumes rig!=NULL, rig->state.priv!=NULL */ int racal_set_conf(RIG *rig, token_t token, const char *val) { struct racal_priv_data *priv = (struct racal_priv_data*)rig->state.priv; switch (token) { case TOK_RIGID: priv->receiver_id = atoi(val); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * assumes rig!=NULL, * Assumes rig!=NULL, rig->state.priv!=NULL * and val points to a buffer big enough to hold the conf value. */ int racal_get_conf(RIG *rig, token_t token, char *val) { struct racal_priv_data *priv = (struct racal_priv_data*)rig->state.priv; switch(token) { case TOK_RIGID: sprintf(val, "%d", priv->receiver_id); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * racal_open * Assumes rig!=NULL */ int racal_open(RIG *rig) { /* Set Receiver to remote control * * TODO: Perform the BITE routine (1mn!) at each open? * TODO: "S5" request values of IF bandwidth filters found? */ return racal_transaction (rig, "S2", NULL, NULL); } /* * racal_close * Assumes rig!=NULL */ int racal_close(RIG *rig) { /* Set Receiver to local control */ return racal_transaction (rig, "S1", NULL, NULL); } /* * racal_set_freq * Assumes rig!=NULL */ int racal_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char freqbuf[BUFSZ]; int freq_len; freq_len = sprintf(freqbuf, "F%0g", (double)(freq/MHz(1))); if (freq_len < 0) return -RIG_ETRUNC; return racal_transaction (rig, freqbuf, NULL, NULL); } int racal_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { char freqbuf[BUFSZ]; int retval, len; double f; retval = racal_transaction (rig, "TF", freqbuf, &len); if (retval < RIG_OK) return retval; if (len < 2 || freqbuf[0] != 'F') return -RIG_EPROTO; sscanf(freqbuf+1, "%lf", &f); *freq = (freq_t)f * MHz(1); return RIG_OK; } /* * racal_set_mode * Assumes rig!=NULL */ int racal_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct racal_priv_data *priv = (struct racal_priv_data*)rig->state.priv; int ra_mode; char buf[BUFSZ]; switch (mode) { case RIG_MODE_CW: ra_mode = (priv->bfo!=0) ? MD_MCW:MD_CW; break; case RIG_MODE_USB: ra_mode = MD_USB; break; case RIG_MODE_LSB: ra_mode = MD_LSB; break; case RIG_MODE_AM: ra_mode = MD_AM; break; case RIG_MODE_AMS: ra_mode = MD_ISB; break; /* TBC */ case RIG_MODE_FM: ra_mode = MD_FM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %d\n", __FUNCTION__, mode); return -RIG_EINVAL; } if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); sprintf(buf, "D%dI%.0f", ra_mode, (double)(width/kHz(1))); return racal_transaction (rig, buf, NULL, NULL); } int racal_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char resbuf[BUFSZ], *p; int retval, len; double f; retval = racal_transaction (rig, "TDI", resbuf, &len); if (retval < RIG_OK) return retval; p = strchr(resbuf, 'I'); if (len < 3 || resbuf[0] != 'D' || !p) return -RIG_EPROTO; switch (resbuf[1]-'0') { case MD_MCW: case MD_CW: *mode = RIG_MODE_CW; break; case MD_LSB: *mode = RIG_MODE_LSB; break; case MD_USB: *mode = RIG_MODE_USB; break; case MD_ISB: *mode = RIG_MODE_AMS; break; /* TBC */ case MD_FM: *mode = RIG_MODE_FM; break; case MD_AM: *mode = RIG_MODE_AM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %d\n", __FUNCTION__, mode); return -RIG_EPROTO; } sscanf(p+1, "%lf", &f); *width = (pbwidth_t)(f * kHz(1)); return RIG_OK; } /* * racal_set_level * Assumes rig!=NULL */ int racal_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct racal_priv_data *priv = (struct racal_priv_data*)rig->state.priv; char cmdbuf[BUFSZ]; int agc; switch (level) { case RIG_LEVEL_RF: /* Manually set threshold */ sprintf(cmdbuf, "A%d", (int)(val.f*120)); priv->threshold = val.f; break; case RIG_LEVEL_IF: sprintf(cmdbuf, "B%+0g", ((double)val.i)/kHz(1)); priv->bfo = val.i; break; case RIG_LEVEL_AGC: switch (val.i) { case RIG_AGC_FAST: agc = 1; break; case RIG_AGC_MEDIUM: agc = 2; break; case RIG_AGC_SLOW: agc = 3; break; case RIG_AGC_USER: agc = 4; break; default: return -RIG_EINVAL; } if (priv->threshold != 0 && agc != 4) agc += 4; /* with manually set threshold */ sprintf(cmdbuf, "M%d", agc); break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported %d\n", __FUNCTION__, level); return -RIG_EINVAL; } return racal_transaction (rig, cmdbuf, NULL, NULL); } /* * racal_get_level * Assumes rig!=NULL */ int racal_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct racal_priv_data *priv = (struct racal_priv_data*)rig->state.priv; char resbuf[BUFSZ]; int retval, len, att; double f; switch (level) { case RIG_LEVEL_RF: /* Manually set threshold */ retval = racal_transaction (rig, "TA", resbuf, &len); if (retval < RIG_OK) return retval; if (len < 2 || resbuf[0] != 'A') return -RIG_EPROTO; sscanf(resbuf+1, "%d", &att); val->f = priv->threshold = (float)att/120; break; case RIG_LEVEL_IF: retval = racal_transaction (rig, "TB", resbuf, &len); if (retval < RIG_OK) return retval; if (len < 2 || resbuf[0] != 'B') return -RIG_EPROTO; sscanf(resbuf+1, "%lf", &f); val->i = priv->bfo = (shortfreq_t)(f * kHz(1)); break; case RIG_LEVEL_AGC: retval = racal_transaction (rig, "TM", resbuf, &len); if (retval < RIG_OK) return retval; if (len < 2 || resbuf[0] != 'M') return -RIG_EPROTO; switch (resbuf[1]-'0') { case 1: case 5: val->i = RIG_AGC_FAST; break; case 2: case 6: val->i = RIG_AGC_MEDIUM; break; case 3: case 7: val->i = RIG_AGC_SLOW; break; case 4: val->i = RIG_AGC_USER; break; default: return -RIG_EINVAL; } break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported %d\n", __FUNCTION__, level); return -RIG_EINVAL; } return RIG_OK; } /* * Assumes rig!=NULL, rig->state.priv!=NULL */ int racal_reset(RIG *rig, reset_t reset) { /* Initiate BITE routine, takes 1 minute! */ return racal_transaction (rig, "S3", NULL, NULL); } const char* racal_get_info(RIG *rig) { static char infobuf[64]; char bitebuf[BUFSZ]; char filterbuf[BUFSZ]; int res_len, retval; /* get BITE results */ retval = racal_transaction (rig, "S6", bitebuf, &res_len); if (retval < 0) return "IO error"; if (bitebuf[1] == 'O' && bitebuf[2] == 'K') { bitebuf[3] = '\0'; } else { char *p = strstr(bitebuf, "END"); if (p) *p = '\0'; } /* get filters */ retval = racal_transaction (rig, "S5", filterbuf, &res_len); if (retval < 0) strcpy(filterbuf,"IO error"); sprintf(infobuf, "BITE errors: %s, Filters: %s\n", bitebuf+1, filterbuf); return infobuf; } /* * initrigs_racal is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(racal) { rig_debug(RIG_DEBUG_VERBOSE, "racal: _init called\n"); rig_register(&ra6790_caps); rig_register(&ra3702_caps); return RIG_OK; } hamlib-1.2.15.3/racal/Makefile.am0000644000175000017500000000050612044564477013252 00000000000000RACALSRCLIST = ra6790.c ra3702.c pkglib_LTLIBRARIES = hamlib-racal.la hamlib_racal_la_SOURCES = $(RACALSRCLIST) racal.c ra37xx.c hamlib_racal_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_racal_la_LIBADD = $(top_builddir)/src/libhamlib.la \ $(top_builddir)/lib/libmisc.la noinst_HEADERS = racal.h ra37xx.h hamlib-1.2.15.3/racal/ra37xx.h0000644000175000017500000000617512044564477012533 00000000000000/* * Hamlib Racal backend - RA37XX header * Copyright (c) 2004-2010 by Stephane Fillod * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _RA37XX_H #define _RA37XX_H 1 #include "hamlib/rig.h" #include "racal.h" extern const struct confparams ra37xx_cfg_params[]; /* Packet timeout at Master port, 5-9 */ #define RA37XX_TIMEOUT 1000 /* ms */ #define RA37XX_STR_CAL { 13, \ { \ { 97, 86 }, /* 120 dBuV */ \ { 109, 76 }, /* 110 dBuV */ \ { 120, 66 }, /* 100 dBuV */ \ { 132, 56 }, /* 90 dBuV */ \ { 144, 46 }, /* 80 dBuV */ \ { 155, 36 }, /* 70 dBuV */ \ { 167, 26 }, /* 60 dBuV */ \ { 179, 16 }, /* 50 dBuV */ \ { 190, 6 }, /* 40 dBuV */ \ { 202, -4 }, /* 30 dBuV */ \ { 214, -14 }, /* 20 dBuV */ \ { 225, -24 }, /* 10 dBuV */ \ { 255, -34 }, /* 0 dBuV */ \ } } #define RA37XX_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .levels = RIG_LEVEL_AGC|RIG_LEVEL_CWPITCH, \ /* .flags = 1, */ \ } struct ra37xx_priv_data { int receiver_id; }; int ra37xx_set_conf(RIG *rig, token_t token, const char *val); int ra37xx_get_conf(RIG *rig, token_t token, char *val); int ra37xx_init(RIG *rig); int ra37xx_cleanup(RIG *rig); int ra37xx_open(RIG *rig); int ra37xx_close(RIG *rig); int ra37xx_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int ra37xx_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int ra37xx_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int ra37xx_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int ra37xx_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int ra37xx_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); int ra37xx_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int ra37xx_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); const char* ra37xx_get_info(RIG *rig); int ra37xx_set_ant(RIG *rig, vfo_t vfo, ant_t ant); int ra37xx_get_ant(RIG *rig, vfo_t vfo, ant_t *ant); int ra37xx_set_mem(RIG *rig, vfo_t vfo, int ch); int ra37xx_get_mem(RIG *rig, vfo_t vfo, int *ch); int ra37xx_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch); int ra37xx_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); #endif /* _RA37XX_H */ hamlib-1.2.15.3/README.developer0000644000175000017500000006152712044564477013012 00000000000000Hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com) (C) Stephane Fillod 2000-2011 (C) The Hamlib Group 2000-2011 Take a look at http://sourceforge.net/projects/hamlib/ Here you will find a mail list, and the latest releases. See README for frontend/backend outline. See README.betatester for background on testing Hamlib. The shared libs provide functions for both radio control, and data retrieval from the radio. The structure of the libraries is as follows. (1) There is one frontend library "libhamlib" that provides the generic API for user applications. (2) There are "n" backend libraries that "wrap" rig specific communications inside frontend API. (3) Frontend lib loads (on demand) the appropriate backend lib as required. Frontend Library ---------------- libhamlib.so - frontend lib that provides generic API for all RIG types. This is what Application programmers will "see". Backend Examples are: --------------------- 1.hamlib-yaesu.so will provide connectivity to Yaesu FT 747GX Transceiver, FT 847 "Earth Station", etc. via a standard API. 2. hamlib-xxxx.so will provide connectivity to the Wiz-bang moon-melter 101A (yikes..) Hamlib also enables developers to develop professional looking GUI's towards a standard control library API, and they would not have to worry about the underlying connection towards physical hardware. Serial (RS232) connectivity is built in as are RPC, IP (also via a socket utility), and USB. Other connectivity will follow afterwards. General Guidelines. ------------------- 0. The top level directory looks like this as of 13 Feb 2011 (Note, it has grown considerably). $ tree -d -I .git . ├── alinco ├── aor ├── ars ├── bindings ├── c++ ├── doc ├── drake ├── dummy ├── easycomm ├── flexradio ├── fodtrack ├── gnuradio ├── gs232a ├── heathkit ├── icom ├── include │   └── hamlib ├── jrc ├── kachina ├── kenwood ├── kit ├── kylix │   └── tests ├── lib ├── lowe ├── m2 ├── macros ├── microtune ├── miniVNA ├── pcr ├── perl ├── prm80 ├── racal ├── rft ├── rotorez ├── rpcrig ├── rpcrot ├── rs ├── sartek ├── skanti ├── spid ├── src ├── tapr ├── tentec ├── tests │   ├── config │   ├── rigctl.test │   ├── testbcd.test │   ├── testfreq.test │   └── testloc.test ├── tuner ├── uniden ├── winradio │   └── linradio ├── wj └── yaesu 56 directories 1. Building If you just want to recompile the library, please refer to the INSTALL file. This document introduces hacking the code of Hamlib. 1.1 Obtaining sources: git clone git clone git://hamlib.git.sourceforge.net/gitroot/hamlib/hamlib The clone has to only be done the first time. After the initial clone, whenever you want to update your local repository, issue the following command in the root directory of hamlib. git pull This will download and merge any changes from the canonical Hamlib Git repository (what Git calls origin by default). This command actually combines two Git commands, fetch and merge into one that will first check for conflicting changes between your local repository and the remote (origin) repository and will not apply any changes if conflicts are found. 1.1.1 Obtaining more info on Git Check out the Source Forge page at https://sourceforge.net/scm/?type=git&group_id=8305 for more information about how to use the Git repository of Hamlib. Much documentation on Git exists. A good starting point is: http://git-scm.com/documentation From this page are links to toturials, books (Pro Git proved useful for me), and references (http://gitref.org/ is another good resource). Another site: http://www-cs-students.stanford.edu/~blynn/gitmagic/ 1.1.2 Providing patches with Git Git provides tools to generate patches and submit them to the Hamlib developers via email. Use of these tools is preferred as Git allows credit to be given to the author and submitter of the patches. Please submit the patches to the hamlib-developer mailing list. See section 8.3. 1.1.3 Git and branches One of the most powerful features of Git is its ability to make working with branches easy. It also allows the developers to "cherry pick" patches from the master development branch into stable release branches. In this manner we can accomodate patches submitted against a stable release and merge them into master as well. Such parallel development is a new feature for our project and there will be a learning curve! After cloning the repository as above, the repository is synchronized with the "master" branch. This can be confirmed by 'git branch'. A new branch can be created by providing a name, 'git branch n0nb_k3_level' which will now exist as a branch in your local repository. This is a good way to work on new features as Git keeps changes to files in each branch separate. As you can see: $ git branch Hamlib-1.2.13 Hamlib-1.2.13.1 * master n0nb_k3 there are a number of branches in my local repository. Most, such as "Hamlib-1.2.13", exist in the canonical repository as well. They can be seen by 'git branch -r' and you can switch to any of them using the 'git checkout BRANCH_NAME' command. Finally, once your changes are ready for inclusion in Hamlib, commit your changes to the branch you are working in, checkout the master branch, and use 'git merge' to synchronize your changes into the master branch. Lastly, push your changes to the canonical repository (developer write access and checkout using the SSH protocol required. See https://sourceforge.net/scm/?type=git&group_id=8305) or email them to hamlib-developer@lists.sourceforge.net for inclusion into Hamlib. 1.1.4 Summary This is a very brief introduction to Git for Hamlib developers. Day-to-day Git usage involves a handful of commands--clone, status, commit, pull, branch, checkout, merge, and push are probably the most common. Other useful commands are log and diff to see changes (especially when color output is enabled in your Git configuration). See the references above to learn about setting up Git to your preference. If you like a GUI tool several exist. Gitk and Gitg are similar with the former being written with the Tk toolkit and the latter in GTK+. Another is Giggle with its own interface. All allow looking at the complete history of the repository and changes made to any file. 1.2. Requirements Hamlib is entirely developed using GNU tools, under various Linux systems. Note that Hamlib is not restricted to Linux systems. We welcome anyone who has access to a POSIXish system to port Hamlib. Contact us for help. That is, if you want to take part in the development of Hamlib, you'll need the following tools. Make sure you have at least the required version or you won't even be able to build from the Git clone. N.B. The Debian and derivatives (Ubuntu and friends) 'build-essentials' package will install a number of tools and minimize the number of packages that need to be installed manually (Debian package names are listed, other distributions may differ). * Gnu C or any C99 compliant compiler # gcc --version * Gnu make (or any modern one, BSD okay) # make --version * autoconf 2.59 # autoconf --version * automake 1.7 # automake --version * libtool 2.2.6b+ # libtool --version * libltdl-dev 2.2.6b+ * Git for connection to hamlib.git.sourceforge.net N.B. Hamlib requires libtool >= 2.2.6b in compliance with CVE-2009-3736. Optional, but highly recommended: * GNU C++ # g++ --version * swig (for bindings) 1.3.14 # swig -version * perl devel # h2xs * tcl devel # tcltk-depends * python devel # python-config * libxml2 devel # xml2-config --version * libgd2 devel # gdlib-config --version * libusb devel # libusb-config --version (not 1.0.0!) * RPC devel (libc-dev) # rpcgen --version N.B.: The libusb package is required for building most of the 'kit' backend. The older version is needed, not 1.0.0 or higher. Debian and derivatives package libusb 0.1.12 which is what is needed. Documentation: * Doxygen N.B.: Some systems can have several versions of the autotools installed. In that case, autoconf may be called "autoconf2.50", autoheader "autoheader2.50", and automake "automake-1.7", aclocal "aclocal-1.7" or a newer version. IMPORTANT: If autoconf or automake are installed on your system, make sure they are matching *at least* the version shown above. Some people experience troubles with automake 1.5, if you're one of those, it's recommended to upgrade to automake 1.7, which is a lot more stable. 1.3. configure and build stage It is important to note that the Git repository holds no autogenerated files, i.e. configure, config.guess, Makefile, etc. Hence after a fresh checkout, you'll have to generate those files. To proceed, first edit the autogen.sh script, and set appropriately the AUTOCONF, AUTOHEADER, AUTOHEADER, and ACLOCAL variables with the required versions seen in the previous section (most systems will be fine with the default names, only do this if a problem arises). cd hamlib sh ./autogen.sh [--disable-static] [CFLAGS=<"-g -O0">] make make install If you don't want the build files cluttering the source directories, do the following in the same parent directory of hamlib: mkdir build && cd build sh ../hamlib/autogen.sh [--disable-static] [CFLAGS=<"-g -O0">] make make install This will keep the binary output files seperate from the source tree and aid in development by reducing clutter in the source tree. Once you've run `autogen.sh', make sure you've got some recent config.guess and config.sub (needed to guess your system type). Anything of at least year 2004 should be fine, unless you run some exotic hardware/software system: ./config.guess --version ./config.sub --version The '--prefix' option to `autogen.sh' is optional and not shown as it defaults to /usr/local. Convention is that locally built packages be installed in /usr/local away from distribution installed packages. The '--disable-static' and 'CFLAGS="-g -O0"' speeds up compilation if you don't plan to use static libraries and can bear less optimized binaries while the '-g' option adds debugging info which can be changed to -ggdb to generate debugging info for gdb. Additionally, you may want to add the '--with-perl-binding' or '--with-python-binding' or '--enable-tcl-binding' if you are interested in Swig binding support for those scripting languages. NOTE: The autogen.sh script has only to be run the first time after a fresh checkout or when a Makefile.am or other build file is modified or added. The difference between building as a beta tester and a developer is in the '--enable-maintainer-mode' option passed to configure from autogen.sh. This option will add new Makefile targets and dependencies and not force a rebuild of the Makefiles when make is executed. This is why we recommend that beta testers use the daily Git master branch snapshot from: http://n0nb.users.sourceforge.net For a Tcl build, add this if needed: --with-tcl=/usr/lib/tcl8.2 Note: C-shell users may have to run autogen.sh and make through a bourne shell instead, or pass "SHELL=bash" as a parameter to make. NOTE! If Hamlib has not been previously installed as a locally built package you will need to make sure that `ldconfig' is configured correctly and run periodically after `make install'. Most modern distributions have an /etc/ld.so.conf.d/ directory where local configuration can be made. Later versions of Debian and derivatives have a file named 'libc.conf' in this directory. The contents of libc.conf are: # libc default configuration /usr/local/lib If your system does not have such a file, one will need to be created and then `ldconfig' will need to be run as the root user so that applications using the Hamlib libraries can find them. 1.4. Feedback The Hamlib team is very interested to hear from you, how Hamlib builds and works on your system, especially on non-Linux or non-PC systems. We are trying to make Hamlib as portable as possible. Please report problems to our developer mailing list, hamlib-developer@lists.sourceforge.net Patches are welcome too! Just send them to the mailing list. Git formatted patches are preferred. Unified diff format (diff -u) is also welcome. Patches should apply to the current Git master branch or a testing branch, if possible. If you're patching against an older released version of Hamlib, we can take those as well but please document the release the diff is generated against. So far, Hamlib has been tested successfully under the following systems: (if your system is not present, please report to the mailing list) * Debian i386 (plus derivatives--Ubuntu, etc.) * Debian sid mipsel * RedHat i386 * Linux ppc * Slackware i386 * FreeBSD & NetBSD * Solaris 2.6 * Mac OS X * win32: Cygwin, Mingw 2. How to add a new backend The rule is one backend per protocol family. Try to share code between rigs of the same family, if applicable. 2.1. mkdir mybackend Create a new subdir, of the name of the protocol backend. NB: the directory MUST be the same as the backend name. 2.2. Add to the DIST_SUBDIRS variable in the topdir Makefile.am 2.3. Add the backend name to the BACKEND_LIST variable (add to ROT_BACKEND_LIST for a new rotor backend) in configure.ac.ltv1 and configure.ac.ltv2 (configure.ac is deprecated at the moment). 2.4. Add "mybackend/Makefile" in the AC_CONFIG_FILES macro at the bottom of configure.ac.ltv1 and configure.ac.ltv2 (configure.ac is deprecated at the moment) 2.5. Create mybackend/Makefile.am, mybackend.c mybackend.h Use 'dummy' backend as a template. Here are commands for the bourne shell: $ automake mybackend/Makefile $ CONFIG_HEADERS= CONFIG_LINKS= CONFIG_FILES=mybackend/Makefile ./config.status make in topdir to rebuild all 2.6. Commit your work to your local repository. (developer access to Hamlib Git required for pushing to the canonical Hamlib repository (origin)) Provide patches to the mailing list: (Please let N0NB know if the commands below are incorrect) $ git status # Show uncommitted/staged/unstaged files $ git add mybackend $ cd mybackend (The following command might not be necessary) $ git add Makefile.am mybackend.c mybackend.h While specifying each file individually as above allows for fine- grained control, git offers a wildcard shortcut to add all new files: $ git add . Be careful! If you have other files that were created as part of the build process, this command will add them too unless they match a pattern in .gitignore. Always check with 'git status' first! $ git commit -m "Initial release" Makefile.am mybackend.c mybackend.h Note: The `-m' switch passes a short message to the Git repository upon a commit. If a longer message is desired, do not use the `-m' option. The editor specified in the EDITOR or VISUAL environment variables will be started where a more detailed message may be composed. 2.7 If you have developer access to the Git repository hosted at Source Forge, you can do the following: $ git push origin Your changes will now be available to others. 3. How to add a new model to an existing backend 3.1. make sure there's already a (unique) ID for the model to be added in include/hamlib/riglist.h 3.2. locate the existing backend 3.3. Clone the most similar model in the backend 3.4. Add the new C file to the _SOURCES variable of the backend's Makefile.am 3.5. Add "extern const struct rig_caps _caps;" to mybackend.h 3.6. In initrigs_ of mybackend.c, add "rig_register(&_caps);" 3.7. Run `make' if you have dependencies, or the following to regenerate the makefile: $ automake mybackend/Makefile $ CONFIG_HEADERS= CONFIG_LINKS= CONFIG_FILES=mybackend/Makefile ./config.status Run `make' in topdir to rebuild all. 3.8. Commit your work (once tests are satisfactory): $ svn add mybackend/mymodel.c $ svn commit -m "added to " Makefile.am mybackend.c mybackend.h mymodel.c Note: See Note in section 2.6 above. 4. Read README.betatester to test the new backend/model. Report to mailing list. 5. Basic functions: set/get_freq, set/get_mode, and set/get_vfo would be a good starting point for your new backend. 6. C code examples. A C code snippet to connect to a FT847 and set the frequency of the main VFO to 439,700,000 Hz, using FM as the required mode, would look something like this. The error checking is removed for simplicity. See tests/testrig.c 7. Where are the GUI's? "Build it and they will come ..." Seriously, I am hoping the API's will provide a solid framework for some cool GUI development. I would like to see some GTK or Qt apps that use the hamlib API's so they can be used by end users as a nice part of the Ham shack. Starting points (not exhaustive): Fldigi, CQRlog, gmfsk, gpredict, grig, klog, kontakt, ktrack, xlog 8. Contributing code 8.1 License Contributed code to the Hamlib frontend must be released under the LGPL. Contributed code to Hamlib backends must follow backend current license. Needless to say, the LGPL is the license of choice. End user applications like rigctl, rotctl and RPC daemons should be released under the GPL, so any contributed code must follow the license. 8.2 Coding guidelines and style Try to keep current style of existing code. Improvements are welcome though. When in doubt, follow the Linux kernel coding style guide: http://www.kernel.org/doc/Documentation/CodingStyle Hamlib is a code base from many contributors and a variety of styles have been employed. If you work on a source file, go ahead and apply good judgment and clean it up per the kernel style guide. Lining things up nicely with 8 space tabs (use tabs, not spaces) is an excellent start. Next, put spaces in assignments to aid readability. Align closing braces with the opening block's keyword. In function definitions put the opening brace on its own line under the definition's parameter line. Hamlib source code is no place for an entry into the obsfucated C contest! Many of us are hobbyists and write this for fun. Easy to read and understand logic is preferred over a clever solution. If your solution must be written in a clever fashion, please document it well in your comments. Any header files included from the hamlib/ directory should be enclosed in <>: #include # Per GNU GCC documentation Other included header files (backend and rig specific headers) should be enclosed in "": #include "yaesu.h" Contributed code should always keep the source base in a compilable state, and not regress unless stated otherwise. There's no need to tag the source in a patch with your name in comments behind each modification, we already know the culprit from commit logs (also see "git blame"). :-) Patches should take portability issues into account. Keep in mind Hamlib has to run under: * various Linux's * NetBSD, FreeBSD * MacOS X * Windows: MinGW/Cygwin, and VisualC++ support for rig.h Hamlib should also compile with the following common compilers: * gcc-2.9x (most likely deprecated) * gcc-3.0 and gcc-3.2+ (nearly deprecated?) * gcc-4.x and newer * in shared and static * C++ compiler against rig.h, riglist.h, rotator.h Portability issues to watch: * little vs. big endian systems (use shifts or adhoc functions) * 64 bit int: avoid them in API * printf/scanf of 64bit int: use PRIll and SCNll * printf/scanf of freq_t: use PRIfreq and SCNfreq 8.2.1 Use of rig_debug() function Hamlib provides a debugging aid in the form of the rig_debug() function, It is essentially a wrapper around printf() and takes many of the same flags and conversion specifiers as the C library's various printf() functions. It adds an additional parameter for specifying the desired debug level for the output string. Six levels of debugging are defined in include/hamlib/rig.h and they are: NONE No bug reporting BUG Serious bug ERR Error case (e.g. protocol, memory allocation) WARN Warning VERBOSE Verbose TRACE Tracing They correspond to the use of the -v switch (from no -v switch to -vvvvv) to rigctl's command line. Hamlib applications can also set the debug level via the Hamlib API. From an application's perspective, setting a specific level includes all messages at that level and all at any lower level. In the library, passing RIG_DEBUG_ERR to rig_debug() limits display of that message to a level setting of ERR or any higher level. In this case if the application sets the message level to RIG_DEBUG_INFO, the message will not be seen. Use of a given level can show the value of a critical variable without the need of a TRACE level message where it can get lost in the stream of output produced by low-level Hamlib functions. Here are my (N0NB's) suggested use of rig_debug() levels in backends. * Many backend functions should have an initial call to rig_debug() as follows: rig_debug(RIG_DEBUG_VERBOSE, "%s() entered\n", __func__); The use of RIG_DEBUG_VERBOSE allows tracking the chain of function calls through the backend while still keeping rigctl's output mostly uncluttered by use of the -vvvv switch. * Developers will want to call rig_debug() to display values of critical variable(s) in a backend function. For this RIG_DEBUG_VERBOSE (rigctl -vvvv) should be a good choice as the output won't be lost in the stream of RIG_DEBUG_TRACE (rigctl -vvvvv) level output by various low-level Hamlib functions. It will also match the display of the values of critical variable(s) with the function calls as above. * Use RIG_DEBUG_TRACE when it makes sense to see the variable(s) in the context of a lot of low-level debugging output (rigctl -vvvvv). * Lower levels (BUG, ERR, and WARN) should be used where it makes sense that information be printed when the user selects less verbosity. Use sparingly. Many backends do not conform to this suggestion at the moment. The use of the RIG_DEBUG_LEVEL values has been somewhat haphazard (at least by this scribe) so fixing these when working in a given backend is encouraged. If an application sets the debugging level to RIG_DEBUG_NONE, then rig_debug() functions will produce no output. Therefore rig_debug() cannot be counted on to output a message in all runtime cases. The debugging levels may be an area for consideration in API_3. 8.3 Submitting patches Git provides tools to generate patches and submit them to the Hamlib developers via email. Use of these tools is preferred as Git allows credit to be given to the author and submitter of the patches. Alternately, patches can be submitted in unified format (diff -u), against the Git master branch or a given release (please note well which one!). Both formats make patches easily readable. The patches are to be sent to the hamlib-developer mailing list ( hamlib-developer@lists.sourceforge.net). If the file is too big, you can send it as a compressed attachment. 8.3.1 Changelog Simply summarize your changes when the files are committed to Git or, if providing patches to the mailing list, provide a summary so the uploader can include it in the commit message which will show in the commit log (Git formatted emails will inlcude this already). 8.4 Git commit access Generally, volunteers can get commit access to the SourceForge Hamlib Git repository upon asking one of the project administrators. Sometimes we'll ask you! However, before your start committing, the project admins would like first to have a look at your "style", just to make sure you grok the Hamlib approach (c.f. previous section on submitting a patch). Then you'll be able to commit by yourself to the backend you chose to maintain. Please follow the rules hereunder: * Always keep the Git repository (all branches) in a compilable state. * Follow the coding guidelines * Touching the frontend (files in src/ and include/hamlib) always requires discussion beforehand on the hamlib-developer list. * Announce on the hamlib-developer list if you're about to do serious maintainance work Thanks for contributing and have fun! Stephane Fillod f8cfe and The Hamlib Group hamlib-1.2.15.3/COPYING0000644000175000017500000004325412044564477011176 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. hamlib-1.2.15.3/celestron/0000755000175000017500000000000012044565042012176 500000000000000hamlib-1.2.15.3/celestron/celestron.c0000644000175000017500000001463312044564477014302 00000000000000/* * Hamlib Rotator backend - Celestron * Copyright (c) 2011 by Stephane Fillod * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include "hamlib/rotator.h" #include "serial.h" #include "misc.h" #include "register.h" #include "celestron.h" #define ACK "#" #define BUFSZ 128 /** * celestron_transaction * * cmdstr - Command to be sent to the rig. * data - Buffer for reply string. Can be NULL, indicating that no reply is * is needed, but answer will still be read. * data_len - in: Size of buffer. It is the caller's responsibily to provide * a large enough buffer for all possible replies for a command. * * returns: * RIG_OK - if no error occured. * RIG_EIO - if an I/O error occured while sending/receiving data. * RIG_ETIMEOUT - if timeout expires without any characters received. */ static int celestron_transaction (ROT *rot, const char *cmdstr, char *data, size_t data_len) { struct rot_state *rs; int retval; int retry_read = 0; char replybuf[BUFSZ]; rs = &rot->state; transaction_write: serial_flush(&rs->rotport); if (cmdstr) { retval = write_block(&rs->rotport, cmdstr, strlen(cmdstr)); if (retval != RIG_OK) goto transaction_quit; } /* Always read the reply to know whether the cmd went OK */ if (!data) data = replybuf; if (!data_len) data_len = BUFSZ; /* the answer */ memset(data,0,data_len); retval = read_string(&rs->rotport, data, data_len, ACK, strlen(ACK)); if (retval < 0) { if (retry_read++ < rot->state.rotport.retry) goto transaction_write; goto transaction_quit; } /* check for acknowledge */ if (retval < 1 || data[retval-1] != '#') { rig_debug(RIG_DEBUG_ERR, "%s: unexpected response, len %d: '%s'\n", __func__, retval, data); return -RIG_EPROTO; } data[retval-1] = '\0'; retval = RIG_OK; transaction_quit: return retval; } static int celestron_set_position(ROT *rot, azimuth_t az, elevation_t el) { char cmdstr[32]; int retval; rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __func__, az, el); /* Note: if the telescope has not been aligned, the RA/DEC values will not be meaningful and the AZM-ALT values will be relative to where the telescope was powered on. After alignment, RA/DEC values will reflect the actual sky, azimuth will be indexed to North equals 0 and altitude will be indexed with 0 equal to the orientation where the optical tube is perpendicular to the azimuth axis. */ sprintf(cmdstr, "B%04X,%04X", (unsigned)((az/360.)*65535), (unsigned)((el/360.)*65535)); retval = celestron_transaction(rot, cmdstr, NULL, 0); return retval; } static int celestron_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { char posbuf[32]; int retval; unsigned w; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); /* Get Azm-Alt */ retval = celestron_transaction(rot, "Z" , posbuf, sizeof(posbuf)); if (retval != RIG_OK || strlen(posbuf) < 9 || posbuf[4] != ',') { return retval < 0 ? retval : -RIG_EPROTO; } if (sscanf(posbuf, "%04X", &w) != 1) return -RIG_EPROTO; *az = ((azimuth_t)w*360.)/65536.; if (sscanf(posbuf+5, "%04X", &w) != 1) return -RIG_EPROTO; *el = ((elevation_t)w*360.)/65536.; rig_debug(RIG_DEBUG_TRACE, "%s: (az, el) = (%.1f, %.1f)\n", __func__, *az, *el); return RIG_OK; } static int celestron_stop(ROT *rot) { int retval; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); /* Cancel Goto */ retval = celestron_transaction(rot, "M", NULL, 0); return retval; } static const char * celestron_get_info(ROT *rot) { static char info[16]; char str[8]; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__); if (celestron_transaction(rot, "V", str, sizeof(str)) != RIG_OK) return NULL; sprintf(info, "V%c.%c", str[0], str[1]); return info; } /* ************************************************************************* */ /* * Celestron Nexstar telescope(rotator) capabilities. * * Protocol documentation: * from Celestron: * http://www.celestron.com/c3/images/files/downloads/1154108406_nexstarcommprot.pdf * from Orion Teletrack Az-G: * http://content.telescope.com/rsc/img/catalog/product/instructions/29295.pdf */ const struct rot_caps nexstar_rot_caps = { .rot_model = ROT_MODEL_NEXSTAR, .model_name = "NexStar", // Any Celestron starting with version 1.2 .mfg_name = "Celestron", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rot_type = ROT_TYPE_AZEL, .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 = 3500, /* worst case scenario */ .retry = 1, .min_az = 0.0, .max_az = 360.0, .min_el = 0.0, .max_el = 180.0, .get_position = celestron_get_position, .set_position = celestron_set_position, .stop = celestron_stop, .get_info = celestron_get_info, }; /* ************************************************************************* */ DECLARE_INITROT_BACKEND(celestron) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); rot_register(&nexstar_rot_caps); return RIG_OK; } /* ************************************************************************* */ /* end of file */ hamlib-1.2.15.3/celestron/celestron.h0000644000175000017500000000170612044564477014304 00000000000000/* * Hamlib Rotator backend - Celestron interface protocol * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROT_CELESTRON_H #define _ROT_CELESTRON_H 1 extern const struct rot_caps nexstar_rot_caps; #endif /* _ROT_CELESTRON_H */ hamlib-1.2.15.3/celestron/Makefile.in0000644000175000017500000004751012044564551014176 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = celestron DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_celestron_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am_hamlib_celestron_la_OBJECTS = celestron.lo hamlib_celestron_la_OBJECTS = $(am_hamlib_celestron_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_celestron_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_celestron_la_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_celestron_la_SOURCES) DIST_SOURCES = $(hamlib_celestron_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = hamlib-celestron.la hamlib_celestron_la_SOURCES = celestron.c hamlib_celestron_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_celestron_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = celestron.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu celestron/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu celestron/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-celestron.la: $(hamlib_celestron_la_OBJECTS) $(hamlib_celestron_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_celestron_la_LINK) -rpath $(pkglibdir) $(hamlib_celestron_la_OBJECTS) $(hamlib_celestron_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/celestron.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/celestron/Makefile.am0000644000175000017500000000036312044564477014167 00000000000000 pkglib_LTLIBRARIES = hamlib-celestron.la hamlib_celestron_la_SOURCES = celestron.c hamlib_celestron_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_celestron_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = celestron.h hamlib-1.2.15.3/tentec/0000755000175000017500000000000012044565021011457 500000000000000hamlib-1.2.15.3/tentec/tt550.c0000644000175000017500000010703112044564477012444 00000000000000/* * Hamlib Tentec Pegasus TT550 backend - main file * Heavily modified for 550 support from the original tentec.c * (c) Oct 2002, Jan,Feb 2004- Ken Koster N7IPB * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 #include #include #include #include #include "tt550.h" /* * Filter table for 550 reciver support */ static int tt550_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 }; /* * Filter table for 550 transmit support - The 550 allows the transmitter audio * filter bandwidth to be changed, but the filters allowed are only a subset of the * receive filters. This table is used to restrict the filters to the allowable * range. */ static int tt550_tx_filters[] = { 3900, 3600, 3300, 3000, 2850, 2700, 2550, 2400, 2250, 2100, 1950, 1800, 1650, 1500, 1350, 1200, 1050 }; /***************************Support Functions********************************/ /* * tt550_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 tt550_transaction (RIG * rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval; struct rig_state *rs; rs = &rig->state; /* * Hold_Decode keeps the asynchronous decode routine from being called * when we get data back from a normal command. */ Hold_Decode (rig); serial_flush (&rs->rigport); retval = write_block (&rs->rigport, cmd, cmd_len); if (retval != RIG_OK) { Unhold_Decode (rig); return retval; } /* * no data expected, TODO: flush input? */ if (!data || !data_len) { Unhold_Decode (rig); return 0; } retval = read_string (&rs->rigport, data, *data_len, "", 0); if (retval == -RIG_ETIMEOUT) retval = 0; if (retval < 0) return retval; *data_len = retval; Unhold_Decode (rig); return RIG_OK; } /* * tt550_tx_control - The 550 has a number of operations that control * the transmitter. Commands like enable/disable tx, enable/disable * amplifier loop, enable/disable keep alive, etc. * This function provides for these commands. */ int tt550_tx_control (RIG * rig, char oper) { struct rig_state *rs = &rig->state; int retval, cmd_len; char cmdbuf[4]; cmd_len = sprintf (cmdbuf, "#%c" EOM, oper); retval = write_block (&rs->rigport, cmdbuf, cmd_len); /* * if (retval == RIG_OK) not currently saving the state of these operations I'm * not sure we need to, but if so, this is where it would go. */ return retval; } /* * tt550_ldg_control - The 550 has a builtin LDG antenna tuner option. * This function controls the tuner operations. * * * The LDG tuner listens on the Pegasus' RS-232 * Rx Data line. The interface is one-way. The tuner can't * respond at all. The Pegasus will respond with Z when * it sees the commands meant for the tuner. This is normal. * The LDG tuner is only listening on the serial line * when RF is applied. Therefore, RF must be applied before * the tuner will do anything. * * $0 = Place tuner in bypass mode * $1 = Start Tune process * $3 = Cap Up * $4 = Cap Dn * $5 = Inductor Up * $6 = Inductor Dn * This function provides for these commands. */ int tt550_ldg_control (RIG * rig, char oper) { int retval, cmd_len, lvl_len; char cmdbuf[4], lvlbuf[32]; cmd_len = sprintf (cmdbuf, "$%c" EOM, oper); if (cmd_len < 0) return cmd_len; lvl_len = 3; retval = tt550_transaction (rig, cmdbuf, 3, lvlbuf, &lvl_len); /* * if (retval == RIG_OK) not currently saving the state of these operations I'm * not sure we need to, but if so, this is where it would go. */ return retval; } /* * Tuning Factor Calculations * Used by both receive and transmit vfo routines * to calculate the desired tuning parameters. * tx - 0 for receive tuning, 1 for transmit tuning * Thanks to the unknown author of the GPL'd windows program * found on the Ten-Tec site. Having working examples of the * calculations was invaluable. */ static void tt550_tuning_factor_calc (RIG * rig, int tx) { struct tt550_priv_data *priv; int Bfo = 700; double TFreq = 0, IVal, radio_freq = 0; int NVal, FVal; // N value/finetune value int TBfo = 0; // temporary BFO int IBfo = 1500; // Intermediate BFO Freq int FilterBw; // Filter Bandwidth determined from table int Mode, bwBFO, PbtAdj, RitAdj, XitAdj; priv = (struct tt550_priv_data *) rig->state.priv; Mode = (tx ? priv->tx_mode : priv->rx_mode); radio_freq = ((tx ? priv->tx_freq : priv->rx_freq)) / (double) MHz (1); FilterBw = priv->width; PbtAdj = priv->pbtadj; RitAdj = priv->rit; XitAdj = priv->xit; if (tx) { bwBFO = (FilterBw / 2) + 200; IBfo = (bwBFO > IBfo) ? bwBFO : IBfo; if (Mode == RIG_MODE_USB) { TFreq = radio_freq + (double) (IBfo / 1e6) + (double) (XitAdj / 1e6); IBfo = (int) (IBfo * 2.73); } if (Mode == RIG_MODE_LSB) { TFreq = radio_freq - (double) (IBfo / 1e6) + (double) (XitAdj / 1e6); IBfo = (int) (IBfo * 2.73); } if (Mode == RIG_MODE_CW) { // CW Mode uses LSB Mode IBfo = 1500; TFreq = radio_freq - (double) (IBfo / 1e6) + (double) (Bfo / 1e6) + (double) (XitAdj / 1e6); IBfo = (int) (Bfo * 2.73); } if (Mode == RIG_MODE_FM) { IBfo = 0; TFreq = radio_freq - (double) (IBfo / 1e6) + (double) (Bfo / 1e6) + (double) (XitAdj / 1e6); IBfo = 0; } if (Mode == RIG_MODE_AM) { IBfo = 0; TFreq = radio_freq - (double) (IBfo / 1e6) + (double) (Bfo / 1e6) + (double) (XitAdj / 1e6); IBfo = 0; } } else { radio_freq = radio_freq + (double) (RitAdj / 1e6); if (Mode == RIG_MODE_USB) { IBfo = (FilterBw / 2) + 200; TFreq = radio_freq + (double) (IBfo / 1e6) + (double) (PbtAdj / 1e6) + (double) (RitAdj / 1e6); IBfo = IBfo + PbtAdj ; } if (Mode == RIG_MODE_LSB) { IBfo = (FilterBw / 2) + 200; TFreq = radio_freq - (double) (IBfo / 1e6) - (double) (PbtAdj / 1e6) + (double) (RitAdj / 1e6); IBfo = IBfo + PbtAdj ; } if (Mode == RIG_MODE_CW) { /* CW Mode uses LSB Mode */ if (((FilterBw / 2) + 300) <= Bfo) { IBfo = 0; TFreq = radio_freq - (double) (IBfo / 1e6) - (double) (PbtAdj / 1e6) + (double) (RitAdj / 1e6); IBfo = IBfo + Bfo + PbtAdj; } else { IBfo = (FilterBw / 2) + 300; TFreq = radio_freq - (double) (IBfo / 1e6) + (double) (Bfo / 1e6) - (double) (PbtAdj / 1e6) + (double) (RitAdj / 1e6); IBfo = IBfo + PbtAdj ; } } if (Mode == RIG_MODE_FM) { IBfo = 0; TFreq = radio_freq - (double) (IBfo / 1e6) + (double) (Bfo / 1e6) - (double) (PbtAdj / 1e6) + (double) (RitAdj / 1e6); IBfo = 0; } if (Mode == RIG_MODE_AM) { IBfo = 0; TFreq = radio_freq - (double) (IBfo / 1e6) + (double) (Bfo / 1e6) - (double) (PbtAdj / 1e6) + (double) (RitAdj / 1e6); IBfo = 0; } } TFreq = TFreq - 0.00125; NVal = (int) (TFreq * 400); IVal = (double) ((TFreq * 400.0) - NVal); FVal = (int) (IVal * 2500.0 * 5.46); NVal = (NVal + 18000); TBfo = (tx ? IBfo : (int) (((double) IBfo + 8000.0) * 2.73)); priv->ctf = NVal; priv->ftf = FVal; priv->btf = TBfo; } /*************************End of Support Functions**************************/ /* * tt550_init: * Basically, it just sets up *priv with some sane defaults * */ int tt550_init (RIG * rig) { struct tt550_priv_data *priv; priv = (struct tt550_priv_data *) malloc (sizeof (struct tt550_priv_data)); if (!priv) { /* * whoops! memory shortage! */ return -RIG_ENOMEM; } memset (priv, 0, sizeof (struct tt550_priv_data)); /* * set arbitrary initial status */ priv->rx_freq = MHz (3.985); priv->tx_freq = MHz (3.985); priv->rx_mode = RIG_MODE_LSB; priv->tx_mode = RIG_MODE_LSB; priv->width = kHz (2.4); priv->tx_width = kHz (2.4); priv->tx_cwbfo = priv->cwbfo = kHz (0.7); priv->agc = 0.5; /* medium */ priv->lineout = priv->spkvol = 0.0; /* mute */ priv->stepsize = 100; /* default to 100Hz tuning step */ rig->state.priv = (rig_ptr_t) priv; return RIG_OK; } /* * Tentec generic tt550_cleanup routine * the serial port is closed by the frontend */ int tt550_cleanup (RIG * rig) { if (rig->state.priv) free (rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * Software restart */ int tt550_reset (RIG * rig, reset_t reset) { int retval, reset_len; char reset_buf[32]; reset_len = 16; retval = tt550_transaction (rig, "XX" EOM, 3, reset_buf, &reset_len); if (retval != RIG_OK) return retval; reset_len = 16; if (strstr (reset_buf, "DSP START")) { retval = tt550_transaction (rig, "P1" EOM, 3, reset_buf, &reset_len); if (retval != RIG_OK) return retval; } if (!strstr (reset_buf, "RADIO START")) { return -RIG_EPROTO; } return RIG_OK; } /* * Tentec 550 transceiver open routine * Restart and set program to execute. */ int tt550_trx_open (RIG * rig) { struct tt550_priv_data *priv; priv = (struct tt550_priv_data *) rig->state.priv; /* * Reset the radio and start it's program running * We'll try twice to reset before giving up */ if (tt550_reset (rig, RIG_RESET_SOFT) != RIG_OK) { if (tt550_reset (rig, RIG_RESET_SOFT) != RIG_OK) { return -RIG_EPROTO; } } #ifdef BYPASS_KEEPALIVE /* * Temporarily Disable the transmitter Keep alive. The 550 expects the software * to execute a serial command at least once every two seconds or it will * disable TX. */ tt550_tx_control (rig, DISABLE_KEEPALIVE); #endif /* * Program the radio with the default mode,freq,filter */ tt550_set_tx_mode (rig, RIG_VFO_CURR, priv->tx_mode, priv->tx_width); tt550_set_rx_mode (rig, RIG_VFO_CURR, priv->rx_mode, priv->width); tt550_set_tx_freq (rig, RIG_VFO_CURR, priv->tx_freq); tt550_set_rx_freq (rig, RIG_VFO_CURR, priv->rx_freq); /* * Enable TX */ tt550_tx_control (rig, ENABLE_TX); /* * Bypass automatic tuner */ tt550_ldg_control (rig, '0'); return RIG_OK; } /* * tt550_set_freq * Set the receive frequency to that requested and if * Split mode is OFF do the transmitter too */ int tt550_set_freq (RIG * rig, vfo_t vfo, freq_t freq) { int retval; struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; retval = tt550_set_rx_freq (rig, vfo, freq); if (retval != RIG_OK) { return retval; } if (priv->split == RIG_SPLIT_OFF) { return tt550_set_tx_freq (rig, vfo, freq); } return retval; } /* * tt550_get_freq * Get the current receive frequency */ int tt550_get_freq (RIG * rig, vfo_t vfo, freq_t * freq) { struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; *freq = priv->rx_freq; return RIG_OK; } /* * tt550_set_mode * Set the receive mode and if NOT in split mode * set the transmitter to the same mode/width */ int tt550_set_mode (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { int retval; struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; retval = tt550_set_rx_mode (rig, vfo, mode, width); if (retval != RIG_OK) { return retval; } if (priv->split == RIG_SPLIT_OFF) { return tt550_set_tx_mode (rig, vfo, mode, width); } return retval; } /* * tt550_get_mode * GET the current receive mode/width */ int tt550_get_mode (RIG * rig, vfo_t vfo, rmode_t * mode, pbwidth_t * width) { struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; *mode = priv->rx_mode; *width = priv->width; return RIG_OK; } /* * tt550_set_rx_freq * Set the receiver to the requested frequency */ int tt550_set_rx_freq (RIG * rig, vfo_t vfo, freq_t freq) { struct tt550_priv_data *priv; struct rig_state *rs = &rig->state; int freq_len, retval; char freqbuf[16]; priv = (struct tt550_priv_data *) rig->state.priv; priv->rx_freq = freq; tt550_tuning_factor_calc (rig, RECEIVE); 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; return RIG_OK; } /* * tt550_set_tx_freq * Set the current transmit frequency */ int tt550_set_tx_freq (RIG * rig, vfo_t vfo, freq_t freq) { struct tt550_priv_data *priv; struct rig_state *rs = &rig->state; int freq_len, retval; char freqbuf[16]; priv = (struct tt550_priv_data *) rig->state.priv; priv->tx_freq = freq; tt550_tuning_factor_calc (rig, TRANSMIT); freq_len = sprintf (freqbuf, "T%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; return RIG_OK; } /* * tt550_get_tx_freq * Get the current transmit frequency */ int tt550_get_tx_freq (RIG * rig, vfo_t vfo, freq_t * freq) { struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; *freq = priv->tx_freq; return RIG_OK; } /* * tt550_set_rx_mode * SET the current receive mode */ int tt550_set_rx_mode (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct tt550_priv_data *priv = (struct tt550_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[48]; /* * Find mode for receive */ 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, "tt550_set_rxmode: unsupported mode %d\n", mode); return -RIG_EINVAL; } if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal (rig, mode); for (ttfilter = 0; tt550_filters[ttfilter] != 0; ttfilter++) { if (tt550_filters[ttfilter] == width) break; } if (tt550_filters[ttfilter] != width) { rig_debug (RIG_DEBUG_ERR, "tt550_set_mode: unsupported width %d\n", width); return -RIG_EINVAL; } /* * backup current values in case we fail to write to port */ saved_mode = priv->rx_mode; saved_width = priv->width; priv->rx_mode = mode; priv->width = width; tt550_tuning_factor_calc (rig, RECEIVE); mdbuf_len = sprintf (mdbuf, "M%c%c" EOM, ttmode, ttmode); retval = write_block (&rs->rigport, mdbuf, mdbuf_len); mdbuf_len = sprintf (mdbuf, "W%c" EOM "N%c%c%c%c%c%c" EOM, ttfilter, priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8, priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff); retval = write_block (&rs->rigport, mdbuf, mdbuf_len); if (retval != RIG_OK) { priv->rx_mode = saved_mode; priv->width = saved_width; return retval; } return RIG_OK; } /* * tt550_set_tx_mode * Set the current transmit mode/filter * Since the transmitter uses a subset of the filters used * by the receiver we set the filter if possible, if not we use * the nearest value. */ int tt550_set_tx_mode (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct tt550_priv_data *priv = (struct tt550_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[48]; 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, "tt550_set_mode: unsupported tx mode %d\n", mode); return -RIG_EINVAL; } /* * Limit the transmitter bandwidth - it's not the same as the receiver */ if (width < 1050) width = 1050; if (width > 3900) width = 3900; if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal (rig, mode); for (ttfilter = 0; tt550_tx_filters[ttfilter] != 0; ttfilter++) { if (tt550_tx_filters[ttfilter] == width) break; } if (tt550_tx_filters[ttfilter] != width) { rig_debug (RIG_DEBUG_ERR, "tt550_set_mode: unsupported tx width %d,%d\n", width, ttfilter); return -RIG_EINVAL; } /* * The tx filter array contains just the allowed filter values, but the * command assumes that the first allowed value is at offset 7. We add * 7 to compensate for the array difference */ ttfilter += 7; /* * backup current values in case we fail to write to port */ saved_mode = priv->tx_mode; saved_width = priv->tx_width; priv->tx_mode = mode; priv->tx_width = width; tt550_tuning_factor_calc (rig, TRANSMIT); mdbuf_len = sprintf (mdbuf, "M%c%c" EOM, ttmode, ttmode); retval = write_block (&rs->rigport, mdbuf, mdbuf_len); mdbuf_len = sprintf (mdbuf, "C%c" EOM "T%c%c%c%c%c%c" EOM, ttfilter, priv->ctf >> 8, priv->ctf & 0xff, priv->ftf >> 8, priv->ftf & 0xff, priv->btf >> 8, priv->btf & 0xff); retval = write_block (&rs->rigport, mdbuf, mdbuf_len); if (retval != RIG_OK) { priv->tx_mode = saved_mode; priv->tx_width = saved_width; return retval; } return RIG_OK; } /* * tt550_get_tx_mode */ int tt550_get_tx_mode (RIG * rig, vfo_t vfo, rmode_t * mode, pbwidth_t * width) { struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; *mode = priv->tx_mode; *width = priv->tx_width; return RIG_OK; } /* * Set the RIT value and force receive frequency to change */ int tt550_set_rit (RIG * rig, vfo_t vfo, shortfreq_t rit) { struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; priv->rit = rit; tt550_set_rx_freq (rig, vfo, priv->rx_freq); return RIG_OK; } /* * Get The current RIT value */ int tt550_get_rit (RIG * rig, vfo_t vfo, shortfreq_t * rit) { struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; *rit = priv->rit; return RIG_OK; } /* * Set the XIT value and force the Transmit frequency to change */ int tt550_set_xit (RIG * rig, vfo_t vfo, shortfreq_t xit) { struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; priv->xit = xit; tt550_set_tx_freq (rig, vfo, priv->tx_freq); return RIG_OK; } /* * Get the Current XIT value */ int tt550_get_xit (RIG * rig, vfo_t vfo, shortfreq_t * xit) { struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; *xit = priv->xit; return RIG_OK; } /* * tt550_set_level */ int tt550_set_level (RIG * rig, vfo_t vfo, setting_t level, value_t val) { struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; struct rig_state *rs = &rig->state; int cmd_len, retval, ditfactor, dahfactor, spcfactor; char cmdbuf[32]; switch (level) { case RIG_LEVEL_AGC: cmd_len = sprintf (cmdbuf, "G%c" EOM, val.i >= 3 ? '3' : (val.i < 2 ? '1' : '2')); retval = write_block (&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->agc = val.i; return retval; case RIG_LEVEL_AF: cmd_len = sprintf (cmdbuf, "V%c" EOM, (int) (val.f * 255)); retval = write_block (&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->spkvol = val.f; return retval; #ifdef RIG_LEVEL_LINEOUT case RIG_LEVEL_LINEOUT: cmd_len = sprintf (cmdbuf, "L%c" EOM, (int) (val.f * 63)); retval = write_block (&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->lineout = val.f; return retval; #endif case RIG_LEVEL_RF: cmd_len = sprintf (cmdbuf, "A%c" EOM, (int) (val.f * 255)); retval = write_block (&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->rflevel = val.f; return retval; case RIG_LEVEL_SQL: cmd_len = sprintf (cmdbuf, "S%c" EOM, (int) (val.f * 19)); retval = write_block (&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->sql = val.f; return retval; case RIG_LEVEL_NR: cmd_len = sprintf (cmdbuf, "D%c" EOM, (int) (val.f * 7)); retval = write_block (&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->nr = val.f; return retval; case RIG_LEVEL_ATT: /* * attenuator is either on or off */ cmd_len = sprintf (cmdbuf, "B%c" EOM, val.i < 15 ? '0' : '1'); retval = write_block (&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->att = val.i; return retval; case RIG_LEVEL_KEYSPD: ditfactor = spcfactor = (int) (((double) 0.50 / (val.i * (double) 0.4166 * (double) 0.0001667))); dahfactor = ditfactor * 3; cmd_len = sprintf (cmdbuf, "E%c%c%c%c%c%c" EOM, ditfactor >> 8, ditfactor & 0xff, dahfactor >> 8, dahfactor & 0xff, spcfactor >> 8, spcfactor & 0xff); retval = write_block (&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->keyspd = val.i; return retval; case RIG_LEVEL_RFPOWER: cmd_len = sprintf (cmdbuf, "P%c" EOM, (int) (val.f * 255)); retval = write_block (&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->rfpower = val.f; return retval; case RIG_LEVEL_VOXGAIN: cmd_len = sprintf (cmdbuf, "UG%c" EOM, (int) (val.f * 255)); retval = write_block (&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->voxgain = val.f; return retval; case RIG_LEVEL_VOX: cmd_len = sprintf (cmdbuf, "UH%c" EOM, (int) (val.f * 255)); retval = write_block (&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->voxdelay = val.f; return retval; case RIG_LEVEL_ANTIVOX: cmd_len = sprintf (cmdbuf, "UA%c" EOM, (int) (val.f * 255)); retval = write_block (&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->antivox = val.f; return retval; case RIG_LEVEL_COMP: cmd_len = sprintf (cmdbuf, "Y%c" EOM, (int) (val.f * 127)); retval = write_block (&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->speechcomp = val.f; return retval; case RIG_LEVEL_MICGAIN: cmd_len = sprintf (cmdbuf, "O1%c%c" EOM, 0, (int) (val.f * 15)); retval = write_block (&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->mikegain = val.f; return retval; case RIG_LEVEL_BKINDL: cmd_len = sprintf (cmdbuf, "UQ%c" EOM, (int) (val.f * 255)); retval = write_block (&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->bkindl = val.f; return retval; case RIG_LEVEL_IF: priv->pbtadj = val.i; retval = tt550_set_rx_freq (rig, vfo, priv->tx_freq); return retval; default: rig_debug (RIG_DEBUG_ERR, "Unsupported set_level %d\n", level); return -RIG_EINVAL; } return RIG_OK; } /* * tt550_get_level */ int tt550_get_level (RIG * rig, vfo_t vfo, setting_t level, value_t * val) { struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; int retval, lvl_len; char lvlbuf[32]; switch (level) { case RIG_LEVEL_STRENGTH: /* * read A/D converted value */ lvl_len = 7; retval = tt550_transaction (rig, "?S" EOM, 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 6) { rig_debug (RIG_DEBUG_ERR, "tt550_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } /* * Crude but it should work, the first and second digits are * the ascii value for the S number (0x30 = S0 etc.) followed by * a two byte fractional binary portion - We only use the first * portion for now. */ val->i = (((lvlbuf[2] - 0x30) * 6) - 54); break; case RIG_LEVEL_RAWSTR: /* * read A/D converted value */ lvl_len = 6; retval = tt550_transaction (rig, "?X" EOM, 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 5) { rig_debug (RIG_DEBUG_ERR, "tt550_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } val->i = (lvlbuf[1] << 8) + lvlbuf[2]; break; case RIG_LEVEL_AGC: val->f = priv->agc; break; case RIG_LEVEL_AF: val->f = priv->spkvol; break; #ifdef RIG_LEVEL_LINEOUT case RIG_LEVEL_LINEOUT: val->f = priv->lineout; break; #endif case RIG_LEVEL_RF: val->f = priv->rflevel; break; case RIG_LEVEL_SQL: val->f = priv->sql; break; case RIG_LEVEL_ATT: val->i = priv->att; break; case RIG_LEVEL_KEYSPD: val->i = priv->keyspd; break; case RIG_LEVEL_NR: val->f = priv->nr; break; case RIG_LEVEL_RFPOWER: val->f = priv->rfpower; break; case RIG_LEVEL_VOXGAIN: val->f = priv->voxgain; break; case RIG_LEVEL_VOX: val->f = priv->voxdelay; break; case RIG_LEVEL_ANTIVOX: val->f = priv->antivox; break; case RIG_LEVEL_COMP: val->f = priv->speechcomp; break; case RIG_LEVEL_MICGAIN: val->f = priv->mikegain; break; case RIG_LEVEL_BKINDL: val->f = priv->bkindl; break; case RIG_LEVEL_IF: val->i = priv->pbtadj; break; default: rig_debug (RIG_DEBUG_ERR, "Unsupported get_level %d\n", level); return -RIG_EINVAL; } return RIG_OK; } /* * tt550_get_info */ const char * tt550_get_info (RIG * rig) { static char buf[16]; int firmware_len, retval; /* * protocol version */ firmware_len = 10; retval = tt550_transaction (rig, "?V" EOM, 3, buf, &firmware_len); if (retval != RIG_OK || firmware_len != 9) { rig_debug (RIG_DEBUG_ERR, "tt550_get_info: ack NG, len=%d\n", firmware_len); return NULL; } buf[firmware_len] = '\0'; return buf; } /* * tt550_set_ptt */ int tt550_set_ptt (RIG * rig, vfo_t vfo, ptt_t ptt) { struct rig_state *rs = &rig->state; int cmd_len; char cmdbuf[16]; cmd_len = sprintf (cmdbuf, "Q%c" EOM, ptt == 0 ? '0' : '1'); return (write_block (&rs->rigport, cmdbuf, cmd_len)); } /* * tt550_get_ptt */ int tt550_get_ptt (RIG * rig, vfo_t vfo, ptt_t * ptt) { static char buf[10]; int len, retval; /* * The 550 doesn't have an explicit command to return ptt status, so we fake it * with the request for signal strength which returns a 'T' for the first * character if we're transmitting */ len = 7; retval = tt550_transaction (rig, "?S" EOM, 3, buf, &len); if (retval != RIG_OK) { return retval; } /* * buf should contain either Sxx for Receive Signal strenth * or Txx for Transmit power/reflected power */ *ptt = buf[0] == 'T' ? RIG_PTT_ON : RIG_PTT_OFF; return RIG_OK; } /* * tt550_set_split_vfo */ int tt550_set_split_vfo (RIG * rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; priv->split = split; return RIG_OK; } /* * tt550_get_split_vfo */ int tt550_get_split_vfo (RIG * rig, vfo_t vfo, split_t * split, vfo_t * tx_vfo) { struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; *split = priv->split; return RIG_OK; } int tt550_set_func (RIG * rig, vfo_t vfo, setting_t func, int status) { unsigned char fctbuf[16]; int fct_len; struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; struct rig_state *rs = &rig->state; /* Optimize: * sort the switch cases with the most frequent first */ switch (func) { case RIG_FUNC_VOX: fct_len = sprintf ((char *) fctbuf, "U%c" EOM, status == 0 ? '0' : '1'); priv->vox = status; return write_block (&rs->rigport, (char *) fctbuf, fct_len); case RIG_FUNC_NR: fct_len = sprintf ((char *) fctbuf, "K%c%c" EOM, status == 0 ? '0' : '1', priv->anf == 0 ? '0' : '1'); priv->en_nr = status; return write_block (&rs->rigport, (char *) fctbuf, fct_len); case RIG_FUNC_ANF: fct_len = sprintf ((char *) fctbuf, "K%c%c" EOM, priv->en_nr == 0 ? '0' : '1', status == 0 ? '0' : '1'); priv->anf = status; return write_block (&rs->rigport, (char *) fctbuf, fct_len); case RIG_FUNC_TUNER: priv->tuner = status; if (status == '0') tt550_ldg_control (rig, 0); return RIG_OK; default: rig_debug (RIG_DEBUG_ERR, "Unsupported set_func %#x", func); return -RIG_EINVAL; } return RIG_OK; } int tt550_get_func (RIG * rig, vfo_t vfo, setting_t func, int *status) { struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; /* Optimize: * sort the switch cases with the most frequent first */ switch (func) { case RIG_FUNC_VOX: *status = priv->vox; break; case RIG_FUNC_NR: *status = priv->en_nr; break; case RIG_FUNC_ANF: *status = priv->anf; break; case RIG_FUNC_TUNER: *status = priv->tuner; break; default: rig_debug (RIG_DEBUG_ERR, "Unsupported get_func %#x", func); return -RIG_EINVAL; } return RIG_OK; } /* * tt550_set_tuning_step */ int tt550_set_tuning_step (RIG * rig, vfo_t vfo, shortfreq_t stepsize) { struct tt550_priv_data *priv; struct rig_state *rs; rs = &rig->state; priv = (struct tt550_priv_data *) rs->priv; rig_debug (RIG_DEBUG_VERBOSE, "tt550: tt550_set_tuning_step - %d\n", stepsize); priv->stepsize = stepsize; return RIG_OK; } /* * tt550_get_tuning_step */ int tt550_get_tuning_step (RIG * rig, vfo_t vfo, shortfreq_t * stepsize) { struct tt550_priv_data *priv; struct rig_state *rs; rs = &rig->state; priv = (struct tt550_priv_data *) rs->priv; rig_debug (RIG_DEBUG_VERBOSE, "tt550: tt550_get_tuning_step - %d\n", priv->stepsize); *stepsize = priv->stepsize; return RIG_OK; } /* * Tune the radio using the LDG antenna tuner */ int tt550_tune (RIG * rig) { value_t current_power; rmode_t current_mode; value_t lowpower; struct tt550_priv_data *priv = (struct tt550_priv_data *) rig->state.priv; /* Set our lowpower level to about 10 Watts */ lowpower.f = 0.12; /* Get the current power and save it, */ current_power.f = priv->rfpower; /* Set power to approx 10w */ tt550_set_level (rig, RIG_VFO_CURR, RIG_LEVEL_RFPOWER, lowpower); /* Get the current mode, and save */ current_mode = priv->tx_mode; /* Set the mode to cw, keep the old frequency and bandwidth */ tt550_set_tx_mode (rig, RIG_VFO_CURR, RIG_MODE_CW, priv->tx_width); tt550_set_tx_freq (rig, RIG_VFO_CURR, priv->tx_freq); /* key the radio */ tt550_set_ptt (rig, RIG_VFO_CURR, 1); /* Wait long enough for the transmitter to key up */ sleep (1); /* Start the tuner */ tt550_ldg_control (rig, '1'); /* * Wait for tuner to finish * NOTE: Using sleep and blocking like this is BAD, we * really should have a way to tell that the tuner is finished. * What we should be doing here is probably: * 1. wait one second for tuner to start. * 2. Unkey the radio - the LDG tuner will keep it keyed until * it is done. (I think) * NOTE: I was wrong, the LDG does not key the rig so this won't work. * Have to come up with something else. * 3. Keep checking for the Radio to be unkeyed * 4. Stop the tuner and restore everything. * The above should all be done asynchronous to this function so * that we don't stall the calling routine. */ sleep (4); /* Unkey the Radio */ tt550_set_ptt (rig, RIG_VFO_CURR, 0); /* Restore the mode and frequency */ tt550_set_tx_mode (rig, RIG_VFO_CURR, current_mode, priv->tx_width); tt550_set_tx_freq (rig, RIG_VFO_CURR, priv->tx_freq); /* Restore the original Power setting */ tt550_set_level (rig, RIG_VFO_CURR, RIG_LEVEL_RFPOWER, current_power); return RIG_OK; } /* * tt550_vfo_op */ int tt550_vfo_op (RIG * rig, vfo_t vfo, vfo_op_t op) { switch (op) { case RIG_OP_TUNE: tt550_tune (rig); break; default: rig_debug (RIG_DEBUG_ERR, "tt550_vfo_op: unsupported op %#x\n", op); return -RIG_EINVAL; } return RIG_OK; } #define MAXFRAMELEN 7 /* * tt550_decode is called by sa_sigio, when asynchronous data * has been received from the rig * * A lot more can be done in this routine. Things like allowing F2 * to switch the encoder between frequency, audio, power control. Or * letting a function key cycle thru various bands. * For now it just handles the encoder for frequency change and F1 for * changing the step size. */ int tt550_decode_event (RIG * rig) { struct tt550_priv_data *priv; struct rig_state *rs; unsigned char buf[MAXFRAMELEN]; int data_len; short movement = 0; // char key; rig_debug (RIG_DEBUG_VERBOSE, "tt550: tt550_decode_event called\n"); rs = &rig->state; priv = (struct tt550_priv_data *) rs->priv; data_len = read_string (&rs->rigport, (char *) buf, MAXFRAMELEN, "\n\r", 2); if (data_len == -RIG_ETIMEOUT) { rig_debug (RIG_DEBUG_VERBOSE, "tt550: tt550_decode got a timeout before the first character\n"); return RIG_OK; } rig_debug (RIG_DEBUG_VERBOSE, "tt550: tt550_decode %x\n", &buf); /* * The first byte must be either 'U' for keypad operations * or '!' for encoder operations. */ switch (*buf) { /* * For now we'll assume that the encoder is only used for * frequency control, but since it's really a general purpose * device we could later use it for other purposes. * Tied in with priv->stepsize to allow the step rate to change */ case '!': if (rig->callbacks.freq_event) { movement = buf[1] << 8; movement = movement | buf[2]; // key = buf[3]; rig_debug (RIG_DEBUG_VERBOSE, "tt550: Step Direction = %d\n", movement); if (movement > 0) priv->rx_freq += priv->stepsize; if (movement < 0) priv->rx_freq -= priv->stepsize; rig->callbacks.freq_event (rig, RIG_VFO_CURR, priv->rx_freq, rig->callbacks.freq_arg); } break; /* * Keypad Function Key support - for now only F1 * Numeric pad can be done later */ case 'U': switch (buf[1]) { case KEY_F1_DOWN: /* F1 changes the Step size from 1hz to 1mhz */ if (priv->stepsize < 10000) { /* In powers of ten */ priv->stepsize = priv->stepsize * 10; } else { priv->stepsize = 1; } break; case KEY_F2_DOWN: case KEY_F3_DOWN: case KEY_F1_UP: case KEY_F2_UP: case KEY_F3_UP: default: rig_debug (RIG_DEBUG_VERBOSE, "tt550_decode: KEY " "unsupported %d\n", buf[1]); return -RIG_ENIMPL; } break; default: rig_debug (RIG_DEBUG_VERBOSE, "tt550_decode: response " "unsupported %s\n", buf); return -RIG_ENIMPL; } return RIG_OK; } hamlib-1.2.15.3/tentec/orion.h0000644000175000017500000004523212044564477012722 00000000000000/* * Hamlib TenTenc backend - TT-565 headers * Copyright (c) 2004-2011 by Stephane Fillod * Copyright (c) 2004-2011 by Martin Ewing * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * \addtogroup tentec_orion * @{ */ /** * \file orion.h * \brief Backend for Tentec Orion 565 / 566 * * This backend supports the Ten-Tec Orion (565) and Orion II (566) transceivers. */ #define TRUE (1) #define FALSE (0) #define TT565_BUFSIZE 16 /** * \brief Memory capability * * Orion's own memory channel holds a freq, mode, and bandwidth. * May be captured from VFO A or B and applied to VFO A or B. * It cannot directly be read or written from the computer! */ #define TT565_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ } static int tt565_init(RIG *rig); static int tt565_open(RIG *rig); static int tt565_cleanup(RIG *rig); static int tt565_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int tt565_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int tt565_set_vfo(RIG *rig, vfo_t vfo); static int tt565_get_vfo(RIG *rig, vfo_t *vfo); static int tt565_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int tt565_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int tt565_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int tt565_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); static int tt565_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); static int tt565_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); static int tt565_reset(RIG *rig, reset_t reset); static int tt565_set_mem(RIG * rig, vfo_t vfo, int ch); static int tt565_get_mem(RIG * rig, vfo_t vfo, int *ch); static int tt565_vfo_op(RIG * rig, vfo_t vfo, vfo_op_t op); static int tt565_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts); static int tt565_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts); static int tt565_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit); static int tt565_get_rit(RIG * rig, vfo_t vfo, shortfreq_t *rit); static int tt565_set_xit(RIG * rig, vfo_t vfo, shortfreq_t xit); static int tt565_get_xit(RIG * rig, vfo_t vfo, shortfreq_t *xit); static int tt565_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val); static int tt565_get_level(RIG * rig, vfo_t vfo, setting_t level, value_t *val); static const char* tt565_get_info(RIG *rig); static int tt565_send_morse(RIG *rig, vfo_t vfo, const char *msg); static int tt565_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); static int tt565_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static int tt565_set_ant(RIG * rig, vfo_t vfo, ant_t ant); static int tt565_get_ant(RIG *rig, vfo_t vfo, ant_t *ant); /** \brief Orion private data */ struct tt565_priv_data { int ch; /*!< memory channel */ vfo_t vfo_curr; /*!< Currently selected VFO */ }; /** \brief Orion Supported Modes */ #define TT565_MODES (RIG_MODE_FM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|\ RIG_MODE_RTTY|RIG_MODE_AM) /** \brief Orion Receiver Modes */ #define TT565_RXMODES (TT565_MODES) /** \brief Orion Supported Functions */ #define TT565_FUNCS (RIG_FUNC_LOCK|RIG_FUNC_TUNER|RIG_FUNC_VOX|RIG_FUNC_NB) /** \brief Orion Supported Levels */ #define TT565_LEVELS (RIG_LEVEL_RAWSTR| \ RIG_LEVEL_CWPITCH| \ RIG_LEVEL_SQL|RIG_LEVEL_IF| \ RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD| \ RIG_LEVEL_RF|RIG_LEVEL_NR| \ RIG_LEVEL_MICGAIN| \ RIG_LEVEL_AF|RIG_LEVEL_AGC| \ RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOX|RIG_LEVEL_ANTIVOX| \ RIG_LEVEL_COMP|RIG_LEVEL_PREAMP| \ RIG_LEVEL_SWR|RIG_LEVEL_ATT) /** \brief Orion Tx/Rx Antennas*/ #define TT565_ANTS (RIG_ANT_1|RIG_ANT_2) /** \brief Orion Rx Antennas*/ #define TT565_RXANTS (TT565_ANTS|RIG_ANT_3) /** \brief Orion Parameters */ #define TT565_PARMS (RIG_PARM_NONE) /** * \brief Orion VFOs - A and B */ #define TT565_VFO (RIG_VFO_A|RIG_VFO_B) /** * \brief Orion VFO Operations * * Allowed operations */ #define TT565_VFO_OPS (RIG_OP_UP|RIG_OP_DOWN|\ RIG_OP_TO_VFO|RIG_OP_FROM_VFO| \ RIG_OP_TUNE) /** * \brief S-Meter Calibration list * * List format: { hardware units, dB relative to S9} * * These alternate tables must be of equal size, because they may be * switched depending on firmware version detection. * * Note high end of scale is severely compressed in v1 * Table corrected against v 1.372, 11/2007 */ #define TT565_STR_CAL_V1 { 14, { \ { 1, -47 }, /* padding to match lengths with v2 */ \ { 10, -47 }, \ { 13, -42 }, \ { 18, -37 }, \ { 22, -32 }, \ { 27, -27 }, \ { 32, -18 }, \ { 37, -11 }, \ { 42, -4 }, \ { 47, -1 }, \ { 52, 10 }, \ { 57, 20 }, \ { 65, 30 }, \ { 74, 40 }, \ } } /** * Calibration for Version 2.062a firmware, from Rigserve project. * Again, this is approximate based on one measurement. */ #define TT565_STR_CAL_V2 { 14, { \ { 10., -48. }, /* S1 = min. indication */ \ { 24., -42. }, \ { 38., -36. }, \ { 47., -30. }, \ { 61., -24. }, \ { 70., -18. }, \ { 79., -12. }, \ { 84., -6. }, \ { 94., 0. }, /* S9 */ \ { 103., 10. }, \ { 118., 20. }, \ { 134., 30. }, \ { 147., 40. }, \ { 161., 50. }, \ } } #undef TT565_TIME /* Define to enable time checks */ #define TT565_ASCII_FREQ /* select ascii mode for vfo commands */ /* Note: Binary mode seems buggy at certain freqs like 7015679 < freq < 7015936, etc. Use ascii mode. */ /** * \brief tt565 transceiver capabilities. * * All of the Orion's personality is defined here! * * Protocol is documented at Tentec's firmware site * http://www.rfsquared.com/ */ const struct rig_caps tt565_caps = { .rig_model = RIG_MODEL_TT565, .model_name = "TT-565 Orion", .mfg_name = "Ten-Tec", .version = "0.5", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 57600, .serial_rate_max = 57600, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, /* no delay between characters written */ .post_write_delay = 10, /* ms delay between writes DEBUGGING HERE */ .timeout = 200, /* ms */ .retry = 4, .has_get_func = TT565_FUNCS, .has_set_func = TT565_FUNCS, .has_get_level = TT565_LEVELS, .has_set_level = RIG_LEVEL_SET(TT565_LEVELS), .has_get_parm = TT565_PARMS, .has_set_parm = TT565_PARMS, .level_gran = {}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { 20, RIG_DBLST_END }, .attenuator = { 6, 12, 18, RIG_DBLST_END }, .max_rit = kHz(8), .max_xit = kHz(8), .max_ifshift = kHz(8), .vfo_ops = TT565_VFO_OPS, .targetable_vfo = RIG_TARGETABLE_ALL, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 199, RIG_MTYPE_MEM, TT565_MEM_CAP }, }, /* Note Orion's ranges correspond to the hardware capability - same in * regions 1 and 2. Band edges (VFOA) are wider than legal bands. * VFOB is used for general coverage receive. */ .rx_range_list1 = { /* FRQ_RNG_HF(1,TT565_RXMODES, -1,-1,RIG_VFO_N(0),TT565_RXANTS), */ {kHz(1790),kHz(2010),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(3490),kHz(4075),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(5100),kHz(5450),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(6890),kHz(7430),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(10090),kHz(10160),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(13990),kHz(15010),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(18058),kHz(18178),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(20990),kHz(21460),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(24880),kHz(25000),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(27990),kHz(29710),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(100),MHz(30),TT565_RXMODES,-1,-1,RIG_VFO_N(1),TT565_RXANTS}, RIG_FRNG_END, }, .tx_range_list1 = { /* FRQ_RNG_HF(1,TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS), */ {kHz(1790),kHz(2010),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(3490),kHz(4075),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(5100),kHz(5450),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(6890),kHz(7430),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(10090),kHz(10160),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(13990),kHz(15010),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(18058),kHz(18178),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(20990),kHz(21460),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(24880),kHz(25000),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(27990),kHz(29710),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, RIG_FRNG_END, }, .rx_range_list2 = { /* FRQ_RNG_HF(2,TT565_RXMODES, -1,-1,RIG_VFO_N(0),TT565_RXANTS), {MHz(5.25),MHz(5.40),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, */ {kHz(1790),kHz(2010),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(3490),kHz(4075),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(5100),kHz(5450),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(6890),kHz(7430),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(10090),kHz(10160),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(13990),kHz(15010),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(18058),kHz(18178),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(20990),kHz(21460),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(24880),kHz(25000),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(27990),kHz(29710),TT565_RXMODES,-1,-1,RIG_VFO_N(0),TT565_RXANTS}, {kHz(100),MHz(30),TT565_RXMODES,-1,-1,RIG_VFO_N(1),TT565_RXANTS}, RIG_FRNG_END, }, .tx_range_list2 = { /* FRQ_RNG_HF(2,TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS), {MHz(5.25),MHz(5.40),TT565_MODES,W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, */ {kHz(1790),kHz(2010),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(3490),kHz(4075),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(5100),kHz(5450),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(6890),kHz(7430),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(10090),kHz(10160),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(13990),kHz(15010),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(18058),kHz(18178),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(20990),kHz(21460),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(24880),kHz(25000),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, {kHz(27990),kHz(29710),TT565_MODES, W(5),W(100),RIG_VFO_N(0),TT565_ANTS}, RIG_FRNG_END, }, .tuning_steps = { {TT565_RXMODES,1}, {TT565_RXMODES,10}, {TT565_RXMODES,100}, {TT565_RXMODES,kHz(1)}, {TT565_RXMODES,kHz(10)}, {TT565_RXMODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { /* 9MHz IF filters: 15kHz, 6kHz, 2.4kHz, 1.0kHz */ /* opt: 1.8kHz, 500Hz, 250Hz */ {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY, kHz(2.4)}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY, 100}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY, kHz(6)}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY, 0}, /* 590 filters */ {RIG_MODE_AM, kHz(6)}, {RIG_MODE_AM, kHz(4)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .priv = (void*)NULL, .rig_init = tt565_init, .rig_cleanup = tt565_cleanup, .rig_open = tt565_open, .set_freq = tt565_set_freq, .get_freq = tt565_get_freq, .set_vfo = tt565_set_vfo, .get_vfo = tt565_get_vfo, .set_mode = tt565_set_mode, .get_mode = tt565_get_mode, .set_split_vfo = tt565_set_split_vfo, .get_split_vfo = tt565_get_split_vfo, .set_level = tt565_set_level, .get_level = tt565_get_level, .set_mem = tt565_set_mem, .get_mem = tt565_get_mem, .set_ptt = tt565_set_ptt, .get_ptt = tt565_get_ptt, .vfo_op = tt565_vfo_op, .set_ts = tt565_set_ts, .get_ts = tt565_get_ts, .set_rit = tt565_set_rit, .get_rit = tt565_get_rit, .set_xit = tt565_set_xit, .get_xit = tt565_get_xit, .reset = tt565_reset, .get_info = tt565_get_info, .send_morse = tt565_send_morse, .get_func = tt565_get_func, .set_func = tt565_set_func, .get_ant = tt565_get_ant, .set_ant = tt565_set_ant, /* V2 is default. S-Meter cal table may be changed if V1 firmware detected. */ .str_cal = TT565_STR_CAL_V2, }; /* * Eagle TT-599 share the same ability as Orion's */ #define TT599_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR|\ /* optional */ RIG_MODE_AM|RIG_MODE_FM) #define TT599_RXMODES TT599_MODES #define TT599_FUNCS (RIG_FUNC_ANF) #define TT599_LEVELS (RIG_LEVEL_RAWSTR| \ RIG_LEVEL_SWR|RIG_LEVEL_RFPOWER| \ RIG_LEVEL_NR|RIG_LEVEL_AGC| \ RIG_LEVEL_PREAMP|RIG_LEVEL_ATT) #define TT599_PARMS (RIG_PARM_NONE) #define TT599_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .split = 1, \ .tx_freq = 1, \ } #define TT599_ANTS (RIG_ANT_1) #define TT599_RXANTS TT599_ANTS #define TT599_VFO (RIG_VFO_A|RIG_VFO_B) #define TT599_VFO_OPS (RIG_OP_TO_VFO|RIG_OP_FROM_VFO) /* * Random guess, to be measured. See FAQ at http://hamlib.org */ #define TT599_STR_CAL { 3, { \ { 10., -48. }, /* S1 = min. indication */ \ { 94., 0. }, /* S9 */ \ { 161., 50. }, \ } } /** * \brief tt599 transceiver capabilities. * * All of the Eagle's personality is defined here! * * Protocol is documented in Programmers Reference Manual V1.001 at * http://www.tentec.com/index.php?id=360#down * */ const struct rig_caps tt599_caps = { .rig_model = RIG_MODEL_TT599, .model_name = "TT-599 Eagle", .mfg_name = "Ten-Tec", .version = "0.4", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 57600, .serial_rate_max = 57600, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, /* no delay between characters written */ .post_write_delay = 10, /* ms delay between writes DEBUGGING HERE */ .timeout = 200, /* ms */ .retry = 3, .has_get_func = TT599_FUNCS, .has_set_func = TT599_FUNCS, .has_get_level = TT599_LEVELS|RIG_LEVEL_RF, .has_set_level = RIG_LEVEL_SET(TT599_LEVELS), .has_get_parm = TT599_PARMS, .has_set_parm = TT599_PARMS, .level_gran = {}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { 10, RIG_DBLST_END }, .attenuator = { 12, RIG_DBLST_END }, .max_rit = kHz(0), .max_xit = kHz(0), .max_ifshift = kHz(0), .vfo_ops = TT599_VFO_OPS, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 100, RIG_MTYPE_MEM, TT599_MEM_CAP }, }, .rx_range_list1 = { FRQ_RNG_HF(1,TT599_RXMODES, -1,-1,RIG_VFO_N(0),TT599_RXANTS), FRQ_RNG_6m(1,TT599_RXMODES, -1,-1,RIG_VFO_N(0),TT599_RXANTS), {kHz(500),MHz(30),TT599_RXMODES,-1,-1,RIG_VFO_N(1),TT599_RXANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,TT599_MODES, W(5),W(100),RIG_VFO_N(0),TT599_ANTS), FRQ_RNG_6m(1,TT599_MODES, W(5),W(100),RIG_VFO_N(0),TT599_ANTS), RIG_FRNG_END, }, .rx_range_list2 = { FRQ_RNG_HF(2,TT599_RXMODES, -1,-1,RIG_VFO_N(0),TT599_RXANTS), FRQ_RNG_6m(2,TT599_RXMODES, -1,-1,RIG_VFO_N(0),TT599_RXANTS), {MHz(5.25),MHz(5.40),TT599_RXMODES,-1,-1,RIG_VFO_N(0),TT599_RXANTS}, {kHz(500),MHz(30),TT599_RXMODES,-1,-1,RIG_VFO_N(1),TT599_RXANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,TT599_MODES, W(5),W(100),RIG_VFO_N(0),TT599_ANTS), FRQ_RNG_6m(2,TT599_MODES, W(5),W(100),RIG_VFO_N(0),TT599_ANTS), {MHz(5.25),MHz(5.40),TT599_MODES,W(5),W(100),RIG_VFO_N(0),TT599_ANTS}, RIG_FRNG_END, }, .tuning_steps = { {TT599_RXMODES,1}, {TT599_RXMODES,10}, {TT599_RXMODES,100}, {TT599_RXMODES,kHz(1)}, {TT599_RXMODES,kHz(10)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { /* 15kHz, 6kHz, 2.4kHz, 1.0kHz */ /* 9MHz IF filters: 2.4K standard */ /* optional = 300, 600, 1.8k, 6k, 15k */ {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB, kHz(2.4)}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB, 600}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB, 300}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB, kHz(1.8)}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB, kHz(6)}, {RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB, 0}, /* 127 filters */ {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .priv = (void*)NULL, .rig_init = tt565_init, .rig_cleanup = tt565_cleanup, .rig_open = tt565_open, .set_freq = tt565_set_freq, .get_freq = tt565_get_freq, .set_vfo = tt565_set_vfo, .get_vfo = tt565_get_vfo, .set_mode = tt565_set_mode, .get_mode = tt565_get_mode, .set_split_vfo = tt565_set_split_vfo, .get_split_vfo = tt565_get_split_vfo, .set_level = tt565_set_level, .get_level = tt565_get_level, .set_mem = tt565_set_mem, .get_mem = tt565_get_mem, .set_ptt = tt565_set_ptt, .get_ptt = tt565_get_ptt, .vfo_op = tt565_vfo_op, .get_info = tt565_get_info, .get_func = tt565_get_func, .set_func = tt565_set_func, .str_cal = TT599_STR_CAL, }; /* * Function definitions below */ /** \brief End of command marker */ #define EOM "\015" /* CR */ /** \brief USB Mode */ #define TT565_USB '0' /** \brief LSB Mode */ #define TT565_LSB '1' /** \brief CW normal Mode */ #define TT565_CW '2' /** \brief CW reverse Mode */ #define TT565_CWR '3' /** \brief AM Mode */ #define TT565_AM '4' /** \brief FM Mode */ #define TT565_FM '5' /** \brief RTTY Mode */ #define TT565_RTTY '6' /** \brief minimum sidetone freq., Hz */ #define TT565_TONE_MIN 300 /** \brief maximum sidetone freq., Hz */ #define TT565_TONE_MAX 1200 /** \brief minimum CW keyer rate, wpm */ #define TT565_CW_MIN 10 /** \brief maximum CW keyer rate, wpm */ #define TT565_CW_MAX 60 /** @} */ hamlib-1.2.15.3/tentec/rx331.h0000644000175000017500000000200712044564477012445 00000000000000/* * Hamlib Tentec backend - RX331 header * Copyright (c) 2010 by Berndt Josef Wulf * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _RX331_H #define _RX331_H #include "hamlib/rig.h" #define TOK_RIGID TOKEN_BACKEND(1) struct rx331_priv_data { unsigned int receiver_id; }; #endif hamlib-1.2.15.3/tentec/tentec.c0000644000175000017500000002617612044564477013057 00000000000000/* * Hamlib Tentec backend - main file * Copyright (c) 2001-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "cal.h" #include "register.h" #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 retval; struct rig_state *rs; rs = &rig->state; serial_flush(&rs->rigport); 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; retval = read_string(&rs->rigport, data, *data_len, "", 0); if (retval == -RIG_ETIMEOUT) retval = 0; if (retval < 0) return retval; *data_len = retval; return RIG_OK; } /* * tentec_init: * Basically, it just sets up *priv */ int tentec_init(RIG *rig) { struct tentec_priv_data *priv; priv = (struct tentec_priv_data*)malloc(sizeof(struct tentec_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } memset(priv, 0, sizeof(struct tentec_priv_data)); /* * set arbitrary initial status */ priv->freq = MHz(10); priv->mode = RIG_MODE_AM; priv->width = kHz(6); priv->pbt = 0; priv->cwbfo = 1000; priv->agc = RIG_AGC_MEDIUM; /* medium */ priv->lnvol = priv->spkvol = 0.0; /* mute */ rig->state.priv = (rig_ptr_t)priv; /* tentec_tuning_factor_calc needs rig->state.priv */ tentec_tuning_factor_calc(rig); 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; } /* * Tentec transceiver only open routine * Restart and set program to execute. */ int tentec_trx_open(RIG *rig) { int retval; /* * be kind: use XX first, and do 'Dsp Program Execute' only * in " DSP START" state. */ retval = tentec_transaction (rig, "P1" EOM, 3, NULL, NULL); if (retval != RIG_OK) return retval; 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; freq_t tfreq; int adjtfreq, mcor, fcor, cwbfo; priv = (struct tentec_priv_data *)rig->state.priv; cwbfo = 0; /* computed fcor only used if mode is not CW */ fcor = (int)floor((double)priv->width / 2.0) + 200; switch (priv->mode) { case RIG_MODE_AM: case RIG_MODE_FM: mcor=0; break; case RIG_MODE_CW: mcor=-1; cwbfo = priv->cwbfo; fcor = 0; break; 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; break; } tfreq = priv->freq / (freq_t)Hz(1); adjtfreq = (int)tfreq - 1250 + (int)(mcor * (fcor + priv->pbt)); priv->ctf = (adjtfreq / 2500) + 18000; priv->ftf = (int)floor((double)(adjtfreq % 2500) * 5.46); priv->btf = (int)floor((double)(fcor + priv->pbt + 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]; freq_t old_freq; priv = (struct tentec_priv_data *)rig->state.priv; old_freq = priv->freq; priv->freq = freq; 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) { priv->freq = old_freq; return retval; } 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=RIG_OK; char cmdbuf[32]; /* Optimize: * sort the switch cases with the most frequent first */ switch (level) { case RIG_LEVEL_AGC: /* default to MEDIUM */ cmd_len = sprintf(cmdbuf, "G%c" EOM, val.i==RIG_AGC_SLOW ? '1' : ( val.i==RIG_AGC_FAST ? '3' : '2' ) ); retval = write_block(&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->agc = val.i; return retval; case RIG_LEVEL_AF: /* FIXME: support also separate Lineout setting * -> need to create RIG_LEVEL_LINEOUT ? */ cmd_len = sprintf(cmdbuf, "C\x7f%c" EOM, (int)((1.0 - val.f) * 63.0)); retval = write_block(&rs->rigport, cmdbuf, cmd_len); if (retval == RIG_OK) priv->lnvol = priv->spkvol = val.f; return retval; case RIG_LEVEL_IF: priv->pbt = val.i; retval = tentec_set_freq(rig, vfo, priv->freq); return retval; case RIG_LEVEL_CWPITCH: priv->cwbfo = val.i; if(priv->mode == RIG_MODE_CW) { retval = tentec_set_freq(rig, vfo, priv->freq); } 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; unsigned char lvlbuf[32]; /* Optimize: * sort the switch cases with the most frequent first */ switch (level) { case RIG_LEVEL_RAWSTR: /* read A/D converted value */ lvl_len = 4; retval = tentec_transaction (rig, "X" EOM, 2, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"tentec_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } lvlbuf[3] = '\0'; rig_debug(RIG_DEBUG_VERBOSE,"tentec_get_level: cmd=%c,hi=%d,lo=%d\n", lvlbuf[0],lvlbuf[1],lvlbuf[2]); val->i = (lvlbuf[1]<<8) + lvlbuf[2]; break; case RIG_LEVEL_AGC: val->i = priv->agc; break; case RIG_LEVEL_AF: val->f = priv->spkvol; break; case RIG_LEVEL_IF: val->i = priv->pbt; break; case RIG_LEVEL_CWPITCH: val->i = priv->cwbfo; 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 = 10; retval = tentec_transaction (rig, "?" EOM, 2, buf, &firmware_len); if ( (retval != RIG_OK) || (firmware_len > 10) ) { rig_debug(RIG_DEBUG_ERR,"tentec_get_info: ack NG, len=%d\n", firmware_len); return NULL; } return buf; } /* * initrigs_tentec is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(tentec) { rig_debug(RIG_DEBUG_VERBOSE, "tentec: _init called\n"); rig_register(&tt550_caps); rig_register(&tt516_caps); rig_register(&tt565_caps); rig_register(&tt538_caps); rig_register(&tt585_caps); rig_register(&tt588_caps); rig_register(&tt599_caps); rig_register(&rx320_caps); rig_register(&rx331_caps); rig_register(&rx340_caps); rig_register(&rx350_caps); return RIG_OK; } hamlib-1.2.15.3/tentec/omnivii.c0000644000175000017500000005410212044564477013235 00000000000000/* * Hamlib TenTenc backend - TT-588 description * Copyright (c) 2003-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "tentec2.h" #include "tentec.h" #include "bandplan.h" struct tt588_priv_data { int ch; /* mem */ vfo_t vfo_curr; }; #define TT588_MODES (RIG_MODE_FM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM) #define TT588_RXMODES (TT588_MODES) #define TT588_FUNCS (RIG_FUNC_NR|RIG_FUNC_ANF) #define TT588_LEVELS (RIG_LEVEL_STRENGTH|/*RIG_LEVEL_NB|*/ \ RIG_LEVEL_SQL|/*RIG_LEVEL_IF|*/ \ RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD| \ RIG_LEVEL_RF|RIG_LEVEL_NR| \ /*RIG_LEVEL_ANF|*/RIG_LEVEL_MICGAIN| \ RIG_LEVEL_AF|RIG_LEVEL_AGC| \ RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOX| \ RIG_LEVEL_COMP|/*RIG_LEVEL_PREAMP|*/ \ RIG_LEVEL_SWR|RIG_LEVEL_ATT) #define TT588_ANTS (RIG_ANT_1|RIG_ANT_2) #define TT588_PARMS (RIG_PARM_NONE) #define TT588_VFO (RIG_VFO_A|RIG_VFO_B) #define TT588_VFO_OPS (RIG_OP_TO_VFO|RIG_OP_FROM_VFO) #define TT588_AM '0' #define TT588_USB '1' #define TT588_LSB '2' #define TT588_CW '3' #define TT588_FM '4' #define EOM "\015" /* CR */ static int tt588_init(RIG *rig); static int tt588_reset(RIG *rig, reset_t reset); static int tt588_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int tt588_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int tt588_set_vfo(RIG *rig, vfo_t vfo); static int tt588_get_vfo(RIG *rig, vfo_t *vfo); static int tt588_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int tt588_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static char which_vfo(const RIG *rig, vfo_t vfo); static int tt588_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int tt588_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); /* * tt588 transceiver capabilities. * * Protocol is documented at * http://www.rfsquared.com/ * * Only set_freq is supposed to work. * This is a skelton, cloned after TT-538 Jupiter. */ const struct rig_caps tt588_caps = { .rig_model = RIG_MODEL_TT588, .model_name = "TT-588 Omni VII", .mfg_name = "Ten-Tec", .version = "0.3", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 57600, .serial_rate_max = 57600, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 0, .timeout = 400, .retry = 3, .has_get_func = TT588_FUNCS, .has_set_func = TT588_FUNCS, .has_get_level = TT588_LEVELS, .has_set_level = RIG_LEVEL_SET(TT588_LEVELS), .has_get_parm = TT588_PARMS, .has_set_parm = TT588_PARMS, .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { 10, RIG_DBLST_END }, /* FIXME: real value */ .attenuator = { 15, RIG_DBLST_END }, .max_rit = Hz(8192), .max_xit = Hz(8192), .max_ifshift = kHz(2), .targetable_vfo = RIG_TARGETABLE_FREQ|RIG_TARGETABLE_MODE, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 127, RIG_MTYPE_MEM, TT_MEM_CAP }, }, .rx_range_list1 = { {kHz(500),MHz(30),TT588_RXMODES,-1,-1,TT588_VFO,TT588_ANTS}, {MHz(48),MHz(54),TT588_RXMODES,-1,-1,TT588_VFO,TT588_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,TT588_MODES, W(5),W(100),TT588_VFO,TT588_ANTS), FRQ_RNG_6m(1,TT588_MODES, W(5),W(100),TT588_VFO,TT588_ANTS), RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30),TT588_RXMODES,-1,-1,TT588_VFO,TT588_ANTS}, {MHz(48),MHz(54),TT588_RXMODES,-1,-1,TT588_VFO,TT588_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,TT588_MODES, W(5),W(100),TT588_VFO,TT588_ANTS), {MHz(5.25),MHz(5.40),TT588_MODES,W(5),W(100),TT588_VFO,TT588_ANTS}, FRQ_RNG_6m(2,TT588_MODES, W(5),W(100),TT588_VFO,TT588_ANTS), RIG_FRNG_END, }, .tuning_steps = { {TT588_RXMODES,1}, {TT588_RXMODES,10}, {TT588_RXMODES,100}, {TT588_RXMODES,kHz(1)}, {TT588_RXMODES,kHz(10)}, {TT588_RXMODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM, 300}, {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM, kHz(8)}, {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM, 0}, /* 34 filters */ {RIG_MODE_FM, kHz(15)}, /* TBC */ RIG_FLT_END, }, .priv = (void*) NULL, .rig_init = tt588_init, .set_freq = tt588_set_freq, .get_freq = tt588_get_freq, .set_vfo = tt588_set_vfo, .get_vfo = tt588_get_vfo, .set_mode = tt588_set_mode, .get_mode = tt588_get_mode, .get_level = tt588_get_level, .set_level = tt588_set_level, .set_split_vfo = tentec2_set_split_vfo, .get_split_vfo = tentec2_get_split_vfo, .set_ptt = tentec2_set_ptt, .reset = tt588_reset, .get_info = tentec2_get_info, }; /* Filter table for 588 reciver support. */ static int tt588_rxFilter[] = { 12000, 9000, 8000, 7500, 7000, 6500, 6000, 5500, 5000, 4500, 4000, 3800, 3600, 3400, 3200, 3000, 2800, 2600, 2500, 2400, 2200, 2000, 1800, 1600, 1400, 1200, 1000, 900, 800, 700, 600, 500, 450, 400, 350, 300, 250, 200 }; /* * Function definitions below */ /* I frequently see the Omni VII and my laptop get out of sync. A response from the 538 isn't seen by the laptop. A few "XX"s sometimes get things going again, hence this hack, er, function. */ static int tt588_transaction (RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { char reset_buf[32]; int i, reset_len, retval; retval = tentec_transaction (rig, cmd, cmd_len, data, data_len); if (retval == RIG_OK) return retval; /* Try a few times to do a DSP reset to resync things. */ for (i = 0; i < 3; i++) { reset_len = 32; retval = tentec_transaction (rig, "XX" EOM, 3, reset_buf, &reset_len); if (retval != RIG_OK) continue; /* Try again. This 1 didn't work. */ if (strstr(reset_buf, "RADIO START")) break; /* DSP reset successful! */ } /* Try real command one last time... */ return tentec_transaction (rig, cmd, cmd_len, data, data_len); } /* * tt588_init: * Basically, it just sets up *priv */ int tt588_init(RIG *rig) { struct tt588_priv_data *priv; priv = (struct tt588_priv_data *) malloc(sizeof(struct tt588_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } memset(priv, 0, sizeof(struct tt588_priv_data)); /* * set arbitrary initial status */ priv->ch = 0; priv->vfo_curr = RIG_VFO_A; rig->state.priv = (rig_ptr_t)priv; return RIG_OK; } static char which_vfo(const RIG *rig, vfo_t vfo) { struct tt588_priv_data *priv = (struct tt588_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) vfo = priv->vfo_curr; switch (vfo) { case RIG_VFO_A: return 'A'; case RIG_VFO_B: return 'B'; case RIG_VFO_NONE: return 'N'; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %s\n", __FUNCTION__, rig_strvfo(vfo)); return -RIG_EINVAL; } } int tt588_get_vfo(RIG *rig, vfo_t *vfo) { struct tt588_priv_data *priv = (struct tt588_priv_data *) rig->state.priv; *vfo = priv->vfo_curr; return RIG_OK; } /* * tt588_set_vfo * Assumes rig!=NULL */ int tt588_set_vfo(RIG *rig, vfo_t vfo) { struct tt588_priv_data *priv = (struct tt588_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) return RIG_OK; priv->vfo_curr = vfo; return RIG_OK; } /* * Software restart */ int tt588_reset(RIG *rig, reset_t reset) { int retval, reset_len; char reset_buf[32]; reset_len = 32; retval = tt588_transaction (rig, "XX" EOM, 3, reset_buf, &reset_len); if (retval != RIG_OK) return retval; if (!strstr(reset_buf, "RADIO START")) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, reset_buf); return -RIG_EPROTO; } return RIG_OK; } /* * tt588_get_freq * Assumes rig!=NULL, freq!=NULL */ int tt588_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { char curVfo; int cmd_len, resp_len, retval; unsigned char cmdbuf[16], respbuf[32]; cmd_len = sprintf((char *) cmdbuf, "?%c" EOM, which_vfo(rig, vfo)); resp_len = 32; retval = tt588_transaction (rig, (char *) cmdbuf, cmd_len, (char *) respbuf, &resp_len); if (retval != RIG_OK) return retval; curVfo = which_vfo(rig, vfo); if (respbuf[0] != curVfo) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } if (resp_len != 6) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected length '%d'\n", __FUNCTION__, resp_len); return -RIG_EPROTO; } *freq = (respbuf[1] << 24) + (respbuf[2] << 16) + (respbuf[3] << 8) + respbuf[4]; return RIG_OK; } /* * tt588_set_freq * assumes rig!=NULL, rig->state.priv!=NULL * assumes priv->mode in AM,CW,LSB or USB. */ int tt588_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char bytes[4]; int cmd_len; unsigned char cmdbuf[16]; /* Freq is 4 bytes long, MSB sent first. */ bytes[3] = ((int) freq >> 24) & 0xff; bytes[2] = ((int) freq >> 16) & 0xff; bytes[1] = ((int) freq >> 8) & 0xff; bytes[0] = (int) freq & 0xff; cmd_len = sprintf((char *) cmdbuf, "*%c%c%c%c%c" EOM, which_vfo(rig, vfo), bytes[3], bytes[2], bytes[1], bytes[0]); return tt588_transaction(rig, (char *) cmdbuf, cmd_len, NULL, NULL); } /* * tt588_get_mode * Assumes rig!=NULL, mode!=NULL */ int tt588_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { int cmd_len, resp_len, retval; unsigned char cmdbuf[16], respbuf[32]; char ttmode; /* Query mode */ cmd_len = sprintf((char *) cmdbuf, "?M" EOM); resp_len = 32; retval = tt588_transaction (rig, (char *) cmdbuf, cmd_len, (char *) respbuf, &resp_len); if (retval != RIG_OK) return retval; if (respbuf[0] != 'M' || resp_len != 4) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } switch (which_vfo(rig, vfo)) { case 'A': ttmode = respbuf[1]; break; case 'B': ttmode = respbuf[2]; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %s\n", __FUNCTION__, rig_strvfo(vfo)); return -RIG_EINVAL; break; } switch (ttmode) { case TT588_AM: *mode = RIG_MODE_AM; break; case TT588_USB: *mode = RIG_MODE_USB; break; case TT588_LSB: *mode = RIG_MODE_LSB; break; case TT588_CW: *mode = RIG_MODE_CW; break; case TT588_FM: *mode = RIG_MODE_FM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode '%c'\n", __FUNCTION__, ttmode); return -RIG_EPROTO; } /* Query passband width (filter) */ cmd_len = sprintf((char *) cmdbuf, "?W" EOM); resp_len = 32; retval = tt588_transaction (rig, (char *) cmdbuf, cmd_len, (char *) respbuf, &resp_len); if (retval != RIG_OK) return retval; if (respbuf[0] != 'W' && resp_len != 3) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } switch (respbuf[1]) { case 0: *width = 12000; break; case 1: *width = 9000; break; case 2: *width = 8000; break; case 3: *width = 7500; break; case 4: *width = 7000; break; case 5: *width = 6500; break; case 6: *width = 6000; break; case 7: *width = 5500; break; case 8: *width = 5000; break; case 9: *width = 4500; break; case 10: *width = 4000; break; case 11: *width = 3800; break; case 12: *width = 3600; break; case 13: *width = 3400; break; case 14: *width = 3200; break; case 15: *width = 3000; break; case 16: *width = 2800; break; case 17: *width = 2600; break; case 18: *width = 2500; break; case 19: *width = 2400; break; case 20: *width = 2200; break; case 21: *width = 2000; break; case 22: *width = 1800; break; case 23: *width = 1600; break; case 24: *width = 1400; break; case 25: *width = 1200; break; case 26: *width = 1000; break; case 27: *width = 900; break; case 28: *width = 800; break; case 29: *width = 700; break; case 30: *width = 600; break; case 31: *width = 500; break; case 32: *width = 450; break; case 33: *width = 400; break; case 34: *width = 350; break; case 35: *width = 300; break; case 36: *width = 250; break; case 37: *width = 200; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unexpected bandwidth '%c'\n", __FUNCTION__, respbuf[1]); return -RIG_EPROTO; } return RIG_OK; } /* Find rx filter index of bandwidth the same or larger as requested. */ static int tt588_filter_number(int width) { int i; for (i = 34; i >= 0; i--) if (width <= tt588_rxFilter[i]) return i; return 0; /* Widest filter, 8 kHz. */ } /* * tt588_set_mode * Assumes rig!=NULL */ int tt588_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { unsigned char cmdbuf[32], respbuf[32], ttmode; int cmd_len, resp_len, retval; struct tt588_priv_data *priv = (struct tt588_priv_data *) rig->state.priv; /* Query mode for both VFOs. */ cmd_len = sprintf((char *) cmdbuf, "?M" EOM); resp_len = 32; retval = tt588_transaction (rig, (char *) cmdbuf, cmd_len, (char *) respbuf, &resp_len); if (retval != RIG_OK) return retval; if (respbuf[0] != 'M' || resp_len != 4) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } switch (mode) { case RIG_MODE_USB: ttmode = TT588_USB; break; case RIG_MODE_LSB: ttmode = TT588_LSB; break; case RIG_MODE_CW: ttmode = TT588_CW; break; case RIG_MODE_AM: ttmode = TT588_AM; break; case RIG_MODE_FM: ttmode = TT588_FM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %d\n", __FUNCTION__, mode); return -RIG_EINVAL; } /* Set mode for both VFOs. */ if (vfo == RIG_VFO_CURR) vfo = priv->vfo_curr; switch (vfo) { case RIG_VFO_A: cmd_len = sprintf((char *) cmdbuf, "*M%c%c" EOM, ttmode, respbuf[2]); break; case RIG_VFO_B: cmd_len = sprintf((char *) cmdbuf, "*M%c%c" EOM, respbuf[1], ttmode); break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %s\n", __FUNCTION__, rig_strvfo(vfo)); return -RIG_EINVAL; } retval = tt588_transaction (rig, (char *) cmdbuf, cmd_len, NULL, NULL); if (retval != RIG_OK) return retval; /* Set rx filter bandwidth. */ if (width == RIG_PASSBAND_NORMAL) width = tt588_filter_number(rig_passband_normal(rig, mode)); else width = tt588_filter_number((int) width); cmd_len = sprintf((char *) cmdbuf, "*W%c" EOM, (unsigned char) width); return tt588_transaction (rig, (char *) cmdbuf, cmd_len, NULL, NULL); } /* * tt588_get_level * Assumes rig!=NULL, val!=NULL */ int tt588_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { char sunits[6]; float fwd, refl, sstr; int retval, cmd_len, lvl_len; unsigned char cmdbuf[16],lvlbuf[32]; /* Optimize: * sort the switch cases with the most frequent first */ switch (level) { case RIG_LEVEL_SWR: /* Get forward power. */ lvl_len = 32; retval = tt588_transaction (rig, "?F" EOM, 3, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'F' || lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } fwd = (float) lvlbuf[1]; /* Get reflected power. */ lvl_len = 32; retval = tt588_transaction (rig, "?R" EOM, 3, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'R' || lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } refl = (float) lvlbuf[1]; val->f = fwd/refl; break; case RIG_LEVEL_STRENGTH: retval = tt588_transaction (rig, "?S" EOM, 3, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'S' || lvl_len != 6) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } /* Reply in the form S0944 for 44 dB over S9 */ /* TODO: check whether in RX or TX mode */ val->i = (int)lvlbuf[2] * 6 - 54 + lvlbuf[3]*10 + lvlbuf[4]; break; case RIG_LEVEL_RFPOWER: /* Get forward power in volts. */ lvl_len = 32; retval = tt588_transaction (rig, "?P" EOM, 3, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'P' || lvl_len != 4) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = 100 * (float) lvlbuf[1] / 0xff; break; case RIG_LEVEL_AGC: /* Read rig's AGC level setting. */ cmd_len = sprintf((char *) cmdbuf, "?G" EOM); lvl_len = 32; retval = tt588_transaction (rig, (char *) cmdbuf, cmd_len, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'G' || lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } switch(lvlbuf[1]) { case '0': val->i=RIG_AGC_OFF; break; case '1': val->i=RIG_AGC_SLOW; break; case '2': val->i=RIG_AGC_MEDIUM; break; case '3': val->i=RIG_AGC_FAST; break; default: return -RIG_EPROTO; } break; case RIG_LEVEL_AF: /* Volume returned as single byte. */ cmd_len = sprintf((char *) cmdbuf, "?U" EOM); lvl_len = 32; retval = tt588_transaction (rig, (char *) cmdbuf, cmd_len, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'U' || lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = (float) lvlbuf[1] / 127; break; case RIG_LEVEL_IF: #if 0 NO IF MONITOR?? cmd_len = sprintf((char *) cmdbuf, "?R%cP" EOM, which_receiver(rig, vfo)); retval = tt588_transaction (rig, (char *) cmdbuf, cmd_len, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'R' || lvlbuf[3] != 'P' || lvl_len < 5) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->i = atoi(lvlbuf+4); #endif val->i = 0; break; case RIG_LEVEL_RF: cmd_len = sprintf((char *) cmdbuf, "?I" EOM); lvl_len = 32; retval = tt588_transaction (rig, (char *) cmdbuf, cmd_len, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'I' || lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = 1 - (float) lvlbuf[1] / 0xff; break; case RIG_LEVEL_ATT: cmd_len = sprintf((char *) cmdbuf, "?J" EOM); lvl_len = 32; retval = tt588_transaction (rig, (char *) cmdbuf, cmd_len, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'J' || lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->i = lvlbuf[1]; break; case RIG_LEVEL_PREAMP: /* Receiver does not contain a preamp */ val->i=0; break; case RIG_LEVEL_SQL: cmd_len = sprintf((char *) cmdbuf, "?H" EOM); lvl_len = 32; retval = tt588_transaction (rig, (char *) cmdbuf, cmd_len, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'H' || lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = ((float) lvlbuf[1] / 127); break; case RIG_LEVEL_MICGAIN: lvl_len = 3; retval = tt588_transaction (rig, "?O" EOM, 3, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'O' || lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = (float) lvlbuf[2] / 0x0f; break; case RIG_LEVEL_COMP: /* Query S units signal level. */ lvl_len = 32; retval = tt588_transaction (rig, "?S" EOM, 3, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'S' || lvl_len != 6) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } sprintf((char *) sunits, "%c%c.%c%c", lvlbuf[1], lvlbuf[2], lvlbuf[3], lvlbuf[4]); sscanf(sunits, "%f", &sstr); printf("%f\n", sstr); val->f = sstr; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported level %d\n", __FUNCTION__, level); return -RIG_EINVAL; } return RIG_OK; } /* * tt588_set_level * Assumes rig!=NULL, val!=NULL */ int tt588_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { int retval, cmd_len; unsigned char cmdbuf[16], agcmode; switch (level) { case RIG_LEVEL_AF: /* Volume */ cmd_len = sprintf((char *) cmdbuf, "*U%c" EOM, (char)(val.f * 127)); retval = tt588_transaction (rig, (char *) cmdbuf, cmd_len, NULL, NULL); if (retval != RIG_OK) return retval; break; case RIG_LEVEL_RF: /* RF gain. Omni-VII expects value 0 for full gain, and 127 for lowest gain */ cmd_len = sprintf((char *) cmdbuf, "*I%c" EOM, (char)(127- val.f * 127)); retval = tt588_transaction (rig, (char *) cmdbuf, cmd_len, NULL, NULL); if (retval != RIG_OK) return retval; break; case RIG_LEVEL_AGC: switch(val.i) { case RIG_AGC_OFF: agcmode = '0'; break; case RIG_AGC_SLOW: agcmode = '1'; break; case RIG_AGC_MEDIUM: agcmode = '2'; break; case RIG_AGC_FAST: agcmode = '3'; break; default: return -RIG_EINVAL; } cmd_len = sprintf((char *) cmdbuf, "*G%c" EOM, agcmode); retval = tt588_transaction (rig, (char *) cmdbuf, cmd_len, NULL, NULL); if (retval != RIG_OK) return retval; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported level %d\n", __FUNCTION__, level); return -RIG_EINVAL; } return RIG_OK; } hamlib-1.2.15.3/tentec/paragon.c0000644000175000017500000003441712044564477013221 00000000000000/* * Hamlib TenTenc backend - TT-585 Paragon description * Copyright (c) 2003-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "hamlib/rig.h" #include "tentec.h" #include "bandplan.h" #include "iofunc.h" #include "serial.h" #include "misc.h" #include "num_stdio.h" struct tt585_priv_data { unsigned char status_data[30]; struct timeval status_tv; int channel_num; }; /* RIG_MODE_FM is optional */ #define TT585_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FM) #define TT585_RXMODES (TT585_MODES|RIG_MODE_AM) #define TT585_FUNCS (RIG_FUNC_NONE) #define TT585_LEVELS (RIG_LEVEL_NONE) #define TT585_ANTS (RIG_ANT_1) #define TT585_PARMS (RIG_PARM_ANN|RIG_PARM_TIME) #define TT585_VFO (RIG_VFO_A|RIG_VFO_B) #define TT585_VFO_OPS (RIG_OP_TO_VFO|RIG_OP_FROM_VFO|\ RIG_OP_CPY|RIG_OP_MCL|RIG_OP_TOGGLE|\ RIG_OP_UP|RIG_OP_DOWN|RIG_OP_BAND_UP|RIG_OP_BAND_DOWN|\ RIG_OP_TUNE) #define TT585_CACHE_TIMEOUT 500 /* ms */ /* * Mem caps to be checked, maybe more like split.. */ #define TT585_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .channel_desc = 1, \ } static int tt585_init(RIG *rig); static int tt585_cleanup(RIG *rig); static int tt585_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int tt585_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int tt585_set_vfo(RIG *rig, vfo_t vfo); static int tt585_get_vfo(RIG *rig, vfo_t *vfo); static int tt585_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo); static int tt585_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *txvfo); static int tt585_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int tt585_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int tt585_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); static int tt585_set_parm(RIG *rig, setting_t parm, value_t val); static int tt585_set_mem(RIG *rig, vfo_t vfo, int ch); static int tt585_get_mem(RIG *rig, vfo_t vfo, int *ch); static int tt585_get_status_data(RIG *rig); /* * tt585 transceiver capabilities, * with the optional model 258 RS232 Interface board. */ const struct rig_caps tt585_caps = { .rig_model = RIG_MODEL_TT585, .model_name = "TT-585 Paragon", .mfg_name = "Ten-Tec", .version = "0.3", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .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 = 100, /* instead of 20 ms */ .post_write_delay = 200, /* FOR T=1 TO 200 on a 4.77 MHz PC */ .timeout = 1000, .retry = 0, .has_get_func = TT585_FUNCS, .has_set_func = TT585_FUNCS, .has_get_level = TT585_LEVELS, .has_set_level = RIG_LEVEL_SET(TT585_LEVELS), .has_get_parm = TT585_PARMS, .has_set_parm = TT585_PARMS, .level_gran = {}, .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 = RIG_TARGETABLE_NONE, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 7, .vfo_ops = TT585_VFO_OPS, .chan_list = { { 0, 61, RIG_MTYPE_MEM, TT585_MEM_CAP }, }, .rx_range_list1 = { {kHz(100),MHz(30)-10,TT585_RXMODES,-1,-1,TT585_VFO,TT585_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,TT585_MODES, W(5),W(100),TT585_VFO,TT585_ANTS), RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(30)-10,TT585_RXMODES,-1,-1,TT585_VFO,TT585_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,TT585_MODES, W(5),W(100),TT585_VFO,TT585_ANTS), {MHz(5.25),MHz(5.40),TT585_MODES,W(5),W(100),TT585_VFO,TT585_ANTS}, RIG_FRNG_END, }, .tuning_steps = { {TT585_RXMODES,10}, {TT585_RXMODES,20}, {TT585_RXMODES,50}, {TT585_RXMODES,100}, {TT585_RXMODES,500}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_AM, kHz(6)}, {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_AM, kHz(1.8)}, {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_AM, 500}, {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_AM, 250}, {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .priv = (void*) NULL, .rig_init = tt585_init, .rig_cleanup = tt585_cleanup, .set_freq = tt585_set_freq, .get_freq = tt585_get_freq, .set_vfo = tt585_set_vfo, .get_vfo = tt585_get_vfo, .set_split_vfo = tt585_set_split_vfo, .get_split_vfo = tt585_get_split_vfo, .vfo_op = tt585_vfo_op, .set_mode = tt585_set_mode, .get_mode = tt585_get_mode, .set_parm = tt585_set_parm, .set_mem = tt585_set_mem, .get_mem = tt585_get_mem, }; /* * Function definitions below */ /* * tt585_init: * Basically, it just sets up *priv */ int tt585_init(RIG *rig) { struct tt585_priv_data *priv; priv = (struct tt585_priv_data *) malloc(sizeof(struct tt585_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } memset(priv, 0, sizeof(struct tt585_priv_data)); rig->state.priv = priv; return RIG_OK; } int tt585_cleanup(RIG *rig) { if (rig->state.priv) { free(rig->state.priv); rig->state.priv = NULL; } return RIG_OK; } int tt585_get_vfo(RIG *rig, vfo_t *vfo) { struct tt585_priv_data *priv = (struct tt585_priv_data *) rig->state.priv; int ret; ret = tt585_get_status_data(rig); if (ret < 0) return ret; *vfo = priv->status_data[9] & 0x08 ? RIG_VFO_A : RIG_VFO_B; return RIG_OK; } /* * tt585_set_vfo * Assumes rig!=NULL */ int tt585_set_vfo(RIG *rig, vfo_t vfo) { vfo_t curr_vfo; int ret; ret = tt585_get_vfo(rig, &curr_vfo); if (ret < 0) return ret; if (vfo == curr_vfo || vfo == RIG_VFO_CURR || vfo == RIG_VFO_VFO) return RIG_OK; /* toggle VFOs */ return write_block(&rig->state.rigport, "F", 1); } int tt585_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo) { split_t curr_split; vfo_t curr_txvfo; int ret; ret = tt585_get_split_vfo(rig, vfo, &curr_split, &curr_txvfo); if (ret < 0) return ret; if (split == curr_split) return RIG_OK; /* toggle split mode */ return write_block(&rig->state.rigport, "J", 1); } int tt585_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *txvfo) { struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv; int ret; ret = tt585_get_status_data(rig); if (ret < 0) return ret; *split = priv->status_data[9] & 0x02 ? RIG_SPLIT_ON : RIG_SPLIT_OFF; *txvfo = RIG_VFO_B; return RIG_OK; } /* * tt585_get_freq * Assumes rig!=NULL, freq!=NULL */ int tt585_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv; int ret; unsigned char *p; ret = tt585_get_status_data(rig); if (ret < 0) return ret; p = priv->status_data; *freq = ((((((p[0]*10 + p[1])*10 + p[2])*10 + p[3])*10 + p[4])*10 + p[5])*10 + p[6])*10; return RIG_OK; } /* * tt585_set_freq * assumes rig!=NULL, rig->state.priv!=NULL * assumes priv->mode in AM,CW,LSB or USB. */ int tt585_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv; #define FREQBUFSZ 16 char buf[FREQBUFSZ], *p; int ret; ret = num_snprintf(buf, FREQBUFSZ-1, "%.5f@", (double)freq/MHz(1)); buf[FREQBUFSZ-1] = '\0'; /* replace decimal point with W */ p = strchr(buf, '.'); *p = 'W'; rig_force_cache_timeout(&priv->status_tv); return write_block(&rig->state.rigport, buf, ret); } /* * tt585_get_mode * Assumes rig!=NULL, mode!=NULL */ int tt585_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv; int ret; ret = tt585_get_status_data(rig); if (ret < 0) return ret; if (priv->status_data[7] & 0x02) *mode = RIG_MODE_CW; else if (priv->status_data[7] & 0x04) *mode = RIG_MODE_USB; else if (priv->status_data[7] & 0x08) *mode = RIG_MODE_LSB; else if (priv->status_data[7] & 0x10) *mode = RIG_MODE_AM; else if (priv->status_data[7] & 0x20) *mode = RIG_MODE_FM; else if (priv->status_data[7] & 0x40) *mode = RIG_MODE_RTTY; else *mode = RIG_MODE_NONE; if (priv->status_data[8] & 0x08) *width = 250; else if (priv->status_data[8] & 0x10) *width = 500; else if (priv->status_data[8] & 0x20) *width = 1800; else if (priv->status_data[8] & 0x40) *width = 2400; else if (priv->status_data[8] & 0x80) *width = 6000; else *width = 0; return RIG_OK; } /* * tt585_set_mode * Assumes rig!=NULL */ int tt585_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv; const char *mcmd, *wcmd; int ret; if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); switch(mode) { case RIG_MODE_LSB: mcmd = "N"; break; case RIG_MODE_USB: mcmd = "O"; break; case RIG_MODE_CW: mcmd = "P"; break; case RIG_MODE_FM: mcmd = "L"; break; case RIG_MODE_AM: mcmd = "M"; break; case RIG_MODE_RTTY:mcmd = "XP"; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } rig_force_cache_timeout(&priv->status_tv); ret = write_block(&rig->state.rigport, mcmd, strlen(mcmd)); if (ret < 0) return ret; if (width <= 250) wcmd = "V"; else if (width <= 500) wcmd = "U"; else if (width <= 1800) wcmd = "T"; else if (width <= 2400) wcmd = "S"; else /* 6000 (or FM?) */ wcmd = "R"; return write_block(&rig->state.rigport, wcmd, strlen(mcmd)); } int tt585_set_mem(RIG *rig, vfo_t vfo, int ch) { struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv; char buf[16]; int ret; if (ch < 0 || ch > 61) return -RIG_EINVAL; priv->channel_num = ch; /* does it work without a command after the channel number? */ ret = sprintf(buf, ":%02d", ch); return write_block(&rig->state.rigport, buf, ret); } int tt585_get_mem(RIG *rig, vfo_t vfo, int *ch) { struct tt585_priv_data *priv = (struct tt585_priv_data *) rig->state.priv; int ret; ret = tt585_get_status_data(rig); if (ret < 0) return ret; /* 63 means not in MEM mode, 0xfe means mem full */ if (priv->status_data[11] > 61) return -RIG_ERJCTED; *ch = priv->status_data[11]; return RIG_OK; } /* * private helper function. Retrieves status data from rig. * using buffer indicated in *priv struct. * * need to use this when doing tt585_get_* stuff */ int tt585_get_status_data(RIG *rig) { struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv; hamlib_port_t *rigport; int ret; rigport = &rig->state.rigport; if (!rig_check_cache_timeout(&priv->status_tv, TT585_CACHE_TIMEOUT)) return RIG_OK; serial_flush(rigport); /* send STATUS comand to fetch data*/ ret = write_block(rigport, "\\", 1); if (ret < 0) return ret; ret = read_block(rigport, (char *) priv->status_data, sizeof(priv->status_data)); if (ret < 0) return ret; /* update cache date */ gettimeofday(&priv->status_tv, NULL); return RIG_OK; } int tt585_set_parm(RIG *rig, setting_t parm, value_t val) { int ret; switch (parm) { case RIG_PARM_ANN: /* FIXME: > is a toggle command only */ ret = write_block(&rig->state.rigport, ">", 1); if (ret < 0) return ret; /* exact addional delay TBC */ sleep(1); return RIG_OK; /* TODO: RIG_PARM_TIME */ default: rig_debug (RIG_DEBUG_ERR, "%s: unsupported parm %#x\n", __func__, parm); return -RIG_EINVAL; } return RIG_OK; } /* * tt585_vfo_op * Assumes rig!=NULL */ int tt585_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { struct tt585_priv_data *priv = (struct tt585_priv_data *)rig->state.priv; const char *cmd; char buf[16]; switch (op) { case RIG_OP_TUNE: cmd = "Q"; break; case RIG_OP_MCL: sprintf(buf, ":%02dXD", priv->channel_num); cmd = buf; break; case RIG_OP_TO_VFO: sprintf(buf, ":%02d", priv->channel_num); cmd = buf; break; case RIG_OP_FROM_VFO: sprintf(buf, "<%02d", priv->channel_num); cmd = buf; break; case RIG_OP_CPY: cmd = "E"; break; case RIG_OP_TOGGLE: cmd = "F"; break; case RIG_OP_DOWN: cmd = "]"; break; case RIG_OP_UP: cmd = "["; break; case RIG_OP_BAND_DOWN: cmd = "XY"; break; case RIG_OP_BAND_UP: cmd = "XZ"; break; default: rig_debug (RIG_DEBUG_ERR, "%s: unsupported op %#x\n", __func__, op); return -RIG_EINVAL; } rig_force_cache_timeout(&priv->status_tv); return write_block(&rig->state.rigport, cmd, strlen(cmd)); } hamlib-1.2.15.3/tentec/pegasus.c0000644000175000017500000002104512044564477013232 00000000000000/* * Hamlib TenTenc backend - TT-550 PC-Radio description * Copyright (c) 2002-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "idx_builtin.h" #include "tentec.h" #include "tt550.h" #define TT550_MODES (RIG_MODE_FM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_AM) #define TT550_RXMODES (TT550_MODES) #define TT550_FUNCS (RIG_FUNC_VOX|RIG_FUNC_ANF|RIG_FUNC_TUNER| \ RIG_FUNC_NR|RIG_FUNC_VOX) #define TT550_LEVELS (RIG_LEVEL_AGC|RIG_LEVEL_AF|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH| \ RIG_LEVEL_RF|RIG_LEVEL_COMP|RIG_LEVEL_VOX|RIG_LEVEL_SQL| \ RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_KEYSPD| \ RIG_LEVEL_SWR|RIG_LEVEL_ATT|RIG_LEVEL_NR|RIG_LEVEL_IF| \ RIG_LEVEL_VOXGAIN|RIG_LEVEL_ANTIVOX) #define TT550_VFO (RIG_VFO_A ) #define TT550_VFO_OPS (RIG_OP_TUNE) /* * a bit coarse, but I don't have a TT550, and the manual is not * verbose on the subject. Please test it and report! --SF */ #define TT550_STR_CAL { 2, { \ { 0, -60 }, \ { 10000, 20 }, \ } } /* * tt550 receiver capabilities. * * protocol is documented at * http://www.tentec.com/550/550prg2.pdf * * TODO: */ const struct rig_caps tt550_caps = { .rig_model = RIG_MODEL_TT550, .model_name = "TT-550", .mfg_name = "Ten-Tec", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_COMPUTER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 57600, .serial_rate_max = 57600, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 0, .timeout = 30, .retry = 3, .has_get_func = TT550_FUNCS, .has_set_func = TT550_FUNCS, .has_get_level = TT550_LEVELS, .has_set_level = RIG_LEVEL_SET (TT550_LEVELS), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = {.min = {.i = 0},.max = {.i = 65535}}, }, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = {RIG_DBLST_END}, .attenuator = {20, RIG_DBLST_END}, .max_rit = Hz (10000), .max_xit = Hz (10000), .max_ifshift = Hz (2000), .targetable_vfo = RIG_TARGETABLE_ALL, .vfo_ops = TT550_VFO_OPS, .transceive = RIG_TRN_RIG, .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), TT550_RXMODES, -1, -1, TT550_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { {kHz (1800), MHz (2) - 1, TT550_MODES, 5000, 100000, TT550_VFO}, {kHz (3500), MHz (4) - 1, TT550_MODES, 5000, 100000, TT550_VFO}, {kHz (5330), kHz (5407) - 1, RIG_MODE_USB, 5000, 50000, TT550_VFO}, {MHz (7), kHz (7300), TT550_MODES, 5000, 100000, TT550_VFO}, {kHz (10100), kHz (10150), TT550_MODES, 5000, 100000, TT550_VFO}, {MHz (14), kHz (14350), TT550_MODES, 5000, 100000, TT550_VFO}, {kHz (18068), kHz (18168), TT550_MODES, 5000, 100000, TT550_VFO}, {MHz (21), kHz (21450), TT550_MODES, 5000, 100000, TT550_VFO}, {kHz (24890), kHz (24990), TT550_MODES, 5000, 100000, TT550_VFO}, {MHz (28), kHz (29700), TT550_MODES, 5000, 100000, TT550_VFO}, RIG_FRNG_END, }, .tuning_steps = { {TT550_RXMODES, RIG_TS_ANY}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_CW, Hz (450)}, {RIG_MODE_CW, Hz (300)}, {RIG_MODE_CW, Hz (750)}, {RIG_MODE_AM|RIG_MODE_FM, kHz (6)}, {RIG_MODE_AM|RIG_MODE_FM, Hz (4200)}, {RIG_MODE_AM|RIG_MODE_FM, kHz (8)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(2400)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(2700)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(2100)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(5700)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(5400)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(5100)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(4800)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(4500)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(4200)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(3900)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(3600)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(3300)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(2850)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(8000)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(2550)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(2400)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(2250)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(6000)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(1950)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(1800)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(1650)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(1500)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(1350)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(1200)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(1050)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(900)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(750)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(675)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(600)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(525)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(450)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(375)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(330)}, {RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_CW, Hz(300)}, RIG_FLT_END, }, .str_cal = TT550_STR_CAL, .rig_init = tt550_init, .rig_cleanup = tt550_cleanup, .rig_open = tt550_trx_open, .reset = tt550_reset, .set_freq = tt550_set_freq, .get_freq = tt550_get_freq, .set_mode = tt550_set_mode, .get_mode = tt550_get_mode, .set_func = tt550_set_func, .get_func = tt550_get_func, .set_level = tt550_set_level, .get_level = tt550_get_level, .get_info = tt550_get_info, .set_ptt = tt550_set_ptt, .get_ptt = tt550_get_ptt, .set_split_freq = tt550_set_tx_freq, .get_split_freq = tt550_get_tx_freq, .set_split_mode = tt550_set_tx_mode, .get_split_mode = tt550_get_tx_mode, .set_split_vfo = tt550_set_split_vfo, .get_split_vfo = tt550_get_split_vfo, .decode_event = tt550_decode_event, .set_ts = tt550_set_tuning_step, .get_ts = tt550_get_tuning_step, .vfo_op = tt550_vfo_op, .set_rit = tt550_set_rit, .get_rit = tt550_get_rit, .set_xit = tt550_set_xit, .get_xit = tt550_get_xit, }; /* * Function definitions below */ hamlib-1.2.15.3/tentec/README0000644000175000017500000000611112044564477012274 00000000000000Jupiter (538) (29 February 2012, AA6E) The Jupiter needs current firmware, at least version 1,18. Earlier firmware apparently had a different command protocol. Most available commands are now implemented, with exception of NB, NR, and AN. Omni VI (563), VI Plus (564) (26 March 2008, AA6E) Note that the Omni uses an Icom-style command interface. The Omni backend lives in the ../icom directory! Omni (hardware) menu selections: The Omni's device address must be set to '04'. The 563 and 564 provide 1200, 2400, 4800, 9600, and 19200 baud rates. Notes on 563 (Omni VI) vs. 564 (Omni VI Plus) Omni VI Plus (Hamlib model 351) backend can be used with the Omni VI, subject to its hardware limitations. Orion (TT 565, 565AT) and Orion II (TT 566, 566AT) (14 February 2008) Improved serial I/O transfer reliability, better error handling V1 and V2 firmware are autorecognized in the tt565_open routine. Version 2.xxx is now the default for Orion. (5 November 2007) The S-meter behavior has changed for Version 2.xxx of firmware for Orion. Orion II presumably also has a different calibration. We will recalibrate, but it is not clear if Orion and Orion II will produce the same readings. :-( Please send calibration info to me as indicated on the Hamlib FAQ at http://hamlib.sourceforge.net/faq.html . (23 April 2006) These are all covered by the TT565 backend (model 1608). This backend is functioning for basic HF work, although memory, multi-VFO, and antenna selection, etc. are left for the future. All testing to date has been on a model 565AT, running v 1.372 firmware. All reports of success/failure (especially for the Orion 2) are welcome -- Martin, aa6e@arrl.net (26 Feb 2006) tt550 TODO (Ken, N7IPB): Support for multiple VFO's and Memories. The TT550 doesn't really have VFO's or Memories since it's strictly a software controlled radio, but they can easily be simulated in software. I already support a split mode since the TX and RX control is separate. Adding support for VFO-A, VFO-B and memory channels will be done next. The optional encoder with keypad is supported for changing frequency only, along with F1 changing the stepsize. The other function keys have no current assignments. I can add hard-coded Function keys as I did with F1 but maybe a more generic solution can be determined. In addition the keypad is not supported. Hamlib has no apparent way to make use of the numeric keys. We probably need to add a callback for key data. IF-Shift: IF-Shift code is in place but I see no way in hamlib to make use of it. The Icom dual pass-band tuning is supported, but not just simple IF shift. Or maybe I just missed something. TX Audio Monitor Volume - no hamlib support - RIG_LEVEL_TX_MON? CW Sidetone Volume - no hamlib support - RIG_LEVEL_SIDETONE? Transmit Audio Source and Volume select - no hamlib support - RIG_LEVEL_LINEIN? CW Spot Level - no hamlib support - RIG_LEVEL_CW_SPOT? Enable/Disable Amplifier keying loop - no hamlib support - RIG_FUNC_AMP? hamlib-1.2.15.3/tentec/argonaut.c0000644000175000017500000001027312044564477013404 00000000000000/* * Hamlib TenTenc backend - TT-516 PC-Radio description * Copyright (c) 2003-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "tentec2.h" #include "bandplan.h" #define TT516_MODES (RIG_MODE_FM|RIG_MODE_CW|RIG_MODE_SSB) #define TT516_RXMODES (TT516_MODES|RIG_MODE_AM) #define TT516_FUNCS (RIG_FUNC_NONE) #define TT516_LEVELS (RIG_LEVEL_RAWSTR|/* RIG_LEVEL_NB| */ \ RIG_LEVEL_SQL|/*RIG_LEVEL_PBT|*/ \ RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD| \ RIG_LEVEL_SWR|RIG_LEVEL_ATT) #define TT516_ANTS RIG_ANT_1 #define TT516_VFO (RIG_VFO_A|RIG_VFO_B) /* * tt516 receiver capabilities. * * protocol is documented at * http://www.rfsquared.com/ * */ const struct rig_caps tt516_caps = { .rig_model = RIG_MODEL_TT516, .model_name = "TT-516 Argonaut V", .mfg_name = "Ten-Tec", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .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 = 400, .retry = 3, .has_get_func = TT516_FUNCS, .has_set_func = TT516_FUNCS, .has_get_level = TT516_LEVELS, .has_set_level = RIG_LEVEL_SET(TT516_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 = { 15, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_FREQ|RIG_TARGETABLE_MODE, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 100, RIG_MTYPE_MEM, TT_MEM_CAP }, }, .rx_range_list1 = { {kHz(500),MHz(30),TT516_RXMODES,-1,-1,TT516_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,TT516_MODES, W(1),W(20),TT516_VFO,TT516_ANTS), FRQ_RNG_HF(1,RIG_MODE_AM, W(1),W(5),TT516_VFO,TT516_ANTS), RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30),TT516_RXMODES,-1,-1,TT516_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,TT516_MODES, W(1),W(20),TT516_VFO,TT516_ANTS), FRQ_RNG_HF(2,RIG_MODE_AM, W(1),W(5),TT516_VFO,TT516_ANTS), RIG_FRNG_END, }, .tuning_steps = { {RIG_MODE_SSB|RIG_MODE_CW,10}, /* {RIG_MODE_SSB|RIG_MODE_CW,kHz(1)}, */ {RIG_MODE_AM,100}, /* {RIG_MODE_AM,kHz(5)}, */ {RIG_MODE_FM,kHz(2.5)}, /* {RIG_MODE_FM,kHz(5)}, */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { /* FIXME: add increments -> 34 filters? */ {RIG_MODE_CW|RIG_MODE_SSB, kHz(2.8)}, {RIG_MODE_CW|RIG_MODE_SSB, 200}, {RIG_MODE_CW|RIG_MODE_SSB, 0}, /* Filters are 200 Hz to 1000 Hz in 50 Hz steps, 1000 to 2800 Hz in 100 Hz steps */ {RIG_MODE_AM, kHz(4)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .priv = (void*)NULL, .set_freq = tentec2_set_freq, .get_freq = tentec2_get_freq, .set_vfo = tentec2_set_vfo, .get_vfo = tentec2_get_vfo, .set_mode = tentec2_set_mode, .get_mode = tentec2_get_mode, .set_split_vfo = tentec2_set_split_vfo, .get_split_vfo = tentec2_get_split_vfo, .set_ptt = tentec2_set_ptt, .reset = tentec2_reset, .get_info = tentec2_get_info, }; /* * Function definitions below */ hamlib-1.2.15.3/tentec/tentec2.c0000644000175000017500000002671312044564477013136 00000000000000/* * Hamlib Tentec backend - Argonaut, Jupiter, RX-350 * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * Module rewritten and tested by Dave Freese, W1HKJ * Tested using the distributed test program "rigctl" to control an Argonaut V xcvr. * Linked to digital modem program, "gmfsk" and bench tested and used on-air * Linked to experimental digital modem program "fldigi", bench tested * and used on-air. * * Note for anyone wishing to expand on the command set. * Recommend using the * * tentec_transaction (rig, sendbuf, sendlen, rcvbuf, &rcv_len) * * function to send the command and receive the response. * * The Argo V always sends a response and ends the response with a "G\r" to * indicate that the command was accepted. A rejected command is responded to by a * two character sequence "Z\r". You should always expect a maximum response equal * to the number of data bytes plus two. * * For example: * A request for the present receiver filter bandwidth is the the string: * "?W\r" which is 3 bytes in length * The response from the Argonaut V will be: * "Wn\rG\r" which is 5 bytes in length, where n is an unsigned char (byte) * If the transceiver failed to receive the command correctly it will respond: * "Z\r" ----> you need to check for that condition * * The tentec_transaction(...) function will always terminate the rcvbuf with a null * character. The pointer to the receive buffer length MUST be initialized to the * length of the max # chars for that command PLUS 1 for the terminator. * For the above command, rcv_len should be 6. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "cal.h" #include "register.h" #include "tentec.h" #include "tentec2.h" #define TT_AM '0' #define TT_USB '1' #define TT_LSB '2' #define TT_CW '3' #define TT_FM '4' /************************************************************************************* * * Specs from http://www.rfsquared.com * * TODO: [sg]et_split * [sg]et_level: ATT, NB, PBT, KEYER_SPD, RFPOWER, SWR, SQL, STRENGTH, .. * vfo_op: TO_VFO, FROM_VFO + emulated set_mem/get_mem */ /* * tentec_set_freq * assumes rig!=NULL, rig->state.priv!=NULL * assumes priv->mode in AM,CW,LSB or USB. */ int tentec2_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { int retval, ret_len; char freqbuf[16] = "*Axxxx\r"; unsigned long f = (unsigned long)freq; if (vfo == RIG_VFO_CURR) { if ((retval = tentec2_get_vfo(rig, &vfo)) != RIG_OK) return retval; } switch(vfo) { case RIG_VFO_A: break; case RIG_VFO_B: freqbuf[1] = 'B'; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %s\n", __FUNCTION__, rig_strvfo(vfo)); return -RIG_EINVAL; } freqbuf[2] = (f >> 24) & 0xFF; freqbuf[3] = (f >> 16) & 0xFF; freqbuf[4] = (f >> 8) & 0xFF; freqbuf[5] = f & 0xFF; // Argo V will respond // "G\r" or "Z\r" ret_len = 3; retval = tentec_transaction (rig, freqbuf, 7, freqbuf, &ret_len); if (retval != RIG_OK || ret_len != 2) return -RIG_EINVAL; if (freqbuf[0] == 'G') return RIG_OK; return -RIG_ERJCTED; } /* * tentec2_get_freq * Assumes rig!=NULL, freq!=NULL */ int tentec2_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { int retval, ret_len; char freqbuf[16] = "?A\r"; if (vfo == RIG_VFO_CURR) { if ((retval = tentec2_get_vfo(rig, &vfo)) != RIG_OK) return retval; } switch(vfo) { case RIG_VFO_A: break; case RIG_VFO_B: freqbuf[1] = 'B'; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %s\n", __FUNCTION__, rig_strvfo(vfo)); return -RIG_EINVAL; } // Argo V will respond with 8 characters // "Annnn\rG\r" or "Bnnnn\rG\r" // or it will respond // "Z\r" meaning the command was rejected ret_len = 9; retval = tentec_transaction (rig, freqbuf, strlen(freqbuf), freqbuf, &ret_len); if (retval != RIG_OK) return retval; if (ret_len == 2 && freqbuf[1] == 'Z') return -RIG_ERJCTED; if (ret_len < 6) return -RIG_EINVAL; *freq = (unsigned int)((freqbuf[1] & 0x0FF) << 24) + (unsigned int)((freqbuf[2] & 0x0FF) << 16) + (unsigned int)((freqbuf[3] & 0x0FF) << 8) + (unsigned int)(freqbuf[4] & 0x0FF); return RIG_OK; } /* * tentec2_set_vfo * Assumes rig!=NULL */ int tentec2_set_vfo(RIG *rig, vfo_t vfo) { int retval, ret_len; char vfobuf[16] = "*EVA\r"; if ((vfo & ~RIG_VFO_MEM) == RIG_VFO_NONE || vfo == RIG_VFO_VFO) { vfo_t cvfo; retval = tentec2_get_vfo(rig, &cvfo); if (retval != RIG_OK) return retval; vfo = (cvfo&(RIG_VFO_A|RIG_VFO_B)) | (vfo & RIG_VFO_MEM); } if (vfo & RIG_VFO_MEM) vfobuf[2] = 'M'; switch(vfo & ~RIG_VFO_MEM) { case RIG_VFO_A: break; case RIG_VFO_B: vfobuf[3] = 'B'; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %s\n", __FUNCTION__, rig_strvfo(vfo)); return -RIG_EINVAL; } ret_len = 3; retval = tentec_transaction (rig, vfobuf, 5, vfobuf, &ret_len); if (retval != RIG_OK) return retval; if (vfobuf[0] == 'G') return RIG_OK; return -RIG_ERJCTED; } /* * tentec2_get_vfo * Assumes rig!=NULL */ int tentec2_get_vfo(RIG *rig, vfo_t *vfo) { int ret_len, retval; unsigned char vfobuf[16] = "?E\r"; ret_len = 7; retval = tentec_transaction (rig, (char *) vfobuf, 3, (char *) vfobuf, &ret_len); if (retval != RIG_OK) return retval; // ArgoV sends back 6 character string // "EVA\rG\r" or "EVB\rG\r" // or 2 character failure string // "Z\r" if (ret_len == 2 && vfobuf[0] == 'Z') return -RIG_ERJCTED; if (ret_len != 6) return -RIG_EPROTO; *vfo = vfobuf[2] == 'A' ? RIG_VFO_A : RIG_VFO_B; if (vfobuf[1] == 'M') *vfo |= RIG_VFO_MEM; return RIG_OK; } /* * tentec2_set_split_vfo * Assumes rig!=NULL */ int tentec2_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { int retval, ret_len; char retbuf[10] = "*Ox\r"; if (split == RIG_SPLIT_ON) retbuf[1] = 1; else retbuf[1] = 0; ret_len = 3; retval = tentec_transaction( rig, retbuf, 4, retbuf, &ret_len ); if (retval != RIG_OK) return retval; if (ret_len == 2 && retbuf[0] == 'Z') return -RIG_ERJCTED; return RIG_OK; } /* * tentec2_get_split_vfo * Assumes rig!=NULL */ int tentec2_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { int ret_len, retval; char splitbuf[16] = "?O\r"; /* * TODO: handle tx_vfo */ ret_len = 5; retval = tentec_transaction (rig, splitbuf, 3, splitbuf, &ret_len); // Argo V returns // "On\rG\r" or // "Z\r" if (retval != RIG_OK) return retval; if (ret_len == 2 && splitbuf[0] == 'Z') return -RIG_ERJCTED; if (ret_len != 4) return -RIG_EPROTO; *split = splitbuf[1] == 0 ? RIG_SPLIT_OFF : RIG_SPLIT_ON; return RIG_OK; } /* * tentec2_set_mode * Assumes rig!=NULL */ int tentec2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { char ttmode, ttmode_a, ttmode_b; int ttfilter, retval, ret_len; unsigned char mdbuf[16]; 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, "%s: unsupported mode %d\n", __FUNCTION__, mode); return -RIG_EINVAL; } ttmode_a = ttmode_b = ttmode; strcpy((char *) mdbuf, "*M00\r" ); ret_len = 3; mdbuf[2] = ttmode_a; mdbuf[3] = ttmode_b; retval = tentec_transaction (rig, (char *) mdbuf, 5, (char *) mdbuf, &ret_len); if (retval != RIG_OK) return retval; if (ret_len == 2 && mdbuf[1] == 'Z') return -RIG_ERJCTED; if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); /* * Filter 0: 200 * .. * Filter 16: 1000 * .. * Filter 36: 3000 */ if (width < 1000) ttfilter = (width / 50) - 4; else ttfilter = (width / 100) + 6; strcpy ((char *) mdbuf, "*Wn\r"); mdbuf[2] = ttfilter; ret_len = 3; retval = tentec_transaction (rig, (char *) mdbuf, 5, (char *) mdbuf, &ret_len); if (retval != RIG_OK) return retval; if (ret_len == 2 && mdbuf[0] == 'Z') return -RIG_ERJCTED; return RIG_OK; } /* * tentec2_get_mode * Assumes rig!=NULL, mode!=NULL */ int tentec2_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { int ttfilter, retval, ret_len; char mdbuf[16]; if (vfo == RIG_VFO_CURR) { if ((retval = tentec2_get_vfo(rig, &vfo)) != RIG_OK) return retval; } // response to "?M\r" command: // "M00" -> AM, "M1" -> USB, "M2" -> LSB, "M3" -> CW, "M4" -> FM ret_len = 7; retval = tentec_transaction (rig, "?M\r", 3, mdbuf, &ret_len); if (retval != RIG_OK) return retval; if (ret_len != 6) return -RIG_EPROTO; switch (mdbuf[1]) { case TT_USB: *mode = RIG_MODE_USB; break; case TT_LSB: *mode = RIG_MODE_LSB; break; case TT_CW: *mode = RIG_MODE_CW; break; case TT_AM: *mode = RIG_MODE_AM; break; case TT_FM: *mode = RIG_MODE_FM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode '%c'\n", __FUNCTION__, mdbuf[1]); return -RIG_EPROTO; } ret_len = 6; retval = tentec_transaction (rig, "?W\r", 3, mdbuf, &ret_len); if (retval != RIG_OK) return retval; if (ret_len != 5) return -RIG_EPROTO; /* * Filter 0: 200 * .. * Filter 16: 1000 * .. * Filter 36: 3000 */ ttfilter = mdbuf[1]; if (ttfilter < 0 || ttfilter > 36) return -RIG_EPROTO; if (ttfilter < 16) *width = (ttfilter + 4) * 50; else *width = (ttfilter - 6) * 100; return RIG_OK; } /* * tentec2_set_ptt * Assumes rig!=NULL */ int tentec2_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { int retval, ret_len; char retbuf[10]; ret_len = 3; retval = tentec_transaction ( rig, ptt==RIG_PTT_ON? "#1\r" : "#0\r", 3, retbuf, &ret_len); if (retval != RIG_OK) return retval; if (ret_len == 2 && retbuf[0] == 'G') return RIG_OK; return -RIG_ERJCTED; } /* * Software restart */ int tentec2_reset(RIG *rig, reset_t reset) { int retval, reset_len; char reset_buf[32]; reset_len = 32; retval = tentec_transaction (rig, "*X\r", 3, reset_buf, &reset_len); if (retval != RIG_OK) return retval; if (!strstr(reset_buf, "RADIO START")) return -RIG_EPROTO; return RIG_OK; } /* * tentec2_get_info * Assumes rig!=NULL */ const char *tentec2_get_info(RIG *rig) { static char buf[100]; /* FIXME: reentrancy */ int firmware_len, retval; /* * protocol version */ firmware_len = 100; retval = tentec_transaction (rig, "?V\r", 3, buf, &firmware_len); /* "VER 1010-516" */ if (retval != RIG_OK || firmware_len != 12) { rig_debug(RIG_DEBUG_ERR,"%s: ack NG, len=%d\n", __FUNCTION__, firmware_len); return NULL; } if (firmware_len < 100) buf[firmware_len] = 0; else buf[0] = 0; return buf; } hamlib-1.2.15.3/tentec/Makefile.in0000644000175000017500000005201312044564557013462 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = tentec DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_tentec_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la \ $(top_builddir)/lib/libmisc.la am__objects_1 = rx320.lo rx340.lo rx350.lo rx331.lo pegasus.lo \ argonaut.lo orion.lo jupiter.lo omnivii.lo paragon.lo am_hamlib_tentec_la_OBJECTS = $(am__objects_1) tentec.lo tentec2.lo \ tt550.lo hamlib_tentec_la_OBJECTS = $(am_hamlib_tentec_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_tentec_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_tentec_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_tentec_la_SOURCES) DIST_SOURCES = $(hamlib_tentec_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ TENTECSRCLIST = rx320.c rx340.c rx350.c rx331.c \ pegasus.c argonaut.c orion.c jupiter.c omnivii.c paragon.c pkglib_LTLIBRARIES = hamlib-tentec.la hamlib_tentec_la_SOURCES = $(TENTECSRCLIST) tentec.c tentec2.c tt550.c hamlib_tentec_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_tentec_la_LIBADD = $(top_builddir)/src/libhamlib.la \ $(top_builddir)/lib/libmisc.la EXTRA_DIST = README noinst_HEADERS = tentec.h tentec2.h tt550.h orion.h rx331.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tentec/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tentec/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-tentec.la: $(hamlib_tentec_la_OBJECTS) $(hamlib_tentec_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_tentec_la_LINK) -rpath $(pkglibdir) $(hamlib_tentec_la_OBJECTS) $(hamlib_tentec_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argonaut.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jupiter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/omnivii.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orion.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paragon.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pegasus.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rx320.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rx331.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rx340.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rx350.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tentec.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tentec2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tt550.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/tentec/jupiter.c0000644000175000017500000005122212044564477013245 00000000000000/* * Hamlib TenTenc backend - TT-538 description * Copyright (c) 2003-2012 by Stephane Fillod, Martin Ewing * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* Extended and corrected by Martin Ewing AA6E 2/2012 * This backend tested with firmware v 1.330. * Firmware version >=1.18 is probably required. * Reference: Jupiter Model 538 Programmer's Reference Guide Rev. 1.1 */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "tentec2.h" #include "tentec.h" #include "bandplan.h" struct tt538_priv_data { int ch; /* mem */ vfo_t vfo_curr; }; #define TT538_MODES (RIG_MODE_FM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM) #define TT538_RXMODES (TT538_MODES) #define TT538_FUNCS (RIG_FUNC_NR|RIG_FUNC_ANF) #define TT538_LEVELS (RIG_LEVEL_RAWSTR| \ /*RIG_LEVEL_NB|RIG_LEVEL_NR|RIG_LEVEL_ANF| */ \ RIG_LEVEL_SQL| \ RIG_LEVEL_RF| \ RIG_LEVEL_AF|RIG_LEVEL_AGC| \ RIG_LEVEL_SWR|RIG_LEVEL_ATT) /* Note TT538 supports NB, NR, and AN levels -- to be implemented */ #define TT538_LEVELS_SET (RIG_LEVEL_SQL|RIG_LEVEL_RF| \ /*RIG_LEVEL_NB|RIG_LEVEL_NR|RIG_LEVEL_ANF| */ \ RIG_LEVEL_AF| \ RIG_LEVEL_AGC|RIG_LEVEL_ATT) #define TT538_ANTS (RIG_ANT_1) #define TT538_PARMS (RIG_PARM_NONE) #define TT538_VFO (RIG_VFO_A|RIG_VFO_B) #define TT538_VFO_OPS (RIG_OP_TO_VFO|RIG_OP_FROM_VFO) #define TT538_AM '0' #define TT538_USB '1' #define TT538_LSB '2' #define TT538_CW '3' #define TT538_FM '4' #define EOM "\015" /* CR */ static int tt538_init(RIG *rig); static int tt538_reset(RIG *rig, reset_t reset); static int tt538_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int tt538_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int tt538_set_vfo(RIG *rig, vfo_t vfo); static int tt538_get_vfo(RIG *rig, vfo_t *vfo); static int tt538_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int tt538_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static char which_vfo(const RIG *rig, vfo_t vfo); static int tt538_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int tt538_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); /* * tt538 transceiver capabilities. * * Protocol is documented at * http://www.rfsquared.com/ */ const struct rig_caps tt538_caps = { .rig_model = RIG_MODEL_TT538, .model_name = "TT-538 Jupiter", .mfg_name = "Ten-Tec", .version = "0.6", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 57600, .serial_rate_max = 57600, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 0, .timeout = 400, .retry = 3, .has_get_func = TT538_FUNCS, .has_set_func = TT538_FUNCS, .has_get_level = TT538_LEVELS, .has_set_level = TT538_LEVELS_SET, .has_get_parm = TT538_PARMS, .has_set_parm = TT538_PARMS, .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END }, .attenuator = { 15, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = kHz(2), .targetable_vfo = RIG_TARGETABLE_FREQ|RIG_TARGETABLE_MODE, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 127, RIG_MTYPE_MEM, TT_MEM_CAP }, }, .rx_range_list1 = { {kHz(100),MHz(30),TT538_RXMODES,-1,-1,TT538_VFO,TT538_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,TT538_MODES, W(5),W(100),TT538_VFO,TT538_ANTS), RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(30),TT538_RXMODES,-1,-1,TT538_VFO,TT538_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,TT538_MODES, W(5),W(100),TT538_VFO,TT538_ANTS), {MHz(5.25),MHz(5.40),TT538_MODES,W(5),W(100),TT538_VFO,TT538_ANTS}, RIG_FRNG_END, }, .tuning_steps = { {TT538_RXMODES,1}, {TT538_RXMODES,10}, {TT538_RXMODES,100}, {TT538_RXMODES,kHz(1)}, {TT538_RXMODES,kHz(10)}, {TT538_RXMODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM, 300}, {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM, kHz(8)}, {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM, 0}, /* 34 filters */ {RIG_MODE_FM, kHz(15)}, /* TBC */ RIG_FLT_END, }, .priv = (void*) NULL, .rig_init = tt538_init, .set_freq = tt538_set_freq, .get_freq = tt538_get_freq, .set_vfo = tt538_set_vfo, .get_vfo = tt538_get_vfo, .set_mode = tt538_set_mode, .get_mode = tt538_get_mode, .get_level = tt538_get_level, .set_level = tt538_set_level, .set_split_vfo = tentec2_set_split_vfo, .get_split_vfo = tentec2_get_split_vfo, .set_ptt = tentec2_set_ptt, .reset = tt538_reset, .get_info = tentec2_get_info, }; /* Filter table for 538 reciver support. */ static int tt538_rxFilter[] = { 8000, 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, 260, 225, 180, 165, 150 }; #define JUPITER_TT538_RXFILTERS ( sizeof(tt538_rxFilter) / sizeof(tt538_rxFilter[0]) ) /* * Function definitions below */ /* I frequently see the Jupiter and my laptop get out of sync. A response from the 538 isn't seen by the laptop. A few "XX"s sometimes get things going again, hence this hack, er, function. */ static int tt538_transaction (RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { char reset_buf[32]; int i, reset_len, retval; retval = tentec_transaction (rig, cmd, cmd_len, data, data_len); if (retval == RIG_OK) return retval; /* Try a few times to do a DSP reset to resync things. */ for (i = 0; i < 3; i++) { reset_len = 32; retval = tentec_transaction (rig, "XX" EOM, 3, reset_buf, &reset_len); if (retval != RIG_OK) continue; /* Try again. This 1 didn't work. */ if (strstr(reset_buf, "RADIO START")) break; /* DSP reset successful! */ } /* Try real command one last time... */ return tentec_transaction (rig, cmd, cmd_len, data, data_len); } /* * tt538_init: * Basically, it just sets up *priv */ int tt538_init(RIG *rig) { struct tt538_priv_data *priv; priv = (struct tt538_priv_data *) malloc(sizeof(struct tt538_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } memset(priv, 0, sizeof(struct tt538_priv_data)); /* * set arbitrary initial status */ priv->ch = 0; priv->vfo_curr = RIG_VFO_A; rig->state.priv = (rig_ptr_t)priv; return RIG_OK; } static char which_vfo(const RIG *rig, vfo_t vfo) { struct tt538_priv_data *priv = (struct tt538_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) vfo = priv->vfo_curr; switch (vfo) { case RIG_VFO_A: return 'A'; case RIG_VFO_B: return 'B'; case RIG_VFO_NONE: return 'N'; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %s\n", __FUNCTION__, rig_strvfo(vfo)); return -RIG_EINVAL; } } int tt538_get_vfo(RIG *rig, vfo_t *vfo) { struct tt538_priv_data *priv = (struct tt538_priv_data *) rig->state.priv; *vfo = priv->vfo_curr; return RIG_OK; } /* * tt538_set_vfo * Assumes rig!=NULL */ int tt538_set_vfo(RIG *rig, vfo_t vfo) { struct tt538_priv_data *priv = (struct tt538_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) return RIG_OK; priv->vfo_curr = vfo; return RIG_OK; } /* * Software restart */ int tt538_reset(RIG *rig, reset_t reset) { int retval, reset_len; char reset_buf[32]; reset_len = 32; retval = tt538_transaction (rig, "XX" EOM, 3, reset_buf, &reset_len); if (retval != RIG_OK) return retval; if (!strstr(reset_buf, "RADIO START")) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, reset_buf); return -RIG_EPROTO; } return RIG_OK; } /* * tt538_get_freq * Assumes rig!=NULL, freq!=NULL */ int tt538_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { char curVfo; int cmd_len, resp_len, retval; unsigned char cmdbuf[16], respbuf[32]; cmd_len = sprintf((char *) cmdbuf, "?%c" EOM, which_vfo(rig, vfo)); resp_len = 32; retval = tt538_transaction (rig, (char *) cmdbuf, cmd_len, (char *) respbuf, &resp_len); if (retval != RIG_OK) return retval; curVfo = which_vfo(rig, vfo); if (respbuf[0] != curVfo) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } if (resp_len != 6) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected length '%d'\n", __FUNCTION__, resp_len); return -RIG_EPROTO; } *freq = (respbuf[1] << 24) + (respbuf[2] << 16) + (respbuf[3] << 8) + respbuf[4]; return RIG_OK; } /* * tt538_set_freq * assumes rig!=NULL, rig->state.priv!=NULL * assumes priv->mode in AM,CW,LSB or USB. */ int tt538_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char bytes[4]; int cmd_len; unsigned char cmdbuf[16]; /* Freq is 4 bytes long, MSB sent first. */ bytes[3] = ((int) freq >> 24) & 0xff; bytes[2] = ((int) freq >> 16) & 0xff; bytes[1] = ((int) freq >> 8) & 0xff; bytes[0] = (int) freq & 0xff; cmd_len = sprintf((char *) cmdbuf, "*%c%c%c%c%c" EOM, which_vfo(rig, vfo), bytes[3], bytes[2], bytes[1], bytes[0]); return tt538_transaction(rig, (char *) cmdbuf, cmd_len, NULL, NULL); } /* * tt538_get_mode * Assumes rig!=NULL, mode!=NULL */ int tt538_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { int cmd_len, resp_len, retval; unsigned char cmdbuf[16], respbuf[32]; char ttmode; /* Query mode */ cmd_len = sprintf((char *) cmdbuf, "?M" EOM); resp_len = 32; retval = tt538_transaction (rig, (char *) cmdbuf, cmd_len, (char *) respbuf, &resp_len); if (retval != RIG_OK) return retval; if (respbuf[0] != 'M' || resp_len != 4) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } switch (which_vfo(rig, vfo)) { case 'A': ttmode = respbuf[1]; break; case 'B': ttmode = respbuf[2]; break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %s\n", __FUNCTION__, rig_strvfo(vfo)); return -RIG_EINVAL; break; } switch (ttmode) { case TT538_AM: *mode = RIG_MODE_AM; break; case TT538_USB: *mode = RIG_MODE_USB; break; case TT538_LSB: *mode = RIG_MODE_LSB; break; case TT538_CW: *mode = RIG_MODE_CW; break; case TT538_FM: *mode = RIG_MODE_FM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode '%c'\n", __FUNCTION__, ttmode); return -RIG_EPROTO; } /* Query passband width (filter) */ cmd_len = sprintf((char *) cmdbuf, "?W" EOM); resp_len = 32; retval = tt538_transaction (rig, (char *) cmdbuf, cmd_len, (char *) respbuf, &resp_len); if (retval != RIG_OK) return retval; if (respbuf[0] != 'W' && resp_len != 3) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } switch (respbuf[1]) { case 0: *width = 8000; break; case 1: *width = 6000; break; case 2: *width = 5700; break; case 3: *width = 5400; break; case 4: *width = 5100; break; case 5: *width = 4800; break; case 6: *width = 4500; break; case 7: *width = 4200; break; case 8: *width = 3900; break; case 9: *width = 3600; break; case 10: *width = 3300; break; case 11: *width = 3000; break; case 12: *width = 2850; break; case 13: *width = 2700; break; case 14: *width = 2550; break; case 15: *width = 2400; break; case 16: *width = 2250; break; case 17: *width = 2100; break; case 18: *width = 1950; break; case 19: *width = 1800; break; case 20: *width = 1650; break; case 21: *width = 1500; break; case 22: *width = 1350; break; case 23: *width = 1200; break; case 24: *width = 1050; break; case 25: *width = 900; break; case 26: *width = 750; break; case 27: *width = 675; break; case 28: *width = 600; break; case 29: *width = 525; break; case 30: *width = 450; break; case 31: *width = 375; break; case 32: *width = 330; break; case 33: *width = 300; break; case 34: *width = 260; break; case 35: *width = 225; break; case 36: *width = 180; break; case 37: *width = 165; break; case 38: *width = 150; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unexpected bandwidth '%c'\n", __FUNCTION__, respbuf[1]); return -RIG_EPROTO; } return RIG_OK; } /* Find rx filter index of bandwidth the same or larger as requested. */ static int tt538_filter_number(int width) { int i; for (i = JUPITER_TT538_RXFILTERS - 1; i >= 0; i--) { if (width <= tt538_rxFilter[i]) { return i; } } return 0; /* Widest filter, 8 kHz. */ } /* * tt538_set_mode * Assumes rig!=NULL */ int tt538_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { unsigned char cmdbuf[32], respbuf[32], ttmode; int cmd_len, resp_len, retval; struct tt538_priv_data *priv = (struct tt538_priv_data *) rig->state.priv; /* Query mode for both VFOs. */ cmd_len = sprintf((char *) cmdbuf, "?M" EOM); resp_len = 32; retval = tt538_transaction (rig, (char *) cmdbuf, cmd_len, (char *) respbuf, &resp_len); if (retval != RIG_OK) return retval; if (respbuf[0] != 'M' || resp_len != 4) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } switch (mode) { case RIG_MODE_USB: ttmode = TT538_USB; break; case RIG_MODE_LSB: ttmode = TT538_LSB; break; case RIG_MODE_CW: ttmode = TT538_CW; break; case RIG_MODE_AM: ttmode = TT538_AM; break; case RIG_MODE_FM: ttmode = TT538_FM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %d\n", __FUNCTION__, mode); return -RIG_EINVAL; } /* Set mode for both VFOs. */ if (vfo == RIG_VFO_CURR) vfo = priv->vfo_curr; switch (vfo) { case RIG_VFO_A: cmd_len = sprintf((char *) cmdbuf, "*M%c%c" EOM, ttmode, respbuf[2]); break; case RIG_VFO_B: cmd_len = sprintf((char *) cmdbuf, "*M%c%c" EOM, respbuf[1], ttmode); break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %s\n", __FUNCTION__, rig_strvfo(vfo)); return -RIG_EINVAL; } retval = tt538_transaction (rig, (char *) cmdbuf, cmd_len, NULL, NULL); if (retval != RIG_OK) return retval; /* Set rx filter bandwidth. */ if (width == RIG_PASSBAND_NORMAL) width = tt538_filter_number(rig_passband_normal(rig, mode)); else width = tt538_filter_number((int) width); cmd_len = sprintf((char *) cmdbuf, "*W%c" EOM, (unsigned char) width); return tt538_transaction (rig, (char *) cmdbuf, cmd_len, NULL, NULL); } /* * tt538_get_level * Assumes rig!=NULL, val!=NULL */ int tt538_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { char sunits[6]; float fwd, refl, sstr; float ratio, swr; int retval, cmd_len, lvl_len; unsigned char cmdbuf[16],lvlbuf[32]; /* Optimize: * sort the switch cases with the most frequent first */ switch (level) { case RIG_LEVEL_SWR: /* Get forward power. */ lvl_len = 32; retval = tt538_transaction (rig, "?F" EOM, 3, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'F' || lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } fwd = (float) lvlbuf[1]; /* Get reflected power. */ lvl_len = 32; retval = tt538_transaction (rig, "?R" EOM, 3, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'R' || lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } refl = (float) lvlbuf[1]; ratio = refl / fwd; if (ratio > 0.9) swr = 10.0; /* practical maximum SWR, avoid div by 0 */ else swr = 1.0 / (1.0 - ratio); val->f = swr; break; case RIG_LEVEL_RAWSTR: retval = tt538_transaction (rig, "?S" EOM, 3, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'S' || lvl_len != 6) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } /* Jupiter returns actual S value in 1/100s of an S unit, but Hamlib wants an integer result. We return S units * 100 to maintain precision. */ sprintf(sunits, "%c%c.%c%c", lvlbuf[1], lvlbuf[2], lvlbuf[3], lvlbuf[4]); sscanf(sunits, "%f", &sstr); val->i = (int) (100 * sstr); break; case RIG_LEVEL_AGC: /* Read rig's AGC level setting. */ cmd_len = sprintf((char *) cmdbuf, "?G" EOM); lvl_len = 32; retval = tt538_transaction (rig, (char *) cmdbuf, cmd_len, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'G' || lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } switch(lvlbuf[1]&0xf) { /* Prog. Man. claims Jupiter returns '1', '2', and '3', but not so if AGC was set by program! So look at 2nd hex digit only. */ case 1: val->i=RIG_AGC_SLOW; break; case 2: val->i=RIG_AGC_MEDIUM; break; case 3: val->i=RIG_AGC_FAST; break; default: return -RIG_EPROTO; } break; case RIG_LEVEL_AF: /* Volume returned as single byte. */ cmd_len = sprintf((char *) cmdbuf, "?U" EOM); lvl_len = 32; retval = tt538_transaction (rig, (char *) cmdbuf, cmd_len, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'U' || lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = (float) lvlbuf[1] / 127; break; case RIG_LEVEL_RF: cmd_len = sprintf((char *) cmdbuf, "?I" EOM); lvl_len = 32; retval = tt538_transaction (rig, (char *) cmdbuf, cmd_len, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'I' || lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } /* Note: Any RF gain over "50%" on front panel returns 1.00 (firmware 1.281) on test rig. However RF set level seems OK. Firmware problem? -AA6E */ val->f = 1 - (float) lvlbuf[1] / 0xff; break; case RIG_LEVEL_ATT: cmd_len = sprintf((char *) cmdbuf, "?J" EOM); lvl_len = 32; retval = tt538_transaction (rig, (char *) cmdbuf, cmd_len, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'J' || lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->i = lvlbuf[1]; break; case RIG_LEVEL_SQL: cmd_len = sprintf((char *) cmdbuf, "?H" EOM); lvl_len = 32; retval = tt538_transaction (rig, (char *) cmdbuf, cmd_len, (char *) lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'H' || lvl_len != 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = ((float) lvlbuf[1] / 127); break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported level %d\n", __FUNCTION__, level); return -RIG_EINVAL; } return RIG_OK; } /* * tt538_set_level * Assumes rig!=NULL, val!=NULL */ int tt538_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { char cc, cmdbuf[32]; int cmd_len, retval; switch (level) { case RIG_LEVEL_AGC: switch(val.i) { case RIG_AGC_FAST: cc = '3'; break; case RIG_AGC_MEDIUM: cc = '2'; break; case RIG_AGC_SLOW: cc = '1'; break; default: cc = '2'; } cmd_len = sprintf(cmdbuf, "*G%c" EOM, cc); break; case RIG_LEVEL_AF: cmd_len = sprintf(cmdbuf, "*U%c" EOM, (int)(127 * val.f)); break; case RIG_LEVEL_RF: cmd_len = sprintf(cmdbuf, "*I%c" EOM, (int)(127 * val.f)); break; case RIG_LEVEL_ATT: if (val.i) cc = '1'; else cc = '0'; cmd_len = sprintf(cmdbuf, "*J%c" EOM, cc); break; case RIG_LEVEL_SQL: cmd_len = sprintf(cmdbuf, "*H%c" EOM, (int)(127 * val.f)); break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported level %d\n", __FUNCTION__, level); return -RIG_EINVAL; } retval = tt538_transaction (rig, cmdbuf, cmd_len, NULL,NULL); if (retval != RIG_OK) return retval; return RIG_OK; } hamlib-1.2.15.3/tentec/tt550.h0000644000175000017500000001323512044564477012453 00000000000000/* * Hamlib Tentec backend - main header * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _TT550_H #define _TT550_H 1 #include #include #define EOM "\015" /* CR */ #define TT_AM '0' #define TT_USB '1' #define TT_LSB '2' #define TT_CW '3' #define TT_FM '4' /* * Transmit and receive flags used by tt550_tuning_factor_calc * to modify behavior for transmit versus receive vfo's */ #define RECEIVE 0 #define TRANSMIT 1 /* * Transmitter control operations */ #define DISABLE_TX '0' #define ENABLE_TX '1' #define DISABLE_AMP '2' #define ENABLE_AMP '3' #define ENABLE_KEYER '6' #define DISABLE_KEYER '7' #define DISABLE_KEEPALIVE '8' #define ENABLE_KEEPALIVE '9' /* This is needed until we come up with a way to guarantee that the ** KEEPALIVE mechanism of the Pegasus is met. */ #define BYPASS_KEEPALIVE 1 #define KEY_F1_DOWN 0x11 #define KEY_F2_DOWN 0x12 #define KEY_F3_DOWN 0x13 #define KEY_F1_UP 0x91 #define KEY_F2_UP 0x92 #define KEY_F3_UP 0x93 struct tt550_priv_data { rmode_t tx_mode; /* transmitter mode - may be different from receiver in split mode */ rmode_t rx_mode; /* Current RX Mode */ freq_t tx_freq; /* tuned transmitter frequency - may be different from * 'freq' when in split mode */ freq_t rx_freq; /* Current RX Frequency */ shortfreq_t rit; /* Current RIT Value */ shortfreq_t xit; /* Current XIT Value */ shortfreq_t pbtadj; /* Current pass band tuning value */ pbwidth_t width; /* filter bandwidth in Hz */ pbwidth_t tx_width; /* transmit filter bandwidth in Hz */ int pb; /* RX passband offset in Hz 0 [0-10000] */ int cwbfo; /* BFO frequency: 700 [0-2000Hz] */ int tx_cwbfo; /* TX_BFO frequency: 700 [0-2000Hz] */ float lineout; /* line-out volume: 30 [0..63] */ float spkvol; /* speaker volume: 30 [0..63] */ int agc; /* AGC: medium */ float rflevel; /* RF Gain Level: [0..255] */ float sql; /* Squelch: [0..255] */ int att; /* Attenuator level [0..1] */ int keyspd; /* Keyer speed: [0..255] */ float nr; /* Noise reduction: [0..1] */ float autonotch; /* Autonotch filter: [0..1] */ float rfpower; /* RF Power: [0..255] */ float speechcomp; /* Speech compressor: [0..127] */ float voxgain; /* Vox Gain: [0..255] */ float voxdelay; /* Vox delay: [0..255] */ float antivox; /* AntiVox gain: [0..255] */ float mikegain; /* Microphone gain: [0..15] */ float bkindl; /* CW QSK level */ int split; /* split - ON/OFF */ shortfreq_t stepsize; /*current step size */ int anf; /* ANF on/off 1/0 */ int en_nr; /* Noise Reduction on/off 1/0 */ int tuner; /* automatic tuner on/off 1/0 */ int vox; /* VOX on/off 1/0 */ /* calculated by tt550_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 tt550_init (RIG * rig); int tt550_cleanup (RIG * rig); int tt550_trx_open (RIG * rig); int tt550_reset(RIG * rig, reset_t reset); int tt550_set_freq (RIG * rig, vfo_t vfo, freq_t freq); int tt550_get_freq (RIG * rig, vfo_t vfo, freq_t * freq); int tt550_set_mode (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int tt550_get_mode (RIG * rig, vfo_t vfo, rmode_t * mode, pbwidth_t * width); int tt550_set_level (RIG * rig, vfo_t vfo, setting_t level, value_t val); int tt550_get_level (RIG * rig, vfo_t vfo, setting_t level, value_t * val); int tt550_set_ptt (RIG * rig, vfo_t vfo, ptt_t ptt); int tt550_get_ptt (RIG * rig, vfo_t vfo, ptt_t * ptt); int tt550_decode_event (RIG * rig); const char *tt550_get_info (RIG * rig); int tt550_set_tx_freq (RIG * rig, vfo_t vfo, freq_t freq); int tt550_get_tx_freq (RIG * rig, vfo_t vfo, freq_t * freq); int tt550_set_rx_freq (RIG * rig, vfo_t vfo, freq_t freq); int tt550_get_rx_freq (RIG * rig, vfo_t vfo, freq_t * freq); int tt550_set_tx_mode (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int tt550_get_tx_mode (RIG * rig, vfo_t vfo, rmode_t * mode, pbwidth_t * width); int tt550_set_rx_mode (RIG * rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int tt550_get_rx_mode (RIG * rig, vfo_t vfo, rmode_t * mode, pbwidth_t * width); int tt550_get_split_vfo (RIG * rig, vfo_t vfo, split_t * split, vfo_t * tx_vfo); int tt550_set_split_vfo (RIG * rig, vfo_t vfo, split_t split, vfo_t tx_vfo); int tt550_get_tuning_step (RIG * rig, vfo_t vfo, shortfreq_t * stepsize); int tt550_set_tuning_step (RIG * rig, vfo_t vfo, shortfreq_t stepsize); int tt550_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int tt550_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); int tt550_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); int tt550_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit); int tt550_get_rit(RIG *rig, vfo_t vfo, shortfreq_t * rit); int tt550_set_xit(RIG * rig, vfo_t vfo, shortfreq_t rit); int tt550_get_xit(RIG *rig, vfo_t vfo, shortfreq_t * rit); #endif /* _TT550_H */ hamlib-1.2.15.3/tentec/tentec2.h0000644000175000017500000000342412044564477013135 00000000000000/* * Hamlib Tentec backend - Argonaut, Jupiter, RX-350 header * Copyright (c) 2001-2003 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _TENTEC2_H #define _TENTEC2_H 1 #include /* * Mem caps to be checked.. */ #define TT_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .tx_freq = 1, \ .tx_mode = 1, \ .tx_width = 1, \ .split = 1, \ } int tentec2_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int tentec2_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int tentec2_set_vfo(RIG *rig, vfo_t vfo); int tentec2_get_vfo(RIG *rig, vfo_t *vfo); int tentec2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int tentec2_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int tentec2_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); int tentec2_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); int tentec2_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); int tentec2_reset(RIG *rig, reset_t reset); const char* tentec2_get_info(RIG *rig); #endif /* _TENTEC2_H */ hamlib-1.2.15.3/tentec/orion.c0000644000175000017500000014535512044564477012724 00000000000000/* * Hamlib TenTenc backend - TT-565 description * Copyright (c) 2004-2011 by Martin Ewing * Copyright (c) 2004-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* Edits by Martin Ewing AA6E, 23 Mar 2005 --> ?? * Added valid length settings before tentec_transaction calls. * Added vfo_curr initialization to VFO A * Fixed up VSWR & S-meter, set ATT, set AGC, add rough STR_CAL func. * Use local tt565_transaction due to quirky serial interface * Variable-length transaction read ok. * Calibrated S-meter response with signal generator. * Read re-tries implemented. * Added RIG_LEVEL_CWPITCH, RIG_LEVEL_KEYSPD, send_morse() * Added RIG_FUNC_TUNER, RIG_FUNC_LOCK and RIG_FUNC_VOX, fixed MEM_CAP. * Added VFO_OPS * Support LEVEL_VOX, VOXGAIN, ANTIVOX * Support LEVEL_NR as Orion NB setting (firmware bug), FUNC_NB -> NB=0,4 * Add get_, set_ant (ignores rx only ant) * Use binary mode for VFO read / write, for speed. * November, 2007: * Add RIG_LEVEL_STRENGTH capability (should have been there all along) * Implement auto-detect of firmware for S-meter cal, etc. * Fixed bug in tt565_reset (to send "XX" instead of "X") * Filtered rig info string to ensure all graphics. * Big reliability improvement (for fldigi, v 2.062a) 2/15/2008 * Jan., 2009: * Remove RIG_LEVEL_STRENGTH, so that frontend can handle it. * Dec., 2011: Implement VFO range checking. Adjust range_lists for max coverage. * Fix tt565_transaction for case of Morse (/) command. */ /* Known issues & to-do list: * Memory channels - emulate a more complete memory system? * Send_Morse() - needs to buffer more than 20 chars? * Figure out "granularities". * XCHG or other "fancy" VFO & MEM operations? */ /** * \addtogroup tentec_orion * @{ */ /** * \file orion.c * \brief Backend for Tentec Orion 565 / 566 * * This backend supports the Ten-Tec Orion (565) and Orion II (566) transceivers. * \n This backend tested mostly with firmware versions 1.372 and 2.062a */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include #include "bandplan.h" #include "serial.h" #include "misc.h" #include "idx_builtin.h" #include "orion.h" #include #ifdef TT565_TIME /** * \returns current time in secs/microsecs */ double tt565_timenow() /* returns current time in secs+microsecs */ { struct timeval tv; gettimeofday(&tv, NULL); return (double)tv.tv_sec + ((double)tv.tv_usec)/1.0e+6; } #endif /** * \param rig Rig descriptor * \param cmd command to send * \param cmd_len length of command string * \param data string to receive return data from Orion (NULL if no return desired) * \param data_len length of data string * \returns RIG_OK or < 0 if error * \brief tt565_transaction, adapted from tentec_transaction (tentec.c) * * This is the basic I/O transaction to/from the Orion. * \n Read variable number of bytes, up to buffer size, if data & data_len != NULL. * \n We assume that rig!=NULL, rig->state!= NULL. * Otherwise, you'll get a nice seg fault. You've been warned! */ static int tt565_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval, data_len_init, itry; struct rig_state *rs; static int passcount=0; #ifdef TT565_TIME double ft1, ft2; #endif passcount++; // for debugging /* Capture buffer length for possible read re-try. */ data_len_init = (data && data_len) ? *data_len : 0; /* Allow transaction re-tries according to capabilities. */ for (itry=0; itry < rig->caps->retry; itry++) { 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) { /* If it's not a 'write' to rig or a Morse command, there must be data. */ if ((*cmd != '*') && (*cmd != '/')) { rig_debug(RIG_DEBUG_ERR,"cmd reject 1\n"); return -RIG_ERJCTED; } return RIG_OK; /* normal exit if write, but no read */ } #ifdef TT565_TIME ft1 = tt565_timenow(); #endif *data_len = data_len_init; /* restore orig. buffer length */ *data_len = read_string(&rs->rigport, data, *data_len, EOM, strlen(EOM)); if (!strncmp(data,"Z!",2)) { // command unrecognized?? rig_debug(RIG_DEBUG_ERR,"cmd reject 2\n"); return -RIG_ERJCTED; // what is a better error return? } /* XX and ?V are oddball commands. Thanks, Ten-Tec! */ if (!strncmp(cmd,"XX",2)) { // Was it a firmware reset cmd? return RIG_OK; // Then we accept the response. } if (!strncmp(cmd,"?V",2)) { // Was it a read firmware version cmd? return RIG_OK; // ditto } if (cmd[0] != '?') { // was this a read cmd? rig_debug(RIG_DEBUG_ERR,"cmd reject 3\n"); return -RIG_ERJCTED; // No, but it should have been! } else { // Yes, it was a 'read', phew! if (!strncmp(data+1,cmd+1,cmd_len-2)) { //reponse matches cmd? return RIG_OK; // all is well, normal exit } else { /* The command read back does not match the command that was written. We report the problem if debugging, and issue another read in hopes of eventual success. */ rig_debug(RIG_DEBUG_WARN, "** retry after delay (io=%d, retry=%d) **\n", passcount, itry); *data_len = data_len_init; /* restore orig. buffer length */ read_string(&rs->rigport, data, *data_len, EOM, strlen(EOM)); // purge the input stream... continue; // now go retry the full command } } #ifdef TT565_TIME ft2 = tt565_timenow(); if (*data_len == -RIG_ETIMEOUT) rig_debug(RIG_DEBUG_ERR,"Timeout %d: Elapsed = %f secs.\n", itry, ft2-ft1); else rig_debug(RIG_DEBUG_ERR, "Other Error #%d, itry=%d: Elapsed = %f secs.\n", *data_len, itry, ft2-ft1); #endif } /* end of itry loop */ rig_debug(RIG_DEBUG_ERR,"** Ran out of retries io=%d **\n", passcount); return -RIG_ETIMEOUT; } /** * \param rig * \returns RIG_OK or < 0 * \brief Basically, it just sets up *priv */ int tt565_init(RIG *rig) { struct tt565_priv_data *priv; priv = (struct tt565_priv_data*)malloc(sizeof(struct tt565_priv_data)); if (!priv) { return -RIG_ENOMEM; } /* no memory available */ memset(priv, 0, sizeof(struct tt565_priv_data)); priv->ch = 0; /* set arbitrary initial status */ priv->vfo_curr = RIG_VFO_A; rig->state.priv = (rig_ptr_t)priv; return RIG_OK; } /** * \param rig * \brief tt565_cleanup routine * * the serial port is closed by the frontend */ int tt565_cleanup(RIG *rig) { if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /** * \param rig * \brief tt565_open routine * * Open the rig - check f * This backend supports the Ten-Tec Orion (565) and Orion II (566) transceivers. irmware version issues */ int tt565_open(RIG *rig) { cal_table_t cal1 = TT565_STR_CAL_V1, cal2 = TT565_STR_CAL_V2; char *buf; /* Detect version 1 or version 2 firmware. V2 is default. */ /* The only difference for us is the S-meter cal table */ /* Get Orion's Version string (?V command response) */ buf = (char *)tt565_get_info(rig); /* Is Orion firmware version 1.* or 2.*? */ if (!strstr(buf, "1.")) { /* Not v1 means probably v2 */ memcpy(&rig->state.str_cal, &cal2, sizeof(cal_table_t)); } else { memcpy(&rig->state.str_cal, &cal1, sizeof(cal_table_t)); } return RIG_OK; } /** * \param rig * \param vfo RIG_VFO_MAIN or RIG_VFO_SUB * \returns 'M' or 'S' for main or subreceiver or <0 error * \brief vfo must be RIG_VFO_MAIN or RIG_VFO_SUB * * Note that Orion's "VFO"s are supposed to be logically independent * of the main/sub receiver selection. (In reality, they are not quite * independent.) */ static char which_receiver(const RIG *rig, vfo_t vfo) { struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) vfo = priv->vfo_curr; switch (vfo) { case RIG_VFO_A: case RIG_VFO_B: case RIG_VFO_MAIN: return 'M'; case RIG_VFO_SUB: return 'S'; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported Receiver %s\n", __FUNCTION__, rig_strvfo(vfo)); return -RIG_EINVAL; } } /** * \param rig * \param vfo RIG_VFO_A, RIG_VFO_B, or RIG_VFO_NONE * \returns 'A' or 'B' or 'N' for VFO A, B, or null VFO, or <0 error * \brief vfo must be RIG_VFO_A, RIG_VFO_B, or RIG_VFO_NONE. */ static char which_vfo(const RIG *rig, vfo_t vfo) { struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) vfo = priv->vfo_curr; switch (vfo) { case RIG_VFO_A: return 'A'; case RIG_VFO_B: return 'B'; case RIG_VFO_NONE: return 'N'; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported VFO %s\n", __FUNCTION__, rig_strvfo(vfo)); return -RIG_EINVAL; } } /** * \param rig must != NULL * \param vfo RIG_VFO_A or RIG_VFO_B * \param freq * \brief Set a frequence into the specified VFO * * assumes rig->state.priv!=NULL * \n assumes priv->mode in AM,CW,LSB or USB. */ int tt565_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { int cmd_len, retval, i, in_range; freq_range_t this_range; char cmdbuf[TT565_BUFSIZE]; /* Check for valid frequency request. * Find freq range that includes current request and * matches the VFO A/B setting. c.f. rig_get_range(). * Recall VFOA = ham only, VFOB = gen coverage for Hamlib. * (We assume VFOA = Main RXTX and VFOB = Sub RX.) * If outside range, return RIG_ERJECTED for compatibility vs icom.c etc. */ in_range = FALSE; for (i=0; istate.rx_range_list[i]; if (this_range.start == 0 && this_range.end == 0) { break; /* have come to early end of range list */ } /* We don't care about mode setting, but vfo must match. */ if (freq >= this_range.start && freq <= this_range.end && ( this_range.vfo == rig->state.current_vfo )) { in_range = TRUE; break; } } if(!in_range) return -RIG_ERJCTED; /* Sorry, invalid freq request */ #ifdef TT565_ASCII_FREQ /* Use ASCII mode to set frequencies */ cmd_len = sprintf (cmdbuf, "*%cF%"PRIll EOM, which_vfo(rig, vfo), (int64_t)freq); #else /* Use binary mode */ /* Set frequency using Orion's binary mode (short) sequence. The short sequence transfers faster and may require less Orion firmware effort, but some bugs are reported. */ /* Construct command packet by brute force. */ unsigned int myfreq; myfreq = freq; cmd_len = 7; cmdbuf[0] = '*'; cmdbuf[1] = which_vfo(rig,vfo); cmdbuf[2] = (myfreq & 0xff000000) >> 24; cmdbuf[3] = (myfreq & 0x00ff0000) >> 16; cmdbuf[4] = (myfreq & 0x0000ff00) >> 8; cmdbuf[5] = myfreq & 0x000000ff; cmdbuf[6] = '\r'; /* i.e. EOM */ #endif retval = tt565_transaction (rig, cmdbuf, cmd_len, NULL, NULL); return retval; } /** * \param rig must != NULL * \param vfo RIG_VFO_A or RIG_VFO_B * \param freq must != NULL * \brief Get the frequency currently set in the specified VFO (A or B) * * Performs query on physical rig */ int tt565_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { int cmd_len, resp_len, retval; char cmdbuf[TT565_BUFSIZE], respbuf[TT565_BUFSIZE]; unsigned int binf; #ifdef TT565_ASCII_FREQ /* use ASCII mode */ cmd_len = sprintf(cmdbuf, "?%cF" EOM, which_vfo(rig, vfo)); #else /* Get freq with Orion binary mode short sequence. */ cmd_len = sprintf(cmdbuf, "?%c" EOM, which_vfo(rig, vfo)); #endif resp_len = sizeof(respbuf); retval = tt565_transaction (rig, cmdbuf, cmd_len, respbuf, &resp_len); if (retval != RIG_OK) return retval; #ifdef TT565_ASCII_FREQ respbuf[12] = '\0'; sscanf(respbuf+3,"%8u",&binf); *freq = (freq_t) binf; #else /* Test for valid binary mode return. */ if (respbuf[1] != which_vfo(rig,vfo) || resp_len <= 5) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } /* Convert binary to integer, endedness independent */ binf = (unsigned char)respbuf[2]<<24 | (unsigned char)respbuf[3]<<16 | (unsigned char)respbuf[4]<<8 | (unsigned char)respbuf[5]; *freq = (freq_t) binf; #endif return RIG_OK; } /** * \param rig must != NULL * \param vfo RIG_VFO_MAIN or RIG_VFO_SUB * \returns RIG_OK or < 0 * \brief set RIG_VFO_CURR and send info to physical rig. * * Places Orion into Main or Sub Rx active state */ int tt565_set_vfo(RIG *rig, vfo_t vfo) { struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv; int vfo_len; char vfobuf[TT565_BUFSIZE]; if (vfo == RIG_VFO_CURR) return RIG_OK; if (vfo == RIG_VFO_MAIN || vfo == RIG_VFO_SUB) { /* Select Sub or Main RX */ vfo_len = sprintf (vfobuf, "*K%c" EOM, vfo == RIG_VFO_SUB ? 'S' : 'M'); return tt565_transaction (rig, vfobuf, vfo_len, NULL, NULL); } priv->vfo_curr = vfo; return RIG_OK; } /** * \param rig must != NULL * \param vfo Set = stored state of current VFO state * \returns RIG_OK */ int tt565_get_vfo(RIG *rig, vfo_t *vfo) { struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv; *vfo = priv->vfo_curr; return RIG_OK; } /** * \param rig must != NULL * \param vfo Rx vfo specifier token * \param split (ignored - why?) * \param tx_vfo Tx vfo specifier token * \returns RIG_OK or < 0 * \brief Set split operating mode * * Sets Main Rx to "vfo"( A or B) , Main Tx to "tx_vfo" (A, B, or N). * \n Sub Rx is set to "None". That should be fixed! */ int tt565_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { int cmd_len, retval; char cmdbuf[TT565_BUFSIZE]; cmd_len = sprintf (cmdbuf, "*KV%c%c%c" EOM, which_vfo(rig, vfo), 'N', /* FIXME */ which_vfo(rig, tx_vfo)); retval = tt565_transaction (rig, cmdbuf, cmd_len, NULL, NULL); return retval; } /** * \param c * \returns RIG_VFO_x, x= A, B, or NONE * \brief Translate an Orion command character to internal token form. */ static vfo_t tt2vfo(char c) { switch(c) { case 'A': return RIG_VFO_A; case 'B': return RIG_VFO_B; case 'N': return RIG_VFO_NONE; } return RIG_VFO_NONE; } /** * \param rig must != NULL * \param vfo * \param split Returned with RIG_SPLIT_ON if Tx <> Rx vfo, .._OFF otherwise * \param tx_vfo Returned RIG_VFO_x, signifying selected Tx vfo * \returns RIG_OK or < 0 * \brief Get the current split status and Tx vfo selection. */ int tt565_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { int cmd_len, resp_len, retval; char cmdbuf[TT565_BUFSIZE], respbuf[TT565_BUFSIZE]; char ttreceiver; cmd_len = sprintf(cmdbuf, "?KV" EOM); resp_len = sizeof(respbuf); retval = tt565_transaction (rig, cmdbuf, cmd_len, respbuf, &resp_len); if (retval != RIG_OK) return retval; if (respbuf[2] != 'V' || resp_len < 5) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } ttreceiver = vfo == RIG_VFO_SUB ? respbuf[3] : respbuf[4]; *tx_vfo = tt2vfo(respbuf[5]); *split = ttreceiver == respbuf[5] ? RIG_SPLIT_OFF : RIG_SPLIT_ON; return RIG_OK; } /** * \param rig must != NULL * \param vfo * \param mode * \param width passband in Hz or = RIG_PASSBAND_NORMAL (=0) which gives a nominal value * \brief Set operating mode to RIG_MODE_x with indicated passband width. * * Supported modes x= USB, LSB, CW, CWR, AM, FM, RTTY * \n This applies to currently selected receiver (Main Rx=Tx or Sub Rx) * \sa tt565_set_vfo * * \remarks Note widespread confusion between "VFO" and "Receiver". The Orion * has VFOs A and B which may be mapped to Main and Sub Receivers independently. * But Hamlib may have different ideas! */ int tt565_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct rig_state *rs = &rig->state; char ttmode, ttreceiver; int mdbuf_len, retval; char mdbuf[TT565_BUFSIZE]; switch (mode) { case RIG_MODE_USB: ttmode = TT565_USB; break; case RIG_MODE_LSB: ttmode = TT565_LSB; break; case RIG_MODE_CW: ttmode = TT565_CW; break; case RIG_MODE_CWR: ttmode = TT565_CWR; break; case RIG_MODE_AM: ttmode = TT565_AM; break; case RIG_MODE_FM: ttmode = TT565_FM; break; case RIG_MODE_RTTY: ttmode = TT565_RTTY; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %d\n", __FUNCTION__, mode); return -RIG_EINVAL; } if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); ttreceiver = which_receiver(rig, vfo); mdbuf_len = sprintf(mdbuf, "*R%cM%c" EOM "*R%cF%d" EOM, ttreceiver, ttmode, ttreceiver, (int)width ); retval = write_block(&rs->rigport, mdbuf, mdbuf_len); return retval; } /** * \param rig must != NULL * \param vfo * \param mode Receives current mode setting, must be != NULL * \param width Receives current bandwidth setting, must be != NULL * \returns RIG_OK or < 0 * \brief Get op. mode and bandwidth for selected vfo * * \remarks Confusion of VFO and Main/Sub TRx/Rx. See tt565_set_mode. */ int tt565_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { int cmd_len, resp_len, retval; char cmdbuf[TT565_BUFSIZE], respbuf[TT565_BUFSIZE]; char ttmode, ttreceiver; ttreceiver = which_receiver(rig, vfo); /* Query mode */ cmd_len = sprintf(cmdbuf, "?R%cM" EOM, ttreceiver); resp_len = sizeof(respbuf); retval = tt565_transaction (rig, cmdbuf, cmd_len, respbuf, &resp_len); if (retval != RIG_OK) return retval; if (respbuf[1] != 'R' || respbuf[3] != 'M' || resp_len <= 4) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } ttmode = respbuf[4]; switch (ttmode) { case TT565_USB: *mode = RIG_MODE_USB; break; case TT565_LSB: *mode = RIG_MODE_LSB; break; case TT565_CW: *mode = RIG_MODE_CW; break; case TT565_CWR: *mode = RIG_MODE_CWR; break; case TT565_AM: *mode = RIG_MODE_AM; break; case TT565_FM: *mode = RIG_MODE_FM; break; case TT565_RTTY: *mode = RIG_MODE_RTTY; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode '%c'\n", __FUNCTION__, ttmode); return -RIG_EPROTO; } /* Orion may need some time to "recover" from ?RxM before ?RxF */ usleep(80000); // try 80 ms /* Query passband width (filter) */ cmd_len = sprintf(cmdbuf, "?R%cF" EOM, ttreceiver); resp_len = sizeof(respbuf); retval = tt565_transaction (rig, cmdbuf, cmd_len, respbuf, &resp_len); if (retval != RIG_OK) return retval; if (respbuf[1] != 'R' || respbuf[3] != 'F' || resp_len <= 4) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } *width = atoi(respbuf+4); return RIG_OK; } /** * \param rig must != NULL * \param vfo * \param ts Tuning Step, Hz * \returns RIG_OK or < 0 * \brief Set Tuning Step for VFO A or B. */ int tt565_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) { int cmd_len, retval; char cmdbuf[TT565_BUFSIZE]; cmd_len = sprintf(cmdbuf, "*R%cI%d" EOM, which_receiver(rig, vfo), (int)ts); retval = tt565_transaction (rig, cmdbuf, cmd_len, NULL, NULL); return retval; } /** * \param rig must != NULL * \param vfo * \param ts Receives Tuning Step, Hz * \returns RIG_OK or < 0 * \brief Get Tuning Step for VFO A or B. */ int tt565_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) { int cmd_len, resp_len, retval; char cmdbuf[TT565_BUFSIZE], respbuf[TT565_BUFSIZE]; cmd_len = sprintf(cmdbuf, "?R%cI" EOM, which_receiver(rig, vfo)); resp_len = sizeof(respbuf); retval = tt565_transaction (rig, cmdbuf, cmd_len, respbuf, &resp_len); if (retval != RIG_OK) return retval; if (respbuf[1] != 'R' || respbuf[3] != 'I' || resp_len <= 4) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } *ts = atoi(respbuf+4); return RIG_OK; } /** * \param rig must != NULL * \param vfo * \param rit Rx incremental tuning, Hz * \returns RIG_OK or < 0 * \brief Set Rx incremental tuning * Note: command rit != 0 ==> rit "on"; rit == 0 ==> rit "off" */ int tt565_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { int cmd_len, retval; char cmdbuf[TT565_BUFSIZE]; cmd_len = sprintf(cmdbuf, "*R%cR%d" EOM, which_receiver(rig, vfo), (int)rit); retval = tt565_transaction (rig, cmdbuf, cmd_len, NULL, NULL); return retval; } /** * \param rig must != NULL * \param vfo * \param rit Receives Rx incremental tuning, Hz * \returns RIG_OK or < 0 * \brief Get Rx incremental tuning */ int tt565_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { int cmd_len, resp_len, retval; char cmdbuf[TT565_BUFSIZE], respbuf[TT565_BUFSIZE]; cmd_len = sprintf(cmdbuf, "?R%cR" EOM, which_receiver(rig, vfo)); resp_len = sizeof(respbuf); retval = tt565_transaction (rig, cmdbuf, cmd_len, respbuf, &resp_len); if (retval != RIG_OK) return retval; if (respbuf[1] != 'R' || respbuf[3] != 'R' || resp_len <= 4) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } *rit = atoi(respbuf+4); return RIG_OK; } /** * \param rig must != NULL * \param vfo * \param xit Tx incremental tuning, Hz * \returns RIG_OK or < 0 * \brief Set Tx incremental tuning (Main TRx only) * Note: command xit != 0 ==> xit "on"; xit == 0 ==> xit "off" */ int tt565_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit) { int cmd_len, retval; char cmdbuf[TT565_BUFSIZE]; /* Sub receiver does not contain an XIT setting */ cmd_len = sprintf(cmdbuf, "*R%cX%d" EOM, 'M', (int)xit); retval = tt565_transaction (rig, cmdbuf, cmd_len, NULL, NULL); return retval; } /** * \param rig must != NULL * \param vfo * \param xit Receives Tx incremental tuning, Hz * \returns RIG_OK or < 0 * \brief Get Tx incremental tuning (Main TRx only) */ int tt565_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit) { int cmd_len, resp_len, retval; char cmdbuf[TT565_BUFSIZE], respbuf[TT565_BUFSIZE]; cmd_len = sprintf(cmdbuf, "?R%cX" EOM, 'M'); resp_len = sizeof(respbuf); retval = tt565_transaction (rig, cmdbuf, cmd_len, respbuf, &resp_len); if (retval != RIG_OK) return retval; if (respbuf[1] != 'R' || respbuf[3] != 'X' || resp_len <= 4) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } *xit = atoi(respbuf+4); return RIG_OK; } /** * \param rig must != NULL * \param vfo * \param ptt RIG_PTT_ON or RIG_PTT_OFF * \returns RIG_OK or < 0 * \brief Set push to talk (Tx on/off) */ int tt565_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { struct rig_state *rs = &rig->state; return write_block(&rs->rigport, ptt==RIG_PTT_ON ? "*TK" EOM:"*TU" EOM, 4); } /** * \param rig must != NULL * \param vfo * \param ptt Receives RIG_PTT_ON or RIG_PTT_OFF * \returns RIG_OK or < 0 * \brief Get push to talk (Tx on/off) */ int tt565_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { int resp_len, retval; char respbuf[TT565_BUFSIZE]; resp_len = sizeof(respbuf); retval = tt565_transaction (rig, "?S" EOM, 3, respbuf, &resp_len); if (retval != RIG_OK) return retval; if (respbuf[1] != 'S' || resp_len < 5) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } *ptt = respbuf[2]=='T' ? RIG_PTT_ON : RIG_PTT_OFF ; return RIG_OK; } /** * \param rig must != NULL * \param reset (not used) * \returns RIG_OK or < 0 * \brief Restart Orion firmware * * Sends an "X" command and listens for reply = "ORION START". This only * seems to test for healthy connection to the firmware. There is no effect * on Orion's state, AFAIK. */ int tt565_reset(RIG *rig, reset_t reset) { int retval, reset_len; char reset_buf[TT565_BUFSIZE]; if (reset == RIG_RESET_NONE) return RIG_OK; /* No operation requested. */ reset_len = sizeof(reset_buf); retval = tt565_transaction (rig, "XX" EOM, 3, reset_buf, &reset_len); if (retval != RIG_OK) return retval; if (!strstr(reset_buf, "ORION START")) { rig_debug(RIG_DEBUG_ERR, "%s: unexpected answer '%s'\n", __FUNCTION__, reset_buf); return -RIG_EPROTO; } return RIG_OK; } /** * \param rig must != NULL * \returns firmware identification string or NULL * \brief Get firmware identification, e.g., "Version 1.372" * * Re-entrancy issue (what else is new?) */ const char *tt565_get_info(RIG *rig) { static char buf[TT565_BUFSIZE]; /* FIXME: reentrancy */ int firmware_len, retval, i; firmware_len = sizeof(buf); retval = tt565_transaction (rig, "?V" EOM, 3, buf, &firmware_len); if (retval != RIG_OK || firmware_len < 8) { rig_debug(RIG_DEBUG_ERR,"%s: ack NG, len=%d\n", __FUNCTION__, firmware_len); buf[0] = '\0'; return buf; } buf[firmware_len] = '\0'; /* filter out any non-graphic characters */ for (i=0; i < strlen(buf); i++) if (!isgraph(buf[i])) buf[i] = ' '; // bad chars -> spaces return buf; } /** * \param rig must != NULL * \param vfo * \param level A level id token, e.g. RIG_LEVEL_AF * \param val Value for the level, on a scale or via a token * \returns RIG_OK or < 0 * \brief Sets any of Orion's "Level" adjustments * * Unfortunately, "val" type is not well defined. Sometimes it is a float (AF gain), * an integer (RF Atten.), or an enum (RIG_AGC_FAST)... * * Supported Levels and Units * \n -RIG_LEVEL_RFPOWER, float 0.0 - 1.0 * \n -RIG_LEVEL_AGC, int RIG_AGC_x, x= OFF, FAST, MEDIUM, SLOW, USER * \n -RIG_LEVEL_AF, float 0.0 - 1.0 * \n -RIG_LEVEL_IF, passband tuning, int Hz * \n -RIG_LEVEL_RF, IF gain (!), float 0.0 - 1.0 * \n -RIG_LEVEL_ATT, Atten. setting, int dB (we pick 0, 6, 12, or 18 dB) * \n -RIG_LEVEL_PREAMP, Preamp on/off, 0-1 (main Rx only) * \n -RIG_LEVEL_SQL, squelch, float 0.0 - 1.0 * \n -RIG_LEVEL_MICGAIN, float 0.0 - 1.0 * \n -RIG_LEVEL_COMP, speech compression, float 0.0 - 1.0 * \n -RIG_LEVEL_CWPITCH, int Hz * \n -RIG_LEVEL_KEYSPD, int wpm * \n -RIG_LEVEL_NR, noise reduction/blank, float 0.0 - 1.0 * \n -RIG_LEVEL_VOX, vox delay, float x 1/10 second * \n -RIG_LEVEL_VOXGAIN, float 0.0 - 1.0 * \n -RIG_LEVEL_ANTIVOX, float 0.0 - 1.0 * * \n FIXME: cannot support PREAMP and ATT both at same time (make sens though) */ int tt565_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { int retval, cmd_len=0, ii; char cmdbuf[TT565_BUFSIZE], cc; switch (level) { case RIG_LEVEL_RFPOWER: cmd_len = sprintf(cmdbuf, "*TP%d" EOM, (int)(val.f*100)); break; case RIG_LEVEL_AGC: switch(val.i) { case RIG_AGC_OFF: cc = 'O'; break; case RIG_AGC_FAST: cc = 'F'; break; case RIG_AGC_MEDIUM: cc = 'M'; break; case RIG_AGC_SLOW: cc = 'S'; break; case RIG_AGC_USER: cc = 'P'; break; default: cc = 'M'; } cmd_len = sprintf(cmdbuf, "*R%cA%c" EOM, which_receiver(rig, vfo), cc); break; case RIG_LEVEL_AF: /* AF Gain, float 0.0 - 1.0 */ cmd_len = sprintf(cmdbuf, "*U%c%d" EOM, which_receiver(rig, vfo), (int)(val.f*255)); break; case RIG_LEVEL_IF: /* This is passband tuning int Hz */ cmd_len = sprintf(cmdbuf, "*R%cP%d" EOM, which_receiver(rig, vfo), val.i); break; case RIG_LEVEL_RF: /* This is IF Gain, float 0.0 - 1.0 */ cmd_len = sprintf(cmdbuf, "*R%cG%d" EOM, which_receiver(rig, vfo), (int)(val.f*100)); break; case RIG_LEVEL_ATT: /* RF Attenuator, int dB */ ii = -1; /* Request 0-5 dB -> 0, 6-11 dB -> 6, etc. */ while ( rig->caps->attenuator[++ii] != RIG_DBLST_END ) { if (rig->caps->attenuator[ii] > val.i) break; } cmd_len = sprintf(cmdbuf, "*R%cT%d" EOM, which_receiver(rig, vfo), ii); break; case RIG_LEVEL_PREAMP: /* Sub receiver does not contain a Preamp */ if (which_receiver(rig, vfo) == 'S') { return -RIG_EINVAL; } /* RF Preamp (main Rx), int 0 or 1 */ cmd_len = sprintf(cmdbuf, "*RME%d" EOM, val.i==0 ? 0 : 1); break; case RIG_LEVEL_SQL: /* Squelch level, float 0.0 - 1.0 */ cmd_len = sprintf(cmdbuf, "*R%cS%d" EOM, which_receiver(rig, vfo), (int)((val.f*127)-127)); break; case RIG_LEVEL_MICGAIN: /* Mic gain, float 0.0 - 1.0 */ cmd_len = sprintf(cmdbuf, "*TM%d" EOM, (int)(val.f*100)); break; case RIG_LEVEL_COMP: /* Speech Processor, float 0.0 - 1.0 */ cmd_len = sprintf(cmdbuf, "*TS%d" EOM, (int)(val.f*9)); break; case RIG_LEVEL_CWPITCH: /* "CWPITCH" is the "Tone" button on the Orion. Manual menu adjustment works down to 100 Hz, but not via computer. int Hz. */ if (val.i > TT565_TONE_MAX) val.i = TT565_TONE_MAX; else if (val.i < TT565_TONE_MIN) val.i = TT565_TONE_MIN; cmd_len = sprintf(cmdbuf, "*CT%d" EOM, val.i); break; case RIG_LEVEL_KEYSPD: /* Keyer speed setting does not imply Keyer = "on". That is a command which should be a hamlib function, but is not. Keyer speed determines the rate of computer sent CW also. */ if (val.i > TT565_CW_MAX) val.i = TT565_CW_MAX; else if (val.i < TT565_CW_MIN) val.i = TT565_CW_MIN; cmd_len = sprintf(cmdbuf, "*CS%d" EOM, val.i); break; case RIG_LEVEL_NR: /* Noise Reduction (blanking) Float 0.0 - 1.0 For some reason NB setting is supported in 1.372, but NR, NOTCH, and AN are not. FOR NOW -- RIG_LEVEL_NR controls the Orion NB setting */ cmd_len = sprintf(cmdbuf, "*R%cNB%d" EOM, which_receiver(rig, vfo), (int)(val.f*9)); break; case RIG_LEVEL_VOX: /* VOX delay, float tenths of seconds */ cmd_len = sprintf(cmdbuf, "*TH%4.2f" EOM, 0.1*val.f); break; case RIG_LEVEL_VOXGAIN: /* Float, 0.0 - 1.0 */ cmd_len = sprintf(cmdbuf, "*TG%d" EOM, (int)(100.0*val.f)); break; case RIG_LEVEL_ANTIVOX: /* Float, 0.0 - 1.0 */ cmd_len = sprintf(cmdbuf, "*TA%d" EOM, (int)(100.0*val.f)); break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported level %d\n", __FUNCTION__, level); return -RIG_EINVAL; } retval = tt565_transaction (rig, cmdbuf, cmd_len, NULL,NULL); return retval; } /** * \param rig must be != NULL * \param vfo * \param level identifier for level of interest * \param val Receives level's value, must != NULL * \brief Get the current value of an Orion "level" * * \sa tt565_get_level * Supported rx levels: * \n -RIG_LEVEL_SWR * \n -RIG_LEVEL_RAWSTR, int raw rx signal strength (rig units) * \n -RIG_LEVEL_RFPOWER * \n -RIG_LEVEL_AGC * \n -RIG_LEVEL_AF * \n -RIG_LEVEL_IF * \n -RIG_LEVEL_RF * \n -RIG_LEVEL_ATT * \n -RIG_LEVEL_PREAMP * \n -RIG_LEVEL_SQL * \n -RIG_LEVEL_MICGAIN * \n -RIG_LEVEL_COMP * \n -RIG_LEVEL_CWPITCH * \n -RIG_LEVEL_KEYSPED * \n -RIG_LEVEL_NR * \n -RIG_LEVEL_VOX * \n -RIG_LEVEL_VOXGAIN * \n -RIG_LEVEL_ANTIVOX * * (RIG_LEVEL_STRENGTH, int calibrated signal strength (dB, S9 = 0) is * handled in settings.c) */ int tt565_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int retval, cmd_len, lvl_len; char cmdbuf[TT565_BUFSIZE],lvlbuf[TT565_BUFSIZE]; /* Optimize: sort the switch cases with the most frequent first */ switch (level) { case RIG_LEVEL_SWR: lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, "?S" EOM, 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; /* in Xmit, response is @STFuuuRvvvSwww (or ...Swwww) uuu = 000-100 (apx) fwd watts vvv = 000-100 rev watts www = 256-999 256 * VSWR in Rcv, response is @SRMuuuSvvv uuu = 000-100 (apx) Main S meter vvv = 000-100 (apx) Sub S meter */ if (lvlbuf[1] != 'S' || lvl_len < 5 ) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } if (lvlbuf[2]=='T') { val->f = atof(strchr(lvlbuf+5,'S')+1)/256.0; if (val->f < 1.0) val->f = 9.99; /* high VSWR */ } else val->f = 0.0; /* SWR in Receive = 0.0 */ break; case RIG_LEVEL_RAWSTR: /* provide uncalibrated raw strength, int */ /* NB: RIG_LEVEL_STRENGTH is handled in the frontend */ lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, "?S" EOM, 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'S' || lvl_len < 5) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } if (lvlbuf[2] == 'R') { char *raw_field, *raw_field2; /* response is @SRMnnnSnnn, incl main & sub rx. */ /* TT's spec indicates variable length data 1-3 digits */ if (vfo==RIG_VFO_SUB) { /* look at sub rx info */ raw_field = strchr(lvlbuf+3, 'S')+1; /* length may vary */ } else { /* look at main rx info */ raw_field = lvlbuf+4; raw_field2 = strchr(raw_field,'S'); /* position may vary */ if (raw_field2) *raw_field2 = '\0'; /* valid string */ } val->i = atoi(raw_field); /* get raw value */ } else val->i = 0; /* S-meter in xmit => 0 */ break; case RIG_LEVEL_RFPOWER: lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, "?TP" EOM, 4, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'T' || lvlbuf[2] != 'P' || lvl_len < 4) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = atof(lvlbuf+3)/100.0; break; case RIG_LEVEL_AGC: cmd_len = sprintf(cmdbuf, "?R%cA" EOM, which_receiver(rig, vfo)); lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, cmdbuf, cmd_len, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'R' || lvlbuf[3] != 'A' || lvl_len < 5) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } switch(lvlbuf[4]) { case 'O': val->i=RIG_AGC_OFF; break; case 'F': val->i=RIG_AGC_FAST; break; case 'M': val->i=RIG_AGC_MEDIUM; break; case 'S': val->i=RIG_AGC_SLOW; break; case 'P': val->i=RIG_AGC_USER; break; default: return -RIG_EPROTO; } break; case RIG_LEVEL_AF: cmd_len = sprintf(cmdbuf, "?U%c" EOM, which_receiver(rig, vfo)); lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, cmdbuf, cmd_len, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'U' || lvl_len < 4) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = atof(lvlbuf+3)/255.0; break; case RIG_LEVEL_IF: cmd_len = sprintf(cmdbuf, "?R%cP" EOM, /* passband tuning */ which_receiver(rig, vfo)); lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, cmdbuf, cmd_len, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'R' || lvlbuf[3] != 'P' || lvl_len < 5) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->i = atoi(lvlbuf+4); break; case RIG_LEVEL_RF: cmd_len = sprintf(cmdbuf, "?R%cG" EOM, which_receiver(rig, vfo)); lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, cmdbuf, cmd_len, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'R' || lvlbuf[3] != 'G' || lvl_len < 5) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = atof(lvlbuf+4)/100.0; break; case RIG_LEVEL_ATT: cmd_len = sprintf(cmdbuf, "?R%cT" EOM, which_receiver(rig, vfo)); lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, cmdbuf, cmd_len, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'R' || lvlbuf[3] != 'T' || lvl_len < 5) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } if (lvlbuf[4] == '0') val->i = 0; else val->i = rig->caps->attenuator[lvlbuf[4]-'1']; break; case RIG_LEVEL_PREAMP: /* Sub receiver does not contain a Preamp */ if (which_receiver(rig, vfo) == 'S') { val->i=0; break; } lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, "?RME" EOM, 5, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'R' || lvlbuf[3] != 'E' || lvl_len < 5) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->i = lvlbuf[4] == '0' ? 0 : rig->caps->preamp[0]; break; case RIG_LEVEL_SQL: cmd_len = sprintf(cmdbuf, "?R%cS" EOM, which_receiver(rig, vfo)); lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, cmdbuf, cmd_len, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'R' || lvlbuf[3] != 'S' || lvl_len < 5) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = (atof(lvlbuf+4)+127.0)/127.0; break; case RIG_LEVEL_MICGAIN: lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, "?TM" EOM, 4, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'T' || lvlbuf[2] != 'M' || lvl_len < 4) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = atof(lvlbuf+3)/100.0; break; case RIG_LEVEL_COMP: lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, "?TS" EOM, 4, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'T' || lvlbuf[2] != 'S' || lvl_len < 4) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = atof(lvlbuf+3)/9.0; break; case RIG_LEVEL_CWPITCH: lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, "?CT" EOM, 4, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'C' || lvlbuf[2] != 'T' || lvl_len < 4) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->i = atoi(lvlbuf+3); break; case RIG_LEVEL_KEYSPD: lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, "?CS" EOM, 4, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'C' || lvlbuf[2] != 'S' || lvl_len < 4) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->i = atoi(lvlbuf+3); break; case RIG_LEVEL_NR: /* RIG_LEVEL_NR controls Orion NB setting - TEMP */ cmd_len = sprintf(cmdbuf, "?R%cNB" EOM, which_receiver(rig, vfo)); lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, cmdbuf, cmd_len, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'R' || lvlbuf[3] != 'N' || lvlbuf[4] != 'B' || lvl_len < 6 ) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = atof(lvlbuf+5)/9.0; /* Note 0-9 -> 0.0 - 1.0 */ break; case RIG_LEVEL_VOX: /* =VOXDELAY, tenths of secs. */ lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, "?TH" EOM, 4, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'T' || lvlbuf[2] != 'H' || lvl_len < 4) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = 10.0*atof(lvlbuf+3); break; case RIG_LEVEL_VOXGAIN: /* Float, 0.0 - 1.0 */ lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, "?TG" EOM, 4, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'T' || lvlbuf[2] != 'G' || lvl_len < 4) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = 0.01 * atof(lvlbuf+3); break; case RIG_LEVEL_ANTIVOX: /* Float, 0.0 - 1.0 */ lvl_len = sizeof(lvlbuf); retval = tt565_transaction (rig, "?TA" EOM, 4, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[1] != 'T' || lvlbuf[2] != 'A' || lvl_len < 4) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer '%s'\n", __FUNCTION__, lvlbuf); return -RIG_EPROTO; } val->f = 0.01 * atof(lvlbuf+3); break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported level %d\n", __FUNCTION__, level); return -RIG_EINVAL; } return RIG_OK; } /** * \param rig !=NULL * \param vfo * \param ch Channel number * \returns RIG_OK * \brief This only sets the current memory channel locally. No Orion I/O. * * Use RIG_OP_TO_VFO and RIG_OP_FROM_VFO to get/store a freq in the channel. * \sa tt565_vfo_op */ int tt565_set_mem(RIG * rig, vfo_t vfo, int ch) { struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv; priv->ch = ch; /* See RIG_OP_TO/FROM_VFO */ return RIG_OK; } /** * \param rig != NULL * \param vfo * \param ch to receive the current channel number * \returns RIG_OK * \brief Get the current memory channel number (only) */ int tt565_get_mem(RIG * rig, vfo_t vfo, int *ch) { struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv; *ch = priv->ch; return RIG_OK; } /** * \param rig != NULL * \param vfo * \param op Operation to perform, a RIG_OP token * \returns RIG_OK or < 0 * \brief perform a RIG_OP operation * * Supported operations: * \n RIG_OP_TO_VFO memory channel to VFO (includes bw, mode, etc) * \n RIG_OP_FROM_VFO stores VFO (& other data) to memory channel * \n RIG_OP_TUNE initiates a tuner cycle (if tuner present) MAY BE BROKEN * \n RIG_OP_UP increment VFO freq by tuning step * \n RIG_OP_DOWN decrement VFO freq by tuning step */ int tt565_vfo_op(RIG * rig, vfo_t vfo, vfo_op_t op) { struct tt565_priv_data *priv = (struct tt565_priv_data *)rig->state.priv; char cmdbuf[TT565_BUFSIZE]; int retval; int cmd_len; switch (op) { case RIG_OP_TO_VFO: case RIG_OP_FROM_VFO: cmd_len = sprintf (cmdbuf, "*K%c%c%d" EOM, op == RIG_OP_TO_VFO ? 'R' : 'W', which_vfo(rig, vfo), priv->ch); break; case RIG_OP_TUNE: strcpy(cmdbuf, "*TTT" EOM); cmd_len = 5; break; case RIG_OP_UP: case RIG_OP_DOWN: cmd_len = sprintf (cmdbuf, "*%cS%c1" EOM, which_vfo(rig, vfo), op == RIG_OP_UP ? '+' : '-'); break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported op %d\n", __FUNCTION__, op); return -RIG_EINVAL; } retval = tt565_transaction (rig, cmdbuf, cmd_len, NULL, NULL); return retval; } /** * \param rig * \param vfo * \param msg A message string (<= 20 char) * \returns RIG_OK * \brief Send a string as morse characters * * Orion keyer must be on for morse, but we do not have a "keyer on" function in * hamlib (yet). Keyer will be forced on. * * Orion can queue up to about 20 characters. * We could batch a longer message into 20 char chunks, but there is no * simple way to tell if message has completed. We could calculate a * duration based on keyer speed and the text that was sent, but * what we really need is a handshake for "message complete". * Without it, you can't easily use the Orion as a code practice machine. * For now, we let the user do the batching. * Note that rig panel is locked up for duration of message. */ int tt565_send_morse(RIG *rig, vfo_t vfo, const char *msg) { int msg_len, retval, ic, cmdl; char morsecmd[8]; static int keyer_set = FALSE; /*Shouldn't be here!*/ /* Force keyer on. */ if (!keyer_set) { retval = tt565_transaction(rig, "*CK1" EOM, 5, NULL, NULL); if (retval != RIG_OK) return retval; keyer_set = TRUE; usleep(100000); /* 100 msec - guess */ } msg_len = strlen(msg); if (msg_len > 20) msg_len = 20; /* sanity limit 20 chars */ for (ic = 0; ic < msg_len; ic++) { cmdl = sprintf(morsecmd,"/%c" EOM, msg[ic]); retval = tt565_transaction(rig,morsecmd,cmdl,NULL,NULL); if (retval != RIG_OK) return retval; } return RIG_OK; } /** * \param rig != NULL * \param vfo * \param func Identifier for function to be performed * \param status data for function * \returns RIG_OK or < 0 * \brief Set an Orion "function" * * Note that vfo must == RIG_VFO_CURR * * Supported functions & data * \n RIG_FUNC_TUNER, off/on, 0/1 * \n RIG_FUNC_VOX, off/on, 0/1 * \n RIG_FUNC_LOCK, unlock/lock, 0/1 * \n RIG_FUNC_NB, off/on, 0/1 (sets Orion NB=0 or =4), compare RIG_LEVEL_NR * */ int tt565_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { char fcmdbuf[TT565_BUFSIZE]; int retval, fcmdlen; if (vfo != RIG_VFO_CURR) return -RIG_EINVAL; switch (func) { case RIG_FUNC_TUNER: fcmdlen = sprintf(fcmdbuf,"*TT%c" EOM, !status ? 0:1); break; case RIG_FUNC_VOX: fcmdlen = sprintf(fcmdbuf,"*TV%c" EOM, !status ? 0:1); break; case RIG_FUNC_LOCK: fcmdlen = sprintf(fcmdbuf,"*%c%c" EOM, which_vfo(rig, vfo), !status ? 'U' : 'L' ); break; case RIG_FUNC_NB: /* NB "on" sets Orion NB=4; "off" -> NB=0. See also RIG_LEVEL_NR which maps to NB setting due to firmware limitation. */ fcmdlen = sprintf(fcmdbuf,"*R%cNB%c" EOM, which_receiver(rig, vfo), !status ? '0' : '4' ); break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_func %#x", func); return -RIG_EINVAL; } retval = tt565_transaction(rig, fcmdbuf, fcmdlen, NULL, NULL); if (retval != RIG_OK) return retval; return RIG_OK; } /** * \param rig != NULL * \param vfo must == RIG_VFO_CURR * \param func * \param status receives result of function query * \returns RIG_OK or < 0 * \brief get state of an Orion "function" * * \sa tt565_set_func */ int tt565_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { char fcmdbuf[TT565_BUFSIZE], frespbuf[TT565_BUFSIZE]; int retval, fcmdlen, fresplen; if (vfo != RIG_VFO_CURR) return -RIG_EINVAL; switch (func) { case RIG_FUNC_TUNER: fcmdlen = sprintf(fcmdbuf, "?TT" EOM); break; case RIG_FUNC_VOX: fcmdlen = sprintf(fcmdbuf, "?TV" EOM); break; case RIG_FUNC_LOCK: fcmdlen = sprintf(fcmdbuf, "?%cU" EOM, which_vfo(rig, vfo) ); /* needs special treatment */ fresplen = sizeof(frespbuf); retval = tt565_transaction(rig, fcmdbuf, fcmdlen, frespbuf, &fresplen); if (retval != RIG_OK) return retval; /* response is @AL @AU or @BL @BU */ *status = frespbuf[ 2 ] == 'L' ? 1:0; return RIG_OK; case RIG_FUNC_NB: /* Note NB should be a LEVEL for Orion. It is also available through LEVEL_NR */ fcmdlen = sprintf(fcmdbuf, "?R%cNB" EOM, which_receiver(rig, vfo) ); /* needs special treatment */ fresplen = sizeof(frespbuf); retval = tt565_transaction(rig, fcmdbuf, fcmdlen, frespbuf, &fresplen); if (retval != RIG_OK) return retval; /* response is @RxNBn, n=0--9. Return 0 iff receive NB=0 */ *status = frespbuf[ 5 ] == '0' ? 0:1; return RIG_OK; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_func %#x", func); return -RIG_EINVAL; } fresplen = sizeof(frespbuf); retval = tt565_transaction(rig, fcmdbuf, fcmdlen, frespbuf, &fresplen); if (retval != RIG_OK) return retval; *status = frespbuf[ 3 ] == '1' ? 1:0; return RIG_OK; } /** * \param rig != NULL * \param vfo * \param ant antenna identifier RIG_ANT_1 or RIG_ANT_2 * \returns RIG_OK or < 0 * \brief Antenna selection for Orion * * We support Ant_1 and Ant_2 for M and S receivers. * \n Note that Rx-only antenna (Ant_3?) is not supported at this time. * \n Orion command assigns MSBN (main rtx, sub rx, both, or none) to each ant, * but hamlib wants to assign an ant to rx/tx! * The efficient way would be to keep current config in rig priv area, but we will * ask the rig what its state is each time... */ int tt565_set_ant(RIG * rig, vfo_t vfo, ant_t ant) { char respbuf[TT565_BUFSIZE]; int resp_len, retval; ant_t main_ant, sub_ant; /* First, find out what antenna config is now. */ resp_len = sizeof(respbuf); retval = tt565_transaction (rig, "?KA" EOM, 4, respbuf, &resp_len); if (retval != RIG_OK) return retval; if (resp_len != 7 || respbuf[1] != 'K' || respbuf[2] != 'A') { rig_debug(RIG_DEBUG_ERR,"%s; tt565_set_ant: ?KA NG %s\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } /* respbuf="@KAxxx" * x='M'|'S'|'B'|'N'=main/sub/both/none for ants 1,2,3. * but hardware will not permit all combinations! * respbuf [3,4] can be MS, SM, BN, NB * decode to rx-centric view */ if (respbuf[3] == 'M' || respbuf[3] == 'B') main_ant = RIG_ANT_1; else main_ant = RIG_ANT_2; if (respbuf[3] == 'S' || respbuf[3] == 'B') sub_ant = RIG_ANT_1; else sub_ant = RIG_ANT_2; switch (which_receiver(rig,vfo)) { case 'M': main_ant = ant; break; case 'S': sub_ant = ant; break; default: { /* no change? */ } } /* re-encode ant. settings into command */ if (main_ant == RIG_ANT_1) { if (sub_ant == RIG_ANT_1) { respbuf[3] = 'B'; respbuf[4] = 'N'; } else { respbuf[3] = 'M'; respbuf[4] = 'S'; } } else if (sub_ant == RIG_ANT_2) { respbuf[3] = 'N'; respbuf[4] = 'B'; } else { respbuf[3] = 'S'; respbuf[4] = 'M'; } respbuf[0] = '*'; /* respbuf becomes a store command */ respbuf[5] = 'N'; /* Force no rx on Ant 3 */ respbuf[6] = EOM[0]; respbuf[7] = 0; retval = tt565_transaction (rig, respbuf, 7, NULL, NULL); if (retval != RIG_OK) return retval; return RIG_OK; } /** * \param rig != NULL * \param vfo * \param ant receives antenna identifier * \returns RIG_OK or < 0 * \brief Find what antenna is "attached" to our vfo * * \sa tt565_set_ant */ int tt565_get_ant(RIG *rig, vfo_t vfo, ant_t *ant) { char respbuf[TT565_BUFSIZE]; int resp_len, retval; resp_len = sizeof(respbuf); retval = tt565_transaction(rig, "?KA" EOM, 4, respbuf, &resp_len); if (retval != RIG_OK) return retval; if (respbuf[1] != 'K' || respbuf[2] != 'A' || resp_len != 7) { rig_debug(RIG_DEBUG_ERR,"%s; tt565_get_ant: NG %s\n", __FUNCTION__, respbuf); return -RIG_EPROTO; } /* Look for first occurrence of M or S in ant 1, 2, 3 characters */ if (respbuf[3] == which_receiver(rig,vfo) || respbuf[3] == 'B' ) { *ant = RIG_ANT_1; return RIG_OK; } if (respbuf[4] == which_receiver(rig,vfo) || respbuf[4] == 'B' ) { *ant = RIG_ANT_2; return RIG_OK; } *ant = RIG_ANT_NONE; /* ignore possible RIG_ANT_3 = rx only ant */ return RIG_OK; } /* End of orion.c */ /** @} */ hamlib-1.2.15.3/tentec/rx340.c0000644000175000017500000003004412044564477012442 00000000000000/* * Hamlib TenTenc backend - RX-340 description * Copyright (c) 2003-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "hamlib/rig.h" #include "bandplan.h" #include "serial.h" #include "misc.h" #include "num_stdio.h" #define RX340_MODES (RIG_MODE_FM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_DSB|\ RIG_MODE_AM|RIG_MODE_AMS) #define RX340_FUNCS (RIG_FUNC_NB) #define RX340_LEVELS (RIG_LEVEL_STRENGTH| \ RIG_LEVEL_RF|RIG_LEVEL_IF| \ RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL| \ RIG_LEVEL_CWPITCH|RIG_LEVEL_AGC| \ RIG_LEVEL_ATT|RIG_LEVEL_PREAMP) #define RX340_ANTS (RIG_ANT_1) #define RX340_PARMS (RIG_PARM_NONE) #define RX340_VFO (RIG_VFO_A) #define RX340_VFO_OPS (RIG_OP_TO_VFO|RIG_OP_FROM_VFO) /* TODO: levels.. */ #define RX340_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ } #if 0 static int rx340_init(RIG *rig); static int rx340_cleanup(RIG *rig); #endif static int rx340_open(RIG *rig); static int rx340_close(RIG *rig); static int rx340_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int rx340_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int rx340_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int rx340_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int rx340_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int rx340_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static const char* rx340_get_info(RIG *rig); /* * RX340 receiver capabilities. * * Protocol is documented at * http://radio.tentec.com/downloads/receivers/RX340 * * TODO: from/to memory, scan, get_level, .. * supposes non-multidrop */ const struct rig_caps rx340_caps = { .rig_model = RIG_MODEL_RX340, .model_name = "RX-340", .mfg_name = "Ten-Tec", .version = "0.3", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 75, .serial_rate_max = 38400, .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 = 400, .retry = 3, .has_get_func = RX340_FUNCS, .has_set_func = RX340_FUNCS, .has_get_level = RX340_LEVELS, .has_set_level = RIG_LEVEL_SET(RX340_LEVELS), .has_get_parm = RX340_PARMS, .has_set_parm = RX340_PARMS, .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { 10, RIG_DBLST_END }, .attenuator = { 15, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = kHz(2), .targetable_vfo = RIG_TARGETABLE_NONE, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 100, RIG_MTYPE_MEM, RX340_MEM_CAP }, }, .rx_range_list1 = { {kHz(0),MHz(30),RX340_MODES,-1,-1,RX340_VFO,RX340_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(0),MHz(30),RX340_MODES,-1,-1,RX340_VFO,RX340_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {RX340_MODES,1}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RX340_MODES, kHz(3.2)}, {RX340_MODES, Hz(100)}, {RX340_MODES, kHz(16)}, {RX340_MODES, 0}, RIG_FLT_END, }, .priv = (void*)NULL, .rig_open = rx340_open, .rig_close = rx340_close, .set_freq = rx340_set_freq, .get_freq = rx340_get_freq, .set_mode = rx340_set_mode, .get_mode = rx340_get_mode, .set_level = rx340_set_level, .get_level = rx340_get_level, .get_info = rx340_get_info, }; /* * Function definitions below */ #define BUFSZ 128 #define EOM "\015" /* CR */ #define RX340_AM '1' #define RX340_FM '2' #define RX340_CW '3' #define RX340_CW1 '4' #define RX340_ISB '5' #define RX340_LSB '6' #define RX340_USB '7' #define RX340_SAM '8' /* * rx340_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! */ static int rx340_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval; struct rig_state *rs; rs = &rig->state; serial_flush(&rs->rigport); 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 RIG_OK; retval = read_string(&rs->rigport, data, BUFSZ, EOM, 1); if (retval < 0) return retval; *data_len = retval; return RIG_OK; } #if 0 /* * rx340_init: * Basically, it just sets up *priv */ int rx340_init(RIG *rig) { struct rx340_priv_data *priv; priv = (struct rx340_priv_data*)malloc(sizeof(struct rx340_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } memset(priv, 0, sizeof(struct rx340_priv_data)); /* * set arbitrary initial status */ rig->state.priv = (rig_ptr_t)priv; return RIG_OK; } /* * Tentec generic rx340_cleanup routine * the serial port is closed by the frontend */ int rx340_cleanup(RIG *rig) { if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } #endif int rx340_open(RIG *rig) { struct rig_state *rs = &rig->state; #define REMOTE_CMD "*R1"EOM return write_block(&rs->rigport, REMOTE_CMD, strlen(REMOTE_CMD)); } int rx340_close(RIG *rig) { struct rig_state *rs = &rig->state; #define LOCAL_CMD "*R0"EOM return write_block(&rs->rigport, LOCAL_CMD, strlen(LOCAL_CMD)); } /* * rx340_set_freq */ int rx340_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct rig_state *rs = &rig->state; int freq_len, retval; char freqbuf[16]; freq_len = num_sprintf(freqbuf, "F%.6f" EOM, freq/1e6); retval = write_block(&rs->rigport, freqbuf, freq_len); return retval; } /* * rx340_get_freq * Assumes rig!=NULL, freq!=NULL */ int rx340_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { char buf[BUFSZ]; int buf_len; int retval; double f; #define REPORT_FREQ "TF"EOM retval = rx340_transaction(rig, REPORT_FREQ, strlen(REPORT_FREQ), buf, &buf_len); if (retval < 0) return retval; if (buf_len < 2 || buf[0] != 'F' || num_sscanf(buf+1, "%lf", &f) != 1) return -RIG_EPROTO; *freq = f*1e6; return RIG_OK; } /* * rx340_set_mode * Assumes rig!=NULL */ int rx340_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct rig_state *rs = &rig->state; char dmode; int mdbuf_len, retval; char mdbuf[32]; switch (mode) { case RIG_MODE_USB: dmode = RX340_USB; break; case RIG_MODE_LSB: dmode = RX340_LSB; break; case RIG_MODE_CW: dmode = RX340_CW; break; case RIG_MODE_FM: dmode = RX340_FM; break; case RIG_MODE_AM: dmode = RX340_AM; break; case RIG_MODE_AMS: dmode = RX340_SAM; break; case RIG_MODE_DSB: dmode = RX340_ISB; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %d\n", __func__, mode); return -RIG_EINVAL; } if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); /* * Set DETECTION MODE and IF FILTER */ mdbuf_len = num_sprintf(mdbuf, "D%cI%.02f" EOM, dmode, (float)width/1e3); retval = write_block(&rs->rigport, mdbuf, mdbuf_len); return retval; } /* * rx340_get_mode * Assumes rig!=NULL, mode!=NULL */ int rx340_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char buf[BUFSZ]; int buf_len; int retval; double f; #define REPORT_MODEFILTER "TDI"EOM retval = rx340_transaction(rig, REPORT_MODEFILTER, strlen(REPORT_MODEFILTER), buf, &buf_len); if (retval < 0) return retval; if (buf_len < 4 || buf[0] != 'D' || buf[2] != 'I') return -RIG_EPROTO; switch (buf[1]) { case RX340_USB: *mode = RIG_MODE_USB; break; case RX340_LSB: *mode = RIG_MODE_LSB; break; case RX340_CW1: case RX340_CW: *mode = RIG_MODE_CW; break; case RX340_FM: *mode = RIG_MODE_FM; break; case RX340_AM: *mode = RIG_MODE_AM; break; case RX340_SAM: *mode = RIG_MODE_AMS; break; case RX340_ISB: *mode = RIG_MODE_DSB; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unknown mode '%c'\n", __func__, buf[1]); return -RIG_EPROTO; } if (num_sscanf(buf+3, "%lf", &f) != 1) return -RIG_EPROTO; *width = f*1e3; return RIG_OK; } /* * rx340_set_level * Assumes rig!=NULL * cannot support PREAMP and ATT both at same time (make sense though) */ int rx340_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct rig_state *rs = &rig->state; int cmd_len, retval=RIG_OK; char cmdbuf[32]; switch (level) { case RIG_LEVEL_ATT: cmd_len = sprintf(cmdbuf, "K%c" EOM, val.i ? '3' : '1'); break; case RIG_LEVEL_PREAMP: cmd_len = sprintf(cmdbuf, "K%c" EOM, val.i ? '2' : '1'); break; case RIG_LEVEL_AGC: /* default to MEDIUM */ cmd_len = sprintf(cmdbuf, "M%c" EOM, val.i==RIG_AGC_SLOW ? '3' : ( val.i==RIG_AGC_FAST ? '1' : '2' ) ); break; case RIG_LEVEL_RF: cmd_len = sprintf(cmdbuf, "A%d" EOM, 120-(int)(val.f*120)); break; case RIG_LEVEL_SQL: cmd_len = sprintf(cmdbuf, "Q%d" EOM, 150-(int)(val.f*150)); break; case RIG_LEVEL_NOTCHF: cmd_len = num_sprintf(cmdbuf, "N%f" EOM, ((float)val.i)/1e3); break; case RIG_LEVEL_IF: cmd_len = num_sprintf(cmdbuf, "P%f" EOM, ((float)val.i)/1e3); break; case RIG_LEVEL_CWPITCH: /* only in CW mode */ cmd_len = num_sprintf(cmdbuf, "B%f" EOM, ((float)val.i)/1e3); break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported set_level %d\n", __func__, level); return -RIG_EINVAL; } retval = write_block(&rs->rigport, cmdbuf, cmd_len); return retval; } /* * rx340_get_level * Assumes rig!=NULL, val!=NULL */ int rx340_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int retval, lvl_len; char lvlbuf[BUFSZ]; switch (level) { case RIG_LEVEL_STRENGTH: #define REPORT_STRENGTH "X"EOM retval = rx340_transaction (rig, REPORT_STRENGTH, strlen(REPORT_STRENGTH), lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len < 2 || lvlbuf[0] != 'X') { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer" "len=%d\n", __func__, lvl_len); return -RIG_EPROTO; } /* range 0-150 covering the dynamic range * of receiver -140..+10dBm */ val->i = atoi(lvlbuf+1)-140+73; break; case RIG_LEVEL_AGC: case RIG_LEVEL_ATT: case RIG_LEVEL_PREAMP: case RIG_LEVEL_RF: case RIG_LEVEL_IF: case RIG_LEVEL_SQL: case RIG_LEVEL_CWPITCH: case RIG_LEVEL_NOTCHF: return -RIG_ENIMPL; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported get_level %d\n", __func__, level); return -RIG_EINVAL; } return RIG_OK; } /* * rx340_get_info * Assumes rig!=NULL */ const char *rx340_get_info(RIG *rig) { static char buf[BUFSZ]; /* FIXME: reentrancy */ int firmware_len, retval; #define REPORT_FIRM "V"EOM retval = rx340_transaction (rig, REPORT_FIRM, strlen(REPORT_FIRM), buf, &firmware_len); if ( (retval != RIG_OK) || (firmware_len > 10) ) { rig_debug(RIG_DEBUG_ERR,"%s: ack NG, len=%d\n", __func__, firmware_len); return NULL; } return buf; } hamlib-1.2.15.3/tentec/rx320.c0000644000175000017500000001166312044564477012446 00000000000000/* * Hamlib TenTenc backend - RX-320 PC-Radio description * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "idx_builtin.h" #include "tentec.h" #define RX320_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB) /* TODO: LINEOUT */ #define RX320_LEVELS (RIG_LEVEL_AGC|RIG_LEVEL_AF|RIG_LEVEL_IF|RIG_LEVEL_RAWSTR|RIG_LEVEL_CWPITCH) #define RX320_VFO (RIG_VFO_A) /* * Modified 11/18/2008, Josh Rovero, KK1D * Calibration via comparison with JRC NRD-525. * Highy non-linear.... */ #define RX320_STR_CAL { 17, { \ { 0, -60 }, \ { 10, -50 }, \ { 20, -40 }, \ { 30, -30 }, \ { 40, -20 }, \ { 50, -15 }, \ { 100, -10 }, \ { 200, -5 }, \ { 225, -3 }, \ { 256, 0 }, \ { 512, 1 }, \ { 768, 3}, \ { 1024, 4 }, \ { 1280, 5 }, \ { 2560, 10 }, \ { 5120, 20 }, \ { 10000, 30 }, \ } } /* * 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.6", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .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, /* * Added S-meter read support, Josh Rovero KK1D * Only get_level is for RIG_LEVEL_RAWSTR */ .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 = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 10000 } }, [LVL_AF] = { .min = { .f = 0 }, .max = { .f = 1 }, .step = { .f = 1.0/64 } }, [LVL_IF] = { .min = { .i = -2000 }, .max = { .i = 2000 }, .step = { .i = 10} }, [LVL_CWPITCH] = { .min = { .i = 0}, .max = { .i = 2000 }, .step = { .i = 100} } }, .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 = kHz(2), .targetable_vfo = 0, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100),MHz(30),RX320_MODES,-1,-1,RX320_VFO}, RIG_FRNG_END, }, .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_CW, 300}, {RIG_MODE_CW, 450}, {RIG_MODE_CW, 600}, {RIG_MODE_CW, 750}, {RIG_MODE_CW, 900}, {RIG_MODE_CW, kHz(1.2)}, {RIG_MODE_SSB|RIG_MODE_CW, kHz(1.5)}, {RIG_MODE_SSB|RIG_MODE_CW, kHz(1.8)}, {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.1)}, {RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_CW, kHz(2.4)}, {RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_CW, kHz(3.0)}, {RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_CW, kHz(4.2)}, {RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_CW, kHz(5.1)}, {RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_CW, kHz(6)}, {RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_CW, kHz(8)}, RIG_FLT_END, }, .str_cal = RX320_STR_CAL, .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 */ hamlib-1.2.15.3/tentec/rx350.c0000644000175000017500000000715512044564477012452 00000000000000/* * Hamlib TenTenc backend - RX-350 description * Copyright (c) 2003-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "tentec2.h" #include "bandplan.h" #define RX350_MODES (RIG_MODE_FM|RIG_MODE_CW|RIG_MODE_SSB|\ RIG_MODE_AM|RIG_MODE_AMS) #define RX350_FUNCS (RIG_FUNC_NR|RIG_FUNC_ANF) #define RX350_LEVELS (RIG_LEVEL_RAWSTR|/*RIG_LEVEL_NB|*/ \ RIG_LEVEL_RF|RIG_LEVEL_IF| \ RIG_LEVEL_AF|RIG_LEVEL_AGC| \ RIG_LEVEL_SQL|RIG_LEVEL_ATT) #define RX350_ANTS (RIG_ANT_1) #define RX350_PARMS (RIG_PARM_TIME) #define RX350_VFO (RIG_VFO_A|RIG_VFO_B) #define RX350_VFO_OPS (RIG_OP_TO_VFO|RIG_OP_FROM_VFO) /* * RX350 receiver capabilities. * * Protocol is documented at * http://www.rfsquared.com/ * * Only set_freq is supposed to work. * This is a skelton. */ const struct rig_caps rx350_caps = { .rig_model = RIG_MODEL_RX350, .model_name = "RX-350", .mfg_name = "Ten-Tec", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 57600, .serial_rate_max = 57600, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 0, .timeout = 400, .retry = 3, .has_get_func = RX350_FUNCS, .has_set_func = RX350_FUNCS, .has_get_level = RX350_LEVELS, .has_set_level = RIG_LEVEL_SET(RX350_LEVELS), .has_get_parm = RX350_PARMS, .has_set_parm = RX350_PARMS, .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END }, .attenuator = { 20, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = kHz(2), .targetable_vfo = RIG_TARGETABLE_FREQ|RIG_TARGETABLE_MODE, .transceive = RIG_TRN_OFF, .bank_qty = 8, .chan_desc_sz = 15, .chan_list = { { 0, 127, RIG_MTYPE_MEM, TT_MEM_CAP }, }, .rx_range_list1 = { {kHz(100),MHz(30),RX350_MODES,-1,-1,RX350_VFO,RX350_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(30),RX350_MODES,-1,-1,RX350_VFO,RX350_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {RX350_MODES,1}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RX350_MODES, kHz(2.4)}, {RX350_MODES, 300}, {RX350_MODES, kHz(8)}, {RX350_MODES, 0}, /* 34 filters */ RIG_FLT_END, }, .priv = (void*)NULL, .set_freq = tentec2_set_freq, .get_freq = tentec2_get_freq, .set_vfo = tentec2_set_vfo, .get_vfo = tentec2_get_vfo, .set_mode = tentec2_set_mode, .get_mode = tentec2_get_mode, .reset = tentec2_reset, .get_info = tentec2_get_info, }; /* * Function definitions below */ hamlib-1.2.15.3/tentec/rx331.c0000644000175000017500000004412612044564477012450 00000000000000/* * Hamlib Tentec backend - RX331 description * Copyright (c) 2010 by Berndt Josef Wulf * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "hamlib/rig.h" #include "bandplan.h" #include "serial.h" #include "misc.h" #include "num_stdio.h" #include "token.h" #include "rx331.h" static const struct confparams rx331_cfg_params[] = { { TOK_RIGID, "receiver_id", "receiver ID", "receiver ID", "0", RIG_CONF_NUMERIC, { .n = { 0, 99, 1 } } }, { RIG_CONF_END, NULL, } }; #define RX331_MODES (RIG_MODE_FM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_DSB|\ RIG_MODE_AM|RIG_MODE_AMS) #define RX331_FUNCS (RIG_FUNC_NB) #define RX331_LEVELS (RIG_LEVEL_STRENGTH| \ RIG_LEVEL_RF|RIG_LEVEL_IF| \ RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL| \ RIG_LEVEL_CWPITCH|RIG_LEVEL_AGC| \ RIG_LEVEL_ATT|RIG_LEVEL_PREAMP) #define RX331_ANTS (RIG_ANT_1) #define RX331_PARMS (RIG_PARM_NONE) #define RX331_VFO (RIG_VFO_A) #define RX331_VFO_OPS (RIG_OP_TO_VFO|RIG_OP_FROM_VFO) /* TODO: levels.. */ #define RX331_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ } static int rx331_init(RIG *rig); static int rx331_cleanup(RIG *rig); static int rx331_set_conf(RIG *rig, token_t token, const char *val); static int rx331_get_conf(RIG *rig, token_t token, char *val); static int rx331_open(RIG *rig); static int rx331_close(RIG *rig); static int rx331_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int rx331_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int rx331_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int rx331_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int rx331_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int rx331_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int rx331_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); static const char* rx331_get_info(RIG *rig); /* * RX331 receiver capabilities. * * Protocol is documented at * http://radio.tentec.com/downloads/receivers/RX331 * * TODO: from/to memory */ const struct rig_caps rx331_caps = { .rig_model = RIG_MODEL_RX331, .model_name = "RX-331", .mfg_name = "Ten-Tec", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 75, .serial_rate_max = 38400, .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 = 400, .retry = 3, .has_get_func = RX331_FUNCS, .has_set_func = RX331_FUNCS, .has_get_level = RX331_LEVELS, .has_set_level = RIG_LEVEL_SET(RX331_LEVELS), .has_get_parm = RX331_PARMS, .has_set_parm = RX331_PARMS, .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { 10, RIG_DBLST_END }, .attenuator = { 15, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = kHz(2), .targetable_vfo = RIG_TARGETABLE_NONE, .transceive = RIG_TRN_OFF, .vfo_ops = RX331_VFO_OPS, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 100, RIG_MTYPE_MEM, RX331_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(0),MHz(30),RX331_MODES,-1,-1,RX331_VFO,RX331_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(0),MHz(30),RX331_MODES,-1,-1,RX331_VFO,RX331_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {RX331_MODES,1}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RX331_MODES, kHz(3.2)}, {RX331_MODES, Hz(100)}, {RX331_MODES, kHz(16)}, {RX331_MODES, 0}, RIG_FLT_END, }, .priv = (void*)NULL, .cfgparams = rx331_cfg_params, .rig_init = rx331_init, .rig_cleanup= rx331_cleanup, .rig_open = rx331_open, .rig_close = rx331_close, .set_conf = rx331_set_conf, .get_conf = rx331_get_conf, .set_freq = rx331_set_freq, .get_freq = rx331_get_freq, .set_mode = rx331_set_mode, .get_mode = rx331_get_mode, .set_level = rx331_set_level, .get_level = rx331_get_level, .vfo_op = rx331_vfo_op, .get_info = rx331_get_info, }; /* * Function definitions below */ #define BUFSZ 128 #define EOM "\015" /* CR */ #define RX331_AM '1' #define RX331_FM '2' #define RX331_CW '3' #define RX331_CW1 '4' #define RX331_ISB '5' #define RX331_LSB '6' #define RX331_USB '7' #define RX331_SAM '8' #define RX331_PREAMP_OFF 0x1 #define RX331_PREAMP_ON 0x2 #define RX331_ATT_OFF 0x1 #define RX331_ATT_ON 0x3 #define RX331_AGC_FAST 0x1 #define RX331_AGC_MEDIUM 0x2 #define RX331_AGC_SLOW 0x3 #define RX331_AGC_PROG 0x4 #define REPORT_FREQ "TF"EOM #define REPORT_MODEFILTER "TDI"EOM #define REPORT_FIRM "V"EOM #define REPORT_STRENGTH "X"EOM #define REPORT_AGC "TM"EOM #define REPORT_ATT "TK"EOM #define REPORT_PREAMP "TK"EOM #define REPORT_RF "TA"EOM #define REPORT_IF "TP"EOM #define REPORT_SQL "TQ"EOM #define REPORT_CWPITCH "TB"EOM #define REPORT_NOTCHF "TN"EOM /* * rx331_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! */ static int rx331_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int rig_id; int retval; char str[BUFSZ]; struct rig_state *rs; struct rx331_priv_data *priv = (struct rx331_priv_data*)rig->state.priv; rs = &rig->state; serial_flush(&rs->rigport); num_snprintf(str, BUFSZ, "$%i%s", priv->receiver_id, cmd); retval = write_block(&rs->rigport, str, strlen(str)); if (retval != RIG_OK) return retval; /* no data expected, TODO: flush input? */ if (!data || !data_len) return RIG_OK; retval = read_string(&rs->rigport, data, BUFSZ, EOM, 1); if (retval < 0) return retval; sscanf(data + 1,"%i%s", &rig_id, data); if(rig_id != priv->receiver_id) return -RIG_EPROTO; *data_len = retval; return RIG_OK; } /* * rx331_init: * Basically, it just sets up *priv */ int rx331_init(RIG *rig) { struct rx331_priv_data *priv; priv = (struct rx331_priv_data*)malloc(sizeof(struct rx331_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } memset(priv, 0, sizeof(struct rx331_priv_data)); /* * set arbitrary initial status */ rig->state.priv = (rig_ptr_t)priv; return RIG_OK; } /* * Tentec generic rx331_cleanup routine * the serial port is closed by the frontend */ int rx331_cleanup(RIG *rig) { if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } int rx331_set_conf(RIG *rig, token_t token, const char *val) { struct rx331_priv_data *priv = (struct rx331_priv_data*)rig->state.priv; switch(token) { case TOK_RIGID: priv->receiver_id = atoi(val); break; default: return -RIG_EINVAL; } return RIG_OK; } int rx331_get_conf(RIG *rig, token_t token, char *val) { struct rx331_priv_data *priv = (struct rx331_priv_data*)rig->state.priv; switch(token) { case TOK_RIGID: sprintf(val, "%d", priv->receiver_id); break; default: return -RIG_EINVAL; } return RIG_OK; } int rx331_open(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; return RIG_OK; } /* * rig_close */ int rx331_close(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; return RIG_OK; } int rx331_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct rx331_priv_data *priv = (struct rx331_priv_data*)rig->state.priv; struct rig_state *rs = &rig->state; int freq_len, retval; char freqbuf[16]; freq_len = num_sprintf(freqbuf, "$%iF%.6f" EOM, priv->receiver_id, freq/1e6); retval = write_block(&rs->rigport, freqbuf, freq_len); return retval; } /* * rx331_get_freq * Assumes rig!=NULL, freq!=NULL */ int rx331_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { char buf[BUFSZ]; int buf_len; int retval; double f; retval = rx331_transaction(rig, REPORT_FREQ, strlen(REPORT_FREQ), buf, &buf_len); if (retval < 0) return retval; if (buf_len < 2 || buf[0] != 'F' || num_sscanf(buf+1, "%lf", &f) != 1) return -RIG_EPROTO; *freq = f*1e6; return RIG_OK; } /* * rx331_set_mode * Assumes rig!=NULL */ int rx331_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct rx331_priv_data *priv = (struct rx331_priv_data*)rig->state.priv; struct rig_state *rs = &rig->state; char dmode; int mdbuf_len, retval; char mdbuf[32]; switch (mode) { case RIG_MODE_USB: dmode = RX331_USB; break; case RIG_MODE_LSB: dmode = RX331_LSB; break; case RIG_MODE_CW: dmode = RX331_CW; break; case RIG_MODE_FM: dmode = RX331_FM; break; case RIG_MODE_AM: dmode = RX331_AM; break; case RIG_MODE_AMS: dmode = RX331_SAM; break; case RIG_MODE_DSB: dmode = RX331_ISB; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %d\n", __func__, mode); return -RIG_EINVAL; } if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); /* * Set DETECTION MODE and IF FILTER */ mdbuf_len = num_sprintf(mdbuf, "$%iD%cI%.02f" EOM, priv->receiver_id, dmode, (float)width/1e3); retval = write_block(&rs->rigport, mdbuf, mdbuf_len); return retval; } /* * rx331_get_mode * Assumes rig!=NULL, mode!=NULL */ int rx331_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char buf[BUFSZ]; int buf_len; int retval; double f; retval = rx331_transaction(rig, REPORT_MODEFILTER, strlen(REPORT_MODEFILTER), buf, &buf_len); if (retval < 0) return retval; if (buf_len < 4 || buf[0] != 'D' || buf[2] != 'I') return -RIG_EPROTO; switch (buf[1]) { case RX331_USB: *mode = RIG_MODE_USB; break; case RX331_LSB: *mode = RIG_MODE_LSB; break; case RX331_CW1: case RX331_CW: *mode = RIG_MODE_CW; break; case RX331_FM: *mode = RIG_MODE_FM; break; case RX331_AM: *mode = RIG_MODE_AM; break; case RX331_SAM: *mode = RIG_MODE_AMS; break; case RX331_ISB: *mode = RIG_MODE_DSB; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unknown mode '%c'\n", __func__, buf[1]); return -RIG_EPROTO; } if (num_sscanf(buf+3, "%lf", &f) != 1) return -RIG_EPROTO; *width = f*1e3; return RIG_OK; } /* * rx331_set_level * Assumes rig!=NULL * cannot support PREAMP and ATT both at same time (make sense though) */ int rx331_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct rx331_priv_data *priv = (struct rx331_priv_data*)rig->state.priv; struct rig_state *rs = &rig->state; int cmd_len, retval=RIG_OK; char cmdbuf[32]; switch (level) { case RIG_LEVEL_ATT: cmd_len = sprintf(cmdbuf, "$%iK%i" EOM, priv->receiver_id, val.i ? RX331_ATT_ON : RX331_ATT_OFF); break; case RIG_LEVEL_PREAMP: cmd_len = sprintf(cmdbuf, "$%iK%i" EOM, priv->receiver_id, val.i ? RX331_PREAMP_ON : RX331_PREAMP_OFF); break; case RIG_LEVEL_AGC: switch(val.i) { case RIG_AGC_FAST: val.i = RX331_AGC_FAST; break; case RIG_AGC_MEDIUM: val.i = RX331_AGC_MEDIUM; break; case RIG_AGC_SLOW: val.i = RX331_AGC_SLOW; break; case RIG_AGC_USER: val.i = RX331_AGC_PROG; break; default: rig_debug(RIG_DEBUG_ERR, "%s: Unsupported set_level %d\n", __func__, val.i); return -RIG_EINVAL; } cmd_len = sprintf(cmdbuf, "$%iM%i" EOM, priv->receiver_id,val.i); break; case RIG_LEVEL_RF: cmd_len = sprintf(cmdbuf, "$%iA%d" EOM, priv->receiver_id, 120-(int)(val.f*120)); break; case RIG_LEVEL_SQL: cmd_len = sprintf(cmdbuf, "$%iQ%d" EOM, priv->receiver_id, 120-(int)(val.f*120)); break; case RIG_LEVEL_NOTCHF: cmd_len = num_sprintf(cmdbuf, "$%iN%f" EOM, priv->receiver_id, ((float)val.i)/1e3); break; case RIG_LEVEL_IF: cmd_len = num_sprintf(cmdbuf, "$%iP%f" EOM, priv->receiver_id, ((float)val.i)/1e3); break; case RIG_LEVEL_CWPITCH: /* only in CW mode */ cmd_len = num_sprintf(cmdbuf, "$%iB%f" EOM, priv->receiver_id, ((float)val.i)/1e3); break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported set_level %d\n", __func__, level); return -RIG_EINVAL; } retval = write_block(&rs->rigport, cmdbuf, cmd_len); return retval; } /* * rx331_get_level * Assumes rig!=NULL, val!=NULL */ int rx331_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int retval, lvl_len; char lvlbuf[BUFSZ]; switch (level) { case RIG_LEVEL_STRENGTH: retval = rx331_transaction (rig, REPORT_STRENGTH, strlen(REPORT_STRENGTH), lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len < 2 || lvlbuf[0] != 'X') { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer" "len=%d\n", __func__, lvl_len); return -RIG_EPROTO; } // Range is 0-120 covering the 120dB range of the receiver if(num_sscanf(lvlbuf+1,"%d",&val->i) != 1) return -RIG_EPROTO; val->i = val->i - 120; break; case RIG_LEVEL_AGC: retval = rx331_transaction (rig, REPORT_AGC, strlen(REPORT_AGC), lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len < 0 || lvlbuf[0] != 'M') { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer" "len=%d\n", __func__, lvl_len); return -RIG_EPROTO; } switch(atoi(lvlbuf+1)) { case RX331_AGC_FAST: val->i = RIG_AGC_FAST; break; case RX331_AGC_MEDIUM: val->i = RIG_AGC_MEDIUM; break; case RX331_AGC_SLOW: val->i = RIG_AGC_SLOW; break; case RX331_AGC_PROG: val->i = RIG_AGC_USER; break; default: rig_debug(RIG_DEBUG_ERR, "%s:Unsupported get_level %d\n", __func__, level); return -RIG_EINVAL; } break; case RIG_LEVEL_ATT: retval = rx331_transaction (rig, REPORT_ATT, strlen(REPORT_ATT), lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len < 0 || lvlbuf[0] != 'K') { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer" "len=%d\n", __func__, lvl_len); return -RIG_EPROTO; } if(num_sscanf(lvlbuf+1,"%i",&val->i) != 1) return -RIG_EPROTO; val->i = (val->i == RX331_ATT_ON); break; case RIG_LEVEL_PREAMP: retval = rx331_transaction (rig, REPORT_PREAMP, strlen(REPORT_PREAMP), lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len < 0 || lvlbuf[0] != 'K') { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer" "len=%d\n", __func__, lvl_len); return -RIG_EPROTO; } if(num_sscanf(lvlbuf+1,"%i",&val->i) != 1) return -RIG_EPROTO; val->i = (val->i == RX331_PREAMP_ON); break; case RIG_LEVEL_RF: retval = rx331_transaction (rig, REPORT_RF, strlen(REPORT_RF), lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len < 0 || lvlbuf[0] != 'A') { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer" "len=%d\n", __func__, lvl_len); return -RIG_EPROTO; } if(num_sscanf(lvlbuf+1,"%d",&val->i) != 1) return -RIG_EPROTO; val->f = 1.0 - (float)(val->i / 120.0); break; case RIG_LEVEL_IF: retval = rx331_transaction (rig, REPORT_IF, strlen(REPORT_IF), lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len < 0 || lvlbuf[0] != 'P') { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer" "len=%d\n", __func__, lvl_len); return -RIG_EPROTO; } if(num_sscanf(lvlbuf+1,"%f",&val->f) != 1) return -RIG_EPROTO; val->i = (int)(val->f * 1000.0); break; case RIG_LEVEL_SQL: retval = rx331_transaction (rig, REPORT_SQL, strlen(REPORT_SQL), lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len < 0 || lvlbuf[0] != 'Q') { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer" "len=%d\n", __func__, lvl_len); return -RIG_EPROTO; } if(num_sscanf(lvlbuf+1,"%d", &val->i) != 1) return -RIG_EPROTO; val->f = 1.0 - (val->i/ 120.0); break; case RIG_LEVEL_CWPITCH: retval = rx331_transaction (rig, REPORT_CWPITCH, strlen(REPORT_CWPITCH), lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len < 0 || lvlbuf[0] != 'B') { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer" "len=%d\n", __func__, lvl_len); return -RIG_EPROTO; } if(num_sscanf(lvlbuf+1,"%f", &val->f) != 1) return -RIG_EPROTO; val->i = (val->f * 1000.0); break; case RIG_LEVEL_NOTCHF: retval = rx331_transaction (rig, REPORT_NOTCHF, strlen(REPORT_NOTCHF), lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len < 0 || lvlbuf[0] != 'N') { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer" "len=%d\n", __func__, lvl_len); return -RIG_EPROTO; } if(num_sscanf(lvlbuf+1,"%f", &val->f) != 1) return -RIG_EPROTO; val->i = (val->f * 1000.0); break; default: rig_debug(RIG_DEBUG_ERR,"%s: Unsupported get_level %d\n", __func__, level); return -RIG_EINVAL; } return RIG_OK; } /* * rx331_vfo_op * Assumes rig!=NULL */ int rx331_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { return -RIG_ENIMPL; } /* * rx331_get_info * Assumes rig!=NULL */ const char *rx331_get_info(RIG *rig) { static char buf[BUFSZ]; /* FIXME: reentrancy */ int firmware_len, retval; retval = rx331_transaction (rig, REPORT_FIRM, strlen(REPORT_FIRM), buf, &firmware_len); if ( (retval != RIG_OK) || (firmware_len > 10) ) { rig_debug(RIG_DEBUG_ERR,"%s: ack NG, len=%d\n", __func__, firmware_len); return NULL; } return buf; } hamlib-1.2.15.3/tentec/Makefile.am0000644000175000017500000000072012044564477013450 00000000000000TENTECSRCLIST = rx320.c rx340.c rx350.c rx331.c \ pegasus.c argonaut.c orion.c jupiter.c omnivii.c paragon.c pkglib_LTLIBRARIES = hamlib-tentec.la hamlib_tentec_la_SOURCES = $(TENTECSRCLIST) tentec.c tentec2.c tt550.c hamlib_tentec_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_tentec_la_LIBADD = $(top_builddir)/src/libhamlib.la \ $(top_builddir)/lib/libmisc.la EXTRA_DIST = README noinst_HEADERS = tentec.h tentec2.h tt550.h orion.h rx331.h hamlib-1.2.15.3/tentec/tentec.h0000644000175000017500000000536512044564477013061 00000000000000/* * Hamlib Tentec backend - main header * Copyright (c) 2001-2011 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * \addtogroup tentec * @{ */ /** * \file tentec.h * \brief Includes for Tentec Backends */ #ifndef _TENTEC_H #define _TENTEC_H 1 #include /** * \brief Private tentec info */ 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: 1000 [0-2000Hz] */ int pbt; /*!< Passband Tuning, IF shift: 0 [-2000Hz to 2000Hz] */ float lnvol; /*!< line-out volume: 30 [0..63] */ float spkvol; /*!< speaker volume: 30 [0..63] */ int 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 */ }; int tentec_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len); int tentec_init(RIG *rig); int tentec_cleanup(RIG *rig); int tentec_trx_open(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 const struct rig_caps rx340_caps; extern const struct rig_caps rx350_caps; extern const struct rig_caps tt516_caps; extern const struct rig_caps tt538_caps; extern const struct rig_caps tt585_caps; extern const struct rig_caps tt588_caps; extern const struct rig_caps tt550_caps; extern const struct rig_caps tt565_caps; extern const struct rig_caps tt599_caps; extern const struct rig_caps rx331_caps; #endif /* _TENTEC_H */ /** @} */ hamlib-1.2.15.3/config.guess0000755000175000017500000012763712044564547012471 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. timestamp='2009-12-30' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU 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 # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: hamlib-1.2.15.3/NEWS0000644000175000017500000002620712044564477010641 00000000000000Hamlib -- History of visible changes. Copyright (C) 2000-2003 Frank Singleton Copyright (C) 2000-2012 Stephane Fillod, and others Please send Hamlib bug reports to hamlib-developer@lists.sourceforge.net Version 1.2.15.3 2012-11-01 * Fix configure.ac so that rigctld/rotcld work on Win32 platform * Add NSIS script to build executable installer on Win32 platform * Remove unsupported commands on IC-756 (non-Pro model) from AK6I * Fix set_split in netrigctl.c to properly accept the split value. TNX, N2ADR. * IC-R8500: Add RIG_LEVEL_AF to has_set_level. TNX John, EI7IG * ADAT updates from Frank, DG1SBG, needed for stable operation. Version 1.2.15.2 2012-08-05 * Read eeprom value for digital mode from FT-857 * Clean up TS-950 series commands and read mode using IF command * Fix GS-232A/B rotor command terminations * Fix warnings and other issues found by mingw-w64 * Allow seamless access to ports higher than COM9 on Windows * Fix ineffective packed attribute on WinRadio * Correct low signal strength S-meter error on AR7030+ * Updates to HiQSDR by Jim, N2ADR Version 1.2.15.1 2012-03-11 * HD-1780 rotor endpoint limit fix * Quell adat compile warnings * Sort rig/rot list output from rig/rotctl (-l) by model # * TenTec Jupiter (TT538) fixes * Include various backend notes files * Document sorted -l output for ctl[d] * Updates README.betatester and README.developer Version 1.2.15 2012-02-02 * New models: TT-599 Eagle, IC-RX7, IC-1275, HiQSDR, ADAT ADT-200A, DttSP UDP, TM-D710 * New rotator backends: Celestron (telescope mount) * Fixes and features: K3, various other rigs * Update LGPL/GPL header boilerplate * Quell various compiler errors * Add CM108 PTT capability Version 1.2.14 2011-08-01 * New models: SigFox Transfox, TH-D72A, IC-7410, IC-9100, IC-R9500, KX3, V4L2 API support (untested), * New rotator backends: IF-100, TS-7400 * Fixes and features: K3/KX3, Build Win32 from script, rigctld/rotctld ported to Mingw32, Win32 build fixes, remove obsolete bundled libtool files, rigctl improvements, FUNcube string test (works with V0.0 and V1.0), Yaesu newcat.c fixed to use rig->state.current_vfo to store vfo value, add a command to halt rigctld, select PTT source in Kenwood backends (TS-590S), make sure scan is stopped at IC-9000 opening, thd72 get channel data (alpha). See ChangeLog for a link to the online log. Correct typos and SF.net URIs. Version 1.2.13.1 * 2011-05-29 * Conversion to Git SCM and updated README documentation for Git SCM * Mingw32 build fixes * FUNcube dongle USB fixes for Win32 * Added kit/README.funcubedongle * Bug fix--K3 antenna selection function Version 1.2.13 2011-03-12 * New models: VX-1700, FUNcube Dongle, FiFi-SDR, KTH-SDR Si570, FT-DX5000, TS-590S, TH-F6A, PRM8060, SR-2200 * Rotor fixes and features: SPID * New Rotor backend: F1TE Tracker * Fixes and features: TS-440S, K2, K3, THF6A, THF7E, NewCAT rigs serial port defaults, TM-D700, FT-950, Si570 AVR-USB * Removed libtool tree from source tree * Removed old DocBook files * Allow USB device's VID/PID/Vendor/Product to be explicitly specified * Doxygen documentation updates and new style sheet Version 1.2.12 2010-09-03 * New models: PCR-2500, RX331, TRP 8255 S R * New rotator backends: DF9GR's ERC * Fixes and features: Paragon, TS-690S, FT-920, FT-990, FT-2000, Elektor SDR-USB, IC-7000, IC-7700, AR-8200, AR-8600 Version 1.2.11 2010-05-31 * New models: RA-3702, IC-738, IC-7600, IC-7700, AR 7030+, FT-980, TT-536 Delta-II, R&S EB200 * New rotator backends: GS-232B, GS-232 (not A or B), ARS RCI, M2 RC2800 * Fixes and features: TH-F7E, FT-847, FT-736, FT-920, FT767GX, FT-747, FT-950, FT-450, Yaesu NewCAT, PCR*, IC-706MkIIG, IC-7800, R-8A, Paragon * rigctld/rotctld * ltdl security update * IPv6 ready * bindings not built by default Version 1.2.10 2009-11-02 * New models: IC-7200, PCR-1500, RX-340, R&S ESMC, BC898T, Si570 AVR-USB, Paragon (skeleton) * New rotator backend: SPID * Fixes and features: TH-F7E, K2, FT-920, Yaesu NewCAT, IC-7000, IC-7800, IC-910, IC-718, IC-756PROIII, Tentec Orion, Jupiter, RX320, AOR-8000, PCR-1000, Video4Linux, all the kenwood backends, GS-232A * ABI version in backend symbols * expose PTT/DCD setup through rig_set_conf() * Parallel port PTT now following cwdaemon (STROBE+INIT) interface * bindings * ltdl update Version 1.2.9 2009-02-25 * New models: FT2000, FT9000, TT-588 Omni VII, FT-840, NRD525, Winradio G305, TRC-80 * New rotator backend: Heathkit HD 1780 Intellirotor * Fixes and features: IC-706*, IC-910, K2, K3, DWT, PCR-100, PCR-1000, RX-320, FT-450, FT-747, FT-817, FT-847, FT-857, FT-990, FT-1000D, Orion, netrot, Rotor-EZ, dummy rig and dummy rotator * Bug fix in qrb() * Better assisted split operation * ext_level/ext_parm examples * Documentation update Version 1.2.8 2008-11-02 * New models: BC235, BC250, BC780, PRO-2052, BCD396T, BCD996T, K3, FT950 * New pseudo models: netrigctl/netrotctl, backends ala rpcrig/rpcrot, but based on rigctld/rotctld * New rotator backend: GS232A, PcRotor * Removed microtune backend * Fixes: DttSP, IC-275, IC-475, IC-725, IC-735, IC-756PRO, IC-761, IC-775, IC-781, IC-706*, Kenwood TH/TM models, Orion, BC245, BC895, FT-100, FT757GX, FT-857, FT-897, FT-920 * Numerous bindings fixes, esp. for memory channel works * New commands available in rigctl * New rotctld to go with rigctld rig daemon. The protocol changed, but there's the compatibility option -e to pass to the daemon for previous protocol. Version 1.2.7.1 2008-04-11 * New model: miniVNA * Fixes: FT1000MP, Tentec Orion, Omni VI Plus * AOR: implemented scanning * Kenwood models TS2000, TS870S can now get/set antenna. TS2000 gained strength meter calibration. Version 1.2.7 2008-02-13 * Improved Documentation * New models: IC-820H, DttSP, Elektor SDR-USB, DDS-60, FT-450, FT-767GX * Fixes: IC-746, IC-765, IC-910, Kenwood, FT1000MP, FT817, .. * New rigsmtr toy to graph polar signal strength * New experimental rigctld rig daemon, with simple protocol Version 1.2.6.2 * Fixes: TS570 (Split, RIT/XIT), IC910H * Improved Tentec Orion,RX-320 functionality * Improved Winradio G-313 * Better man pages Version 1.2.6.1 * Icom protocol fixes * bindings build fixing Version 1.2.6 2006-12-22 * Bump version to 1.2.6 * no changes from 1.2.6rc1 Version 1.2.6rc1 2006-12-10 * Python 2.4 compatibility * Improved TS570 functionality * Improved Argonaut V functionality * New models: IC7000, G313i/G313e * Many Icom, Kenwood, and Tentec fixes. * Build system fixes Version 1.2.5 2006-02-26 * frontend API: support for clonable rigs - rigmem: CSV format change - rigctl: new send_cmd for protocol debugging purpose - easy USB devices support * new models: AR8600, AR2700, DWT (DLL based under Windows, need test under other OS) * fixes: big AOR update, AR7030, Orion, NRD-545, RX-320, FT-817, FT-990, TS-2000, Easycomm * port: BSD fix of parallel port support Version 1.2.4 2005-04-03 * frontend API: port_t renamed as hamlib_port_t * new models: TS-480, VR5000, FT1000MkV Fld * fixes: TS-570S, AR7030, AR3000A, Orion, FT-897, IC746 * port: fixed 64bit int handling which potentially fixes backends kenwood/alinco/pcr/uniden/aor/jrc/tentec, added xBSD parallel port support Version 1.2.3 2004-11-17 * frontend API: LEVEL_SQLSTAT marked as deprecated * new backends: Racal, V4L radio cards, Watkins-Johnson 8888 * new models: IC-78, IC-7800, IC-R20, IC-756PROIII * fixes: AOR 5k&8k: added S-Meter, 7030: fixed freq, IC-R8500: calibrated S-Meter, Jupiter and many others.. * port: mingw32 support with gcc 3.4 version Version 1.2.2 2004-08-23 * new models: Ten-Tec (Orion), AOR 3030, Yaesu FRG's, Skanti * fixes: JRC NRD435 & NRD535, Drake, AOR3000, and many other * port: Fixes for BRK/RTS/DTR handling under win32 (-> Elektor304) * bindings: updated Visual Basic wrapper file * rigswr: new command to measure VSWR vs frequency Version 1.2.1 2004-05-19 * API change: added RIG_AGC_MEDIUM enum * new backends: kit (Elektor304) * new models: Winradio (G303 under Win32), Kenwood (TMD700,R5000,..), Yaesu(FT757GX,FRG8800), Ten-Tec (Jupiter,RX340,RX350) * fixes: JRC NRD435 & NRD535, and many other * port: made rig.h more Visual C++ friendly, along an import lib Version 1.2.0 2004-02-16 * API change: - freq_t type changed from long long to double - setting_t changed from long long to long int. - locator and dec/dms interface rework - bump library CURRENT version info * new backends: Lowe (HF-235), FlexRadio (SDR-1000), skelton TAPR (DSP-10), skelton RFT, Ten-Tec models and many new models & fixes * new rotator backends: sartek * frontend: emulated transceive mode using polling * icom: implemented retry, esp. useful for CI-V * icom: pipelined tuning on Optoscan's * microtune: no need of root priviledges anymore * bindings: added Python, new install method (perl is installed in $prefix) * rigmem: new command to load/store memory content from/to XML file * port: NetBSD & FreeBSD, mingw32(Windows) port, MacOSX ready Version 1.1.4 2003-04-28 * new backends: Drake (R8B), GNU Radio (experimental), microtune, and many new rig models * new rotator backends: fodtrack, rotorez * better doxygenized documentation * reworked perl and tcl bindings using swig * vfo_t rework * gcc-3.x compilance Version 1.1.3 2002-06-17 * new backend: JRC (NRD-545), and many new rig models * rotator frontend, new easycomm backend * added Kylix and perl bindings and completed tcl/tk support * networked (RPC) rig and rotator Version 1.1.2 2001-09-23 * License converted to LGPL * new backends: Alinco (DX-77), Uniden (BC895), Ten-Tec (RX320), Kachina (505DSP) * New port_t design, coming with easy rig auto-probe * mv_ctl replaced by vfo_op, set_vfo/get_vfo extended to RIG_VFO_MEM * set_conf/get_conf for opaque variable parameters setting * Better portability, esp. with libtool (DLL dlopen'ing works under Win32 !) * added C++ and tcl/tk bindings (not complete yet) * converted from hamlib-doc to doxygen in-source interface documenting Version 1.1.1 2001-05-26 * new backends: Kenwood (TS870S), WiNRADiO, PCR-1000, Dummy (for tests) * Hamlib frontend will take care of backends that can't target VFO. * Extended API: caps, levels, parms, etc. * rig_set_mode/rig_get_mode changed again, now use filter caps * more fields shadowed in rig->state, etc. * rigctl now works also non-interactively * get_channel/set_channel can be emulated and new dumpmem utility * will not compile on pure ANSI C compiler, because of gcc struct extension Version 1.1.0 2000-11-11 * First draft of a generic API, abstracting radios differences behind a set of capabilities. * Hamlib is (somewhat) conform to GNU coding standards, and so it uses configure script generated by Automake and Autoconf * Included hamlib-doc system to generate man pages, API references in html format. * 2 new backends: Icom (CI-V) with IC706 series, and AOR (AR8200) Version 1.0.0 Initial release. ------------------------------------------------------- Copying information: This file is licensed to you under the license specified in the included file `LICENSE'. Look there for further details. hamlib-1.2.15.3/uniden/0000755000175000017500000000000012044565020011456 500000000000000hamlib-1.2.15.3/uniden/uniden_digital.c0000644000175000017500000002555212044564477014551 00000000000000/* * Hamlib Uniden backend - uniden_digital backend * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "uniden_digital.h" /* * Uniden Digital backend should work for: * BCD996T as well as the BCD396T. Some protocols available for the * BCD996T may not be available for the BCD396T or modified to work. * * Protocol information can be found here: * http://www.uniden.com/files/BCD396T_Protocol.pdf * http://www.uniden.com/files/BCD996T_Protocol.pdf * * There are undocumented commands such as firmware_dump and * firmware_load. These commands are defined within DSctl code. * * There are two methods of retrieving the next memory location * (aka frequency bank). Use either the "Get Next Location" or * use the address returned from one of the commands. If you decide * the latter method, the order is slightly confusing but, I have it * well documented within DSctl. The latter method is also as much * as 30% faster then using the Uniden software or "Get Next * Location" command. */ static const struct { rig_model_t model; const char *id; } uniden_id_string_list[] = { { RIG_MODEL_BCD396T, "BCD396T" }, { RIG_MODEL_BCD996T, "BCD99tT" }, { RIG_MODEL_NONE, NULL }, /* end marker */ }; /* EOM is not consistant with this BCD996T! * Some commands return newline while others carriage return. * Some commands return nothing special for End of Line char. */ #define EOM "\r" /* end of message */ /* I'm still getting clipped output from buffers being too small elsewhere! */ #define BUFSZ 256 /* Wild guess, 64 was too small. */ /** * uniden_transaction * uniden_digital_transaction * Assumes rig!=NULL rig->state!=NULL rig->caps!=NULL * * cmdstr - Command to be sent to the rig. Cmdstr can also be NULL, indicating * that only a reply is needed (nothing will be send). * replystr - Reply prefix to be expected. Replystr can also be NULL, indicating * that the prefix is either the cmdstr prefix or OK. * data - Buffer for reply string. Can be NULL, indicating that no reply is * is needed and will return with RIG_OK after command was sent. * datasize - in: Size of buffer. It is the caller's responsibily to provide * a large enough buffer for all possible replies for a command. * out: location where to store number of bytes read. * * returns: * RIG_OK - if no error occured. * RIG_EIO - if an I/O error occured while sending/receiving data. * RIG_ETIMEOUT - if timeout expires without any characters received. * RIG_REJECTED - if a negative acknowledge was received or command not * recognized by rig. */ int uniden_digital_transaction (RIG *rig, const char *cmdstr, int cmd_len, const char *replystr, char *data, size_t *datasize) { struct rig_state *rs; int retval; int retry_read = 0; char replybuf[BUFSZ]; size_t reply_len=BUFSZ; rs = &rig->state; rs->hold_decode = 1; transaction_write: serial_flush(&rs->rigport); if (cmdstr) { retval = write_block(&rs->rigport, cmdstr, strlen(cmdstr)); if (retval != RIG_OK) goto transaction_quit; } /* Always read the reply to known if it went OK */ if (!data) data = replybuf; if (!datasize) datasize = &reply_len; memset(data,0,*datasize); retval = read_string(&rs->rigport, data, *datasize, EOM, strlen(EOM)); if (retval < 0) { if (retry_read++ < rig->state.rigport.retry) goto transaction_write; goto transaction_quit; } else *datasize = retval; /* Check that command termination is correct * FIXME: Sometimes the BCD996T DOES NOT return a * consistant carriage return or newline. * ie: STS command will not return either "\r" or "\n"! */ /*if (strchr(EOM, data[strlen(data)-1])==NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __FUNCTION__, data); if (retry_read++ < rig->state.rigport.retry) goto transaction_write; retval = -RIG_EPROTO; goto transaction_quit; }*/ if (strcmp(data, "OK"EOM)) { /* everything is fine */ retval = RIG_OK; goto transaction_quit; } /* Any syntax returning NG indicates a VALID Command but not entered * in the right mode or using the correct parameters. ERR indicates * an INVALID Command. */ if (strcmp(data, "NG"EOM)) { /* Invalid command */ rig_debug(RIG_DEBUG_VERBOSE, "%s: Command Format Error / Value Error for '%s'\n", __FUNCTION__, cmdstr); retval = -RIG_EPROTO; goto transaction_quit; } if (strcmp(data, "ERR"EOM)) { /* Command format error */ rig_debug(RIG_DEBUG_VERBOSE, "%s: The Command is Invalid at this Time for '%s'\n", __FUNCTION__, cmdstr); retval = -RIG_EINVAL; goto transaction_quit; } if (strcmp(data, "FER"EOM)) { /* Framing error */ rig_debug(RIG_DEBUG_VERBOSE, "%s: Framing Error for '%s'\n", __FUNCTION__, cmdstr); retval = -RIG_EINVAL; goto transaction_quit; } if (strcmp(data, "ORER"EOM)) { /* Overrun error */ rig_debug(RIG_DEBUG_VERBOSE, "%s: Overrun Error for '%s'\n", __FUNCTION__, cmdstr); retval = -RIG_EINVAL; goto transaction_quit; } #define CONFIG_STRIP_CMDTRM 1 #ifdef CONFIG_STRIP_CMDTRM if (strlen(data) > 0) data[strlen(data)-1] = '\0'; /* not very elegant, but should work. */ else data[0] = '\0'; #endif /* Special case for SQuelch */ /*if (!memcmp(cmdstr,"SQ",2) && (replystr[0] == '-' || replystr[0] == '+')) { retval = RIG_OK; goto transaction_quit; }*/ /* Command prefix if no replystr supplied */ if (!replystr) replystr = cmdstr; /* * Check that received the correct reply. The first two characters * should be the same as command. */ if (replystr && replystr[0] && (data[0] != replystr[0] || (replystr[1] && data[1] != replystr[1]))) { /* * TODO: When RIG_TRN is enabled, we can pass the string * to the decoder for callback. That way we don't ignore * any commands. */ rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __FUNCTION__, data); if (retry_read++ < rig->state.rigport.retry) goto transaction_write; retval = -RIG_EPROTO; goto transaction_quit; } retval = RIG_OK; transaction_quit: rs->hold_decode = 0; return retval; } /* * uniden_get_info * Assumes rig!=NULL */ const char * uniden_digital_get_info(RIG *rig) { static char infobuf[BUFSZ]; size_t info_len=BUFSZ/2, mdlinfo_len=BUFSZ/2; int ret; /* GET CURRENT STATUS -- STS */ ret = uniden_digital_transaction (rig, "STS" EOM, 3, NULL, infobuf, &info_len); /* NOTE FOR ME: Check Buffer Size with what we got returned in info_len. * Don't know the max length of return on these units, so check frequently! * Use five v's (-vvvvv) to activate output. */ rig_debug(RIG_DEBUG_VERBOSE, "%s: DEBUG BUFSZ'%i'\n", __FUNCTION__, BUFSZ); rig_debug(RIG_DEBUG_VERBOSE, "%s: DEBUG info_len'%i'\n", __FUNCTION__, info_len); if (ret != RIG_OK) return NULL; /* Example output: * STS,011000, XXX ,,Fa * * STS command returns 3 lines including system, truck, freq info * * XXX indicates the BCD996T returns some non-printable ascii chars * within it's comma separated fields. See pg 30-32 of BCD996T_Protocol.pdf. * These chars cause abnomalies on stdout! */ /* FIXME: Strip or replace non-printable chars return from STS command! * (Below is a snip from DSctl utils.c file) * * For example, search each character. For each sequence of chars found, replace with normal printable ascii [KEY] * if (strstr(bcd_chars, "\213") != 0) * strncat(tmp_line, "[FUNCTION KEY] ", 15); * * if (strstr(bcd_chars, "\215\216\217\220") != 0) * strncat(tmp_line, "[HOLD] ", 7); */ if (info_len < 4) return NULL; if (info_len >= BUFSZ) { rig_debug(RIG_DEBUG_VERBOSE, "%s: DEBUG Max BUFSZ Reached: info_len = '%i'\n", __FUNCTION__, info_len); info_len = BUFSZ-1; } infobuf[info_len] = '\0'; /* VR not on every rig <- This doesn't belong here for the newer BCD* units*/ /* VR1.00 */ /*ret = uniden_digital_transaction (rig, "VR" EOM, 2, NULL, infobuf+info_len, &vrinfo_len); if (ret == RIG_OK) {*/ /* overwrite "VR" */ /* FIXME: need to filter \r or it screws w/ stdout */ /*infobuf[info_len] = '\n'; infobuf[info_len+1] = ' '; } else { infobuf[info_len] = '\0'; }*/ /* GET MODEL INFO -- MDL */ ret = uniden_digital_transaction (rig, "MDL" EOM, 3, NULL, infobuf+info_len, &mdlinfo_len); if (ret == RIG_OK) { infobuf[info_len] = '\n'; infobuf[info_len+1] = ' '; } else { infobuf[info_len] = '\0'; } /* GET FIRMWARE VERSION -- VER */ ret = uniden_digital_transaction (rig, "VER" EOM, 3, NULL, infobuf+info_len, &mdlinfo_len); if (ret == RIG_OK) { infobuf[info_len] = '\n'; infobuf[info_len+1] = ' '; } else { infobuf[info_len] = '\0'; } /* skip beginning "STS, " */ /* FIXME: What about clipping the above two other MDL & VER Commands? */ return infobuf+4; } /* * skeleton */ int uniden_digital_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { #if 0 char freqbuf[BUFSZ]; size_t freq_len=BUFSZ; /* freq in hundreds of Hz */ freq /= 100; /* exactly 8 digits */ freq_len = sprintf(freqbuf, "RF%08u" EOM, (unsigned)freq); return uniden_transaction (rig, freqbuf, freq_len, NULL, NULL, NULL); #else return -RIG_ENIMPL; #endif } /* * skeleton */ int uniden_digital_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { #if 0 char freqbuf[BUFSZ]; size_t freq_len=BUFSZ; int ret; ret = uniden_transaction (rig, "RF" EOM, 3, NULL, freqbuf, &freq_len); if (ret != RIG_OK) return ret; if (freq_len < 10) return -RIG_EPROTO; sscanf(freqbuf+2, "%"SCNfreq, freq); /* returned freq in hundreds of Hz */ *freq *= 100; return RIG_OK; #else return -RIG_ENIMPL; #endif } hamlib-1.2.15.3/uniden/bc895.c0000644000175000017500000000746512044564477012427 00000000000000/* * Hamlib Uniden backend - BC895 description * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "uniden.h" #define BC895_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define BC895_FUNC (RIG_FUNC_MUTE) #define BC895_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_RAWSTR) #define BC895_PARM_ALL (RIG_PARM_NONE) #define BC895_VFO RIG_VFO_A #define BC895_CHANNEL_CAPS \ UNIDEN_CHANNEL_CAPS \ .ctcss_sql=1, \ .dcs_sql=1 /* The BC895 seems to max out at 32 while 12 seems to be about minimum. */ #define BC895_STR_CAL { 4, \ { \ { 0, -54 }, \ { 12, -20 }, /* TBC */ \ { 32, 4 }, /* TBC */ \ { 255, 60 }, \ } } /* * 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 = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRUNKSCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 2400, .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 = uniden_ctcss_list, .dcs_list = uniden_dcs_list, .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 = 10, /* A..J */ .chan_desc_sz = 0, .str_cal = BC895_STR_CAL, .chan_list = { { 1, 300, RIG_MTYPE_MEM, {BC895_CHANNEL_CAPS} }, 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,kHz(5)}, {BC895_MODES,kHz(7.5)}, {BC895_MODES,kHz(10)}, {BC895_MODES,kHz(12.5)}, {BC895_MODES,kHz(25)}, {BC895_MODES,kHz(50)}, RIG_TS_END, 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, .get_freq = uniden_get_freq, .set_mode = uniden_set_mode, .get_mode = uniden_get_mode, .set_mem = uniden_set_mem, .get_mem = uniden_get_mem, .get_dcd = uniden_get_dcd, .get_info = uniden_get_info, .get_level = uniden_get_level, .set_level = uniden_set_level, .get_channel = uniden_get_channel, .set_channel = uniden_set_channel, }; /* * Function definitions below */ hamlib-1.2.15.3/uniden/bc245.c0000644000175000017500000000676412044564477012415 00000000000000/* * Hamlib Uniden backend - BC245 description * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "uniden.h" #define BC245_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define BC245_FUNC (RIG_FUNC_MUTE) #define BC245_LEVEL_ALL (RIG_LEVEL_ATT) #define BC245_PARM_ALL (RIG_PARM_NONE) #define BC245_VFO RIG_VFO_A /* * bc245 rig capabilities. * * TODO: check this with manual or web site. */ const struct rig_caps bc245_caps = { .rig_model = RIG_MODEL_BC245, .model_name = "BC245xlt", .mfg_name = "Uniden", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRUNKSCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 2400, .serial_rate_max = 19200, .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 = BC245_FUNC, .has_set_func = BC245_FUNC, .has_get_level = BC245_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(BC245_LEVEL_ALL), .has_get_parm = BC245_PARM_ALL, .has_set_parm = RIG_PARM_SET(BC245_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 }, 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(54),BC245_MODES,-1,-1,BC245_VFO}, {MHz(108),MHz(174),BC245_MODES,-1,-1,BC245_VFO}, {MHz(406),MHz(512),BC245_MODES,-1,-1,BC245_VFO}, {MHz(806),MHz(956),BC245_MODES,-1,-1,BC245_VFO}, /* TODO: less cellular */ RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {BC245_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, .get_freq = uniden_get_freq, .set_mode = uniden_set_mode, .get_mode = uniden_get_mode, .set_mem = uniden_set_mem, .get_mem = uniden_get_mem, .get_dcd = uniden_get_dcd, .get_info = uniden_get_info, .get_level = uniden_get_level, .set_level = uniden_set_level, .get_channel = uniden_get_channel, .set_channel = uniden_set_channel, }; /* * Function definitions below */ hamlib-1.2.15.3/uniden/bc898.c0000644000175000017500000001041512044564477012417 00000000000000/* * Hamlib Uniden backend - BC898 description * Copyright (c) 2001-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "uniden.h" #define BC898_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define BC898_FUNC (RIG_FUNC_MUTE) #define BC898_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_RAWSTR) #define BC898_PARM_ALL (RIG_PARM_NONE) #define BC898_VFO RIG_VFO_A #define BC898_CHANNEL_CAPS \ UNIDEN_CHANNEL_CAPS \ .ctcss_sql=1, \ .dcs_sql=1 /* The BC898 seems to max out at 32 while 12 seems to be about minimum. */ #define BC898_STR_CAL { 4, \ { \ { 0, -54 }, \ { 12, -20 }, /* TBC */ \ { 32, 4 }, /* TBC */ \ { 255, 60 }, \ } } static const tone_t bc898_ctcss_list[] = { 670, 693, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, 1365, 1413, 1462, 1514, 1567, 1598, 1622, 1655, 1679, 1713, 1738, 1773, 1799, 1835, 1862, 1899, 1928, 1966, 1995, 2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541, 0 }; /* * bc898 rig capabilities. * * TODO: check this with manual or web site. * http://www.uniden.com/products/productdetail.cfm?product=BC898T&filter=Mobile */ const struct rig_caps bc898_caps = { .rig_model = RIG_MODEL_BC898, .model_name = "BC898T", .mfg_name = "Uniden", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRUNKSCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 2400, .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 = BC898_FUNC, .has_set_func = BC898_FUNC, .has_get_level = BC898_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(BC898_LEVEL_ALL), .has_get_parm = BC898_PARM_ALL, .has_set_parm = RIG_PARM_SET(BC898_PARM_ALL), .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = bc898_ctcss_list, .dcs_list = uniden_dcs_list, .preamp = { RIG_DBLST_END }, .attenuator = { 20, RIG_DBLST_END }, /* TBC */ .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_OFF, .bank_qty = 10, /* A..J */ .chan_desc_sz = 0, .str_cal = BC898_STR_CAL, .chan_list = { { 1, 500, RIG_MTYPE_MEM, {BC898_CHANNEL_CAPS} }, RIG_CHAN_END, }, .rx_range_list1 = { {MHz(25),MHz(956),BC898_MODES,-1,-1,BC898_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { /* TODO: is it really continuous coverage ? what about cellular? */ {MHz(25),MHz(956),BC898_MODES,-1,-1,BC898_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {BC898_MODES,kHz(5)}, {BC898_MODES,kHz(6.25)}, {BC898_MODES,kHz(12.5)}, {BC898_MODES,kHz(25)}, 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, .get_freq = uniden_get_freq, .set_mode = uniden_set_mode, .get_mode = uniden_get_mode, .set_mem = uniden_set_mem, .get_mem = uniden_get_mem, .get_dcd = uniden_get_dcd, .get_info = uniden_get_info, .get_level = uniden_get_level, .set_level = uniden_set_level, .get_channel = uniden_get_channel, .set_channel = uniden_set_channel, }; /* * Function definitions below */ hamlib-1.2.15.3/uniden/bc780.c0000644000175000017500000000744712044564477012420 00000000000000/* * Hamlib Uniden backend - BC780 description * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "uniden.h" #define BC780_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define BC780_FUNC (RIG_FUNC_MUTE) #define BC780_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_RAWSTR) #define BC780_PARM_ALL (RIG_PARM_NONE) #define BC780_VFO RIG_VFO_A #define BC780_CHANNEL_CAPS \ UNIDEN_CHANNEL_CAPS \ .channel_desc=1, \ .ctcss_sql=1, \ .dcs_sql=1 #define BC780_STR_CAL UNIDEN_STR_CAL /* * bc780 rig capabilities. * * TODO: check this with manual or web site. */ const struct rig_caps bc780_caps = { .rig_model = RIG_MODEL_BC780, .model_name = "BC780xlt", .mfg_name = "Uniden", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRUNKSCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 2400, .serial_rate_max = 19200, .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 = BC780_FUNC, .has_set_func = BC780_FUNC, .has_get_level = BC780_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(BC780_LEVEL_ALL), .has_get_parm = BC780_PARM_ALL, .has_set_parm = RIG_PARM_SET(BC780_PARM_ALL), .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = uniden_ctcss_list, .dcs_list = uniden_dcs_list, .preamp = { RIG_DBLST_END }, .attenuator = { 20, RIG_DBLST_END }, /* TBC */ .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_OFF, .bank_qty = 10, /* A..J */ .chan_desc_sz = 16, .str_cal = BC780_STR_CAL, .chan_list = { { 0, 499, RIG_MTYPE_MEM, {BC780_CHANNEL_CAPS} }, RIG_CHAN_END, }, .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {MHz(25),MHz(512),BC780_MODES,-1,-1,BC780_VFO}, {MHz(806),MHz(956),BC780_MODES,-1,-1,BC780_VFO}, /* (minus Cellular frequencies) */ {MHz(1240),MHz(1300),BC780_MODES,-1,-1,BC780_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {BC780_MODES,kHz(5)}, {BC780_MODES,kHz(7.5)}, {BC780_MODES,kHz(10)}, {BC780_MODES,kHz(12.5)}, {BC780_MODES,kHz(50)}, RIG_TS_END, 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, .get_freq = uniden_get_freq, .set_mode = uniden_set_mode, .get_mode = uniden_get_mode, .set_mem = uniden_set_mem, .get_mem = uniden_get_mem, .get_dcd = uniden_get_dcd, .get_info = uniden_get_info, .get_level = uniden_get_level, .set_level = uniden_set_level, .get_channel = uniden_get_channel, .set_channel = uniden_set_channel, }; /* * Function definitions below */ hamlib-1.2.15.3/uniden/pro2052.c0000644000175000017500000001065012044564477012674 00000000000000/* * Hamlib Uniden backend - Radio Shack PRO-2052 description * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "uniden.h" #define PRO2052_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define PRO2052_FUNC (RIG_FUNC_MUTE) #define PRO2052_LEVEL_ALL (RIG_LEVEL_NONE) #define PRO2052_PARM_ALL (RIG_PARM_NONE) #define PRO2052_VFO RIG_VFO_A #define PRO2052_CHANNEL_CAPS \ UNIDEN_CHANNEL_CAPS /* * PRO-2052 rig capabilities. * * From http://www.cantonmaine.com/pro2052.htm: * After connecting the cable, turn on the computer and the scanner and then * press and hold the Remote/Hold button on the scanner until you see "SFT" * flashing on the right side of the LCD. You should now be communicating * with the scanner. If it doesn't work, check all the normal stuff for * whatever it was you overlooked. NOTE: You can change the scanner's * default * baud rate by holding down the Remote/Hold button while turning * on the scanner.) * * TODO: check this with manual or web site. */ const struct rig_caps pro2052_caps = { .rig_model = RIG_MODEL_PRO2052, .model_name = "PRO-2052", .mfg_name = "Radio Shack", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRUNKSCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 2400, .serial_rate_max = 19200, .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 = PRO2052_FUNC, .has_set_func = PRO2052_FUNC, .has_get_level = PRO2052_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(PRO2052_LEVEL_ALL), .has_get_parm = PRO2052_PARM_ALL, .has_set_parm = RIG_PARM_SET(PRO2052_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 = 10, /* A..J */ .chan_desc_sz = 0, .chan_list = { { 0, 999, RIG_MTYPE_MEM, {PRO2052_CHANNEL_CAPS} }, 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(54),PRO2052_MODES,-1,-1,PRO2052_VFO}, {MHz(108),MHz(174),PRO2052_MODES,-1,-1,PRO2052_VFO}, {MHz(179.75),MHz(512),PRO2052_MODES,-1,-1,PRO2052_VFO}, {MHz(806),MHz(823.9375),PRO2052_MODES,-1,-1,PRO2052_VFO}, {MHz(851),MHz(868.9875),PRO2052_MODES,-1,-1,PRO2052_VFO}, {MHz(896.1125),MHz(956),PRO2052_MODES,-1,-1,PRO2052_VFO}, {MHz(1240),MHz(1300),PRO2052_MODES,-1,-1,PRO2052_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {PRO2052_MODES,kHz(5)}, {PRO2052_MODES,kHz(7.5)}, {PRO2052_MODES,kHz(10)}, {PRO2052_MODES,kHz(12.5)}, {PRO2052_MODES,kHz(25)}, {PRO2052_MODES,kHz(50)}, 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, .get_freq = uniden_get_freq, .set_mode = uniden_set_mode, .get_mode = uniden_get_mode, .set_mem = uniden_set_mem, .get_mem = uniden_get_mem, .get_dcd = uniden_get_dcd, .get_info = uniden_get_info, .get_level = uniden_get_level, .set_level = uniden_set_level, .get_channel = uniden_get_channel, .set_channel = uniden_set_channel, }; /* * Function definitions below */ hamlib-1.2.15.3/uniden/uniden.h0000644000175000017500000000523512044564477013055 00000000000000/* * Hamlib Uniden backend - main header * Copyright (c) 2001-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _UNIDEN_H #define _UNIDEN_H 1 #include #include #define BACKEND_VER "0.3" /* TODO: Trunk, Delay, Recording * * .channel_desc=1 is only on BC780 BC250 BC785 * .ctcss_sql=1, * .dcs_sql=1, */ #define UNIDEN_CHANNEL_CAPS \ .freq=1,\ .levels=RIG_LEVEL_ATT,\ .flags=1, /* L/O */ /* Calibration, actually from the BC785D */ #define UNIDEN_STR_CAL { 8, \ { \ { 0, -54 }, \ { 134, -20 }, /* < 0.50uV */ \ { 157, -12 }, \ { 173, -9 }, \ { 189, -5 }, \ { 204, -1 }, \ { 221, 4 }, /* < 7.50uV */ \ { 255, 60 }, \ } } extern const tone_t uniden_ctcss_list[]; extern const tone_t uniden_dcs_list[]; int uniden_transaction (RIG *rig, const char *cmdstr, int cmd_len, const char *replystr, char *data, size_t *datasize); int uniden_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int uniden_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int uniden_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int uniden_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int uniden_set_mem(RIG *rig, vfo_t vfo, int ch); int uniden_get_mem(RIG *rig, vfo_t vfo, int *ch); int uniden_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); int uniden_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int uniden_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int uniden_get_channel(RIG *rig, channel_t *chan); int uniden_set_channel(RIG *rig, const channel_t *chan); const char* uniden_get_info(RIG *rig); extern const struct rig_caps bc895_caps; extern const struct rig_caps bc898_caps; extern const struct rig_caps bc245_caps; extern const struct rig_caps bc780_caps; extern const struct rig_caps bc250_caps; extern const struct rig_caps pro2052_caps; extern const struct rig_caps bcd396t_caps; extern const struct rig_caps bcd996t_caps; #endif /* _UNIDEN_H */ hamlib-1.2.15.3/uniden/bcd996t.c0000644000175000017500000000701012044564477012743 00000000000000/* * Hamlib Uniden backend - BCD996T description * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" /*#include "uniden.h"*/ #include "uniden_digital.h" /* TODO: All these defines have to be filled in properly */ #define BCD996T_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define BCD996T_FUNC (RIG_FUNC_MUTE) #define BCD996T_LEVEL_ALL (RIG_LEVEL_ATT) #define BCD996T_PARM_ALL (RIG_PARM_BEEP|RIG_PARM_BACKLIGHT) #define BCD996T_VFO (RIG_VFO_A|RIG_VFO_B) #define BCD996T_CHANNEL_CAPS \ .freq=1,\ .flags=1, /* L/O */ /* * bcd996t rig capabilities. * * TODO: check this with manual or web site. */ const struct rig_caps bcd996t_caps = { .rig_model = RIG_MODEL_BCD996T, .model_name = "BCD-996T", .mfg_name = "Uniden", .version = BACKEND_DIGITAL_VER, .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRUNKSCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 9600, .serial_rate_max = 115200, .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 = 2000, .retry = 3, .has_get_func = BCD996T_FUNC, .has_set_func = BCD996T_FUNC, .has_get_level = BCD996T_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(BCD996T_LEVEL_ALL), .has_get_parm = BCD996T_PARM_ALL, .has_set_parm = RIG_PARM_SET(BCD996T_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 = { { 0, 5999, RIG_MTYPE_MEM, {BCD996T_CHANNEL_CAPS} }, /* Really 6000 channels? */ RIG_CHAN_END, }, .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {MHz(25),MHz(512),BCD996T_MODES,-1,-1,BCD996T_VFO}, {MHz(764),MHz(776),BCD996T_MODES,-1,-1,BCD996T_VFO}, {MHz(794),MHz(956),BCD996T_MODES,-1,-1,BCD996T_VFO}, {MHz(1240),MHz(1300),BCD996T_MODES,-1,-1,BCD996T_VFO}, /* TBC */ RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {BCD996T_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, }, .get_info = uniden_digital_get_info, .set_freq = uniden_digital_set_freq, .get_freq = uniden_digital_get_freq, }; /* * Function definitions below */ hamlib-1.2.15.3/uniden/uniden.c0000644000175000017500000004231112044564477013044 00000000000000/* * Hamlib Uniden backend - main file * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "register.h" #include "idx_builtin.h" #include "uniden.h" static const struct { rig_model_t model; const char *id; } uniden_id_string_list[] = { { RIG_MODEL_BC780, "BC780" }, { RIG_MODEL_BC245, "BC245XLT" }, { RIG_MODEL_BC250, "BC250D" }, { RIG_MODEL_BC895, "BC895" }, { RIG_MODEL_BC235, "BC235XLT" }, { RIG_MODEL_BC785, "BC785" }, { RIG_MODEL_BC786, "BC786D" }, { RIG_MODEL_PRO2052,"PRO2052" }, /* ?? */ { RIG_MODEL_BCT8, "BCT8" }, /* ?? */ { RIG_MODEL_BC898, "BC898T" }, /* TBC */ { RIG_MODEL_NONE, NULL }, /* end marker */ }; const tone_t uniden_ctcss_list[] = { 670, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, 1365, 1413, 1462, 1514, 1567, 1622, 1679, 1738, 1799, 1862, 1928, 2035, 2107, 2181, 2257, 2336, 2418, 2503, 0 }; const tone_t uniden_dcs_list[] = { 23, 25, 26, 31, 32, 36, 43, 47, 51, 53, 54, 65, 71, 72, 73, 74, 114, 115, 116, 122, 125, 131, 132, 134, 143, 145, 152, 155, 156, 162, 165, 172, 174, 205, 212, 223, 225, 226, 243, 244, 245, 246, 251, 252, 255, 261, 263, 265, 266, 271, 274, 306, 311, 315, 325, 331, 332, 343, 346, 351, 356, 364, 365, 371, 411, 412, 413, 423, 431, 432, 445, 446, 452, 454, 455, 462, 464, 465, 466, 503, 506, 516, 523, 526, 532, 546, 565, 606, 612, 624, 627, 631, 632, 654, 662, 664, 703, 712, 723, 731, 732, 734, 743, 754, 0 }; /* * Uniden backend: should work for: * BC235XLT, BC895XLT, BC245XLT, BC780XLT, BC250D, BC785D and BCT8 * and most probably for the RadioShack PRO-2052. * * Protocol information available at http://www.cantonmaine.com/pro2052.htm * and http://www.freqofnature.com/software/protocols.html * * It seems like these rigs have no VFO, I mean only mem channels. * Is that correct? --SF */ #define EOM "\r" #define BUFSZ 64 /** * uniden_transaction * Assumes rig!=NULL rig->state!=NULL rig->caps!=NULL * * cmdstr - Command to be sent to the rig. Cmdstr can also be NULL, indicating * that only a reply is needed (nothing will be send). * replystr - Reply prefix to be expected. Replystr can also be NULL, indicating * that the prefix is either the cmdstr prefix or OK. * data - Buffer for reply string. Can be NULL, indicating that no reply is * is needed and will return with RIG_OK after command was sent. * datasize - in: Size of buffer. It is the caller's responsibily to provide * a large enough buffer for all possible replies for a command. * out: location where to store number of bytes read. * * returns: * RIG_OK - if no error occured. * RIG_EIO - if an I/O error occured while sending/receiving data. * RIG_ETIMEOUT - if timeout expires without any characters received. * RIG_REJECTED - if a negative acknowledge was received or command not * recognized by rig. */ int uniden_transaction (RIG *rig, const char *cmdstr, int cmd_len, const char *replystr, char *data, size_t *datasize) { struct rig_state *rs; int retval; int retry_read = 0; char replybuf[BUFSZ]; size_t reply_len=BUFSZ; rs = &rig->state; rs->hold_decode = 1; transaction_write: serial_flush(&rs->rigport); if (cmdstr) { retval = write_block(&rs->rigport, cmdstr, strlen(cmdstr)); if (retval != RIG_OK) goto transaction_quit; } /* Always read the reply to known if it went OK */ if (!data) data = replybuf; if (!datasize) datasize = &reply_len; memset(data,0,*datasize); retval = read_string(&rs->rigport, data, *datasize, EOM, strlen(EOM)); if (retval < 0) { if (retry_read++ < rig->state.rigport.retry) goto transaction_write; goto transaction_quit; } else *datasize = retval; /* Check that command termination is correct */ if (strchr(EOM, data[strlen(data)-1])==NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __FUNCTION__, data); if (retry_read++ < rig->state.rigport.retry) goto transaction_write; retval = -RIG_EPROTO; goto transaction_quit; } if (strcmp(data, "OK"EOM)) { /* everything is fine */ retval = RIG_OK; goto transaction_quit; } /* Any syntax returning NG indicates a VALID Command but not entered * in the right mode or using the correct parameters. ERR indicates * an INVALID Command. */ if (strcmp(data, "NG"EOM) || strcmp(data, "ORER"EOM)) { /* Invalid command */ rig_debug(RIG_DEBUG_VERBOSE, "%s: NG/Overflow for '%s'\n", __FUNCTION__, cmdstr); retval = -RIG_EPROTO; goto transaction_quit; } if (strcmp(data, "ERR"EOM)) { /* Command format error */ rig_debug(RIG_DEBUG_VERBOSE, "%s: Error for '%s'\n", __FUNCTION__, cmdstr); retval = -RIG_EINVAL; goto transaction_quit; } #define CONFIG_STRIP_CMDTRM 1 #ifdef CONFIG_STRIP_CMDTRM if (strlen(data) > 0) data[strlen(data)-1] = '\0'; /* not very elegant, but should work. */ else data[0] = '\0'; #endif /* Special case for SQuelch */ if (!memcmp(cmdstr,"SQ",2) && (replystr[0] == '-' || replystr[0] == '+')) { retval = RIG_OK; goto transaction_quit; } /* Command prefix if no replystr supplied */ if (!replystr) replystr = cmdstr; /* * Check that received the correct reply. The first two characters * should be the same as command. */ if (replystr && replystr[0] && (data[0] != replystr[0] || (replystr[1] && data[1] != replystr[1]))) { /* * TODO: When RIG_TRN is enabled, we can pass the string * to the decoder for callback. That way we don't ignore * any commands. */ rig_debug(RIG_DEBUG_ERR, "%s: Unexpected reply '%s'\n", __FUNCTION__, data); if (retry_read++ < rig->state.rigport.retry) goto transaction_write; retval = -RIG_EPROTO; goto transaction_quit; } retval = RIG_OK; transaction_quit: rs->hold_decode = 0; return retval; } /* * uniden_set_freq * Assumes rig!=NULL */ int uniden_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char freqbuf[BUFSZ]; size_t freq_len=BUFSZ; /* freq in hundreds of Hz */ freq /= 100; /* exactly 8 digits */ freq_len = sprintf(freqbuf, "RF%08u" EOM, (unsigned)freq); return uniden_transaction (rig, freqbuf, freq_len, NULL, NULL, NULL); } /* * uniden_get_freq * Assumes rig!=NULL */ int uniden_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { char freqbuf[BUFSZ]; size_t freq_len=BUFSZ; int ret; ret = uniden_transaction (rig, "RF" EOM, 3, NULL, freqbuf, &freq_len); if (ret != RIG_OK) return ret; if (freq_len < 10) return -RIG_EPROTO; sscanf(freqbuf+2, "%"SCNfreq, freq); /* returned freq in hundreds of Hz */ *freq *= 100; return RIG_OK; } int uniden_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { const char *modebuf; switch (mode) { case RIG_MODE_AM: modebuf = "RM AM"EOM; break; case RIG_MODE_FM: if (width > 0 && width < rig_passband_normal(rig, mode)) modebuf = "RM NFM"EOM; else modebuf = "RM FM"EOM; break; case RIG_MODE_WFM: modebuf = "RM WFM"EOM; break; default: return -RIG_EINVAL; } return uniden_transaction (rig, modebuf, strlen(modebuf), NULL, NULL, NULL); } int uniden_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char modebuf[BUFSZ]; size_t mode_len=BUFSZ; int ret; ret = uniden_transaction (rig, "RM" EOM, 3, NULL, modebuf, &mode_len); if (ret != RIG_OK) return ret; if (mode_len < 4) return -RIG_EPROTO; *width = 0; if (!strcmp(modebuf+3, "AM")) *mode = RIG_MODE_AM; else if (!strcmp(modebuf+3, "WFM")) *mode = RIG_MODE_AM; else if (!strcmp(modebuf+3, "FM")) *mode = RIG_MODE_FM; else if (!strcmp(modebuf+3, "NFM")) { *mode = RIG_MODE_FM; *width = rig_passband_narrow(rig, RIG_MODE_FM); } if (*width == 0) *width = rig_passband_normal(rig, *mode); return RIG_OK; } int uniden_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { char levelbuf[16]; size_t level_len=16; int retval; switch (level) { case RIG_LEVEL_ATT: if (rig->state.attenuator[0] == 0) return -RIG_EINVAL; level_len = sprintf(levelbuf, "AT%c"EOM, val.i != 0 ? 'N':'F'); break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_level %d", level); return -RIG_EINVAL; } retval = uniden_transaction (rig, levelbuf, level_len, NULL, NULL, NULL); if (retval != RIG_OK) return retval; return RIG_OK; } /* * uniden_get_level * Assumes rig!=NULL, val!=NULL */ int uniden_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { char lvlbuf[BUFSZ]; int retval; size_t lvl_len=BUFSZ; switch (level) { case RIG_LEVEL_RAWSTR: retval = uniden_transaction (rig, "SG"EOM, 3, "S", lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len < 4) { rig_debug(RIG_DEBUG_ERR,"%s: wrong answer len=%d\n", __FUNCTION__, lvl_len); return -RIG_ERJCTED; } /* S182 F08594375 */ sscanf(lvlbuf+1, "%d", &val->i); /* rawstr */ break; case RIG_LEVEL_ATT: retval = uniden_transaction (rig, "AT"EOM, 3, NULL, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len < 3) { rig_debug(RIG_DEBUG_ERR,"%s: unexpected answer len=%d\n", __FUNCTION__, lvl_len); return -RIG_ERJCTED; } val->i = lvlbuf[2] == 'N' ? rig->state.attenuator[0] : 0; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_level %d", level); return -RIG_EINVAL; } return RIG_OK; } /* * uniden_get_dcd * Assumes rig!=NULL */ int uniden_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { char dcdbuf[BUFSZ]; size_t dcd_len=BUFSZ; int ret; ret = uniden_transaction (rig, "SQ" EOM, 3, NULL, dcdbuf, &dcd_len); if (ret != RIG_OK) return ret; if (dcd_len < 1 || (dcdbuf[0] != '+' && dcdbuf[0] != '-')) return -RIG_EPROTO; *dcd = (dcdbuf[0] == '-') ? RIG_DCD_OFF : RIG_DCD_ON; return RIG_OK; } /* * uniden_set_mem * Assumes rig!=NULL */ int uniden_set_mem(RIG *rig, vfo_t vfo, int ch) { char cmdbuf[BUFSZ]; size_t cmd_len=BUFSZ; cmd_len = sprintf(cmdbuf, "MA%03d" EOM, ch); return uniden_transaction (rig, cmdbuf, cmd_len, NULL, NULL, NULL); } /* * uniden_get_mem * Assumes rig!=NULL */ int uniden_get_mem(RIG *rig, vfo_t vfo, int *ch) { char membuf[BUFSZ]; size_t mem_len=BUFSZ; int ret; ret = uniden_transaction (rig, "MA" EOM, 3, "C", membuf, &mem_len); if (ret != RIG_OK) return ret; if (mem_len < 4) return -RIG_EPROTO; sscanf(membuf+1, "%d", ch); return RIG_OK; } /* * uniden_get_channel * Assumes rig!=NULL */ int uniden_get_channel(RIG *rig, channel_t *chan) { char cmdbuf[BUFSZ], membuf[BUFSZ]; size_t cmd_len=BUFSZ,mem_len=BUFSZ; int ret; int tone; if (chan->vfo == RIG_VFO_MEM) cmd_len = sprintf(cmdbuf, "PM%03d" EOM, chan->channel_num); else cmd_len = sprintf(cmdbuf, "MA" EOM); ret = uniden_transaction (rig, cmdbuf, cmd_len, "C", membuf, &mem_len); if (ret != RIG_OK) return ret; /* * 0123456789012345678901234567890123456789 * C089 F08511625 TN DN LF AF RF N000 */ if (mem_len < 30 || membuf[5] != 'F' || membuf[25] != 'T' || membuf[28] != 'D' || membuf[31] != 'L' || membuf[34] != 'A' || membuf[37] != 'R' || membuf[40] != 'N') return -RIG_EPROTO; sscanf(membuf+1, "%d", &chan->channel_num); sscanf(membuf+6, "%"SCNfreq, &chan->freq); /* returned freq in hundreds of Hz */ chan->freq *= 100; /* TODO: Trunk, Delay, Recording */ chan->flags = (membuf[22] == 'N') ? RIG_CHFLAG_SKIP : 0; chan->levels[LVL_ATT].i = (membuf[25] == 'N') ? rig->state.attenuator[0] : 0; sscanf(membuf+41, "%d", &tone); if (tone >= 1 && tone <= 38) chan->ctcss_sql = rig->caps->ctcss_list[tone-1]; /* 1..38 */ else if (tone > 38) chan->dcs_sql = rig->caps->dcs_list[tone-39]; /* 39..142 */ if (chan->vfo == RIG_VFO_MEM && rig->caps->chan_desc_sz != 0) { /* only BC780 BC250 BC785 */ cmd_len = sprintf(cmdbuf, "TA C %03d" EOM, chan->channel_num); ret = uniden_transaction (rig, cmdbuf, cmd_len, NULL, membuf, &mem_len); if (ret != RIG_OK) return ret; if (mem_len < 10 || memcmp(membuf, cmdbuf, 8)) return -RIG_EPROTO; /* TA C 001 My Alpha Tag */ strncpy(chan->channel_desc, membuf+9, rig->caps->chan_desc_sz); } return RIG_OK; } /* * uniden_set_channel * * Only freq can be set? */ int uniden_set_channel(RIG *rig, const channel_t *chan) { char cmdbuf[BUFSZ], membuf[BUFSZ]; size_t cmd_len=BUFSZ,mem_len=BUFSZ; int ret; int trunked = 0; if (chan->vfo != RIG_VFO_MEM) return -RIG_EINVAL; /* PM089T08511625 */ cmd_len = sprintf(cmdbuf, "PM%03d%c%08u" EOM, chan->channel_num, trunked ? 'T' : ' ', (unsigned)(chan->freq / 100)); ret = uniden_transaction (rig, cmdbuf, cmd_len, NULL, membuf, &mem_len); if (ret != RIG_OK) return ret; if (chan->vfo == RIG_VFO_MEM && rig->caps->chan_desc_sz != 0) { /* only BC780 BC250 BC785 */ cmd_len = sprintf(cmdbuf, "TA C %03d %s" EOM, chan->channel_num, chan->channel_desc); ret = uniden_transaction (rig, cmdbuf, cmd_len, NULL, NULL, NULL); if (ret != RIG_OK) return ret; } return RIG_OK; } /* * uniden_get_info * Assumes rig!=NULL */ const char * uniden_get_info(RIG *rig) { static char infobuf[BUFSZ]; size_t info_len=BUFSZ/2, vrinfo_len=BUFSZ/2; int ret; ret = uniden_transaction (rig, "SI" EOM, 3, NULL, infobuf, &info_len); if (ret != RIG_OK) return NULL; /* SI BC250D,0000000000,104 */ if (info_len < 4) return NULL; if (info_len >= BUFSZ) info_len = BUFSZ-1; infobuf[info_len] = '\0'; /* VR not on every rig */ /* VR1.00 */ ret = uniden_transaction (rig, "VR" EOM, 3, NULL, infobuf+info_len, &vrinfo_len); if (ret == RIG_OK) { /* overwrite "VR" */ /* FIXME: need to filter \r or it screws w/ stdout */ infobuf[info_len] = '\n'; infobuf[info_len+1] = ' '; } else { infobuf[info_len] = '\0'; } /* skip "SI " */ return infobuf+3; } #define IDBUFSZ 32 /* * proberigs_uniden * * Notes: * There's only one rig possible per port. * * rig_model_t probeallrigs_uniden(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data) */ DECLARE_PROBERIG_BACKEND(uniden) { char idbuf[IDBUFSZ]; int id_len=-1, i; int retval=-1; int rates[] = { 9600, 19200, 0 }; /* possible baud rates */ int rates_idx; if (!port) return RIG_MODEL_NONE; if (port->type.rig != RIG_PORT_SERIAL) return RIG_MODEL_NONE; port->write_delay = port->post_write_delay = 0; port->parm.serial.stop_bits = 1; port->retry = 1; /* * try for all different baud rates */ for (rates_idx = 0; rates[rates_idx]; rates_idx++) { port->parm.serial.rate = rates[rates_idx]; port->timeout = 2*1000/rates[rates_idx] + 50; retval = serial_open(port); if (retval != RIG_OK) return RIG_MODEL_NONE; retval = write_block(port, "SI"EOM, 3); id_len = read_string(port, idbuf, IDBUFSZ, EOM, 1); close(port->fd); if (retval != RIG_OK || id_len < 0) continue; } if (retval != RIG_OK || id_len < 0 || memcmp(idbuf, "SI ", 3)) return RIG_MODEL_NONE; /* * reply should be something like 'SI xxx,xx,xx\x0d' */ if (id_len < 4) { idbuf[id_len] = '\0'; rig_debug(RIG_DEBUG_VERBOSE,"probe_uniden: protocol error," " received %d: '%s'\n", id_len, idbuf); return RIG_MODEL_NONE; } /* search ID string */ for (i=0; uniden_id_string_list[i].model != RIG_MODEL_NONE; i++) { if (!memcmp(uniden_id_string_list[i].id, idbuf+3, strlen(uniden_id_string_list[i].id))) { rig_debug(RIG_DEBUG_VERBOSE,"probe_uniden: " "found '%s'\n", idbuf+3); if (cfunc) (*cfunc)(port, uniden_id_string_list[i].model, data); return uniden_id_string_list[i].model; } } /* * not found in known table.... * update uniden_id_list[]! */ rig_debug(RIG_DEBUG_WARN,"probe_uniden: found unknown device " "with ID '%s', please report to Hamlib " "developers.\n", idbuf+3); return RIG_MODEL_NONE; } /* * initrigs_uniden is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(uniden) { rig_debug(RIG_DEBUG_VERBOSE, "uniden: _init called\n"); rig_register(&bc895_caps); rig_register(&bc898_caps); rig_register(&bc245_caps); rig_register(&bc780_caps); rig_register(&bc250_caps); rig_register(&pro2052_caps); rig_register(&bcd396t_caps); rig_register(&bcd996t_caps); return RIG_OK; } hamlib-1.2.15.3/uniden/Makefile.in0000644000175000017500000005122212044564560013455 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = uniden DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_uniden_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = bc895.lo bc898.lo bc245.lo pro2052.lo bc780.lo \ bc250.lo bcd396t.lo bcd996t.lo am_hamlib_uniden_la_OBJECTS = $(am__objects_1) uniden.lo \ uniden_digital.lo hamlib_uniden_la_OBJECTS = $(am_hamlib_uniden_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_uniden_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_uniden_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_uniden_la_SOURCES) DIST_SOURCES = $(hamlib_uniden_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ UNIDENSRC = bc895.c bc898.c bc245.c pro2052.c bc780.c bc250.c \ bcd396t.c bcd996t.c pkglib_LTLIBRARIES = hamlib-uniden.la hamlib_uniden_la_SOURCES = $(UNIDENSRC) uniden.c uniden_digital.c hamlib_uniden_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_uniden_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = uniden.h uniden_digital.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu uniden/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu uniden/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-uniden.la: $(hamlib_uniden_la_OBJECTS) $(hamlib_uniden_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_uniden_la_LINK) -rpath $(pkglibdir) $(hamlib_uniden_la_OBJECTS) $(hamlib_uniden_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bc245.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bc250.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bc780.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bc895.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bc898.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcd396t.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcd996t.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pro2052.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uniden.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uniden_digital.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/uniden/uniden_digital.h0000644000175000017500000000246312044564477014552 00000000000000/* * Hamlib Uniden backend - uniden_digital header * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _UNIDEN_DIGITAL_H #define _UNIDEN_DIGITAL_H 1 #include "hamlib/rig.h" #define BACKEND_DIGITAL_VER "0.3" int uniden_digital_transaction (RIG *rig, const char *cmdstr, int cmd_len, const char *replystr, char *data, size_t *datasize); const char* uniden_digital_get_info(RIG *rig); int uniden_digital_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int uniden_digital_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); #endif /* _UNIDEN_DIGITAL_H */ hamlib-1.2.15.3/uniden/bc250.c0000644000175000017500000000742712044564477012406 00000000000000/* * Hamlib Uniden backend - BC250 description * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "uniden.h" #define BC250_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define BC250_FUNC (RIG_FUNC_MUTE) #define BC250_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_RAWSTR) #define BC250_PARM_ALL (RIG_PARM_NONE) #define BC250_VFO RIG_VFO_A #define BC250_CHANNEL_CAPS \ UNIDEN_CHANNEL_CAPS \ .channel_desc=1, \ .ctcss_sql=1, \ .dcs_sql=1 #define BC250_STR_CAL UNIDEN_STR_CAL /* * bc250 rig capabilities. * * TODO: check this with manual or web site. */ const struct rig_caps bc250_caps = { .rig_model = RIG_MODEL_BC250, .model_name = "BC250D", .mfg_name = "Uniden", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRUNKSCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 2400, .serial_rate_max = 19200, .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 = BC250_FUNC, .has_set_func = BC250_FUNC, .has_get_level = BC250_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(BC250_LEVEL_ALL), .has_get_parm = BC250_PARM_ALL, .has_set_parm = RIG_PARM_SET(BC250_PARM_ALL), .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = uniden_ctcss_list, .dcs_list = uniden_dcs_list, .preamp = { RIG_DBLST_END }, .attenuator = { 20, RIG_DBLST_END }, /* TBC */ .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_OFF, .bank_qty = 10, /* A..J */ .chan_desc_sz = 16, .str_cal = BC250_STR_CAL, .chan_list = { { 0, 999, RIG_MTYPE_MEM, {BC250_CHANNEL_CAPS} }, RIG_CHAN_END, }, .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {MHz(25),MHz(512),BC250_MODES,-1,-1,BC250_VFO}, {MHz(806),MHz(956),BC250_MODES,-1,-1,BC250_VFO}, /* (minus Cellular frequencies) */ {MHz(1240),MHz(1300),BC250_MODES,-1,-1,BC250_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {BC250_MODES,kHz(5)}, {BC250_MODES,kHz(7.5)}, {BC250_MODES,kHz(10)}, {BC250_MODES,kHz(12.5)}, {BC250_MODES,kHz(50)}, RIG_TS_END, 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, .get_freq = uniden_get_freq, .set_mode = uniden_set_mode, .get_mode = uniden_get_mode, .set_mem = uniden_set_mem, .get_mem = uniden_get_mem, .get_dcd = uniden_get_dcd, .get_info = uniden_get_info, .get_level = uniden_get_level, .set_level = uniden_set_level, .get_channel = uniden_get_channel, .set_channel = uniden_set_channel, }; /* * Function definitions below */ hamlib-1.2.15.3/uniden/Makefile.am0000644000175000017500000000055112044564477013452 00000000000000UNIDENSRC = bc895.c bc898.c bc245.c pro2052.c bc780.c bc250.c \ bcd396t.c bcd996t.c pkglib_LTLIBRARIES = hamlib-uniden.la hamlib_uniden_la_SOURCES = $(UNIDENSRC) uniden.c uniden_digital.c hamlib_uniden_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_uniden_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = uniden.h uniden_digital.h hamlib-1.2.15.3/uniden/bcd396t.c0000644000175000017500000000720312044564477012741 00000000000000/* * Hamlib Uniden backend - BCD396T description * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "hamlib/rig.h" /*#include "uniden.h"*/ #include "uniden_digital.h" /* TODO: All these defines have to be filled in properly */ #define BCD396T_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define BCD396T_FUNC (RIG_FUNC_MUTE) #define BCD396T_LEVEL_ALL (RIG_LEVEL_ATT) #define BCD396T_PARM_ALL (RIG_PARM_BEEP|RIG_PARM_BACKLIGHT) #define BCD396T_VFO (RIG_VFO_A|RIG_VFO_B) #define BCD396T_CHANNEL_CAPS \ .freq=1,\ .flags=1, /* L/O */ /* * bcd396t rig capabilities. * * TODO: check this with manual or web site. */ const struct rig_caps bcd396t_caps = { .rig_model = RIG_MODEL_BCD396T, .model_name = "BCD-396T", .mfg_name = "Uniden", .version = BACKEND_DIGITAL_VER, .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRUNKSCANNER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 9600, .serial_rate_max = 115200, .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 = 2000, .retry = 3, .has_get_func = BCD396T_FUNC, .has_set_func = BCD396T_FUNC, .has_get_level = BCD396T_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(BCD396T_LEVEL_ALL), .has_get_parm = BCD396T_PARM_ALL, .has_set_parm = RIG_PARM_SET(BCD396T_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 = { { 0, 5999, RIG_MTYPE_MEM, {BCD396T_CHANNEL_CAPS} }, /* Really 6000 channels? */ RIG_CHAN_END, }, .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {MHz(25),MHz(512),BCD396T_MODES,-1,-1,BCD396T_VFO}, {MHz(764),MHz(775.9875),BCD396T_MODES,-1,-1,BCD396T_VFO}, {MHz(794),MHz(823.9875),BCD396T_MODES,-1,-1,BCD396T_VFO}, {MHz(849.0125),MHz(868.9875),BCD396T_MODES,-1,-1,BCD396T_VFO}, {MHz(894.0125),MHz(956),BCD396T_MODES,-1,-1,BCD396T_VFO}, {MHz(1240),MHz(1300),BCD396T_MODES,-1,-1,BCD396T_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {BCD396T_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, }, .get_info = uniden_digital_get_info, .set_freq = uniden_digital_set_freq, .get_freq = uniden_digital_get_freq, }; /* * Function definitions below */ hamlib-1.2.15.3/README.betatester0000644000175000017500000003070712044564477013163 00000000000000Hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com) (C) Stephane Fillod 2000-2011 (C) The Hamlib Group 2000-2011 Why does Hamlib need beta-testers? ================================== Hamlib is developed by a team of radio enthusiasts around the world, for fun, much in the spirit of ham radio. (Note that it is not restricted for ham usage only). There are a great deal of protocols and rigs around the world developers may not own. However, protocols may be available, so backends can be implemented, but cannot always be tested by developers. That's where beta-testers are so precious. On top of that, I've been told that there's no such sure thing like bug free code. Feedback and improvement requests are also valuable. Okay, you volunteer as beta-tester, how to proceed? =================================================== First of all, you can start testing official releases. They are easier to test because they come in precompiled and packaged (.rpm, .deb, etc.) but they have the drawback of being older than the Git repository. Reports from these versions are still very appreciated. Please send them to the hamlib-developer@lists.sourceforge.net mailing list. However, the development of Hamlib is still very active, so it's better to test from the latest Git version of the code. And, depending on feedback you make, developers can commit a fix, so you can try out the change soon after, without waiting for the next official version. To proceed, you will have first to obtain either a daily snapshot or a check out the latest sources from the Git repository, then rebuild the Hamlib package and finally test it with your rig. Don't worry, it's much simpler than it looks, despite the size of the package. Pre-requisite: - some kind of internet access - POSIXish compiler toolchain (gcc, make, C library development headers, etc., see README.developer for a complete list and building from a Git checkout) So here we go: Daily Git master branch snapshots: ================================== Download the latest Git master branch snapshot from: http://n0nb.users.sourceforge.net You'll find a tarball with a name like hamlib-1.2.14~git-01db7a3-20110402.tar.gz, i.e. a check out made 02 Apr 2011 With a Git SHA1 of 01db7a3 (The SHA1 is a signature of each commit. Each is unique and as our project is small, the first seven characters for the full 40 character SHA1 are likely unique. The shorthand SHA1 is automatically generated and may become longer in the future.), ready for building using the familiar "three step" (see below). Each morning by about 1130z a new snapshot is generated and uploaded and the prior day's version is removed. The advantage of the Git snapshot is that you won't need as many tools installed to build Hamlib as the work of the GNU Build System has already been done. Most of the other packages listed below will be needed. If you tell the 'configure' script to build certain parts of Hamlib like documentation or scripting language bindings the relavent optional packages will be needed. See 'configure --help' for more information. Here is a list of development packages needed for a complete build of the library (Debian package names are listed, other distributions may differ): * Gnu C (gcc) or any C99 compliant compiler # gcc --version * Gnu make (or any modern one, BSD okay) # make --version * libltdl-dev 2.2.6b+ N.B. The Debian and derivatives (Ubuntu and friends) 'build-essentials' package will install a number of tools and minimize the number of packages that need to be installed manually. Optional, but highly recommended for a complete build: * GNU C++ (g++) # g++ --version * swig (for bindings) 1.3.14+ # swig -version * perl devel # h2xs * tcl devel # tcltk-depends * python devel # python-config * libxml2 devel # xml2-config --version * libgd2 devel # gdlib-config --version * libusb devel # libusb-config --version (not 1.0.0!) * RPC devel (libc-dev) # rpcgen --version * Git for connection to hamlib.git.sourceforge.net N.B The libusb package is required for building most of the 'kit' backend. The older version is needed, not 1.0.0 or higher. Debian and derivatives package libusb 0.1.12 which is what is needed. Documentation: * Doxygen Git master branch daily snapshot build: ======================================= Reading the INSTALL file in top directory will explain in more detail how to do the following commands. ./configure [--disable-static] [--prefix=] make make install The prefix argument is optional. Convention is that local packages be placed in /usr/local away from distribution installed packages This is the default location for the snapshots so it may be disregarded unless you wish to install Hamlib elsewhere. The '--disable-static' option speeds up compilation if you don't plan to use static libraries (static libraries are usually not needed). Other useful options are '--with-perl-binding' or '--with-python-binding' or '--enable-tcl-binding' if you are interested in Swig binding support for those scripting languages If you are unsure it is safe to ignore these options. NOTE! If Hamlib has not been previously installed as a locally built package you will need to make sure that 'ldconfig' is configured correctly and run periodically after 'make install'. Most modern distributions have an /etc/ld.so.conf.d/ directory where local configuration can be made. Later versions of Debian and derivatives have a file named 'libc.conf' in this directory. The contents of libc.conf are: # libc default configuration /usr/local/lib If your system does not have such a file, one will need to be created and then 'ldconfig' will need to be run as the root user so that applications using the Hamlib libraries can find them. To delete the binary files from the source directory after compiling: make clean To also remove the Makefiles and other build files, along with the binary files as above: make distclean The configure script will need to be run again as above. The above commands will clean things up so Hamlib can be compiled with other configure script options. To remove Hamlib from your system: sudo make uninstall Note that due to a limitation in a Perl support script that if the Perl binding is built and installed that not all of the files under /usr/local/lib/perl/PERL_VERSION will not be removed. Git checkout: ============= Please read the beginning of README.developer file, especially Section 1 which details the Git checkout, the required tools and versions (very important or make won't even work!), and how to use the autogen.sh script. Structure: ========== For the brave who want to peruse the contents, here are what all the subdirectories are for (these are just a sample as more are added from time to time): alinco,aor,icom, jrc,kachina,kenwood, pcr,tentec,uniden, winradio, yaesu,etc: rig backends easycomm,rotorez, sartek, etc: rotator backends dummy: virtual dummy rig and rotator, for developer's use. rpcrig: special networked rig backend (through RPC) rpcrot: special networked rotator backend (through RPC) lib: library for functions missing on your system libltdl: wrapper for shared module loader bindings Perl, Python, Tcl, and Visual Basic bindings c++,kylix: C++ and Kylix bindings doc: documentation base and scripts to extract from src include/hamlib: exported header files go here include: non-distributed header files go there src: Hamlib frontend source directory tests: rigctl/rotctl and various C programs for testing Testing Hamlib: =============== Don't attempt to test Hamlib from the source directory unless you're a developer and you understand the side effects of *not* installing freshly generated objects (basically having to mess with LD_LIBRARY_PATH and .libs). Do an 'sudo make install' to install the libraries in the system area. (You did run 'sudo ldconfig' after 'sudo make install', right?) So here we go. First of all, identify your rig model id. Make sure /usr/local/bin (or the path you set --prefix to above) is in your $PATH, as your shell has to be able to locate rigctl. Run 'rigctl -l' to get a list of rigs supported by Hamlib. If you cannot find your radio in the list, please report to the hamlib-developer mailing list. The protocol manual and rig specifications will help us a lot. You found your rig's ID? Good! You're almost ready to use rigctl. Have a quick look at its manual page: man rigctl or: man -M /usr/local/man rigctl or simply: rigctl --help Let's say you own an Icom IC-756: rigctl -vvvvv -r /dev/ttyS0 -m 326 The -vvvvv is very important since this will increase verbosity, and give precious traces to developers if something goes wrong. At this level, the protocol data exchanged will also be dumped to the screen. Some backends produce a useful amount of data regarding function calls and critical variables with the -vvvv option without all the protocol data. Unless some problem shows up, you should be presented with a menu like "Rig command: ". Enter "?" followed by return to have the list of available commands. 'Q' or 'q' quits rigctl immediately. Most wanted functions to be tested are: '_' get misc information on the rig 'f' get frequency 'F' set frequency, in Hz 'm' get mode 'M' set mode (AM,FM,CW,USB,etc. and passband width in Hz) 'v' get vfo 'V' set vfo (VFOA, VFOB, etc.) f,F get_freq/set_freq try various (<1MHz, <30Mhz and >1GHz) v,V get_vfo/set_vfo VFOA, VFOB m,M get_mode/set_mode FM, USB, LSB, CW, WFM, etc. passband is in Hz (pass 0 for default) G vfo_op UP, DOWN _ get_info should give remote Id and firmware vers NB: some functions may not be implemented in the backend or simply not available on this rig. When reporting to the hamlib-developer mailing list, please include traces and also comments to tell developers if the action performed correctly on the rig. Tip: Traces can be hard to cut and paste sometimes. In that case, there's a handy tool for you: script(1) (the (1) is not a part of the command, rather it is a Unix convention telling which section of the manual it is found, in this case section 1, user commands. e.g. 'man 1 script'). It will make a typescript of everything printed on your terminal and save it to the file you give it. $ script my_rig_traces.txt Script started, file is my_rig_traces.txt $ rigctl -vvvvv -r /dev/ttyS0 -m 326 rig:rig_init called rig: loading backend icom icom: _init called rig_register (309) rig_register (326) rig:rig_open called Opened rig model 326, 'IC-756' Rig command: q rig:rig_close called rig:rig_cleanup called $ exit exit Script done, file is my_rig_traces.txt $ And then send my_rig_traces.txt to the hamlib-developer mailing list. Some models need S-meter calibration, because the rig only returns raw measurement. It's easy, it takes only 10mn. Here's how to proceed: 1. Fire up the rigctl program released with the Hamlib package, and pass along options as needed (serial speed, etc.). 2. Tune to some frequency reporting S0 to the radio S-Meter. 3. At rigctl prompt, issue "get_level" ('l' in short) of the level RAWSTR. 4. Write down the S-level read on radio front panel, and the RAWSTR value retrieved. 5. Repeat from step 2 with S9 and S9+60dB. Actually the more plots, the better, otherwise Hamlib does interpolation. 6. Send the table to the hamlib-developer mailing list and it will be added in the next release of Hamlib. NB: It is well known the S-Meter of any given radio is far from being accurate. For owners with a fully equipped lab, you may want to make the above-mentioned measurements with a good signal generator and a set of calibrated attenuators. Greg W8WWV has an insightful page about S-Meter calibration: http://www.seed-solutions.com/gregordy/Amateur%20Radio/Experimentation/SMeterBlues.htm Okay folks, test as much as you can, in the weirdest situations if possible. There is a special prize for those who find 'Segmentation fault' and other nasty bugs. Needless to say, patches are also very welcome (see README.developer). :-) Stephane - F8CFE and The Hamlib Group hamlib-1.2.15.3/jrc/0000755000175000017500000000000012044565022010754 500000000000000hamlib-1.2.15.3/jrc/nrd545.c0000644000175000017500000001326312044564477012103 00000000000000/* * Hamlib JRC backend - NRD-545 DSP description * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "idx_builtin.h" #include "jrc.h" #define NRD545_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_AMS|RIG_MODE_ECSS) #define NRD545_FUNC (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_LOCK|RIG_FUNC_BC|RIG_FUNC_NR|RIG_FUNC_MN) #define NRD545_LEVEL (RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH|RIG_LEVEL_ATT|RIG_LEVEL_RF|RIG_LEVEL_AF|RIG_LEVEL_AGC|RIG_LEVEL_IF|RIG_LEVEL_NR|RIG_LEVEL_NOTCHF|RIG_LEVEL_SQL|RIG_LEVEL_IF|RIG_LEVEL_CWPITCH) /*RIG_LEVEL_BWC*/ /* FIXME: add more from "U" command */ #define NRD545_PARM (RIG_PARM_TIME|RIG_PARM_BACKLIGHT|RIG_PARM_BEEP) #define NRD545_VFO (RIG_VFO_VFO|RIG_VFO_MEM) /* * FIXME: measure S-meter levels */ #define NRD545_STR_CAL { 16, { \ { 0, -60 }, \ { 36, -48 }, \ { 42, -42 }, \ { 48, -36 }, \ { 55, -30 }, \ { 60, -24 }, \ { 67, -18 }, \ { 72, -12 }, \ { 78, -6 }, \ { 87, 0 }, \ { 107, 10 }, \ { 126, 20 }, \ { 146, 30 }, \ { 164, 40 }, \ { 186, 50 }, \ { 255, 60 }, \ } } /* * channel caps. */ #define NRD545_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .levels = RIG_LEVEL_ATT|RIG_LEVEL_AGC, \ } static const struct jrc_priv_caps nrd545_priv_caps = { .max_freq_len = 10, .info_len = 18, .mem_len = 21, .pbs_info_len = 6, .pbs_len = 3, .beep = 100, .beep_len = 3, .cw_pitch = "U14" }; /* * NRD-545 rig capabilities. * */ const struct rig_caps nrd545_caps = { .rig_model = RIG_MODEL_NRD545, .model_name = "NRD-545 DSP", .mfg_name = "JRC", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .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 = NRD545_FUNC, .has_set_func = NRD545_FUNC, .has_get_level = NRD545_LEVEL, .has_set_level = RIG_LEVEL_SET(NRD545_LEVEL), .has_get_parm = RIG_PARM_TIME, .has_set_parm = RIG_PARM_SET(NRD545_PARM), .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, [LVL_ATT] = { .min = { .i = 0 }, .max = { .i = 20 } }, [LVL_IF] = { .min = { .i = -2550 }, .max = { .i = 2550 }, .step = { .i = 10} }, [LVL_NOTCHF] = { .min = { .i = -1023 }, .max = { .i = 1023 } }, [LVL_CWPITCH] = { .min = { .i = -2550 }, .max = { .i = 2550 } }, /*[LVL_BWC] = { .min = { .i = 10 }, .max = { .i = 9990 }, .step = { .i = 10} },*/ }, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END }, .attenuator = { 20, RIG_DBLST_END }, /* To be confirmed */ .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = kHz(2.3), .targetable_vfo = 0, .transceive = RIG_TRN_RIG, .vfo_ops = RIG_OP_FROM_VFO|RIG_OP_UP|RIG_OP_DOWN, .scan_ops = RIG_SCAN_STOP|RIG_SCAN_SLCT, .bank_qty = 0, .chan_desc_sz = 0, .priv = (void*)&nrd545_priv_caps, .chan_list = { { 0, 999, RIG_MTYPE_MEM, NRD545_MEM_CAP }, 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),NRD545_MODES,-1,-1,NRD545_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {NRD545_MODES,1}, {NRD545_MODES,10}, {NRD545_MODES,100}, {NRD545_MODES,kHz(1)}, {NRD545_MODES,kHz(5)}, {NRD545_MODES,kHz(6.25)}, {NRD545_MODES,kHz(9)}, {NRD545_MODES,kHz(10)}, {NRD545_MODES,kHz(12.5)}, {NRD545_MODES,kHz(20)}, {NRD545_MODES,kHz(25)}, {NRD545_MODES,kHz(30)}, {NRD545_MODES,kHz(100)}, RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_AM|RIG_MODE_AMS|RIG_MODE_ECSS|RIG_MODE_FM, kHz(10)}, {RIG_MODE_AM|RIG_MODE_AMS|RIG_MODE_ECSS|RIG_MODE_FM, kHz(4.5)}, {RIG_MODE_SSB|RIG_MODE_RTTY, kHz(2.4)}, {RIG_MODE_SSB|RIG_MODE_RTTY, kHz(1)}, {RIG_MODE_SSB|RIG_MODE_RTTY, kHz(4.5)}, {RIG_MODE_CW, kHz(1)}, {RIG_MODE_CW, kHz(2.4)}, RIG_FLT_END, }, .str_cal = NRD545_STR_CAL, .rig_open = jrc_open, .rig_close = jrc_close, .set_freq = jrc_set_freq, .get_freq = jrc_get_freq, .set_mode = jrc_set_mode, .get_mode = jrc_get_mode, .set_vfo = jrc_set_vfo, .set_func = jrc_set_func, .get_func = jrc_get_func, .set_level = jrc_set_level, .get_level = jrc_get_level, .set_parm = jrc_set_parm, .get_parm = jrc_get_parm, .get_dcd = jrc_get_dcd, .set_trn = jrc_set_trn, .reset = jrc_reset, .set_mem = jrc_set_mem, .get_mem = jrc_get_mem, .set_channel = jrc_set_chan, .get_channel = jrc_get_chan, .vfo_op = jrc_vfo_op, .scan = jrc_scan, .set_powerstat = jrc_set_powerstat, .get_powerstat = jrc_get_powerstat, .decode_event = jrc_decode_event, }; /* * Function definitions below */ hamlib-1.2.15.3/jrc/jrc.h0000644000175000017500000000475612044564477011654 00000000000000/* * Hamlib JRC backend - main header * Copyright (c) 2001-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _JRC_H #define _JRC_H 1 #include #define BACKEND_VER "0.6" struct jrc_priv_caps { int max_freq_len; int info_len; int mem_len; int pbs_info_len; int pbs_len; int beep; int beep_len; const char * cw_pitch; }; int jrc_open(RIG *rig); int jrc_close(RIG *rig); int jrc_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int jrc_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int jrc_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int jrc_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int jrc_set_vfo(RIG *rig, vfo_t vfo); int jrc_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int jrc_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); int jrc_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int jrc_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int jrc_set_parm(RIG *rig, setting_t parm, value_t val); int jrc_get_parm(RIG *rig, setting_t parm, value_t *val); int jrc_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); int jrc_set_trn(RIG *rig, int trn); int jrc_set_mem(RIG *rig, vfo_t vfo, int ch); int jrc_get_mem(RIG *rig, vfo_t vfo, int *ch); int jrc_set_chan(RIG *rig, const channel_t *chan); int jrc_get_chan(RIG *rig, channel_t *chan); int jrc_set_powerstat(RIG *rig, powerstat_t status); int jrc_get_powerstat(RIG *rig, powerstat_t *status); int jrc_reset(RIG *rig, reset_t reset); int jrc_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); int jrc_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch); int jrc_decode_event(RIG *rig); extern const struct rig_caps nrd535_caps; extern const struct rig_caps nrd545_caps; extern const struct rig_caps nrd525_caps; #endif /* _JRC_H */ hamlib-1.2.15.3/jrc/nrd535.c0000644000175000017500000001246712044564477012107 00000000000000/* * Hamlib JRC backend - NRD-535 DSP description * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "idx_builtin.h" #include "jrc.h" #define NRD535_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_ECSS|RIG_MODE_FAX) /* + FAX */ #define NRD535_FUNC (RIG_FUNC_FAGC|RIG_FUNC_NB) #define NRD535_LEVEL (RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH|RIG_LEVEL_ATT|RIG_LEVEL_IF|RIG_LEVEL_AGC|RIG_LEVEL_CWPITCH) /*RIG_LEVEL_BWC*/ /* FIXME: add more from "U" command */ #define NRD535_PARM (RIG_PARM_TIME|RIG_PARM_BEEP) #define NRD535_VFO (RIG_VFO_VFO|RIG_VFO_MEM) /* * NRD-535, specs from http://mods.dk * * FIXME: measure S-meter levels */ #define NRD535_STR_CAL { 16, { \ { 0, 60 }, \ { 71, 50 }, \ { 75, 40 }, \ { 81, 30 }, \ { 87, 20 }, \ { 93, 10 }, \ { 100, 0 }, \ { 103, -6 }, \ { 107, -12 }, \ { 112, -18 }, \ { 118, -24 }, \ { 124, -30 }, \ { 133, -36 }, \ { 143, -42 }, \ { 152, -48 }, \ { 255, -60 }, \ } } /* * channel caps. */ #define NRD535_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .funcs = RIG_FUNC_FAGC, \ .levels = RIG_LEVEL_ATT|RIG_LEVEL_AGC, \ } static const struct jrc_priv_caps nrd535_priv_caps = { .max_freq_len = 8, .info_len = 14, .mem_len = 17, .pbs_info_len = 7, .pbs_len = 4, .beep = 90, .beep_len = 2, .cw_pitch = "U2" }; /* * NRD-535 rig capabilities. * */ const struct rig_caps nrd535_caps = { .rig_model = RIG_MODEL_NRD535, .model_name = "NRD-535D", .mfg_name = "JRC", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 20, .timeout = 200, .retry = 3, .has_get_func = NRD535_FUNC, .has_set_func = NRD535_FUNC, .has_get_level = NRD535_LEVEL, .has_set_level = RIG_LEVEL_SET(NRD535_LEVEL), .has_get_parm = RIG_PARM_TIME, .has_set_parm = RIG_PARM_SET(NRD535_PARM), .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, [LVL_ATT] = { .min = { .i = 0 }, .max = { .i = 20 } }, [LVL_IF] = { .min = { .i = -2000 }, .max = { .i = 2000 } }, [LVL_CWPITCH] = { .min = { .i = -5000 }, .max = { .i = 5000 } }, /*[LVL_BWC] = { .min = { .i = 500 }, .max = { .i = 5500 }, .step = { .i = 10} },*/ }, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END }, .attenuator = { 20, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = kHz(2), .targetable_vfo = 0, .transceive = RIG_TRN_RIG, .vfo_ops = RIG_OP_FROM_VFO, .scan_ops = RIG_SCAN_STOP|RIG_SCAN_SLCT, .bank_qty = 0, .chan_desc_sz = 0, .priv = (void*)&nrd535_priv_caps, .chan_list = { { 0, 199, RIG_MTYPE_MEM, NRD535_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(10),MHz(30),NRD535_MODES,-1,-1,NRD535_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(10),MHz(30),NRD535_MODES,-1,-1,NRD535_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {NRD535_MODES,1}, {NRD535_MODES,10}, {NRD535_MODES,100}, RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_FM, kHz(12)}, {RIG_MODE_FM, kHz(6)}, {RIG_MODE_AM|RIG_MODE_ECSS, kHz(6)}, {RIG_MODE_AM|RIG_MODE_ECSS, kHz(2)}, {RIG_MODE_AM|RIG_MODE_ECSS, kHz(12)}, {RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FAX, kHz(2)}, {RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FAX, kHz(1)}, {RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FAX, kHz(6)}, {RIG_MODE_CW, kHz(1)}, {RIG_MODE_CW, kHz(2)}, RIG_FLT_END, }, .str_cal = NRD535_STR_CAL, .rig_open = jrc_open, .rig_close = jrc_close, .set_freq = jrc_set_freq, .get_freq = jrc_get_freq, .set_mode = jrc_set_mode, .get_mode = jrc_get_mode, .set_vfo = jrc_set_vfo, .set_func = jrc_set_func, .get_func = jrc_get_func, .set_level = jrc_set_level, .get_level = jrc_get_level, .set_parm = jrc_set_parm, .get_parm = jrc_get_parm, .get_dcd = jrc_get_dcd, .set_trn = jrc_set_trn, .reset = jrc_reset, .set_mem = jrc_set_mem, .get_mem = jrc_get_mem, .set_channel = jrc_set_chan, .get_channel = jrc_get_chan, .vfo_op = jrc_vfo_op, .scan = jrc_scan, .set_powerstat = jrc_set_powerstat, .get_powerstat = jrc_get_powerstat, .decode_event = jrc_decode_event, }; /* * Function definitions below */ hamlib-1.2.15.3/jrc/Makefile.in0000644000175000017500000004777112044564553012771 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = jrc DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_jrc_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = nrd535.lo nrd545.lo nrd525.lo am_hamlib_jrc_la_OBJECTS = $(am__objects_1) jrc.lo hamlib_jrc_la_OBJECTS = $(am_hamlib_jrc_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_jrc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(hamlib_jrc_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_jrc_la_SOURCES) DIST_SOURCES = $(hamlib_jrc_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ JRCSRCLIST = nrd535.c nrd545.c nrd525.c pkglib_LTLIBRARIES = hamlib-jrc.la hamlib_jrc_la_SOURCES = $(JRCSRCLIST) jrc.c hamlib_jrc_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_jrc_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = jrc.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu jrc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu jrc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-jrc.la: $(hamlib_jrc_la_OBJECTS) $(hamlib_jrc_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_jrc_la_LINK) -rpath $(pkglibdir) $(hamlib_jrc_la_OBJECTS) $(hamlib_jrc_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jrc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nrd525.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nrd535.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nrd545.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/jrc/nrd525.c0000644000175000017500000001355512044564477012105 00000000000000/* * Hamlib JRC backend - NRD-525 description * Copyright (c) 2001-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "hamlib/rig.h" #include "iofunc.h" #include "jrc.h" static int nrd525_open(RIG *rig); static int nrd525_close(RIG *rig); static int nrd525_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int nrd525_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int nrd525_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static int nrd525_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int nrd525_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); static int nrd525_set_mem(RIG *rig, vfo_t vfo, int ch); #define NRD525_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_FAX) #define NRD525_FUNC (RIG_FUNC_LOCK) #define NRD525_LEVEL (RIG_LEVEL_ATT|RIG_LEVEL_AGC) #define NRD525_VFO (RIG_VFO_VFO) #define NRD525_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .levels = RIG_LEVEL_ATT|RIG_LEVEL_AGC, \ } /* * NRD-525 rig capabilities. * */ const struct rig_caps nrd525_caps = { .rig_model = RIG_MODEL_NRD525, .model_name = "NRD-525", .mfg_name = "JRC", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 20, .timeout = 1000, .retry = 0, .has_get_func = RIG_FUNC_NONE, .has_set_func = NRD525_FUNC, .has_get_level = RIG_LEVEL_NONE, .has_set_level = NRD525_LEVEL, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END }, .attenuator = { 20, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_OFF, .vfo_ops = RIG_OP_FROM_VFO, .scan_ops = RIG_SCAN_NONE, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 199, RIG_MTYPE_MEM, NRD525_MEM_CAP }, RIG_CHAN_END }, .rx_range_list1 = { {kHz(10),MHz(30),NRD525_MODES,-1,-1,NRD525_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(10),MHz(30),NRD525_MODES,-1,-1,NRD525_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {NRD525_MODES,10}, RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_FM, kHz(12)}, {RIG_MODE_FM, kHz(6)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_AM, kHz(2)}, {RIG_MODE_AM, kHz(12)}, {RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FAX, kHz(2)}, {RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FAX, kHz(1)}, {RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FAX, kHz(6)}, {RIG_MODE_CW, kHz(1)}, {RIG_MODE_CW, kHz(2)}, RIG_FLT_END, }, .rig_open = nrd525_open, .rig_close = nrd525_close, .set_freq = nrd525_set_freq, .set_mode = nrd525_set_mode, .set_func = nrd525_set_func, .set_level = nrd525_set_level, .set_mem = nrd525_set_mem, .vfo_op = nrd525_vfo_op, }; /* * Function definitions below */ static int nrd525_open(RIG *rig) { return write_block(&rig->state.rigport, "H1", 2); } static int nrd525_close(RIG *rig) { return write_block(&rig->state.rigport, "H0", 2); } static int nrd525_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char freqbuf[12]; sprintf(freqbuf, "F%08u", (unsigned)(freq/10)); return write_block(&rig->state.rigport, freqbuf, strlen(freqbuf)); } static int nrd525_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { int retval; char *modestr; switch (mode) { case RIG_MODE_RTTY: modestr = "D0"; break; case RIG_MODE_CW: modestr = "D1"; break; case RIG_MODE_USB: modestr = "D2"; break; case RIG_MODE_LSB: modestr = "D3"; break; case RIG_MODE_AM: modestr = "D4"; break; case RIG_MODE_FM: modestr = "D5"; break; case RIG_MODE_FAX: modestr = "D6"; break; default: return -RIG_EINVAL; } retval = write_block(&rig->state.rigport, modestr, strlen(modestr)); if (retval != RIG_OK) return retval; // TODO: width return retval; } static int nrd525_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { return -RIG_ENIMPL; } static int nrd525_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { switch (level) { case RIG_LEVEL_ATT: return write_block(&rig->state.rigport, val.i != 0 ? "A1" : "A0", 2); case RIG_LEVEL_AGC: return write_block(&rig->state.rigport, val.i == RIG_AGC_SLOW ? "G0" : (val.i == RIG_AGC_FAST ? "G1" : "G2"), 2); default: return -RIG_EINVAL; } return -RIG_EINVAL; } static int nrd525_set_mem(RIG *rig, vfo_t vfo, int ch) { char membuf[12]; sprintf(membuf, "C%03u", ch); return write_block(&rig->state.rigport, membuf, strlen(membuf)); } static int nrd525_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { switch (op) { case RIG_OP_FROM_VFO: return write_block(&rig->state.rigport, "E1", 2); default: return -RIG_EINVAL; } return -RIG_EINVAL; } hamlib-1.2.15.3/jrc/jrc.c0000644000175000017500000007755512044564477011656 00000000000000/* * Hamlib JRC backend - main file * Copyright (c) 2001-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "cal.h" #include "register.h" #include "jrc.h" /* * Carriage return */ #define EOM "\r" #define BUFSZ 32 /* * modes in use by the "2G" command */ #define MD_RTTY '0' #define MD_CW '1' #define MD_USB '2' #define MD_LSB '3' #define MD_AM '4' #define MD_FM '5' #define MD_AMS '6' #define MD_FAX '6' #define MD_ECSS_USB '7' #define MD_ECSS_LSB '8' #define MD_WFM '9' /* * jrc_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! * TODO: error case handling */ static int jrc_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval; struct rig_state *rs; rs = &rig->state; serial_flush(&rs->rigport); Hold_Decode(rig); retval = write_block(&rs->rigport, cmd, cmd_len); if (retval != RIG_OK) { Unhold_Decode(rig); return retval; } if (!data || !data_len) { Unhold_Decode(rig); return 0; } retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM)); Unhold_Decode(rig); if (retval < 0) return retval; *data_len = retval; return RIG_OK; } static int jrc2rig_mode(RIG *rig, char jmode, char jwidth, rmode_t *mode, pbwidth_t *width) { switch (jmode) { case MD_RTTY: *mode = RIG_MODE_RTTY; break; case MD_CW: *mode = RIG_MODE_CW; break; case MD_USB: *mode = RIG_MODE_USB; break; case MD_LSB: *mode = RIG_MODE_LSB; break; case MD_AM: *mode = RIG_MODE_AM; break; case MD_FM: *mode = RIG_MODE_FM; break; case MD_AMS: if (rig->caps->rig_model == RIG_MODEL_NRD535) { *mode = RIG_MODE_FAX; } else { *mode = RIG_MODE_AMS; } break; case MD_ECSS_USB: *mode = RIG_MODE_ECSSUSB; break; case MD_ECSS_LSB: *mode = RIG_MODE_ECSSLSB; break; case MD_WFM: *mode = RIG_MODE_WFM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %c\n", __FUNCTION__, jmode); *mode = RIG_MODE_NONE; return -RIG_EINVAL; } /* * determine passband */ switch (jwidth) { case '0': *width = s_Hz(6000); //wide break; case '1': *width = s_Hz(2000); //inter break; case '2': *width = s_Hz(1000); //narr break; case '3': *width = s_Hz(12000); //aux - nrd535 only break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported width %c\n", __FUNCTION__, jwidth); *width = RIG_PASSBAND_NORMAL; return -RIG_EINVAL; } return RIG_OK; } static int rig2jrc_mode(RIG *rig, rmode_t mode, pbwidth_t width, char *jmode, char *jwidth) { switch (mode) { case RIG_MODE_RTTY: *jmode = MD_RTTY; break; case RIG_MODE_CW: *jmode = MD_CW; break; case RIG_MODE_USB: *jmode = MD_USB; break; case RIG_MODE_LSB: *jmode = MD_LSB; break; case RIG_MODE_AM: *jmode = MD_AM; break; case RIG_MODE_FM: *jmode = MD_FM; break; case RIG_MODE_AMS: *jmode = MD_AMS; break; case RIG_MODE_FAX: *jmode = MD_FAX; break; case RIG_MODE_ECSSUSB: *jmode = MD_ECSS_USB; break; case RIG_MODE_ECSSLSB: *jmode = MD_ECSS_LSB; break; case RIG_MODE_WFM: *jmode = MD_WFM; break; default: rig_debug(RIG_DEBUG_ERR, "%s: unsupported mode %d\n", __FUNCTION__, mode); return -RIG_EINVAL; } if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); if (width <= s_Hz(1500)) *jwidth = '2'; /*narr*/ else if (width <= s_Hz(4000)) *jwidth = '1'; /*inter*/ else if (width <= s_Hz(9000)) *jwidth = '0'; /*wide*/ else if (rig->caps->rig_model == RIG_MODEL_NRD535) *jwidth = '3'; /*aux - nrd535 only*/ else *jwidth = '1'; /*inter*/ return RIG_OK; } int jrc_open(RIG *rig) { int retval; /* * Turning computer control ON, * Turn continuous mode on (for "I" query) */ if (rig->caps->rig_model == RIG_MODEL_NRD535) retval = jrc_transaction(rig, "H1" EOM, 3, NULL, NULL); else retval = jrc_transaction(rig, "H1" EOM "I1"EOM, 6, NULL, NULL); return retval; } int jrc_close(RIG *rig) { int retval; /* Turning computer control OFF */ retval = jrc_transaction(rig, "H0" EOM, 3, NULL, NULL); return retval; } /* * jrc_set_freq * Assumes rig!=NULL */ int jrc_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct jrc_priv_caps *priv = (struct jrc_priv_caps*)rig->caps->priv; char freqbuf[BUFSZ]; int freq_len; if (freq >= (freq_t)pow(10, priv->max_freq_len)) return -RIG_EINVAL; freq_len = sprintf(freqbuf, "F%0*"PRIll EOM, priv->max_freq_len, (int64_t)freq); return jrc_transaction (rig, freqbuf, freq_len, NULL, NULL); } static int get_current_istate(RIG *rig, char *buf, int *buf_len) { int retval; /* * JRCs use "I" to get information, */ if (rig->caps->rig_model == RIG_MODEL_NRD535) retval = jrc_transaction (rig, "I1" EOM "I0" EOM, 6, buf, buf_len); else retval = jrc_transaction (rig, "I" EOM, 2, buf, buf_len); return retval; } /* * jrc_get_freq * Assumes rig!=NULL, freq!=NULL */ int jrc_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct jrc_priv_caps *priv = (struct jrc_priv_caps*)rig->caps->priv; int freq_len, retval; char freqbuf[BUFSZ]; //note: JRCs use "I" to get information retval = get_current_istate(rig, freqbuf, &freq_len); if (retval != RIG_OK) return retval; //I command returns Iabdffffffffg if (freqbuf[0] != 'I' || freq_len != priv->info_len) { rig_debug(RIG_DEBUG_ERR,"jrc_get_freq: wrong answer %s, " "len=%d\n", freqbuf, freq_len); return -RIG_ERJCTED; } freqbuf[4+priv->max_freq_len] = '\0'; /* extract freq */ sscanf(freqbuf+4, "%"SCNfreq, freq); return RIG_OK; } /* * jrc_set_vfo * Assumes rig!=NULL */ int jrc_set_vfo(RIG *rig, vfo_t vfo) { unsigned char cmdbuf[16]; int cmd_len, retval; char vfo_function; switch (vfo) { case RIG_VFO_VFO: vfo_function = 'F'; break; case RIG_VFO_MEM: vfo_function = 'C'; break; default: rig_debug(RIG_DEBUG_ERR,"jrc_set_vfo: unsupported VFO %d\n", vfo); return -RIG_EINVAL; } cmd_len = sprintf((char *) cmdbuf, "%c" EOM, vfo_function); retval = jrc_transaction (rig, (char *) cmdbuf, cmd_len, NULL, NULL); return retval; } /* * jrc_set_mode * Assumes rig!=NULL */ int jrc_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { char mdbuf[BUFSZ]; int retval, mdbuf_len; char amode, awidth; retval = rig2jrc_mode(rig, mode, width, &amode, &awidth); if (retval != RIG_OK) return retval; mdbuf_len = sprintf(mdbuf, "D" "%c" EOM, amode); retval = jrc_transaction (rig, mdbuf, mdbuf_len, NULL, NULL); if (retval != RIG_OK) return retval; mdbuf_len = sprintf(mdbuf, "B" "%c" EOM, awidth); retval = jrc_transaction (rig, mdbuf, mdbuf_len, NULL, NULL); if (retval != RIG_OK) return retval; return RIG_OK; } /* * jrc_get_mode * Assumes rig!=NULL, mode!=NULL, width!=NULL */ int jrc_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct jrc_priv_caps *priv = (struct jrc_priv_caps*)rig->caps->priv; int md_len, retval; char mdbuf[BUFSZ]; char cmode; char cwidth; //note: JRCs use "I" to get information retval = get_current_istate(rig, mdbuf, &md_len); if (retval != RIG_OK) return retval; //I command returns Iabdffffffffg if (mdbuf[0] != 'I' || md_len != priv->info_len) { rig_debug(RIG_DEBUG_ERR,"jrc_get_mode: wrong answer %s, " "len=%d\n", mdbuf, md_len); return -RIG_ERJCTED; } /* extract width and mode */ cwidth = mdbuf[2]; cmode = mdbuf[3]; retval = jrc2rig_mode(rig, cmode, cwidth, mode, width); return retval; } /* * jrc_set_func * Assumes rig!=NULL */ int jrc_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { int cmd_len; char cmdbuf[BUFSZ]; /* Optimize: * sort the switch cases with the most frequent first */ switch (func) { case RIG_FUNC_FAGC: /* FIXME: FAGC levels */ cmd_len = sprintf(cmdbuf, "G%d" EOM, status?1:2); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_FUNC_NB: /* FIXME: NB1 and NB2 */ cmd_len = sprintf(cmdbuf, "N%d" EOM, status?1:0); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); /* * FIXME: which BB mode for NR and BC at same time ? */ case RIG_FUNC_NR: cmd_len = sprintf(cmdbuf, "BB%d" EOM, status?1:0); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_FUNC_BC: cmd_len = sprintf(cmdbuf, "BB%d" EOM, status?2:0); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_FUNC_LOCK: cmd_len = sprintf(cmdbuf, "DD%d" EOM, status?1:0); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_FUNC_MN: cmd_len = sprintf(cmdbuf, "EE%d" EOM, status?1:0); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_func %d\n", func); return -RIG_EINVAL; } return RIG_OK; } /* * jrc_get_func * Assumes rig!=NULL, status!=NULL */ int jrc_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { struct jrc_priv_caps *priv = (struct jrc_priv_caps*)rig->caps->priv; int retval, func_len; char funcbuf[BUFSZ]; /* Optimize: * sort the switch cases with the most frequent first */ switch (func) { case RIG_FUNC_FAGC: /* FIXME: FAGC levels */ //retval = jrc_transaction (rig, "G" EOM, 2, funcbuf, &func_len); retval = get_current_istate(rig, funcbuf, &func_len); if (retval != RIG_OK) return retval; //if (func_len != 3 || func_len != 6) { if (funcbuf[0] != 'I' || func_len != priv->info_len) { rig_debug(RIG_DEBUG_ERR,"jrc_get_func: wrong answer %s, " "len=%d\n", funcbuf, func_len); return -RIG_ERJCTED; } //*status = funcbuf[1] != '2'; *status = funcbuf[4+priv->max_freq_len] != '2'; return RIG_OK; case RIG_FUNC_NB: /* FIXME: NB1 and NB2 */ retval = jrc_transaction (rig, "N" EOM, 2, funcbuf, &func_len); if (retval != RIG_OK) return retval; if (func_len != 3) { rig_debug(RIG_DEBUG_ERR,"jrc_get_func: wrong answer %s, " "len=%d\n", funcbuf, func_len); return -RIG_ERJCTED; } *status = funcbuf[1] != '0'; return RIG_OK; /* * FIXME: which BB mode for NR and BC at same time ? */ case RIG_FUNC_NR: retval = jrc_transaction (rig, "BB" EOM, 3, funcbuf, &func_len); if (retval != RIG_OK) return retval; if (func_len != 3) { rig_debug(RIG_DEBUG_ERR,"jrc_get_func: wrong answer %s, " "len=%d\n", funcbuf, func_len); return -RIG_ERJCTED; } *status = funcbuf[2] == '1'; return RIG_OK; case RIG_FUNC_BC: retval = jrc_transaction (rig, "BB" EOM, 3, funcbuf, &func_len); if (retval != RIG_OK) return retval; if (func_len != 3) { rig_debug(RIG_DEBUG_ERR,"jrc_get_func: wrong answer %s, " "len=%d\n", funcbuf, func_len); return -RIG_ERJCTED; } *status = funcbuf[2] == '2'; return RIG_OK; case RIG_FUNC_LOCK: retval = jrc_transaction (rig, "DD" EOM, 3, funcbuf, &func_len); if (retval != RIG_OK) return retval; if (func_len != 3) { rig_debug(RIG_DEBUG_ERR,"jrc_get_func: wrong answer %s, " "len=%d\n", funcbuf, func_len); return -RIG_ERJCTED; } *status = funcbuf[1] == '1'; return RIG_OK; case RIG_FUNC_MN: retval = jrc_transaction (rig, "EE" EOM, 3, funcbuf, &func_len); if (retval != RIG_OK) return retval; if (func_len != 3) { rig_debug(RIG_DEBUG_ERR,"jrc_get_func: wrong answer %s, " "len=%d\n", funcbuf, func_len); return -RIG_ERJCTED; } *status = funcbuf[1] == '1'; return RIG_OK; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_func %d\n", func); return -RIG_EINVAL; } return RIG_OK; } /* * jrc_set_level * Assumes rig!=NULL * FIXME: cannot support PREAMP and ATT both at same time (make sens though) */ int jrc_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct jrc_priv_caps *priv = (struct jrc_priv_caps*)rig->caps->priv; int cmd_len; char cmdbuf[BUFSZ]; /* Optimize: * sort the switch cases with the most frequent first */ switch (level) { case RIG_LEVEL_ATT: cmd_len = sprintf(cmdbuf, "A%d" EOM, val.i?1:0); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_LEVEL_RF: cmd_len = sprintf(cmdbuf, "HH%03d" EOM, (int)(val.f*255.0)); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_LEVEL_AF: cmd_len = sprintf(cmdbuf, "JJ%03d" EOM, (int)(val.f*255.0)); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_LEVEL_SQL: cmd_len = sprintf(cmdbuf, "LL%03d" EOM, (int)(val.f*255.0)); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_LEVEL_NR: cmd_len = sprintf(cmdbuf, "FF%03d" EOM, (int)(val.f*255.0)); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); #if 0 case RIG_LEVEL_TONE: cmd_len = sprintf(cmdbuf, "KK%03d" EOM, (int)(val.f*255.0)); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); #endif case RIG_LEVEL_NOTCHF: cmd_len = sprintf(cmdbuf, "GG%+04d" EOM, val.i); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); #if 0 case RIG_LEVEL_BWC: if (priv->pbs_len == 3) val.i /= 10; cmd_len = sprintf(cmdbuf, "W%0*d" EOM, priv->pbs_len, val.i); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); #endif case RIG_LEVEL_AGC: if (val.i < 10) cmd_len = sprintf(cmdbuf, "G%d" EOM, val.i == RIG_AGC_SLOW ? 0 : val.i == RIG_AGC_FAST ? 1 : 2); else cmd_len = sprintf(cmdbuf, "G3%03d" EOM, val.i/20); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_LEVEL_CWPITCH: cmd_len = sprintf(cmdbuf, "%s%+05d" EOM, priv->cw_pitch, val.i); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_LEVEL_IF: if (priv->pbs_len == 3) val.i /= 10; cmd_len = sprintf(cmdbuf, "P%+0*d" EOM, priv->pbs_len+1, val.i); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_level %d\n", level); return -RIG_EINVAL; } return RIG_OK; } /* * jrc_get_level * Assumes rig!=NULL, val!=NULL */ int jrc_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct jrc_priv_caps *priv = (struct jrc_priv_caps*)rig->caps->priv; int retval, lvl_len, lvl; char lvlbuf[BUFSZ]; char cwbuf[BUFSZ]; int cw_len; switch (level) { case RIG_LEVEL_RAWSTR: /* read A/D converted value */ retval = jrc_transaction (rig, "M" EOM, 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 5) { rig_debug(RIG_DEBUG_ERR,"jrc_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } lvlbuf[4] = '\0'; val->i = atoi(lvlbuf+1); break; case RIG_LEVEL_STRENGTH: /* read calibrated A/D converted value */ retval = jrc_transaction (rig, "M" EOM, 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 5) { rig_debug(RIG_DEBUG_ERR,"jrc_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } lvlbuf[4] = '\0'; val->i = (int)rig_raw2val(atoi(lvlbuf+1), &rig->caps->str_cal); break; case RIG_LEVEL_ATT: retval = get_current_istate(rig, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'I' || lvl_len != priv->info_len) { rig_debug(RIG_DEBUG_ERR,"jrc_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } val->i = lvlbuf[1] == '1' ? 20 : 0; break; case RIG_LEVEL_AGC: retval = get_current_istate(rig, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'I' || lvl_len != priv->info_len) { rig_debug(RIG_DEBUG_ERR,"jrc_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } lvlbuf[priv->info_len-1] = '\0'; if (priv->info_len==14) { switch (lvlbuf[priv->info_len-2]){ case '0' : val->i = RIG_AGC_SLOW; break; case '1' : val->i = RIG_AGC_FAST; break; case '2' : val->i = RIG_AGC_OFF; break; default : val->i = RIG_AGC_FAST; } } else { val->i = atoi(lvlbuf+priv->info_len-4); } break; case RIG_LEVEL_RF: retval = jrc_transaction (rig, "HH" EOM, 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 6) { rig_debug(RIG_DEBUG_ERR,"jrc_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } /* * 000..255 */ sscanf(lvlbuf+2, "%u", &lvl); val->f = (float)lvl/255.0; break; case RIG_LEVEL_AF: retval = jrc_transaction (rig, "JJ" EOM, 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 6) { rig_debug(RIG_DEBUG_ERR,"jrc_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } /* * 000..255 */ sscanf(lvlbuf+2, "%u", &lvl); val->f = (float)lvl/255.0; break; case RIG_LEVEL_SQL: retval = jrc_transaction (rig, "LL" EOM, 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 6) { rig_debug(RIG_DEBUG_ERR,"jrc_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } /* * 000..255 */ sscanf(lvlbuf+2, "%u", &lvl); val->f = (float)lvl/255.0; break; case RIG_LEVEL_NR: retval = jrc_transaction (rig, "FF" EOM, 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 6) { rig_debug(RIG_DEBUG_ERR,"jrc_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } /* * 000..255 */ sscanf(lvlbuf+2, "%u", &lvl); val->f = (float)lvl/255.0; break; #if 0 case RIG_LEVEL_TONE: retval = jrc_transaction (rig, "KK" EOM, 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 6) { rig_debug(RIG_DEBUG_ERR,"jrc_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+2, "%u", &lvl); val->f = (float)lvl/255.0; break; #endif case RIG_LEVEL_NOTCHF: retval = jrc_transaction (rig, "GG" EOM, 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 8) { rig_debug(RIG_DEBUG_ERR,"jrc_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } /* * 000..255 */ sscanf(lvlbuf+2, "%d", &lvl); val->f = (float)lvl/255.0; break; #if 0 case RIG_LEVEL_BWC: retval = jrc_transaction (rig, "W" EOM, 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'W' || lvl_len != priv->pbs_len+2) { rig_debug(RIG_DEBUG_ERR,"jrc_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+1, "%d", &lvl); if (priv->pbs_len == 3) lvl *= 10; val->i = lvl; break; #endif case RIG_LEVEL_CWPITCH: cw_len = sprintf(cwbuf, "%s" EOM, priv->cw_pitch); retval = jrc_transaction (rig, cwbuf, cw_len, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != cw_len+5) { rig_debug(RIG_DEBUG_ERR,"jrc_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+(cw_len-1), "%05d", &lvl); val->i = lvl; break; case RIG_LEVEL_IF: retval = jrc_transaction (rig, "P" EOM, 2, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvlbuf[0] != 'P' || lvl_len != priv->pbs_info_len) { rig_debug(RIG_DEBUG_ERR,"jrc_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } sscanf(lvlbuf+1, "%d", &lvl); if (priv->pbs_len == 3) lvl *= 10; val->i = lvl; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_level %d\n", level); return -RIG_EINVAL; } return RIG_OK; } /* * jrc_set_parm * Assumes rig!=NULL * FIXME: cannot support PREAMP and ATT both at same time (make sens though) */ int jrc_set_parm(RIG *rig, setting_t parm, value_t val) { struct jrc_priv_caps *priv = (struct jrc_priv_caps*)rig->caps->priv; int cmd_len; char cmdbuf[BUFSZ]; int minutes; /* Optimize: * sort the switch cases with the most frequent first */ switch (parm) { case RIG_PARM_BACKLIGHT: cmd_len = sprintf(cmdbuf, "AA%d" EOM, val.f>0.5?0:1); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_PARM_BEEP: cmd_len = sprintf(cmdbuf, "U%0*d" EOM, priv->beep_len, priv->beep + val.i?1:0); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_PARM_TIME: minutes = val.i/60; cmd_len = sprintf(cmdbuf, "R1%02d%02d" EOM, minutes/60, minutes%60); return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_parm %d\n", parm); return -RIG_EINVAL; } return RIG_OK; } /* * jrc_get_parm * Assumes rig!=NULL, val!=NULL */ int jrc_get_parm(RIG *rig, setting_t parm, value_t *val) { struct jrc_priv_caps *priv = (struct jrc_priv_caps*)rig->caps->priv; int retval, lvl_len, i; char lvlbuf[BUFSZ]; char cmdbuf[BUFSZ]; int cmd_len; /* Optimize: * sort the switch cases with the most frequent first */ switch (parm) { case RIG_PARM_TIME: retval = jrc_transaction (rig, "R0" EOM, 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; /* "Rhhmmss"CR */ if (lvl_len != 8) { rig_debug(RIG_DEBUG_ERR,"jrc_get_parm: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } /* convert ASCII to numeric 0..9 */ for (i=1; i<7; i++) { lvlbuf[i] -= '0'; } val->i = ((10*lvlbuf[1] + lvlbuf[2])*60 + /* hours */ 10*lvlbuf[3] + lvlbuf[4])*60 + /* minutes */ 10*lvlbuf[5] + lvlbuf[6]; /* secondes */ break; case RIG_PARM_BEEP: cmd_len = sprintf(cmdbuf, "U%d" EOM, priv->beep/10); retval = jrc_transaction (rig, cmdbuf, cmd_len, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != priv->beep_len+2) { rig_debug(RIG_DEBUG_ERR,"jrc_get_parm: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } val->i = lvlbuf[priv->beep_len] == 0 ? 0 : 1; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_parm %d\n", parm); return -RIG_EINVAL; } return RIG_OK; } /* * jrc_get_dcd * Assumes rig!=NULL, dcd!=NULL */ int jrc_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { char dcdbuf[BUFSZ]; int dcd_len, retval; retval = jrc_transaction (rig, "Q" EOM, 2, dcdbuf, &dcd_len); if (retval != RIG_OK) return retval; if (dcd_len != 3) { rig_debug(RIG_DEBUG_ERR,"jrc_get_dcd: wrong answer %s, " "len=%d\n", dcdbuf, dcd_len); return -RIG_ERJCTED; } *dcd = dcdbuf[1] == '0' ? RIG_DCD_ON : RIG_DCD_OFF; return RIG_OK; } /* * jrc_set_trn * Assumes rig!=NULL */ int jrc_set_trn(RIG *rig, int trn) { char *trncmd; /* transceive(continuous) mode not available in remote mode * so switch back and forth upon entering/leaving */ trncmd = trn==RIG_TRN_RIG ? "H0"EOM"I1"EOM : "H1"EOM"I1"EOM; return jrc_transaction (rig, trncmd, 6, NULL, NULL); } /* * jrc_set_powerstat * Assumes rig!=NULL */ int jrc_set_powerstat(RIG *rig, powerstat_t status) { char pwrbuf[BUFSZ]; int pwr_len; pwr_len = sprintf(pwrbuf, "T%d" EOM, status==RIG_POWER_ON?1:0); return jrc_transaction (rig, pwrbuf, pwr_len, NULL, NULL); } /* * jrc_get_powerstat * Assumes rig!=NULL */ int jrc_get_powerstat(RIG *rig, powerstat_t *status) { char pwrbuf[BUFSZ]; int pwr_len, retval; if (rig->caps->rig_model == RIG_MODEL_NRD535) { retval = jrc_transaction (rig, "T" EOM, 2, pwrbuf, &pwr_len); if (retval != RIG_OK) return retval; if (pwr_len != 3) { rig_debug(RIG_DEBUG_ERR,"jrc_get_powerstat: wrong answer %s, " "len=%d\n", pwrbuf, pwr_len); return -RIG_ERJCTED; } *status = pwrbuf[1] == '0' ? RIG_POWER_OFF : RIG_POWER_ON; return RIG_OK; } else { retval = jrc_transaction (rig, "I" EOM, 2, pwrbuf, &pwr_len); *status = retval != RIG_OK ? RIG_POWER_OFF : RIG_POWER_ON; return retval; } } /* * jrc_reset * Assumes rig!=NULL */ int jrc_reset(RIG *rig, reset_t reset) { char rstbuf[BUFSZ]; int rst_len; char rst; switch(reset) { case RIG_RESET_MCALL: rst='1'; break; /* mem clear */ case RIG_RESET_VFO: rst='2'; break; /* user setup default */ case RIG_RESET_MASTER: rst='3'; break; /* 1 + 2 */ default: rig_debug(RIG_DEBUG_ERR,"jrc_reset: unsupported reset %d\n", reset); return -RIG_EINVAL; } rst_len = sprintf(rstbuf, "Z%c" EOM, rst); return jrc_transaction (rig, rstbuf, rst_len, NULL, NULL); } /* * jrc_set_mem * Assumes rig!=NULL */ int jrc_set_mem(RIG *rig, vfo_t vfo, int ch) { char cmdbuf[BUFSZ]; char membuf[BUFSZ]; int cmd_len, mem_len; if (ch < 0 || ch > rig->caps->chan_list[0].end) return -RIG_EINVAL; cmd_len = sprintf(cmdbuf, "C%03u" EOM, ch); /* don't care about the Automatic reponse from receiver */ return jrc_transaction (rig, cmdbuf, cmd_len, membuf, &mem_len); } /* * jrc_get_mem * Assumes rig!=NULL */ int jrc_get_mem(RIG *rig, vfo_t vfo, int *ch) { struct jrc_priv_caps *priv = (struct jrc_priv_caps*)rig->caps->priv; int mem_len, retval; char membuf[BUFSZ]; int chan; retval = jrc_transaction (rig, "L" EOM, 2, membuf, &mem_len); if (retval != RIG_OK) return retval; /* need to handle vacant memories LmmmV, len = 6 */ if ((mem_len != priv->mem_len) && (mem_len != 6)) { rig_debug(RIG_DEBUG_ERR,"jrc_get_mem: wrong answer %s, " "len=%d\n", membuf, mem_len); return -RIG_ERJCTED; } membuf[4] = '\0'; /*extract current channel*/ sscanf(membuf+1, "%d", &chan); *ch = chan; return RIG_OK; } /* * jrc_set_chan * Assumes rig!=NULL */ int jrc_set_chan(RIG *rig, const channel_t *chan) { struct jrc_priv_caps *priv = (struct jrc_priv_caps*)rig->caps->priv; char cmdbuf[BUFSZ]; int retval, cmd_len; sprintf(cmdbuf,"K%03d000",chan->channel_num); if (chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i == 20) cmdbuf[4] = '1'; retval = rig2jrc_mode(rig, chan->mode, chan->width, &cmdbuf[6], &cmdbuf[5]); if (retval != RIG_OK) return retval; sprintf(cmdbuf+7,"%0*"PRIll, priv->max_freq_len, (int64_t)chan->freq); if (priv->mem_len==17) { switch (chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i) { case RIG_AGC_SLOW : cmdbuf[priv->mem_len-2] = '0'; break; case RIG_AGC_FAST : cmdbuf[priv->mem_len-2] = '1'; break; case RIG_AGC_OFF : cmdbuf[priv->mem_len-2] = '2'; break; default : cmdbuf[priv->mem_len-2] = '1'; } } else { sprintf(cmdbuf+priv->mem_len-4,"%03d", chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i); } cmd_len = priv->mem_len; return jrc_transaction (rig, cmdbuf, cmd_len, NULL, NULL); } /* * jrc_get_chan * Assumes rig!=NULL */ int jrc_get_chan(RIG *rig, channel_t *chan) { struct jrc_priv_caps *priv = (struct jrc_priv_caps*)rig->caps->priv; char membuf[BUFSZ], cmdbuf[BUFSZ], freqbuf[BUFSZ]; int mem_len, cmd_len, retval; chan->vfo = RIG_VFO_MEM; chan->ant = RIG_ANT_NONE; chan->freq = 0; chan->mode = RIG_MODE_NONE; chan->width = RIG_PASSBAND_NORMAL; chan->tx_freq = 0; chan->tx_mode = RIG_MODE_NONE; chan->tx_width = RIG_PASSBAND_NORMAL; chan->split = RIG_SPLIT_OFF; chan->tx_vfo = RIG_VFO_NONE; chan->rptr_shift = RIG_RPT_SHIFT_NONE; chan->rptr_offs = 0; chan->tuning_step = 0; chan->rit = 0; chan->xit = 0; chan->funcs = 0; chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i = RIG_AGC_OFF; chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i = 0; chan->ctcss_tone = 0; chan->ctcss_sql = 0; chan->dcs_code = 0; chan->dcs_sql = 0; chan->scan_group = 0; chan->flags = RIG_CHFLAG_SKIP; strcpy(chan->channel_desc, ""); cmd_len = sprintf(cmdbuf, "L%03d%03d" EOM, chan->channel_num, chan->channel_num); retval = jrc_transaction (rig, cmdbuf, cmd_len, membuf, &mem_len); if (retval != RIG_OK) return retval; /* need to handle vacant memories LmmmV, len = 6 */ if ((mem_len != priv->mem_len) && (mem_len != 6)) { rig_debug(RIG_DEBUG_ERR,"jrc_get_mem: wrong answer %s, " "len=%d\n", membuf, mem_len); return -RIG_ERJCTED; } if (mem_len != 6) { if (membuf[4] == '1') chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i = 20; jrc2rig_mode(rig, membuf[6], membuf[5], &chan->mode, &chan->width); strncpy(freqbuf,membuf+7,priv->max_freq_len); freqbuf[priv->max_freq_len] = 0x00; chan->freq = strtol(freqbuf,NULL, 10); if (priv->mem_len==17) { switch (membuf[priv->mem_len-2]){ case '0' : chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i = RIG_AGC_SLOW; break; case '1' : chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i = RIG_AGC_FAST; break; case '2' : chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i = RIG_AGC_OFF; break; default : chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i = RIG_AGC_FAST; } } else { strncpy(freqbuf,membuf+priv->mem_len-4,3); chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i = strtol(freqbuf,NULL, 10); } } return RIG_OK; } /* * jrc_vfo_op * Assumes rig!=NULL */ int jrc_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { const char *cmd; switch(op) { case RIG_OP_FROM_VFO: cmd="E1" EOM; break; case RIG_OP_UP: cmd="MM25" EOM; break; case RIG_OP_DOWN: cmd="MM24" EOM; break; default: rig_debug(RIG_DEBUG_ERR,"jrc_vfo_op: unsupported op %#x\n", op); return -RIG_EINVAL; } return jrc_transaction (rig, cmd, strlen(cmd), NULL, NULL); } /* * jrc_scan, scan operation * Assumes rig!=NULL * * Not really a scan operation so speaking. * You just make the rig increment frequency of decrement continuously, * depending on the sign of ch. * However, using DCD sensing, followed by a stop, you get it. */ int jrc_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) { const char *scan_cmd = ""; switch(scan) { case RIG_SCAN_STOP: scan_cmd = "Y0" EOM; break; case RIG_SCAN_SLCT: scan_cmd = ch > 0 ? "Y+" EOM : "Y-" EOM; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported scan %#x", scan); return -RIG_EINVAL; } return jrc_transaction (rig, scan_cmd, 3, NULL, NULL); } /* * jrc_decode is called by sa_sigio, when some asynchronous * data has been received from the rig */ int jrc_decode_event(RIG *rig) { struct jrc_priv_caps *priv = (struct jrc_priv_caps*)rig->caps->priv; struct rig_state *rs; freq_t freq; rmode_t mode; pbwidth_t width; int count; char buf[BUFSZ]; rig_debug(RIG_DEBUG_VERBOSE, "jrc: jrc_decode called\n"); rs = &rig->state; /* "Iabdfg"CR */ //#define SETUP_STATUS_LEN 17 //count = read_string(&rs->rigport, buf, SETUP_STATUS_LEN, "", 0); count = read_string(&rs->rigport, buf, priv->info_len, "", 0); if (count < 0) { return count; } buf[31] = '\0'; /* stop run away.. */ if (buf[0] != 'I') { rig_debug(RIG_DEBUG_WARN, "jrc: unexpected data: %s\n", buf); return -RIG_EPROTO; } /* * TODO: Attenuator and AGC change notification. */ if (rig->callbacks.freq_event) { //buf[14] = '\0'; /* side-effect: destroy AGC first digit! */ buf[4+priv->max_freq_len] = '\0'; /* side-effect: destroy AGC first digit! */ sscanf(buf+4, "%"SCNfreq, &freq); return rig->callbacks.freq_event(rig, RIG_VFO_CURR, freq, rig->callbacks.freq_arg); } if (rig->callbacks.mode_event) { jrc2rig_mode(rig, buf[3], buf[2], &mode, &width); return rig->callbacks.mode_event(rig, RIG_VFO_CURR, mode, width, rig->callbacks.freq_arg); } return RIG_OK; } /* * initrigs_jrc is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(jrc) { rig_debug(RIG_DEBUG_VERBOSE, "jrc: _init called\n"); rig_register(&nrd535_caps); rig_register(&nrd545_caps); rig_register(&nrd525_caps); return RIG_OK; } hamlib-1.2.15.3/jrc/Makefile.am0000644000175000017500000000040512044564477012744 00000000000000JRCSRCLIST = nrd535.c nrd545.c nrd525.c pkglib_LTLIBRARIES = hamlib-jrc.la hamlib_jrc_la_SOURCES = $(JRCSRCLIST) jrc.c hamlib_jrc_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_jrc_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = jrc.h hamlib-1.2.15.3/hamlib.pc.in0000644000175000017500000000043012044564477012315 00000000000000prefix=@prefix@ exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: hamlib Description: Library to control radio and rotator equipment. URL: @PACKAGE_URL@ Requires: Version: @VERSION@ Libs: -L${libdir} -lhamlib @MATH_LIBS@ Cflags: -I${includedir} hamlib-1.2.15.3/gs232a/0000755000175000017500000000000012044565036011204 500000000000000hamlib-1.2.15.3/gs232a/gs232a.h0000644000175000017500000000217112044564477012307 00000000000000/* * Hamlib Rotator backend - GS-232 interface protocol * Copyright (c) 2001-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROT_GS232A_H #define _ROT_GS232A_H 1 extern const struct rot_caps gs232_rot_caps; extern const struct rot_caps gs232a_rot_caps; extern const struct rot_caps gs232b_rot_caps; extern const struct rot_caps f1tetracker_rot_caps; #endif /* _ROT_GS232A_H */ hamlib-1.2.15.3/gs232a/gs232.c0000644000175000017500000001613412044564477012145 00000000000000/* * Hamlib Rotator backend - GS-232 * Copyright (c) 2001-2010 by Stephane Fillod * Copyright (c) 2009 by Jason Winningham * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rotator.h" #include "serial.h" #include "misc.h" #include "register.h" #include "gs232a.h" #define EOM "\r" #define REPLY_EOM "\r" #define BUFSZ 64 /** * gs232_transaction * * cmdstr - Command to be sent to the rig. * data - Buffer for reply string. Can be NULL, indicating that no reply is * is needed, but answer will still be read. * data_len - in: Size of buffer. It is the caller's responsibily to provide * a large enough buffer for all possible replies for a command. * * returns: * RIG_OK - if no error occured. * RIG_EIO - if an I/O error occured while sending/receiving data. * RIG_ETIMEOUT - if timeout expires without any characters received. * RIG_REJECTED - if a negative acknowledge was received or command not * recognized by rig. */ static int gs232_transaction (ROT *rot, const char *cmdstr, char *data, size_t data_len) { struct rot_state *rs; int retval; int retry_read = 0; char replybuf[BUFSZ]; rs = &rot->state; transaction_write: serial_flush(&rs->rotport); if (cmdstr) { retval = write_block(&rs->rotport, cmdstr, strlen(cmdstr)); if (retval != RIG_OK) goto transaction_quit; } /* Always read the reply to know whether the cmd went OK */ if (!data) data = replybuf; if (!data_len) data_len = BUFSZ; memset(data,0,data_len); retval = read_string(&rs->rotport, data, data_len, REPLY_EOM, strlen(REPLY_EOM)); if (retval < 0) { if (retry_read++ < rot->state.rotport.retry) goto transaction_write; goto transaction_quit; } #if 0 /* Check that command termination is correct */ if (strchr(REPLY_EOM, data[strlen(data)-1])==NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __FUNCTION__, data); if (retry_read++ < rig->state.rotport.retry) goto transaction_write; retval = -RIG_EPROTO; goto transaction_quit; } #endif if (data[0] == '?') { /* Invalid command */ rig_debug(RIG_DEBUG_VERBOSE, "%s: Error for '%s': '%s'\n", __FUNCTION__, cmdstr, data); retval = -RIG_EPROTO; goto transaction_quit; } retval = RIG_OK; transaction_quit: return retval; } /* * write-only transaction, no data returned by controller */ static int gs232_wo_transaction (ROT *rot, const char *cmdstr, char *data, size_t data_len) { return write_block(&rot->state.rotport, cmdstr, strlen(cmdstr)); } static int gs232_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) { char cmdstr[64]; int retval; unsigned u_az, u_el; rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __FUNCTION__, az, el); u_az = (unsigned)rint(az); u_el = (unsigned)rint(el); sprintf(cmdstr, "W%03u %03u" EOM, u_az, u_el); retval = gs232_wo_transaction(rot, cmdstr, NULL, 0); if (retval != RIG_OK) return retval; return RIG_OK; } static int gs232_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { char posbuf[32]; int retval; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); retval = gs232_transaction(rot, "C2" EOM, posbuf, sizeof(posbuf)); if (retval != RIG_OK || strlen(posbuf) < 10) return retval; /* parse */ if (sscanf(posbuf+2, "%f", az) != 1) { rig_debug(RIG_DEBUG_ERR, "%s: wrong reply '%s'\n", __FUNCTION__, posbuf); return -RIG_EPROTO; } if (sscanf(posbuf+7, "%f", el) != 1) { rig_debug(RIG_DEBUG_ERR, "%s: wrong reply '%s'\n", __FUNCTION__, posbuf); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: (az, el) = (%.1f, %.1f)\n", __FUNCTION__, *az, *el); return RIG_OK; } static int gs232_rot_stop(ROT *rot) { int retval; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); /* All Stop */ retval = gs232_wo_transaction(rot, "S" EOM, NULL, 0); if (retval != RIG_OK) return retval; return RIG_OK; } /* ************************************************************************* */ /* * Generic GS232 (not A, not B) rotator capabilities. */ const struct rot_caps gs232_rot_caps = { .rot_model = ROT_MODEL_GS232, .model_name = "GS-232", .mfg_name = "Yaesu/Kenpro", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_AZEL, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 150, .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 = 400, .retry = 3, .min_az = 0.0, .max_az = 450.0, /* vary according to rotator type */ .min_el = 0.0, .max_el = 180.0, .get_position = gs232_rot_get_position, .set_position = gs232_rot_set_position, .stop = gs232_rot_stop, }; /* ************************************************************************* */ /* * F1TE Tracker, GS232 withtout position feedback * * http://www.f1te.org/index.php?option=com_content&view=article&id=19&Itemid=39 */ const struct rot_caps f1tetracker_rot_caps = { .rot_model = ROT_MODEL_F1TETRACKER, .model_name = "GS232/F1TE Tracker", .mfg_name = "F1TE", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_AZEL, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 150, .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 = 400, .retry = 0, .min_az = 0.0, .max_az = 360.0, /* vary according to rotator type */ .min_el = 0.0, .max_el = 180.0, .get_position = NULL, /* no position feedback available */ .set_position = gs232_rot_set_position, #if 0 .stop = gs232_rot_stop, #endif }; hamlib-1.2.15.3/gs232a/gs232b.c0000644000175000017500000001622312044564477012306 00000000000000/* * Hamlib Rotator backend - GS-232B * Copyright (c) 2001-2012 by Stephane Fillod * (c) 2010 by Kobus Botha * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rotator.h" #include "serial.h" #include "misc.h" #include "register.h" #include "gs232a.h" #define EOM "\r" #define REPLY_EOM "\r\n" #define BUFSZ 64 /** * gs232b_transaction * * cmdstr - Command to be sent to the rig. * data - Buffer for reply string. Can be NULL, indicating that no reply is * is needed, but answer will still be read. * data_len - in: Size of buffer. It is the caller's responsibily to provide * a large enough buffer for all possible replies for a command. * * returns: * RIG_OK - if no error occured. * RIG_EIO - if an I/O error occured while sending/receiving data. * RIG_ETIMEOUT - if timeout expires without any characters received. * RIG_REJECTED - if a negative acknowledge was received or command not * recognized by rig. */ static int gs232b_transaction (ROT *rot, const char *cmdstr, char *data, size_t data_len) { struct rot_state *rs; int retval; int retry_read = 0; char replybuf[BUFSZ]; rs = &rot->state; transaction_write: serial_flush(&rs->rotport); if (cmdstr) { retval = write_block(&rs->rotport, cmdstr, strlen(cmdstr)); if (retval != RIG_OK) goto transaction_quit; } /* Always read the reply to know whether the cmd went OK */ if (!data) data = replybuf; if (!data_len) data_len = BUFSZ; memset(data,0,data_len); retval = read_string(&rs->rotport, data, data_len, REPLY_EOM, strlen(REPLY_EOM)); if (retval < 0) { if (retry_read++ < rot->state.rotport.retry) goto transaction_write; goto transaction_quit; } #if 0 /* Check that command termination is correct */ if (strchr(REPLY_EOM, data[strlen(data)-1])==NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __FUNCTION__, data); if (retry_read++ < rig->state.rotport.retry) goto transaction_write; retval = -RIG_EPROTO; goto transaction_quit; } #endif if (data[0] == '?') { /* Invalid command */ rig_debug(RIG_DEBUG_VERBOSE, "%s: Error for '%s': '%s'\n", __FUNCTION__, cmdstr, data); retval = -RIG_EPROTO; goto transaction_quit; } retval = RIG_OK; transaction_quit: return retval; } static int gs232b_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) { char cmdstr[64]; int retval; unsigned u_az, u_el; rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __FUNCTION__, az, el); u_az = (unsigned)rint(az); u_el = (unsigned)rint(el); sprintf(cmdstr, "W%03u %03u" EOM, u_az, u_el); retval = gs232b_transaction(rot, cmdstr, NULL, 0); if (retval != RIG_OK) { return retval; } return RIG_OK; } static int gs232b_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { char posbuf[32]; int retval, angle; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); retval = gs232b_transaction(rot, "C2" EOM, posbuf, sizeof(posbuf)); if (retval != RIG_OK || strlen(posbuf) < 10) { return retval < 0 ? retval : -RIG_EPROTO; } /* parse "AZ=aaa EL=eee" */ if (sscanf(posbuf+3, "%d", &angle) != 1) { rig_debug(RIG_DEBUG_ERR, "%s: wrong reply '%s'\n", __FUNCTION__, posbuf); return -RIG_EPROTO; } *az = (azimuth_t)angle; if (sscanf(posbuf+11, "%d", &angle) != 1) { rig_debug(RIG_DEBUG_ERR, "%s: wrong reply '%s'\n", __FUNCTION__, posbuf); return -RIG_EPROTO; } *el = (elevation_t)angle; rig_debug(RIG_DEBUG_TRACE, "%s: (az, el) = (%.1f, %.1f)\n", __FUNCTION__, *az, *el); return RIG_OK; } static int gs232b_rot_stop(ROT *rot) { int retval; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); /* All Stop */ retval = gs232b_transaction(rot, "S" EOM, NULL, 0); if (retval != RIG_OK) return retval; return RIG_OK; } static int gs232b_rot_move(ROT *rot, int direction, int speed) { char cmdstr[24]; int retval; unsigned x_speed; rig_debug(RIG_DEBUG_TRACE, "%s called %d %d\n", __FUNCTION__, direction, speed); x_speed = (3*speed)/100 + 1; /* between 1 (slowest) and 4 (fastest) */ sprintf(cmdstr, "X%u" EOM, x_speed); retval = gs232b_transaction(rot, cmdstr, NULL, 0); if (retval != RIG_OK) return retval; switch (direction) { case ROT_MOVE_UP: /* Elevation increase */ sprintf(cmdstr, "U" EOM); break; case ROT_MOVE_DOWN: /* Elevation decrease */ sprintf(cmdstr, "D" EOM); break; case ROT_MOVE_LEFT: /* Azimuth decrease */ sprintf(cmdstr, "L" EOM); break; case ROT_MOVE_RIGHT: /* Azimuth increase */ sprintf(cmdstr, "R" EOM); break; default: rig_debug(RIG_DEBUG_ERR,"%s: Invalid direction value! (%d)\n", __FUNCTION__, direction); return -RIG_EINVAL; } retval = gs232b_transaction(rot, cmdstr, NULL, 0); if (retval != RIG_OK) return retval; return RIG_OK; } /* ************************************************************************* */ /* * Generic GS232B rotator capabilities. */ const struct rot_caps gs232b_rot_caps = { .rot_model = ROT_MODEL_GS232B, .model_name = "GS-232B", .mfg_name = "Yaesu", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_OTHER, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 150, .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 = 400, .retry = 3, .min_az = 0.0, .max_az = 450.0, /* vary according to rotator type */ .min_el = 0.0, .max_el = 180.0, /* requires G-5400B, G-5600B, G-5500, or G-500/G-550 */ .get_position = gs232b_rot_get_position, .set_position = gs232b_rot_set_position, .stop = gs232b_rot_stop, .move = gs232b_rot_move, }; /* end of file */ hamlib-1.2.15.3/gs232a/Makefile.in0000644000175000017500000004765612044564552013215 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = gs232a DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_gs232a_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am_hamlib_gs232a_la_OBJECTS = gs232a.lo gs232b.lo gs232.lo hamlib_gs232a_la_OBJECTS = $(am_hamlib_gs232a_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_gs232a_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_gs232a_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_gs232a_la_SOURCES) DIST_SOURCES = $(hamlib_gs232a_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = hamlib-gs232a.la hamlib_gs232a_la_SOURCES = gs232a.c gs232b.c gs232.c hamlib_gs232a_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_gs232a_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = gs232a.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gs232a/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gs232a/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-gs232a.la: $(hamlib_gs232a_la_OBJECTS) $(hamlib_gs232a_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_gs232a_la_LINK) -rpath $(pkglibdir) $(hamlib_gs232a_la_OBJECTS) $(hamlib_gs232a_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gs232.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gs232a.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gs232b.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/gs232a/gs232a.c0000644000175000017500000001701112044564477012301 00000000000000/* * Hamlib Rotator backend - GS-232A * Copyright (c) 2001-2012 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rotator.h" #include "serial.h" #include "misc.h" #include "register.h" #include "gs232a.h" #define EOM "\r" #define REPLY_EOM "\r\n" #define BUFSZ 64 /** * gs232a_transaction * * cmdstr - Command to be sent to the rig. * data - Buffer for reply string. Can be NULL, indicating that no reply is * is needed, but answer will still be read. * data_len - in: Size of buffer. It is the caller's responsibily to provide * a large enough buffer for all possible replies for a command. * * returns: * RIG_OK - if no error occured. * RIG_EIO - if an I/O error occured while sending/receiving data. * RIG_ETIMEOUT - if timeout expires without any characters received. * RIG_REJECTED - if a negative acknowledge was received or command not * recognized by rig. */ static int gs232a_transaction (ROT *rot, const char *cmdstr, char *data, size_t data_len) { struct rot_state *rs; int retval; int retry_read = 0; char replybuf[BUFSZ]; rs = &rot->state; transaction_write: serial_flush(&rs->rotport); if (cmdstr) { retval = write_block(&rs->rotport, cmdstr, strlen(cmdstr)); if (retval != RIG_OK) goto transaction_quit; } /* Always read the reply to know whether the cmd went OK */ if (!data) data = replybuf; if (!data_len) data_len = BUFSZ; memset(data,0,data_len); retval = read_string(&rs->rotport, data, data_len, REPLY_EOM, strlen(REPLY_EOM)); if (retval < 0) { if (retry_read++ < rot->state.rotport.retry) goto transaction_write; goto transaction_quit; } #if 0 /* Check that command termination is correct */ if (strchr(REPLY_EOM, data[strlen(data)-1])==NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __FUNCTION__, data); if (retry_read++ < rig->state.rotport.retry) goto transaction_write; retval = -RIG_EPROTO; goto transaction_quit; } #endif if (data[0] == '?') { /* Invalid command */ rig_debug(RIG_DEBUG_VERBOSE, "%s: Error for '%s': '%s'\n", __FUNCTION__, cmdstr, data); retval = -RIG_EPROTO; goto transaction_quit; } retval = RIG_OK; transaction_quit: return retval; } static int gs232a_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) { char cmdstr[64]; int retval; unsigned u_az, u_el; rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __FUNCTION__, az, el); u_az = (unsigned)rint(az); u_el = (unsigned)rint(el); sprintf(cmdstr, "W%03u %03u" EOM, u_az, u_el); retval = gs232a_transaction(rot, cmdstr, NULL, 0); if (retval != RIG_OK) { return retval; } return RIG_OK; } static int gs232a_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { char posbuf[32]; int retval, angle; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); retval = gs232a_transaction(rot, "C2" EOM, posbuf, sizeof(posbuf)); if (retval != RIG_OK || strlen(posbuf) < 10) { return retval < 0 ? retval : -RIG_EPROTO; } /* parse "+0aaa+0eee" */ if (sscanf(posbuf+2, "%d", &angle) != 1) { rig_debug(RIG_DEBUG_ERR, "%s: wrong reply '%s'\n", __FUNCTION__, posbuf); return -RIG_EPROTO; } *az = (azimuth_t)angle; if (sscanf(posbuf+7, "%d", &angle) != 1) { rig_debug(RIG_DEBUG_ERR, "%s: wrong reply '%s'\n", __FUNCTION__, posbuf); return -RIG_EPROTO; } *el = (elevation_t)angle; rig_debug(RIG_DEBUG_TRACE, "%s: (az, el) = (%.1f, %.1f)\n", __FUNCTION__, *az, *el); return RIG_OK; } static int gs232a_rot_stop(ROT *rot) { int retval; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); /* All Stop */ retval = gs232a_transaction(rot, "S" EOM, NULL, 0); if (retval != RIG_OK) return retval; return RIG_OK; } static int gs232a_rot_move(ROT *rot, int direction, int speed) { char cmdstr[24]; int retval; unsigned x_speed; rig_debug(RIG_DEBUG_TRACE, "%s called %d %d\n", __FUNCTION__, direction, speed); x_speed = (3*speed)/100 + 1; /* between 1 (slowest) and 4 (fastest) */ sprintf(cmdstr, "X%u" EOM, x_speed); retval = gs232a_transaction(rot, cmdstr, NULL, 0); if (retval != RIG_OK) return retval; switch (direction) { case ROT_MOVE_UP: /* Elevation increase */ sprintf(cmdstr, "U" EOM); break; case ROT_MOVE_DOWN: /* Elevation decrease */ sprintf(cmdstr, "D" EOM); break; case ROT_MOVE_LEFT: /* Azimuth decrease */ sprintf(cmdstr, "L" EOM); break; case ROT_MOVE_RIGHT: /* Azimuth increase */ sprintf(cmdstr, "R" EOM); break; default: rig_debug(RIG_DEBUG_ERR,"%s: Invalid direction value! (%d)\n", __FUNCTION__, direction); return -RIG_EINVAL; } retval = gs232a_transaction(rot, cmdstr, NULL, 0); if (retval != RIG_OK) return retval; return RIG_OK; } /* ************************************************************************* */ /* * Generic GS232A rotator capabilities. */ const struct rot_caps gs232a_rot_caps = { .rot_model = ROT_MODEL_GS232A, .model_name = "GS-232A", .mfg_name = "Yaesu", .version = "0.3", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_OTHER, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 150, .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 = 400, .retry = 3, .min_az = 0.0, .max_az = 450.0, /* vary according to rotator type */ .min_el = 0.0, .max_el = 180.0, /* requires G-5400B, G-5600B, G-5500, or G-500/G-550 */ .get_position = gs232a_rot_get_position, .set_position = gs232a_rot_set_position, .stop = gs232a_rot_stop, .move = gs232a_rot_move, }; /* ************************************************************************* */ DECLARE_INITROT_BACKEND(gs232a) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); rot_register(&gs232a_rot_caps); rot_register(&gs232b_rot_caps); rot_register(&gs232_rot_caps); rot_register(&f1tetracker_rot_caps); return RIG_OK; } /* ************************************************************************* */ /* end of file */ hamlib-1.2.15.3/gs232a/Makefile.am0000644000175000017500000000036212044564477013171 00000000000000 pkglib_LTLIBRARIES = hamlib-gs232a.la hamlib_gs232a_la_SOURCES = gs232a.c gs232b.c gs232.c hamlib_gs232a_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_gs232a_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = gs232a.h hamlib-1.2.15.3/configure.ac0000644000175000017500000004345412044564477012433 00000000000000## Process this file with autoconf to create configure. -*- autoconf -*- ## FIXME: Is this really new enough? ## AC_PREREQ(2.59) ## ------------------------ ## ## Autoconf initialisation. ## ## ------------------------ ## dnl Please do not use '-' in the version number, as package managers will fail, dnl however, the use of '~' should be fine as apt (others?) will treat dnl it as an earlier version than the actual release. TNX KA6MAL dnl PACKAGE_NAME + " " + PACKAGE_VERSION must not exceed 20 chars! AC_INIT([Hamlib],[1.2.15.3],[hamlib-developer@lists.sourceforge.net],[hamlib],[http://www.hamlib.org]) AC_CONFIG_SRCDIR([include/hamlib/rig.h]) AC_CONFIG_MACRO_DIR([macros]) ## ------------------------ ## ## Automake Initialisation. ## ## ------------------------ ## AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION, -) AC_CONFIG_HEADERS([include/config.h]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AM_MAINTAINER_MODE ## ------------------------------- ## ## Hamlib specific configuration. ## ## ------------------------------- ## ABI_VERSION=2 dnl Pick up the Hamlib macros. AM_ACLOCAL_INCLUDE([macros]) AC_DEFINE_UNQUOTED(ABI_VERSION, $ABI_VERSION, [Frontend ABI version]) AC_SUBST(ABI_VERSION) dnl directory for docs (html) hamlibdocdir=$datadir/doc/hamlib AC_SUBST(hamlibdocdir) dnl Checks for programs. AC_PROG_CC AC_PROG_CXX AC_PROG_AWK AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET dnl Pkgconfig PKG_PROG_PKG_CONFIG dnl AC_AIX dnl AC_ISC_POSIX dnl AC_MINIX dnl AC_PROG_CC() dnl AC_DIAGNOSE([obsolete],[AM_PROG_CC_STDC: dnl your code should no longer depend upon 'am_cv_prog_cc_stdc', but upon dnl 'ac_cv_prog_cc_stdc'. Remove this warning and the assignment when dnl you adjust the code. You can also remove the above call to dnl AC_PROG_CC if you already called it elsewhere.]) dnl am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc AC_PROG_GCC_TRADITIONAL AC_C_CONST AC_C_INLINE LF_SET_WARNINGS dnl Automake macro for rigmem compilation AM_PROG_CC_C_O dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS([alloca.h argz.h malloc.h memory.h string.h strings.h]) AC_CHECK_HEADERS([stdlib.h values.h rpc/rpc.h rpc/rpcent.h net/errno.h]) AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/time.h sys/param.h unistd.h getopt.h errno.h]) AC_CHECK_HEADERS([sys/ioccom.h sgtty.h term.h termio.h termios.h]) AC_CHECK_HEADERS([linux/ppdev.h linux/parport.h linux/ioctl.h linux/hidraw.h]) AC_CHECK_HEADERS([dev/ppbus/ppi.h dev/ppbus/ppbconf.h]) AC_CHECK_HEADERS([sys/socket.h netinet/in.h netdb.h arpa/inet.h ws2tcpip.h]) dnl Check for Mingw (Win32 Sleep) support GR_PWIN32 ACX_PTHREAD if test x"$acx_pthread_ok" = xyes; then CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}" CXXFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}" fi AC_SYS_POSIX_TERMIOS() INCLUDES="${INCLUDES} -I\$(top_srcdir)/include -I\$(top_srcdir)/src -I\$(top_srcdir)/lib" dnl Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T AC_HEADER_TIME dnl AC_TYPE_SIGNAL AC_CHECK_TYPES([siginfo_t],[],[],[#include ]) dnl Checks for libraries. # The following comes from SC_TCL_LINK_LIBS # we redefine them here because we want a separate NET_LIBS var #-------------------------------------------------------------------- # On a few very rare systems, all of the libm.a stuff is # already in libc.a. Set compiler flags accordingly. #-------------------------------------------------------------------- AC_CHECK_FUNC(sin, [MATH_LIBS=""], [MATH_LIBS="-lm"]) #-------------------------------------------------------------------- # Interactive UNIX requires -linet instead of -lsocket, plus it # needs net/errno.h to define the socket-related error codes. #-------------------------------------------------------------------- AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"], [], []) #-------------------------------------------------------------------- # Check for the existence of the -lsocket and -lnsl libraries. # The order here is important, so that they end up in the right # order in the command line generated by make. Here are some # special considerations: # 1. Use "connect" and "accept" to check for -lsocket, and # "gethostbyname" to check for -lnsl. # 2. Use each function name only once: can't redo a check because # autoconf caches the results of the last check and won't redo it. # 3. Use -lnsl and -lsocket only if they supply procedures that # aren't already present in the normal libraries. This is because # IRIX 5.2 has libraries, but they aren't needed and they're # bogus: they goof up name resolution if used. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. # To get around this problem, check for both libraries together # if -lsocket doesn't work by itself. #-------------------------------------------------------------------- hl_checkBoth=0 hl_oldLibs=$LIBS AC_CHECK_FUNC(connect, hl_checkSocket=0, hl_checkSocket=1) if test "$hl_checkSocket" = 1; then AC_CHECK_LIB(socket, main, [NET_LIBS="$NET_LIBS -lsocket"], [hl_checkBoth=1], []) fi if test "$hl_checkBoth" = 1; then hl2_oldLibs=$LIBS LIBS="$LIBS -lsocket -lnsl" AC_CHECK_FUNC(accept, hl_checkNsl=0, [LIBS=$hl2_oldLibs]) fi AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [NET_LIBS="$NET_LIBS -lnsl"], [], [])) # Winsock2 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(ws2_32, main, [NET_LIBS="$NET_LIBS -lws2_32"], [], [])) LIBS="$LIBS $NET_LIBS" HL_GETADDRINFO LIBS=$hl_oldLibs AC_SUBST(NET_LIBS) AC_SUBST(MATH_LIBS) AC_CHECK_LIB(syslog,syslog) # OS/2 needs this dnl Checks for library functions. AC_CHECK_FUNCS([atexit snprintf select memmove memset]) AC_CHECK_FUNCS([strcasecmp strchr strdup strerror strrchr strstr strtol]) AC_CHECK_FUNCS([cfmakeraw setitimer ioctl sigaction]) AC_FUNC_ALLOCA #AC_FUNC_MALLOC AC_FUNC_VPRINTF AC_LIBOBJ(termios) AC_LIBOBJ(dummy) ## ------------------------ ## ## libtool Initialisation. ## ## ------------------------ ## ## N.b. LT_INIT([dlopen], [win32-dll]) does not work for older libtool LT_PREREQ([2.2.6b]) LT_INIT([dlopen win32-dll]) dnl AC_LIBTOOL_DLOPEN dnl AC_LIBTOOL_WIN32_DLL dnl AC_PROG_LIBTOOL dnl AM_PROG_LIBTOOL INCLTDL="" LIBLTDL="-lltdl" AC_SUBST(INCLTDL) AC_SUBST(LIBLTDL) case "$host_os" in freebsd*) INCLUDES="-I/usr/local/include ${INCLUDES}" AM_LDFLAGS="${AM_LDFLAGS} -L/usr/local/lib" AC_SUBST([AM_LDFLAGS]) ;; darwin* | rhapsody*) # Trick from http://fink.sourceforge.net/doc/porting/ # TODO: check the compiler actually does support these options CFLAGS="${CFLAGS} -no-cpp-precomp" CXXFLAGS="${CXXFLAGS} -no-cpp-precomp" # Tell the OS X linker to allocate enough space inside the # libhamlib.X.dylib shared object for install_name_tool(1) to # work. This is useful when including hamlib in an app bundle. OSXLDFLAGS="-Wl,-headerpad_max_install_names" AC_SUBST([OSXLDFLAGS]) ;; mingw* | pw32* | cygwin*) WINLDFLAGS="-Wl,--output-def,libhamlib.def -Wl,--add-stdcall-alias" AC_SUBST([WINLDFLAGS]) # Prerequisite for Mingw build (import and build internal ./libltdl): # $ libtoolize --ltdl # $ ( cd libltdl; ./configure --host=i586-mingw32msvc && make ) # Use internal ./libltdl during configure: CFLAGS="${CFLAGS} -I./libltdl" # use internal $(top_builddir)/libltdl during build: INCLTDL="-I\$(top_builddir)/libltdl" # - use internal $(top_builddir)/libltdl during build and library 'ltdlc': LIBLTDL="-L\$(top_builddir)/libltdl -lltdlc" AC_SUBST(INCLTDL) AC_SUBST(LIBLTDL) # Enable ld's "auto import" for executables WINEXELDFLAGS="-Wl,--enable-auto-import" AC_SUBST([WINEXELDFLAGS]) ;; esac dnl Check whether we can actually find ltdl.h AC_CHECK_HEADER([ltdl.h], [AC_MSG_RESULT([yes])], [ AC_MSG_ERROR([ltdl.h not found. Please install the libltdl development files package which provides /usr/include/ltdl.h (perhaps called 'libltdl-dev' or 'libltdl-devel').]) ]) dnl Check if C99 struct initializers are supported AC_MSG_CHECKING(whether C99 struct/array initializers are supported) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[struct{char a;int b;}s[8]={[3]={.b=5}};]])],[AC_MSG_RESULT(yes)],[AC_MSG_ERROR( "" "You need a C99 compliant C compiler that supports struct/array intializers." "Have you considered GCC lately?.")]); dnl libxml2 required rigmem xml support PKG_CHECK_MODULES([LIBXML2], [libxml-2.0], [AC_DEFINE(HAVE_XML2,[1],[Define if libxml2 is available])], [AC_MSG_WARN([libxml-2.0 pkg-config not found, XML support will be disabled])]) AC_SUBST(LIBXML2_LIBS) AC_SUBST(LIBXML2_CFLAGS) dnl Check if libgd-dev is installed, so we can enable rigmatrix AC_ARG_WITH(rigmatrix, [ --with-rigmatrix Generate rigmatrix tool (requires libgd)], [AC_CHECK_HEADERS([gd.h], [AC_CHECK_LIB([gd],[gdImageCreate], [enable_rigmatrix=yes], [enable_rigmatrix=no],[-lz]) ]) ], [enable_rigmatrix=no]) AC_MSG_CHECKING(whether to build rigmatrix) AC_MSG_RESULT($enable_rigmatrix) if test "${enable_rigmatrix}" = "no"; then RIGMATRIX= else RIGMATRIX="rigmatrix" fi AC_SUBST(RIGMATRIX) BACKEND_LIST="icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc drake lowe rft rs kit skanti prm80 tapr flexradio wj racal tuner adat" ROT_BACKEND_LIST="dummy easycomm fodtrack gs232a heathkit kit rotorez sartek spid ars m2 amsat ts7400 celestron" BINDINGS="" BINDING_ALL="" BINDING_CHECK="" BINDING_CLEAN="" BINDING_DISTCLEAN="" BINDING_DISTCHECK="" BINDING_INSTALL_EXEC="" BINDING_UNINSTALL="" BINDING_LIST="" BINDING_LIB_TARGETS="" dnl Check if cxx-binding not wanted, default is to build it # TODO: check whether CXX is functional AC_CHECK_PROG(cf_with_cxx, "${CXX}", [yes], [no]) AC_MSG_CHECKING(whether to build C++ binding and demo) AC_ARG_WITH(cxx-binding, [ --without-cxx-binding do not build C++ binding and demo], [cf_with_cxx_binding=$withval], [cf_with_cxx_binding=$cf_with_cxx]) AC_MSG_RESULT($cf_with_cxx_binding) if test "${cf_with_cxx_binding}" = "yes" ; then BINDINGS="${BINDINGS} c++" fi dnl Check if perl-binding not wanted, default is to not build it AC_MSG_CHECKING(whether to build perl binding and demo) AC_ARG_WITH(perl-binding, [ --with-perl-binding build perl binding and demo], [cf_with_perl_binding=$withval], [cf_with_perl_binding=no]) AC_MSG_RESULT($cf_with_perl_binding) if test "${cf_with_perl_binding}" = "yes" ; then SC_PATH_PERLINC BINDING_LIST="${BINDING_LIST} perl" BINDING_ALL="${BINDING_ALL} all-perl" BINDING_CHECK="${BINDING_CHECK} check-perl" BINDING_CLEAN="${BINDING_CLEAN} clean-perl" BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-perl" BINDING_DISTCHECK="${BINDING_DISTCHECK} distcheck-perl" BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-perl" BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-perl" fi dnl Kylix binding has been removed because unmaintained. Volunteers welcome. # Tcl bindings AC_MSG_CHECKING([Whether to build Tcl bindings and demos]) AC_ARG_ENABLE([tcl-binding], [AS_HELP_STRING([--enable-tcl-binding], [Build Tcl binding and demo (default: no)])], [build_tcl=$enableval], [build_tcl=no]) AC_MSG_RESULT($build_tcl) if test x"${build_tcl}" = "xyes"; then SC_PATH_TCLCONFIG SC_LOAD_TCLCONFIG tcl_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC" AC_CHECK_HEADERS([tcl.h], [], [AC_MSG_ERROR([Unable to find Tcl headers])]) CPPFLAGS=$tcl_save_CPPFLAGS BINDING_LIST="${BINDING_LIST} tcl" BINDING_ALL="${BINDING_ALL} all-tcl" BINDING_CHECK="${BINDING_CHECK} check-tcl" BINDING_CLEAN="${BINDING_CLEAN} clean-tcl" BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-tcl" BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-tcl" BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-tcl" BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(tcl_ltlib)" fi AM_CONDITIONAL(ENABLE_TCL, test x"${build_tcl}" = "xyes") AC_SUBST(TCL_LIB_SPEC) AC_SUBST(TCL_INCLUDE_SPEC) AC_SUBST(TCL_SHLIB_SUFFIX) # TODO: require "${ac_cv_header_sys_socket_h}" = "no" dnl Check for python availability, so we can enable HamlibPy AC_MSG_CHECKING(whether to build python binding and demo) AC_ARG_WITH(python-binding, [ --with-python-binding build python binding and demo], [cf_with_python_binding=$withval], [cf_with_python_binding=no]) AC_MSG_RESULT($cf_with_python_binding) if test "${cf_with_python_binding}" = "yes" ; then AM_PATH_PYTHON([2.1],, [:]) AC_PYTHON_DEVEL BINDING_LIST="${BINDING_LIST} python" BINDING_ALL="${BINDING_ALL} all-py" BINDING_CHECK="${BINDING_CHECK} check-py" BINDING_CLEAN="${BINDING_CLEAN} clean-py" BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-py" BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-py" BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-py" BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(python_ltlib)" fi AM_CONDITIONAL(ENABLE_PYTHON, test x"${cf_with_python_binding}" = "xyes") dnl Backend list # Winradio only under Linux (until someone port it on other os) AC_MSG_CHECKING(whether to build winradio backend) AC_ARG_WITH(winradio, [ --without-winradio do not build winradio backend], [cf_with_winradio="no"], [cf_with_winradio="yes"]) AC_MSG_RESULT($cf_with_winradio) if test "${cf_with_winradio}" = "yes" ; then BACKEND_LIST="$BACKEND_LIST winradio" fi if test "${cf_with_cxx}" = "yes" ; then # stuff that requires C++ support AC_MSG_CHECKING(whether to build USRP backend) AC_ARG_WITH(usrp, [ --with-usrp build USRP backend], [cf_with_usrp=$withval], [cf_with_usrp="no"]) AC_MSG_RESULT($cf_with_usrp) if test "${cf_with_usrp}" = "yes" ; then PKG_CHECK_MODULES(USRP, usrp >= 0.8, [AC_DEFINE(HAVE_USRP,[1],[Define if usrp is available])]) fi fi AM_CONDITIONAL(ENABLE_CXX, test x"${cf_with_cxx}" = "xyes") AM_CONDITIONAL(HAVE_USRP, test x"${cf_with_usrp}" = "xyes") PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1, , [AC_MSG_WARN([libusb pkg-config not found, USB backends will be disabled])]) CFLAGS="${CFLAGS} ${LIBUSB_CFLAGS}" CXXFLAGS="${CXXFLAGS} ${LIBUSB_CFLAGS}" AC_CHECK_HEADERS([usb.h]) AC_MSG_CHECKING(whether to build USB backends) if test x"${LIBUSB_LIBS}" = x; then cf_with_libusb="no" else cf_with_libusb="yes" AC_DEFINE(HAVE_LIBUSB,[1],[Define if libusb is available]) fi AC_MSG_RESULT($cf_with_libusb) # prepare backend dependencies before adding rpcrig and rpcrot dirs # otherwise parallel 'make -jn' will fail for be in ${BACKEND_LIST} ; do BACKENDEPS="${BACKENDEPS} \$(top_builddir)/${be}/hamlib-${be}.la" done # prepare backend dependencies before adding rpcrig and rpcrot dirs # otherwise parallel 'make -jn' will fail for be in ${ROT_BACKEND_LIST} ; do ROT_BACKENDEPS="${ROT_BACKENDEPS} \$(top_builddir)/${be}/hamlib-${be}.la" done AC_CHECK_PROG(cf_with_rpcgen, rpcgen, [yes], [no]) AC_MSG_CHECKING(whether to build rpc backends) # RPCRig must be the last one added to BACKEND_LIST # because it links against other backends (build order) if test "${ac_cv_header_rpc_rpc_h}" = "yes" -a "${cf_with_rpcgen}" = "yes"; then cf_with_rpc=yes else cf_with_rpc=no fi AC_ARG_WITH(rpc-backends, [ --without-rpc-backends do not build rpcrig and rpcrot backends], [cf_with_rpc_backends=$withval], [cf_with_rpc_backends=$cf_with_rpc]) AC_MSG_RESULT($cf_with_rpc_backends) if test "${cf_with_rpc_backends}" = "yes"; then BACKEND_LIST="$BACKEND_LIST rpcrig" ROT_BACKEND_LIST="$ROT_BACKEND_LIST rpcrot" fi # dlopen force or preopen self for static version ? BACKENDLNK="-dlopen force" for be in ${BACKEND_LIST} ; do BACKENDLNK="${BACKENDLNK} -dlopen \$(top_builddir)/${be}/hamlib-${be}.la" done AC_SUBST(BACKEND_LIST) AC_SUBST(BACKENDLNK) AC_SUBST(BACKENDEPS) # dlopen force or preopen self for static version ? ROT_BACKENDLNK="-dlopen force" for be in ${ROT_BACKEND_LIST} ; do ROT_BACKENDLNK="${ROT_BACKENDLNK} -dlopen \$(top_builddir)/${be}/hamlib-${be}.la" done AC_SUBST(ROT_BACKEND_LIST) AC_SUBST(ROT_BACKENDLNK) AC_SUBST(ROT_BACKENDEPS) AC_CHECK_PROG(cf_with_bindings, [swig], [yes], [no], [$PATH]) if test "${cf_with_bindings}" = "yes"; then cf_with_bindings=no SWIG_PROG(1.3.22) if test "${SWIG}" != "false" -a "x${BINDING_ALL}" != "x"; then BINDINGS="${BINDINGS} bindings" cf_with_bindings=yes fi fi AC_MSG_CHECKING(whether to build bindings) AC_MSG_RESULT($cf_with_bindings) AC_SUBST(BINDINGS) AC_SUBST(BINDING_ALL) AC_SUBST(BINDING_CHECK) AC_SUBST(BINDING_CLEAN) AC_SUBST(BINDING_DISTCLEAN) AC_SUBST(BINDING_DISTCHECK) AC_SUBST(BINDING_INSTALL_EXEC) AC_SUBST(BINDING_UNINSTALL) AC_SUBST(BINDING_LIST) AC_SUBST(BINDING_LIB_TARGETS) AC_SUBST(INCLUDES) AC_CONFIG_FILES([Makefile macros/Makefile include/Makefile lib/Makefile dummy/Makefile yaesu/Makefile icom/Makefile aor/Makefile kenwood/Makefile winradio/Makefile pcr/Makefile alinco/Makefile uniden/Makefile tentec/Makefile kachina/Makefile jrc/Makefile drake/Makefile lowe/Makefile rft/Makefile rs/Makefile kit/Makefile tapr/Makefile skanti/Makefile prm80/Makefile wj/Makefile racal/Makefile tuner/Makefile ars/Makefile easycomm/Makefile fodtrack/Makefile gs232a/Makefile heathkit/Makefile spid/Makefile sartek/Makefile rpcrig/Makefile rpcrot/Makefile src/Makefile c++/Makefile bindings/Makefile bindings/hamlibvb.bas tests/Makefile doc/Makefile doc/hamlib.cfg rotorez/Makefile flexradio/Makefile m2/Makefile amsat/Makefile adat/Makefile ts7400/Makefile celestron/Makefile scripts/Makefile hamlib.pc] ) AC_OUTPUT echo \ "---------------------------------------------------------------------- ${PACKAGE_NAME} Version ${PACKAGE_VERSION} configuration: Prefix ${prefix} Compiler ${CC} ${CFLAGS} ${CPPFLAGS} Package features: With C++ binding ${cf_with_cxx_binding} With Perl binding ${cf_with_perl_binding} With Python binding ${cf_with_python_binding} With TCL binding ${build_tcl} Enable Rig Matrix ${enable_rigmatrix} Enable WinRadio ${cf_with_winradio} Enable USRP ${cf_with_usrp} Enable USB backends ${cf_with_libusb} Enable RPC backends ${cf_with_rpc_backends} Enable shared libs ${enable_shared} Enable static libs ${enable_static} -----------------------------------------------------------------------" hamlib-1.2.15.3/easycomm/0000755000175000017500000000000012044565025012016 500000000000000hamlib-1.2.15.3/easycomm/easycomm.c0000644000175000017500000002070612044564477013736 00000000000000/* * Hamlib Rotator backend - Easycom * Copyright (c) 2001-2003 by Stephane Fillod * Contributed by Francois Retief * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rotator.h" #include "serial.h" #include "misc.h" #include "register.h" #include "easycomm.h" #define USE_CUSTOM_CODE 1 /* ************************************************************************* */ /** * easycomm_transaction * * Assumes rot!=NULL and cmdstr!=NULL * * cmdstr - string to send to rotator * data - buffer for reply string * data_len - (input) Maximum size of buffer * (output) Number of bytes read. */ static int easycomm_transaction (ROT *rot, const char *cmdstr, char *data, size_t data_len) { struct rot_state *rs; int retval; rs = &rot->state; retval = write_block(&rs->rotport, cmdstr, strlen(cmdstr)); if (retval != RIG_OK) { return retval; } if (data == NULL || data_len <= 0) return RIG_OK; /* don't want a reply */ retval = read_string(&rs->rotport, data, data_len, "\n", 1); if (retval < 0) return retval; /* error */ /* TODO: Error checking */ return RIG_OK; } /* ************************************************************************* */ static int easycomm_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) { char cmdstr[64]; int retval; rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __FUNCTION__, az, el); sprintf(cmdstr, "AZ%.1f EL%.1f UP000 XXX DN000 XXX\n", az, el); retval = easycomm_transaction(rot, cmdstr, NULL, 0); if (retval != RIG_OK) { return retval; } /* TODO: Error processing */ return RIG_OK; } static int easycomm_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { char cmdstr[16], ackbuf[32]; int retval; int t; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); #ifdef USE_CUSTOM_CODE sprintf(cmdstr, "!"); /* Custom implementation: Remove later */ #else sprintf(cmdstr, "AZ EL \n"); #endif retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf)); if (retval != RIG_OK) { return retval; } /* Parse parse string to extract AZ,EL values */ #ifdef USE_CUSTOM_CODE retval = sscanf(ackbuf, "TM%i AZ%f EL%f", &t, az, el); if (retval != 3) { rig_debug(RIG_DEBUG_ERR, "%s: unknown replay (%s)\n", __FUNCTION__, ackbuf); return -RIG_ERJCTED; } #ifndef USETESTCODE /* Correct for desimal point. */ *az /= 10.0; *el /= 10.0; #else /* Debugging code, remove later */ rig_debug(RIG_DEBUG_TRACE, " (az, el) = (%.1f, %.1f)\n", *az, *el); *az /= 10.0; *el /= 10.0; rig_debug(RIG_DEBUG_TRACE, " (az, el) = (%f, %f)\n", *az, *el); rig_debug(RIG_DEBUG_TRACE, " (az, el) = (%.2f, %.2f)\n", *az, *el); /* Note: For some reason I found that the result of this expression * does not give accurate results. * The first printf give the correct value. * The second printf give incorrect value, while * the third printf give correct values. * * I get az = 42.79999 when it should be 42.8 */ #endif #else *az = 45.3; *el = 10.3; #endif return RIG_OK; } static int easycomm_rot_stop(ROT *rot) { char ackbuf[32]; int retval; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); retval = easycomm_transaction(rot, "SA SE \n", ackbuf, sizeof(ackbuf)); if (retval != RIG_OK) return retval; /* TODO: error processing */ return RIG_OK; } static int easycomm_rot_reset(ROT *rot, rot_reset_t rst) { char ackbuf[32]; int retval; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); retval = easycomm_transaction(rot, "RESET\n", ackbuf, sizeof(ackbuf)); if (retval != RIG_OK) /* Custom command (not in Easycomm) */ return retval; return RIG_OK; } static int easycomm_rot_park(ROT *rot) { char ackbuf[32]; int retval; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); retval = easycomm_transaction(rot, "PARK\n", ackbuf, sizeof(ackbuf)); if (retval != RIG_OK) /* Custom command (not in Easycomm) */ return retval; return RIG_OK; } static int easycomm_rot_move(ROT *rot, int direction, int speed) { char cmdstr[24], ackbuf[32]; int retval; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); /* Note: speed is unused at the moment */ switch (direction) { case ROT_MOVE_UP: /* Elevation increase */ sprintf(cmdstr, "MU\n"); break; case ROT_MOVE_DOWN: /* Elevation decrease */ sprintf(cmdstr, "MD\n"); break; case ROT_MOVE_LEFT: /* Azimuth decrease */ sprintf(cmdstr, "ML\n"); break; case ROT_MOVE_RIGHT: /* Azimuth increase */ sprintf(cmdstr, "MR\n"); break; default: rig_debug(RIG_DEBUG_ERR,"%s: Invalid direction value! (%d)\n", __FUNCTION__, direction); return -RIG_EINVAL; } retval = easycomm_transaction(rot, cmdstr, ackbuf, sizeof(ackbuf)); if (retval != RIG_OK) return retval; return RIG_OK; } /* ************************************************************************* */ /* * Easycomm rotator capabilities. */ /** EasycommI implement essentially only the set position function, but * I included the stop command too. The radio control tags is only included * as dummy entries because the spec require them. */ const struct rot_caps easycomm1_rot_caps = { .rot_model = ROT_MODEL_EASYCOMM1, .model_name = "EasycommI", .mfg_name = "Hamlib", .version = "0.3", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_OTHER, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 9600, .serial_rate_max = 19200, .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, .min_az = 0.0, .max_az = 360.0, .min_el = 0.0, .max_el = 180.0, .priv = NULL, /* priv */ .set_position = easycomm_rot_set_position, .stop = easycomm_rot_stop, }; /* EasycommII implement most of the functions. Again the radio tags * is only dummy values. */ const struct rot_caps easycomm2_rot_caps = { .rot_model = ROT_MODEL_EASYCOMM2, .model_name = "EasycommII", .mfg_name = "Hamlib", .version = "0.3", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_OTHER, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 9600, .serial_rate_max = 19200, .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, .min_az = 0.0, .max_az = 360.0, .min_el = 0.0, .max_el = 180.0, .priv = NULL, /* priv */ .rot_init = NULL, .rot_cleanup = NULL, .rot_open = NULL, .rot_close = NULL, .get_position = easycomm_rot_get_position, .set_position = easycomm_rot_set_position, .stop = easycomm_rot_stop, .park = easycomm_rot_park, .reset = easycomm_rot_reset, .move = easycomm_rot_move, .get_info = NULL, }; /* ************************************************************************* */ DECLARE_INITROT_BACKEND(easycomm) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); rot_register(&easycomm1_rot_caps); rot_register(&easycomm2_rot_caps); return RIG_OK; } /* ************************************************************************* */ /* end of file */ hamlib-1.2.15.3/easycomm/easycomm.h0000644000175000017500000000213712044564477013741 00000000000000/* * Hamlib Rotator backend - Easycomm interface protocol * Copyright (c) 2001-2003 by Stephane Fillod * Contributed by Francois Retief * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROT_EASYCOMM_H #define _ROT_EASYCOMM_H 1 extern const struct rot_caps easycomm1_rot_caps; extern const struct rot_caps easycomm2_rot_caps; #endif /* _ROT_EASYCOMM_H */ hamlib-1.2.15.3/easycomm/Makefile.in0000644000175000017500000004751112044564552014017 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = easycomm DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_easycomm_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am_hamlib_easycomm_la_OBJECTS = easycomm.lo hamlib_easycomm_la_OBJECTS = $(am_hamlib_easycomm_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_easycomm_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_easycomm_la_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_easycomm_la_SOURCES) DIST_SOURCES = $(hamlib_easycomm_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = hamlib-easycomm.la hamlib_easycomm_la_SOURCES = easycomm.c hamlib_easycomm_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_easycomm_la_LIBADD = $(top_builddir)/src/libhamlib.la EXTRA_DIST = easycomm.txt noinst_HEADERS = easycomm.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu easycomm/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu easycomm/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-easycomm.la: $(hamlib_easycomm_la_OBJECTS) $(hamlib_easycomm_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_easycomm_la_LINK) -rpath $(pkglibdir) $(hamlib_easycomm_la_OBJECTS) $(hamlib_easycomm_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/easycomm.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/easycomm/Makefile.am0000644000175000017500000000041012044564477013777 00000000000000 pkglib_LTLIBRARIES = hamlib-easycomm.la hamlib_easycomm_la_SOURCES = easycomm.c hamlib_easycomm_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_easycomm_la_LIBADD = $(top_builddir)/src/libhamlib.la EXTRA_DIST = easycomm.txt noinst_HEADERS = easycomm.h hamlib-1.2.15.3/easycomm/easycomm.txt0000644000175000017500000000561612044564477014336 00000000000000The following are the specifications for the EasyComm interfaces which are available with the WiSP programs. Both EasyComm 1 and EasyComm2 are available in WiSP32. Only EasyComm1 is available with WiSP31. The EasyComm interfaces are for use by those who wish to design their own radio and rotor controllers. EASYCOMM I Standard ------------------- The EasyComm 1 standard is a simple ASCII character based standard for controling antennas and rotators. The host PC issues a single line command as follows -: AZaaa.a ELeee.e UPuuuuuuuuu UUU DNddddddddd DDD The Az and El values (aaa.a and eee.e) are not fixed width. They are in degrees and include 1 decimal place. The Up and Dn frequencies are in Hz. UUU and DDD are the uplink and downlink mode. EASYCOMM II Standard -------------------- The EasyComm 2 standard is an enhanced protocol to allow full station control and also feedback from external systems. The host PC issues commands to the controller by sending a 2 character command identifier followed by the command value. Commands are separated by either a space or carriage return or linefeed. Not all commands need to be implemented, and the most basic system may only decode the rotator control commands. The Host PC can issue the following commands -: Command Meaning Perameters ------- ------- ---------- AZ Azimuth number - 1 decimal place EL Elevation number - 1 decimal place UP Uplink freq in Hertz DN Downlink freq in Hertz DM Downlink Mode ascii, eg SSB, FM UM Uplink Mode ascii, eg SSB, FM DR Downlink Radio number UR Uplink Radio number ML Move Left MR Move Right MU Move Up MD Move Down SA Stop azimuth moving SE Stop elevation moving AO AOS LO LOS OP Set output number IP Read an input number AN Read analogue input number ST Set time YY:MM:DD:HH:MM:SS VE Request Version For those commands that require a response, the response is an echo of the command followed by the response. If the command specifies a field number (eq. AN or IP), then the two numbers are delimited with a comma. eg. To read an analogue value, the host sends ANx where x is the analogue channel number. In response the controller will reply with ANx,yyy where yyy is the value read on the analogue port. eg. To find the controller version number, the host sends VE. In response the controller sends VExxx where xxx is an ascii string containing the version number. All strings sent in either direction are not of fixed length. The controller can also send unsolicited information back to the host. This information may be used by the host for alarms or just control feedback. All of the above commands may be sent by the controller for information, and in addition the following may also be sent ALxxx Alarm, where xxxx is an ascii string with the alarm info. Chris Jackson, G7UPN hamlib-1.2.15.3/rs/0000755000175000017500000000000012044565032010623 500000000000000hamlib-1.2.15.3/rs/esmc.c0000644000175000017500000001042612044564477011655 00000000000000/* * Hamlib R&S backend - ESMC description * Copyright (c) 2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "rs.h" /* TODO: LOG and PULSE ? */ #define ESMC_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define ESMC_FUNC (RIG_FUNC_SQL|RIG_FUNC_AFC) #define ESMC_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_SQL|RIG_LEVEL_AGC|RIG_LEVEL_RF|RIG_LEVEL_STRENGTH) #define ESMC_PARM_ALL (RIG_PARM_NONE) #define ESMC_VFO (RIG_VFO_A) #define ESMC_VFO_OPS (RIG_OP_NONE) #define ESMC_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .ant = 1, \ .funcs = ESMC_FUNC, \ .levels = RIG_LEVEL_SET(ESMC_LEVEL_ALL), \ .channel_desc=1, \ .flags = RIG_CHFLAG_SKIP, \ } /* * ESMC rig capabilities. * * Needs option ESMC-R2 for computer operation RS232C/RS422/RS485 * * http://www2.rohde-schwarz.com/file/ESMC_25.pdf */ const struct rig_caps esmc_caps = { .rig_model = RIG_MODEL_ESMC, .model_name = "ESMC", .mfg_name = "Rohde&Schwarz", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, /* 7E2 */ .serial_rate_max = 115200, /* 7E1, RTS/CTS */ .serial_data_bits = 7, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_EVEN, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 0, .timeout = 200, .retry = 3, .has_get_func = ESMC_FUNC, .has_set_func = ESMC_FUNC, .has_get_level = ESMC_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(ESMC_LEVEL_ALL), .has_get_parm = ESMC_PARM_ALL, .has_set_parm = RIG_PARM_SET(ESMC_PARM_ALL), .level_gran = {}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END }, .attenuator = { 30, 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 = 7, /* FIXME */ .vfo_ops = ESMC_VFO_OPS, .chan_list = { { 0, 999, RIG_MTYPE_MEM, ESMC_MEM_CAP }, RIG_CHAN_END, }, /* * With following options: * ESMC-T2 20 MHz to 1.3 GHz * ESMC-T0 0.5 MHz to 30 MHz * ESMC-FE 20 MHz to 3 GHz */ .rx_range_list1 = { {kHz(20),MHz(650),ESMC_MODES,-1,-1,ESMC_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(20),MHz(650),ESMC_MODES,-1,-1,ESMC_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {ESMC_MODES,1}, {ESMC_MODES,10}, {ESMC_MODES,100}, {ESMC_MODES,1000}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_WFM, kHz(200)}, {RIG_MODE_FM|RIG_MODE_AM, kHz(15)}, {ESMC_MODES, kHz(2.5)}, {ESMC_MODES, kHz(0.5)}, {ESMC_MODES, kHz(8)}, {ESMC_MODES, kHz(15)}, {ESMC_MODES, kHz(30)}, {ESMC_MODES, kHz(50)}, {ESMC_MODES, kHz(100)}, {ESMC_MODES, kHz(200)}, {ESMC_MODES, kHz(500)}, {ESMC_MODES, MHz(1)}, {ESMC_MODES, MHz(2)}, {ESMC_MODES, MHz(4)}, {ESMC_MODES, MHz(8)}, RIG_FLT_END, }, .priv = NULL, .set_freq = rs_set_freq, .get_freq = rs_get_freq, .set_mode = rs_set_mode, .get_mode = rs_get_mode, .set_level = rs_set_level, .get_level = rs_get_level, .set_func = rs_set_func, .get_func = rs_get_func, .get_info = rs_get_info, #if 0 /* TODO */ .rig_open = rs_rig_open, .set_channel = rs_set_channel, .get_channel = rs_get_channel, #endif }; /* * Function definitions below */ hamlib-1.2.15.3/rs/Makefile.in0000644000175000017500000004756312044564556012641 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = rs DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_rs_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = esmc.lo eb200.lo am_hamlib_rs_la_OBJECTS = $(am__objects_1) rs.lo hamlib_rs_la_OBJECTS = $(am_hamlib_rs_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_rs_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(hamlib_rs_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_rs_la_SOURCES) DIST_SOURCES = $(hamlib_rs_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ RSSRC = esmc.c eb200.c pkglib_LTLIBRARIES = hamlib-rs.la hamlib_rs_la_SOURCES = $(RSSRC) rs.c hamlib_rs_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_rs_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = rs.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu rs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu rs/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-rs.la: $(hamlib_rs_la_OBJECTS) $(hamlib_rs_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_rs_la_LINK) -rpath $(pkglibdir) $(hamlib_rs_la_OBJECTS) $(hamlib_rs_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eb200.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/esmc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rs.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/rs/eb200.c0000644000175000017500000001043212044564477011533 00000000000000/* * Hamlib R&S backend - EB200 description * Copyright (c) 2009-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "rs.h" /* TODO: PULSE and IQ ? */ #define EB200_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define EB200_FUNC (RIG_FUNC_SQL|RIG_FUNC_AFC|RIG_FUNC_LOCK) #define EB200_LEVEL_ALL (RIG_LEVEL_ATT|RIG_LEVEL_SQL|RIG_LEVEL_AGC|\ RIG_LEVEL_RF|RIG_LEVEL_AF|RIG_LEVEL_STRENGTH) #define EB200_PARM_ALL (RIG_PARM_NONE) #define EB200_VFO (RIG_VFO_A) #define EB200_VFO_OPS (RIG_OP_NONE) #define EB200_ANTS (RIG_ANT_1) #define EB200_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .ant = 1, \ .funcs = EB200_FUNC, \ .levels = RIG_LEVEL_SET(EB200_LEVEL_ALL), \ .channel_desc=1, \ .flags = RIG_CHFLAG_SKIP, \ } /* * EB200 rig capabilities. * * Needs option ESMBR2 for computer operation RS-232C * * TODO * - set/get_channels * - get_dcd * - set_ant */ const struct rig_caps eb200_caps = { .rig_model = RIG_MODEL_EB200, .model_name = "EB200", .mfg_name = "Rohde&Schwarz", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, /* 7E2 */ .serial_rate_max = 115200, /* 7E1, RTS/CTS */ .serial_data_bits = 7, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_EVEN, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = 0, .post_write_delay = 0, .timeout = 200, .retry = 3, .has_get_func = EB200_FUNC, .has_set_func = EB200_FUNC, .has_get_level = EB200_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(EB200_LEVEL_ALL), .has_get_parm = EB200_PARM_ALL, .has_set_parm = RIG_PARM_SET(EB200_PARM_ALL), .level_gran = {}, .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END }, .attenuator = { 32, 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 = 7, /* FIXME */ .vfo_ops = EB200_VFO_OPS, .chan_list = { { 0, 999, RIG_MTYPE_MEM, EB200_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(10),GHz(3),EB200_MODES,-1,-1,EB200_VFO,EB200_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(10),GHz(3),EB200_MODES,-1,-1,EB200_VFO,EB200_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {EB200_MODES,1}, {EB200_MODES,10}, {EB200_MODES,100}, {EB200_MODES,1000}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_WFM, kHz(150)}, {RIG_MODE_FM|RIG_MODE_AM, kHz(15)}, {EB200_MODES, kHz(2.4)}, {EB200_MODES, kHz(1.5)}, {EB200_MODES, Hz(150)}, {EB200_MODES, Hz(300)}, {EB200_MODES, Hz(600)}, {EB200_MODES, kHz(6)}, {EB200_MODES, kHz(9)}, {EB200_MODES, kHz(15)}, {EB200_MODES, kHz(30)}, {EB200_MODES, kHz(50)}, {EB200_MODES, kHz(120)}, RIG_FLT_END, }, .priv = NULL, .set_freq = rs_set_freq, .get_freq = rs_get_freq, .set_mode = rs_set_mode, .get_mode = rs_get_mode, .set_level = rs_set_level, .get_level = rs_get_level, .set_func = rs_set_func, .get_func = rs_get_func, .get_info = rs_get_info, .reset = rs_reset, #if 0 /* TODO */ .rig_open = rs_rig_open, .set_channel = rs_set_channel, .get_channel = rs_get_channel, #endif }; /* * Function definitions below */ hamlib-1.2.15.3/rs/rs.c0000644000175000017500000001706712044564477011362 00000000000000/* * Hamlib R&S backend - main file * Copyright (c) 2009-2010 by Stéphane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "register.h" #include "num_stdio.h" #include "rs.h" #define BUFSZ 64 #define RESPSZ 64 #define LF "\x0a" #define CR "\x0d" #define BOM CR #define EOM CR /* * R&S GB2 protocol ? */ /* * rs_transaction * We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL */ int rs_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval; struct rig_state *rs; rs = &rig->state; serial_flush(&rs->rigport); retval = write_block(&rs->rigport, cmd, cmd_len); if (retval != RIG_OK) return retval; /* no data expected */ if (!data || !data_len) return RIG_OK; retval = read_string(&rs->rigport, data, BUFSZ, CR, 1); if (retval < 0) return retval; *data_len = retval; return RIG_OK; } /* * rs_set_freq * Assumes rig!=NULL */ int rs_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char freqbuf[32]; int freq_len, retval; freq_len = sprintf(freqbuf, BOM "FREQ %"PRIll EOM, (int64_t)freq); retval = rs_transaction(rig, freqbuf, freq_len, NULL, NULL); return retval; } /* * rs_get_freq * Assumes rig!=NULL */ int rs_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { char buf[RESPSZ]; int len, retval; #define FREQ_QUERY BOM "FREQ?" EOM retval = rs_transaction(rig, FREQ_QUERY, strlen(FREQ_QUERY), buf, &len); if (retval < 0) return retval; retval = (sscanf(buf, "%"SCNfreq, freq)==1) ? RIG_OK : -RIG_EPROTO; return retval; } /* * rs_set_mode * Assumes rig!=NULL */ int rs_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { char buf[32], *smode; int len, retval; switch (mode) { case RIG_MODE_AM: smode = "AM"; break; case RIG_MODE_WFM: case RIG_MODE_FM: smode = "FM"; break; case RIG_MODE_CW: smode = "CW"; break; case RIG_MODE_USB: smode = "USB"; break; case RIG_MODE_LSB: smode = "LSB"; break; default: return -RIG_EINVAL; } len = sprintf(buf, BOM "DEM %s" EOM, smode); retval = rs_transaction(rig, buf, len, NULL, NULL); if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); if (width > 0) { len = sprintf(buf, BOM "BAND %d" EOM, (int) width); retval = rs_transaction(rig, buf, len, NULL, NULL); } return retval; } /* * rs_get_mode * Assumes rig!=NULL */ int rs_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { char buf[RESPSZ]; int buf_len, retval; #define DEM_QUERY BOM "DEM?" EOM retval = rs_transaction(rig, DEM_QUERY, strlen(DEM_QUERY), buf, &buf_len); if (retval < 0) return retval; *mode = rig_parse_mode(buf); #define BAND_QUERY BOM "BAND?" EOM retval = rs_transaction(rig, BAND_QUERY, strlen(BAND_QUERY), buf, &buf_len); if (retval < 0) return retval; *width = atoi(buf); return retval; } int rs_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { char buf[32], *sfunc; int len, retval; switch (func) { case RIG_FUNC_AFC: sfunc = "FREQ:AFC"; break; case RIG_FUNC_SQL: sfunc = "OUTP:SQU"; break; case RIG_FUNC_LOCK: sfunc = "DISP:ENAB"; break; default: return -RIG_EINVAL; } len = sprintf(buf, BOM "%s %s" EOM, sfunc, status ? "ON" : "OFF"); retval = rs_transaction(rig, buf, len, NULL, NULL); return retval; } int rs_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { char buf[RESPSZ], *sfunc; int buf_len, retval; switch (func) { case RIG_FUNC_AFC: sfunc = BOM "FREQ:AFC?" EOM; break; case RIG_FUNC_SQL: sfunc = BOM "OUTP:SQU?" EOM; break; case RIG_FUNC_LOCK: sfunc = BOM "DISP:ENAB?" EOM; break; default: return -RIG_EINVAL; } retval = rs_transaction(rig, sfunc, strlen(sfunc), buf, &buf_len); if (retval < 0) return retval; *status = (!memcmp(buf, "ON", 2) || !memcmp(buf, "1", 1)) ? 1 : 0; return retval; } int rs_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { char buf[32]; int len, retval; switch (level) { case RIG_LEVEL_ATT: len = sprintf(buf, BOM "INP:ATT:STAT %s" EOM, val.i ? "ON" : "OFF"); break; case RIG_LEVEL_SQL: /* dBuV */ len = sprintf(buf, BOM "OUTP:SQU:THR %d" EOM, (int) (20 + val.f*20)); break; case RIG_LEVEL_AF: len = num_sprintf(buf, BOM "SYST:AUD:VOL %.1f" EOM, val.f); break; case RIG_LEVEL_AGC: case RIG_LEVEL_RF: return -RIG_ENIMPL; default: return -RIG_EINVAL; } retval = rs_transaction(rig, buf, len, NULL, NULL); return retval; } int rs_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { char buf[RESPSZ], *slevel; int buf_len, retval; switch (level) { case RIG_LEVEL_STRENGTH: slevel = BOM "SENS:DATA? \"VOLT:AC\"" EOM; break; case RIG_LEVEL_ATT: slevel = BOM "INP:ATT:STAT?" EOM; break; case RIG_LEVEL_AF: slevel = BOM "SYST:AUD:VOL?" EOM; break; case RIG_LEVEL_SQL: case RIG_LEVEL_AGC: case RIG_LEVEL_RF: return -RIG_ENIMPL; default: return -RIG_EINVAL; } retval = rs_transaction(rig, slevel, strlen(slevel), buf, &buf_len); if (retval < 0) return retval; switch (level) { case RIG_LEVEL_STRENGTH: /* assumes FORMAat:DATA ASCii * result in dBuV, keep only integer part */ sscanf(buf, "%d", &val->i); val->i -= 34; break; case RIG_LEVEL_ATT: val->i = (!memcmp(buf, "ON", 2) || !memcmp(buf, "1", 1)) ? rig->state.attenuator[0] : 0; break; case RIG_LEVEL_AF: if (num_sscanf(buf, "%f", &val->f) != 1) return -RIG_EPROTO; break; default: return -RIG_EINVAL; } return retval; } const char * rs_get_info(RIG *rig) { static char infobuf[128]; int info_len, retval; #define ID_QUERY BOM "*IDN?" EOM retval = rs_transaction(rig, ID_QUERY, strlen(ID_QUERY), infobuf, &info_len); if (retval < 0) return NULL; return infobuf; } int rs_reset(RIG *rig, reset_t reset) { int retval; #define RST_CMD BOM "*RST" EOM retval = rs_transaction(rig, RST_CMD, strlen(RST_CMD), NULL, NULL); return retval; } /* * initrigs_rs is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(rs) { rig_debug(RIG_DEBUG_VERBOSE, "rs: _init called\n"); rig_register(&esmc_caps); rig_register(&eb200_caps); return RIG_OK; } hamlib-1.2.15.3/rs/rs.h0000644000175000017500000000311512044564477011354 00000000000000/* * Hamlib R&S backend - main header * Copyright (c) 2009-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _RS_H #define _RS_H 1 #include int rs_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int rs_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int rs_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int rs_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int rs_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int rs_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); int rs_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int rs_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int rs_reset(RIG *rig, reset_t reset); const char * rs_get_info(RIG *rig); extern const struct rig_caps esmc_caps; extern const struct rig_caps eb200_caps; #endif /* _RS_H */ hamlib-1.2.15.3/rs/Makefile.am0000644000175000017500000000035112044564477012612 00000000000000RSSRC = esmc.c eb200.c pkglib_LTLIBRARIES = hamlib-rs.la hamlib_rs_la_SOURCES = $(RSSRC) rs.c hamlib_rs_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_rs_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = rs.h hamlib-1.2.15.3/LICENSE0000644000175000017500000000456012044564477011145 00000000000000Hamlib - Ham Radio Control Libraries Copyright (C) 2000,2001 Frank Singleton Copyright (C) 2000,2001 Stephane Fillod Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009, 2010,2011,2012 The Hamlib Group See the included README file for more information on Hamlib and the Hamlib Project or visit http://www.hamlib.org for documentation and links to the source code of Hamlib. The 'AUTHORS' file lists contributors known as the The Hamlib Group. The frontend library source code files and associated backend library source code files are licensed and released under the Lesser GNU Public License (LGPL): This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA The included file 'COPYING.LIB' is a copy of the GNU Lesser General Public License. Various other supplied program source files and example source files are licensed and released under the GNU Public License (GPL): This program is free software; you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. The included file 'COPYING' is a copy of the GNU General Public License. hamlib-1.2.15.3/Makefile.in0000644000175000017500000006777712044564560012221 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/hamlib.pc.in \ $(top_srcdir)/configure AUTHORS COPYING COPYING.LIB ChangeLog \ INSTALL NEWS THANKS TODO compile config.guess config.sub \ depcomp install-sh ltmain.sh missing py-compile ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = hamlib.pc CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(aclocaldir)" \ "$(DESTDIR)$(pkgconfigdir)" DATA = $(aclocal_DATA) $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ aclocaldir = $(datadir)/aclocal aclocal_DATA = hamlib.m4 pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = hamlib.pc EXTRA_DIST = PLAN TODO LICENSE hamlib.m4 hamlib.pc.in README.developer \ README.betatester README.win32 # BINDINGS_LIST subdirs are no longer built SUBDIRS = macros include lib $(subdirs) src @BACKEND_LIST@ @ROT_BACKEND_LIST@ \ @BINDINGS@ tests doc # perl and kylix subdirs are no longer distributed DIST_SUBDIRS = macros include lib $(subdirs) src c++ bindings tests doc \ icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc \ rpcrig winradio adat easycomm fodtrack rpcrot drake rotorez \ flexradio sartek lowe rft rs tapr kit skanti prm80 wj racal tuner \ gs232a heathkit spid ars m2 amsat scripts ts7400 celestron ACLOCAL_AMFLAGS = -I macros all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): hamlib.pc: $(top_builddir)/config.status $(srcdir)/hamlib.pc.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt install-aclocalDATA: $(aclocal_DATA) @$(NORMAL_INSTALL) test -z "$(aclocaldir)" || $(MKDIR_P) "$(DESTDIR)$(aclocaldir)" @list='$(aclocal_DATA)'; test -n "$(aclocaldir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(aclocaldir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(aclocaldir)" || exit $$?; \ done uninstall-aclocalDATA: @$(NORMAL_UNINSTALL) @list='$(aclocal_DATA)'; test -n "$(aclocaldir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(aclocaldir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(aclocaldir)" && rm -f $$files install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(aclocaldir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-aclocalDATA install-pkgconfigDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-aclocalDATA uninstall-pkgconfigDATA .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-generic distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-aclocalDATA \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkgconfigDATA install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-aclocalDATA uninstall-am \ uninstall-pkgconfigDATA # 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: hamlib-1.2.15.3/INSTALL0000644000175000017500000002600212044564477011164 00000000000000Basic Installation ================== For more information specific to Hamlib, please read the README as well as README.betatester and the first part of README.developer to see which additional development packages are needed. This source code distribution is autoconfiguring and you should be able to compile it and install it without manual interventions such as editing Makefiles, configuration files, and so on. These are generic instructions for people who are not familiar with installing autoconfiguring software (along with some Hamlib-specific information). The simplest way to compile this package is to enter the source code main directory and do the following: 1. Configure the source code by typing: $ ./configure If you're planning to install the package into your home directory or to a location other than `/usr/local' then add the flag `--prefix=PATH' to `configure'. For example, if your home directory is `/home/username' you can configure the package to install itself there by invoking: $ ./configure --prefix=/home/username As of SVN rev-2882, the scripting language bindings are disabled by default so they will need to be specifically enabled for language binding support (this has no effect on rigctld/rotctld). You may get a make error (which means it will quit before compilation is complete) if the --with-[perl|python|tcl]-binding option(s) are used and the Swig package is not installed. N.B. If you know that you won't need static libaries (most applications dynamically link Hamlib by default) invoke `configure' as follows: $ ./configure --disable-static This will result in a much smaller Hamlib installation (and faster compilation :-) ). See also the "Hamlib specific Features" section below for other `configure' options. While running, `configure' prints some messages telling you which features it is checking for. 2. Compile the package by typing: $ make Running `make' takes a while. Since Hamlib is a package, now is the time to go get a cup of coffee. 3. Some packages are bundled with self-tests for source-code verification. If this package includes such tests, you can optionally run them after compilation by typing $ make check Be careful: 'make check' needs an already installed hamlib library. That means that this step has to wait until you finished step 4 (and 5). 4. Type `make install' to install the programs and any data files and documentation. Type `make uninstall' to undo the installation. N.B. Be aware that Super User (root) privileges will be required to install to /usr/local or any other system location outside of your home directory. Many distributions include the `sudo' command which will permit you to install Hamlib after entering your password. Otherwise you will need to log in as 'root'. During installation, the following files go to the following directories: Executables -> /prefix/bin Libraries -> /prefix/lib Public header files -> /prefix/include Man pages -> /prefix/man/man? Info files -> /prefix/info Doc files -> /prefix/share/doc/ Share files -> /prefix/share/ where `prefix' is either `/usr/local' or the PATH that you specified in the `--prefix' flag. If any of these directories do not presently exist, they will be created on demand. If you are installing in your home directory make sure that `/home/username/bin' is in your path. If you're using the bash shell add these lines at the end of your .bashrc file: PATH="/home/username/bin:${PATH}" export PATH If you are using csh or tcsh, then use this line instead: setenv PATH /home/username/bin:${PATH} By prepending your home directory to the rest of the PATH you can override systemwide installed software with your own custom installation. 5. After installation you may need to update the ld.so.cache as the installation files are placed in /usr/local/lib by default. On most systems this is easily accomplished by running the `ldconfig' command as the superuser (root). The following line may need to be added to /etc/ld.so.conf: /usr/local/lib On Debian systems since at least 4.0 (Etch) and its derivatives (Ubuntu, etc.), a file will need to be created in the /etc/ld.so.conf.d directory. It doesn't seem to matter what you name it so long as it ends in .conf and local.conf is a good choice. Place the following line in it: /usr/local/lib Now `ldconfig' can be run. While the programs built along with Hamlib will probably work fine without running `ldconfig', experience has shown that precompiled binaries like Fldigi will not be able to find libhamlib.so.2 without updating the ld.so.cache. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. The `configure' program will need to be run again to recompile Hamlib. 7. You can optionally generate the Doxygen documentation files: cd doc make doc The HTML output files are provided for binary releases on the hamlib.org web site. 8. Finally, if you wish to remove Hamlib, run `make uninstall' as superuser (root), unless Hamlib was installed into your home directory, from the Hamlib source directory. This will work unless `make distclean' has been run. Compiler configuration (Advanced usage) ======================================= The `configure' shell script is responsible for choosing and configuring the compiler(s). The following options allow you to specify whether you want to enable or disable various debugging mechanisms: `--enable-warnings' Make the compilers very picky about warnings. Try this whenever you write new code since it may catch a few bugs. This is not active by default because all too often warnings can be too picky and scare the end-user. All programs are compiled with optimization level 2 by default (-O2). Occasionally that confuses the debugger when code is inlined. To disable optimization and enable debugging, set the shell environment variables CFLAGS, CXXFLAGS, FFLAGS to `-g'. On the bash shell, you can do this like this: $ export CFLAGS="-g" $ export CXXFLAGS="-g" $ export FFLAGS="-g" On the tcsh shell, use the `setenv' command instead: % setenv CFLAGS "-g" ...etc... For other shells, please consult your shell's documentation. Similarly, you can increase the optimization level by assigning these variables to "-g -O3". Depending on what languages the package uses, some of these options may or may not be available. To see what is available, type: % sh ./configure --help About the configure script ========================== The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. This project uses a custom `autoconf.sh' for running autoconf in a developer's checkout of Hamlib from a source repository. Advanced installation options. ============================== The `configure' script also understands the following more advanced options, to handle situations for which `--prefix' alone is not sufficient. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Win32 ===== - Debian system with mingw32msvc cross-compiler ./configure --host=i586-mingw32msvc - Mingw compiler under Cygwin CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin" ./configure --host=i686-pc-mingw32 - Cygwin Native Cygwin requires no special options besides regular ones. Hamlib specific Features ======================== Should you encounter any problem with the build of the C++ binding, you can disable this optional part by passing `--without-cxx-binding' to the configure script (may happen under MacOSX). Any problem encountered with the perl, tcl, python or swig tool can be disabled by passing `--without-tcl-binding', `--without-perl-binding', and/or '--without-python-binding'. Note that these bindings are disabled by default. Some platfroms may have trouble compiling the RPC support (e.g. Mac OS X). in such a case, the rpcrig and rpcrot backends may be disabled with the `--without-rpc-backends' option. Building static libraries can be disabled by use of the `--disable-static' option. This will reduce the installed size of Hamlib considerably. hamlib-1.2.15.3/THANKS0000644000175000017500000000207312044564477011050 00000000000000 This file lists people who contributed indirectly to Hamlib, by generously making information available. Be they thanked for their openness. WiNRADiO backend ---------------- * Harish Pillay 9v1hp and Pascal Brisset and their excellent LiNRADiO project. URL: http://linradio.sourceforge.net/ Icom CI-V backend ----------------- * Ekki Plicht DF4OR and his excellent web site on the CI-V interface. URL: http://www.plicht.de/ekki/civ/ * Karl Kramer DG8FZ for his V24/CI-V cable and his CSMA/CD explanation of the bus. URL: http://KarlKramer.de/ ... x71ci_v.htm * Simon Collings, RS-232 Interfacing for Receiver Control URL: http://www.scnt01426.pwp.blueyonder.co.uk/Articles/RS-232/RS-232.htm * Kai Altenfelder for supporting us and providing documentation Icom PCR backend ---------------- * Ghetto's team, PCR-1000 ICOM receiver URL: http://www.philtered.net/icomlib.phtml Other Assistance ---------------- * Special thanks to Ed Hare, W1RFI, and the American Radio Relay League for technical support. hamlib-1.2.15.3/flexradio/0000755000175000017500000000000012044565027012160 500000000000000hamlib-1.2.15.3/flexradio/flexradio.c0000644000175000017500000000255012044564477014233 00000000000000/* * Hamlib Flexradio backend * Copyright (c) 2003-2012 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "flexradio.h" #include "register.h" DECLARE_INITRIG_BACKEND(flexradio) { rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); rig_register(&sdr1k_rig_caps); //rig_register(&sdr1krfe_rig_caps); rig_register(&dttsp_rig_caps); rig_register(&dttsp_udp_rig_caps); return RIG_OK; } hamlib-1.2.15.3/flexradio/flexradio.h0000644000175000017500000000220212044564477014232 00000000000000/* * Hamlib FLEXRADIO backend - main header * Copyright (c) 2004-2012 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FLEXRADIO_H #define _FLEXRADIO_H 1 #include "hamlib/rig.h" extern const struct rig_caps sdr1k_rig_caps; extern const struct rig_caps sdr1krfe_rig_caps; extern const struct rig_caps dttsp_rig_caps; extern const struct rig_caps dttsp_udp_rig_caps; #endif /* _FLEXRADIO_H */ hamlib-1.2.15.3/flexradio/dttsp.c0000644000175000017500000005224312044564477013420 00000000000000/* * Hamlib DttSP backend - main file * Copyright (c) 2001-2012 by Stephane Fillod * * Some code derived from DttSP * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 by Frank Brickle, AB2KT and Bob McGwier, N4HY * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 #include "hamlib/rig.h" #include "iofunc.h" #include "misc.h" #include "token.h" #include "register.h" #include "cal.h" #include "flexradio.h" /* * This backend is a two layer rig control: DttSP core over a mundane tuner * * 2 interfaces of DttSP are supported: IPC & UDP * * TODO: Transmit setup * http://openhpsdr.org/wiki/index.php?title=Ghpsdr */ #define DEFAULT_DTTSP_CMD_PATH "/dev/shm/SDRcommands" #define DEFAULT_DTTSP_CMD_NET_ADDR "127.0.0.1:19001" #define DEFAULT_SAMPLE_RATE 48000 /* DttSP constants */ #define MAXRX 4 #define RXMETERPTS 5 #define TXMETERPTS 9 #define MAXMETERPTS 9 #define DTTSP_PORT_CLIENT_COMMAND 19001 #define DTTSP_PORT_CLIENT_SPECTRUM 19002 #define DTTSP_PORT_CLIENT_METER 19003 #define DTTSP_PORT_CLIENT_BUFSIZE 65536 struct dttsp_priv_data { /* tuner providing IF */ rig_model_t tuner_model; RIG *tuner; shortfreq_t IF_center_freq; int sample_rate; int rx_delta_f; hamlib_port_t meter_port; }; static int dttsp_init(RIG *rig); static int dttsp_cleanup(RIG *rig); static int dttsp_open(RIG *rig); static int dttsp_close(RIG *rig); static int dttsp_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int dttsp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int dttsp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int dttsp_set_conf(RIG *rig, token_t token, const char *val); static int dttsp_get_conf(RIG *rig, token_t token, char *val); static int dttsp_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int dttsp_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int dttsp_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static int dttsp_set_ant(RIG * rig, vfo_t vfo, ant_t ant); static int dttsp_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); static int dttsp_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit); #define TOK_TUNER_MODEL TOKEN_BACKEND(1) #define TOK_SAMPLE_RATE TOKEN_BACKEND(2) const struct confparams dttsp_cfg_params[] = { { TOK_TUNER_MODEL, "tuner_model", "Tuner model", "Hamlib rig tuner model number", "1" /* RIG_MODEL_DUMMY */, RIG_CONF_NUMERIC, { /* .n = */ { 0, 100000, 1 } } }, { TOK_SAMPLE_RATE, "sample_rate", "Sample rate", "DttSP sample rate in Spls/sec", "48000", RIG_CONF_NUMERIC, { /* .n = */ { 8000, 192000, 1 } } }, /* * TODO: IF_center_freq, etc. */ { RIG_CONF_END, NULL, } }; /* * DttSP dsr-core rig capabilities. */ #define DTTSP_FUNC (RIG_FUNC_NB|RIG_FUNC_ANF|RIG_FUNC_NR|RIG_FUNC_MUTE) #define DTTSP_LEVEL (RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH|RIG_LEVEL_AGC) #define DTTSP_PARM RIG_PARM_NONE #define DTTSP_VFO_OP RIG_OP_NONE #define DTTSP_SCAN RIG_SCAN_NONE #define DTTSP_VFO (RIG_VFO_A) #define DTTSP_MODES (RIG_MODE_FM|RIG_MODE_AM|RIG_MODE_SAM|RIG_MODE_DSB| \ RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB) enum dttsp_mode_e { LSB, USB, DSB, CWL, CWU, FMN, AM, DIGU, SPEC, DIGL, SAM, DRM }; static const struct hamlib_vs_dttsp { rmode_t hamlib_mode; enum dttsp_mode_e dttsp_mode; } hamlib_vs_dttsp_modes[] = { { RIG_MODE_USB, USB }, { RIG_MODE_LSB, LSB }, { RIG_MODE_CW, CWU }, { RIG_MODE_CWR, CWL }, { RIG_MODE_AM, AM }, { RIG_MODE_SAM, SAM }, { RIG_MODE_FM, FMN }, { RIG_MODE_DSB, DSB }, }; #define HAMLIB_VS_DTTSP_MODES_COUNT (sizeof(hamlib_vs_dttsp_modes)/sizeof(struct hamlib_vs_dttsp)) #define DTTSP_REAL_STR_CAL { 16, \ { \ { -73, -73 }, /* S0 */ \ { 50, 40 }, /* +40 */ \ } } const struct rig_caps dttsp_rig_caps = { .rig_model = RIG_MODEL_DTTSP, .model_name = "DttSP IPC", .mfg_name = "DTTS Microwave Society", .version = "0.2", .copyright = "GPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_COMPUTER, .targetable_vfo = RIG_TARGETABLE_ALL, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_DEVICE, .has_get_func = DTTSP_FUNC, .has_set_func = DTTSP_FUNC, .has_get_level = DTTSP_LEVEL, .has_set_level = RIG_LEVEL_SET(DTTSP_LEVEL), .has_get_parm = DTTSP_PARM, .has_set_parm = RIG_PARM_SET(DTTSP_PARM), .ctcss_list = NULL, .dcs_list = NULL, .chan_list = { RIG_CHAN_END, }, .scan_ops = DTTSP_SCAN, .vfo_ops = DTTSP_VFO_OP, .transceive = RIG_TRN_OFF, .attenuator = { RIG_DBLST_END, }, .preamp = { RIG_DBLST_END, }, /* In fact, RX and TX ranges are dependant on the tuner */ .rx_range_list1 = { {.start=kHz(150),.end=MHz(1500),.modes=DTTSP_MODES, .low_power=-1,.high_power=-1,DTTSP_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, /* TODO */ .rx_range_list2 = { {.start=kHz(150),.end=MHz(1500),.modes=DTTSP_MODES, .low_power=-1,.high_power=-1,DTTSP_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, /* TODO */ .tuning_steps = { {DTTSP_MODES,1}, {DTTSP_MODES,RIG_TS_ANY}, RIG_TS_END, }, .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR, kHz(2.4)}, {RIG_MODE_AM|RIG_MODE_DSB|RIG_MODE_SAM, kHz(8)}, {RIG_MODE_FM, kHz(15)}, {DTTSP_MODES, RIG_FLT_ANY}, RIG_FLT_END, }, .str_cal = DTTSP_REAL_STR_CAL, .priv = NULL, .rig_init = dttsp_init, .rig_cleanup = dttsp_cleanup, .rig_open = dttsp_open, .rig_close = dttsp_close, .cfgparams = dttsp_cfg_params, .set_conf = dttsp_set_conf, .get_conf = dttsp_get_conf, .set_freq = dttsp_set_freq, .get_freq = dttsp_get_freq, .set_mode = dttsp_set_mode, .set_level = dttsp_set_level, .get_level = dttsp_get_level, .set_func = dttsp_set_func, .set_rit = dttsp_set_rit, .get_rit = dttsp_get_rit, .set_ant = dttsp_set_ant, }; /* * The same as the previous IPC, but of type RIG_PORT_UDP_NETWORK */ const struct rig_caps dttsp_udp_rig_caps = { .rig_model = RIG_MODEL_DTTSP_UDP, .model_name = "DttSP UDP", .mfg_name = "DTTS Microwave Society", .version = "0.2", .copyright = "GPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_COMPUTER, .targetable_vfo = RIG_TARGETABLE_ALL, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_UDP_NETWORK, .timeout = 500, .has_get_func = DTTSP_FUNC, .has_set_func = DTTSP_FUNC, .has_get_level = DTTSP_LEVEL, .has_set_level = RIG_LEVEL_SET(DTTSP_LEVEL), .has_get_parm = DTTSP_PARM, .has_set_parm = RIG_PARM_SET(DTTSP_PARM), .ctcss_list = NULL, .dcs_list = NULL, .chan_list = { RIG_CHAN_END, }, .scan_ops = DTTSP_SCAN, .vfo_ops = DTTSP_VFO_OP, .transceive = RIG_TRN_OFF, .attenuator = { RIG_DBLST_END, }, .preamp = { RIG_DBLST_END, }, /* In fact, RX and TX ranges are dependant on the tuner */ .rx_range_list1 = { {.start=kHz(150),.end=MHz(1500),.modes=DTTSP_MODES, .low_power=-1,.high_power=-1,DTTSP_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, /* TODO */ .rx_range_list2 = { {.start=kHz(150),.end=MHz(1500),.modes=DTTSP_MODES, .low_power=-1,.high_power=-1,DTTSP_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, /* TODO */ .tuning_steps = { {DTTSP_MODES,1}, {DTTSP_MODES,RIG_TS_ANY}, RIG_TS_END, }, .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR, kHz(2.4)}, {RIG_MODE_AM|RIG_MODE_DSB|RIG_MODE_SAM, kHz(8)}, {RIG_MODE_FM, kHz(15)}, {DTTSP_MODES, RIG_FLT_ANY}, RIG_FLT_END, }, .str_cal = DTTSP_REAL_STR_CAL, .priv = NULL, .rig_init = dttsp_init, .rig_cleanup = dttsp_cleanup, .rig_open = dttsp_open, .rig_close = dttsp_close, .cfgparams = dttsp_cfg_params, .set_conf = dttsp_set_conf, .get_conf = dttsp_get_conf, .set_freq = dttsp_set_freq, .get_freq = dttsp_get_freq, .set_mode = dttsp_set_mode, .set_level = dttsp_set_level, .get_level = dttsp_get_level, .set_func = dttsp_set_func, .set_rit = dttsp_set_rit, .get_rit = dttsp_get_rit, .set_ant = dttsp_set_ant, }; static int send_command(RIG *rig, const char *cmdstr, size_t buflen) { int ret; ret = write_block (&rig->state.rigport, cmdstr, buflen); return ret; } static int fetch_meter (RIG *rig, int *label, float *data, int npts) { struct dttsp_priv_data *priv = (struct dttsp_priv_data*)rig->state.priv; int ret, buf_len; char buf[sizeof(float)*MAXMETERPTS*MAXRX]; if (priv->meter_port.type.rig == RIG_PORT_UDP_NETWORK) { buf_len = sizeof(int) + npts * sizeof(float); ret = read_block(&priv->meter_port, buf, buf_len); if (ret != buf_len) ret = -RIG_EIO; /* copy payload back to client space */ memcpy((char *) label, buf, sizeof(int)); memcpy((char *) data, buf + sizeof(int), npts * sizeof(float)); } else { /* IPC */ buf_len = sizeof(int); ret = read_block(&priv->meter_port, (char*)label, buf_len); if (ret != buf_len) ret = -RIG_EIO; if (ret < 0) return ret; buf_len = sizeof(float) * npts; ret = read_block(&priv->meter_port, (char*)data, buf_len); if (ret != buf_len) ret = -RIG_EIO; if (ret < 0) return ret; } return ret; } /* * Assumes rig!=NULL, rig->state.priv!=NULL */ int dttsp_set_conf(RIG *rig, token_t token, const char *val) { struct dttsp_priv_data *priv; struct rig_state *rs; rs = &rig->state; priv = (struct dttsp_priv_data*)rs->priv; switch(token) { case TOK_TUNER_MODEL: priv->tuner_model = atoi(val); break; case TOK_SAMPLE_RATE: priv->sample_rate = atoi(val); break; default: /* if it's not for the dttsp backend, maybe it's for the tuner */ if (priv->tuner) return rig_set_conf(priv->tuner, token, val); else return -RIG_EINVAL; } return RIG_OK; } /* * assumes rig!=NULL, * Assumes rig!=NULL, rig->state.priv!=NULL * and val points to a buffer big enough to hold the conf value. */ int dttsp_get_conf(RIG *rig, token_t token, char *val) { struct dttsp_priv_data *priv; struct rig_state *rs; rs = &rig->state; priv = (struct dttsp_priv_data*)rs->priv; switch(token) { case TOK_TUNER_MODEL: sprintf(val, "%d", priv->tuner_model); break; case TOK_SAMPLE_RATE: sprintf(val, "%d", priv->sample_rate); break; default: /* if it's not for the dttsp backend, maybe it's for the tuner */ if (priv->tuner) return rig_get_conf(priv->tuner, token, val); else return -RIG_EINVAL; } return RIG_OK; } int dttsp_init(RIG *rig) { struct dttsp_priv_data *priv; const char *cmdpath; char *p; priv = (struct dttsp_priv_data*)calloc(1, sizeof(struct dttsp_priv_data)); if (!priv) return -RIG_ENOMEM; rig->state.priv = (void*)priv; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__ ); priv->tuner = NULL; priv->tuner_model = RIG_MODEL_DUMMY; priv->IF_center_freq = 0; p = getenv ( "SDR_DEFRATE" ); if (p) priv->sample_rate = atoi(p); else priv->sample_rate = DEFAULT_SAMPLE_RATE; cmdpath = getenv ( "SDR_PARMPATH" ); if (!cmdpath) cmdpath = rig->state.rigport.type.rig == RIG_PORT_UDP_NETWORK ? DEFAULT_DTTSP_CMD_NET_ADDR : DEFAULT_DTTSP_CMD_PATH; strncpy(rig->state.rigport.pathname, cmdpath, FILPATHLEN - 1); return RIG_OK; } int dttsp_open(RIG *rig) { struct dttsp_priv_data *priv = (struct dttsp_priv_data*)rig->state.priv; int ret; char *p; char *meterpath; rig_debug(RIG_DEBUG_TRACE,"%s called\n", __FUNCTION__); /* * prevent l8ps */ if (priv->tuner_model == RIG_MODEL_DTTSP || priv->tuner_model == RIG_MODEL_DTTSP_UDP) { return -RIG_ECONF; } priv->tuner = rig_init(priv->tuner_model); if (!priv->tuner) { /* FIXME: wrong rig model? */ return -RIG_ENOMEM; } ret = rig_open(priv->tuner); if (ret != RIG_OK) { rig_cleanup(priv->tuner); priv->tuner = NULL; return ret; } /* open DttSP meter pipe */ priv->meter_port.post_write_delay = rig->state.rigport.post_write_delay; priv->meter_port.timeout = rig->state.rigport.timeout; priv->meter_port.retry = rig->state.rigport.retry; p = getenv ( "SDR_METERPATH" ); if (!p) { meterpath = priv->meter_port.pathname; strncpy(meterpath, rig->state.rigport.pathname, FILPATHLEN - 1); if (rig->state.rigport.type.rig == RIG_PORT_UDP_NETWORK) { p = strrchr(meterpath, ':'); if (p) strcpy(p+1, "19003"); else strcat(meterpath, ":19003"); p = meterpath; } else { p = strrchr(meterpath, '/'); if (p) strcpy(p+1, "SDRmeter"); } } if (!p) { /* disabled */ priv->meter_port.fd = -1; } else { priv->meter_port.type.rig = rig->state.rigport.type.rig; ret = port_open(&priv->meter_port); if (ret < 0) return ret; } /* TODO: * copy priv->tuner->rx_range/tx_range to rig->state */ #if 1 rig->state.has_set_func |= priv->tuner->state.has_set_func; rig->state.has_get_func |= priv->tuner->state.has_get_func; rig->state.has_set_level |= priv->tuner->state.has_set_level; rig->state.has_get_level |= priv->tuner->state.has_get_level; rig->state.has_set_parm |= priv->tuner->state.has_set_parm; rig->state.has_get_parm |= priv->tuner->state.has_get_parm; #endif /* Because model dummy has funky init value */ if (priv->tuner_model == RIG_MODEL_DUMMY) dttsp_set_freq(rig, RIG_VFO_CURR, priv->IF_center_freq); dttsp_set_func(rig, RIG_VFO_CURR, RIG_FUNC_MUTE, 0); return RIG_OK; } int dttsp_close(RIG *rig) { struct dttsp_priv_data *priv = (struct dttsp_priv_data*)rig->state.priv; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); port_close(&priv->meter_port, priv->meter_port.type.rig); rig_close(priv->tuner); return RIG_OK; } int dttsp_cleanup(RIG *rig) { struct dttsp_priv_data *priv = (struct dttsp_priv_data*)rig->state.priv; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __FUNCTION__); if (priv->tuner) rig_cleanup(priv->tuner); priv->tuner = NULL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * rig_set_freq is a good candidate for the GNUradio GUI setFrequency callback? */ int dttsp_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct dttsp_priv_data *priv = (struct dttsp_priv_data *)rig->state.priv; freq_t tuner_freq; int ret; char fstr[20]; char buf[32]; int buf_len; shortfreq_t max_delta; freq_t freq_offset; max_delta = priv->sample_rate/2 - kHz(2); sprintf_freq(fstr, freq); rig_debug(RIG_DEBUG_TRACE,"%s called: %s %s\n", __FUNCTION__, rig_strvfo(vfo), fstr); ret = rig_get_freq(priv->tuner, RIG_VFO_CURR, &tuner_freq); if (ret != RIG_OK) return ret; freq_offset = freq - tuner_freq; /* TODO: take into account the mode width and the IF dead zone */ if (fabs(freq_offset) > max_delta) { tuner_freq = priv->IF_center_freq + freq -kHz(6); ret = rig_set_freq(priv->tuner, RIG_VFO_CURR, tuner_freq); if (ret != RIG_OK) return ret; /* reread the tuner freq because some rigs can't tune to exact frequency. * The rx_delta_f will correct that */ ret = rig_get_freq(priv->tuner, RIG_VFO_CURR, &tuner_freq); if (ret != RIG_OK) return ret; } priv->rx_delta_f = freq - tuner_freq; sprintf_freq(fstr, tuner_freq); rig_debug(RIG_DEBUG_TRACE,"%s: tuner=%s, rx_delta=%d Hz\n", __FUNCTION__, fstr, priv->rx_delta_f); /* setRxFrequenc */ buf_len = sprintf (buf, "setOsc %d\n", priv->rx_delta_f ); ret = send_command (rig, buf, buf_len); return ret; } int dttsp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct dttsp_priv_data *priv = (struct dttsp_priv_data *)rig->state.priv; freq_t tuner_freq; int ret; ret = rig_get_freq(priv->tuner, RIG_VFO_CURR, &tuner_freq); if (ret != RIG_OK) return ret; rig_debug(RIG_DEBUG_TRACE,"%s called\n", __FUNCTION__); *freq = tuner_freq - priv->rx_delta_f; return RIG_OK; } static enum dttsp_mode_e rmode2dttsp(rmode_t mode) { int i; for (i=0; i< HAMLIB_VS_DTTSP_MODES_COUNT; i++) { if (hamlib_vs_dttsp_modes[i].hamlib_mode == mode) return hamlib_vs_dttsp_modes[i].dttsp_mode; } return 0; } /* * WIP */ int dttsp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { char buf[32]; int buf_len; int ret = RIG_OK; int filter_l, filter_h; if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); sprintf_freq(buf, width); rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s %s\n", __FUNCTION__, rig_strrmode(mode), buf); switch (mode) { case RIG_MODE_USB: case RIG_MODE_CW: filter_l = 10; filter_h = width; break; case RIG_MODE_LSB: case RIG_MODE_CWR: filter_l = -width; filter_h = -10; break; case RIG_MODE_AM: case RIG_MODE_SAM: case RIG_MODE_FM: case RIG_MODE_DSB: filter_l = -width/2; filter_h = width/2; break; default: return -RIG_EINVAL; } /* DttSP set mode */ buf_len = sprintf (buf, "setMode %d\n", rmode2dttsp(mode) ); ret = send_command (rig, buf, buf_len); buf_len = sprintf (buf, "setFilter %d %d\n", filter_l, filter_h ); ret = send_command (rig, buf, buf_len); rig_debug(RIG_DEBUG_VERBOSE,"%s: %s\n", __FUNCTION__, buf); return ret; } static int agc_level2dttsp(enum agc_level_e agc) { switch (agc) { case RIG_AGC_OFF: return 0; case RIG_AGC_SLOW: return 2; case RIG_AGC_MEDIUM: return 3; case RIG_AGC_FAST: return 4; default: return 0; } return 0; } /* */ int dttsp_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { struct dttsp_priv_data *priv = (struct dttsp_priv_data *)rig->state.priv; int ret = RIG_OK; int buf_len; char buf[32]; switch (level) { case RIG_LEVEL_AGC: buf_len = sprintf (buf, "setRXAGC %d\n", agc_level2dttsp(val.i)); ret = send_command (rig, buf, buf_len); break; default: rig_debug(RIG_DEBUG_TRACE, "%s: level %s, try tuner\n", __FUNCTION__, rig_strlevel(level)); return rig_set_level(priv->tuner, vfo, level, val); } return ret; } int dttsp_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct dttsp_priv_data *priv = (struct dttsp_priv_data *)rig->state.priv; int ret = RIG_OK; int buf_len; char buf[32]; float rxm[MAXRX][RXMETERPTS]; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %s\n",__FUNCTION__, rig_strlevel(level)); switch (level) { case RIG_LEVEL_RAWSTR: case RIG_LEVEL_STRENGTH: buf_len = sprintf (buf, "reqRXMeter %d\n", getpid()); ret = send_command (rig, buf, buf_len); if (ret < 0) return ret; ret = fetch_meter (rig, (int*)buf, (float*)rxm, MAXRX * RXMETERPTS); if (ret < 0) return ret; val->i = (int)rxm[0][0]; if (level == RIG_LEVEL_STRENGTH) val->i = (int)rig_raw2val(val->i,&rig->state.str_cal); ret = RIG_OK; break; default: rig_debug(RIG_DEBUG_TRACE, "%s: level %s, try tuner\n", __FUNCTION__, rig_strlevel(level)); return rig_get_level(priv->tuner, vfo, level, val); } return ret; } int dttsp_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { struct dttsp_priv_data *priv = (struct dttsp_priv_data *)rig->state.priv; char buf[32]; const char *cmd; int buf_len; int ret; status = status ? 1 : 0; switch ( func ) { case RIG_FUNC_MUTE: cmd = "setRunState"; status = status ? 0 : 2; break; case RIG_FUNC_NB: cmd = "setNB"; break; case RIG_FUNC_ANF: cmd = "setANF"; break; case RIG_FUNC_NR: cmd = "setNR"; break; default: rig_debug(RIG_DEBUG_TRACE, "%s: func %s, try tuner\n", __FUNCTION__, rig_strfunc(func)); return rig_set_func(priv->tuner, vfo, func, status); } buf_len = sprintf (buf, "%s %d\n", cmd, status); ret = send_command (rig, buf, buf_len); return ret; } /* * TODO */ int dttsp_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return -RIG_ENIMPL; } int dttsp_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); return -RIG_ENIMPL; } int dttsp_set_ant(RIG * rig, vfo_t vfo, ant_t ant) { struct dttsp_priv_data *priv = (struct dttsp_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: ant %d, try tuner\n", __FUNCTION__, ant); return rig_set_ant(priv->tuner, vfo, ant); } hamlib-1.2.15.3/flexradio/sdr1k.c0000644000175000017500000002651012044564477013304 00000000000000/* * Hamlib backend - SDR-1000 * Copyright (c) 2003-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "parallel.h" #include "misc.h" #include "bandplan.h" #include "register.h" #include "flexradio.h" static int sdr1k_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int sdr1k_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int sdr1k_reset(RIG *rig, reset_t reset); static int sdr1k_init(RIG *rig); static int sdr1k_open(RIG *rig); static int sdr1k_close(RIG *rig); static int sdr1k_cleanup(RIG *rig); static int sdr1k_set_ptt (RIG *rig, vfo_t vfo, ptt_t ptt); static int sdr1k_set_level (RIG *rig, vfo_t vfo, setting_t level, value_t val); typedef enum { L_EXT = 0, L_BAND = 1, L_DDS0 = 2, L_DDS1 = 3 } latch_t; #define TR 0x40 #define MUTE 0x80 #define GAIN 0x80 #define WRB 0x40 #define RESET 0x80 /* DDS Control Constants */ #define COMP_PD 0x10 /* DDS Comparator power down */ #define DIG_PD 0x01 /* DDS Digital Power down */ #define BYPASS_PLL 0x20 /* Bypass DDS PLL */ #define INT_IOUD 0x01 /* Internal IO Update */ #define OSK_EN 0x20 /* Offset Shift Keying enable */ #define OSK_INT 0x10 /* Offset Shift Keying */ #define BYPASS_SINC 0x40 /* Bypass Inverse Sinc Filter */ #define PLL_RANGE 0x40 /* Set PLL Range */ static int write_latch (RIG *rig, latch_t which, unsigned value, unsigned mask); static int dds_write_reg (RIG *rig, unsigned addr, unsigned data); static int set_bit (RIG *rig, latch_t reg, unsigned bit, unsigned state); #define DEFAULT_XTAL MHz(200) #define DEFAULT_PLL_MULT 1 #define DEFAULT_DAC_MULT 4095 struct sdr1k_priv_data { unsigned shadow[4]; /* shadow latches */ freq_t dds_freq; /* current freq */ freq_t xtal; /* base XTAL */ int pll_mult; /* PLL mult */ }; #define SDR1K_FUNC RIG_FUNC_MUTE #define SDR1K_LEVEL RIG_LEVEL_PREAMP #define SDR1K_PARM RIG_PARM_NONE #define SDR1K_MODES (RIG_MODE_NONE) #define SDR1K_VFO RIG_VFO_A #define SDR1K_ANTS 0 /* ************************************************************************* */ /* * http://www.flex-radio.com * SDR-1000 rig capabilities. * * * TODO: RIG_FUNC_MUTE, set_external_pin? * * def set_mute (self, mute = 1): * self.set_bit(1, 7, mute) * * def set_unmute (self): * self.set_bit(1, 7, 0) * * def set_external_pin (self, pin, on = 1): * assert (pin < 8 and pin > 0), "Out of range 1..7" * self.set_bit(0, pin-1, on) * * def read_input_pin * * set_conf(XTAL,PLL_mult,spur_red) * * What about IOUD_Clock? */ const struct rig_caps sdr1k_rig_caps = { .rig_model = RIG_MODEL_SDR1000, .model_name = "SDR-1000", .mfg_name = "Flex-radio", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TUNER, .targetable_vfo = 0, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_PARALLEL, .has_get_func = SDR1K_FUNC, .has_set_func = SDR1K_FUNC, .has_get_level = SDR1K_LEVEL, .has_set_level = RIG_LEVEL_SET(SDR1K_LEVEL), .has_get_parm = SDR1K_PARM, .has_set_parm = RIG_PARM_SET(SDR1K_PARM), .chan_list = { RIG_CHAN_END, }, .scan_ops = RIG_SCAN_NONE, .vfo_ops = RIG_OP_NONE, .transceive = RIG_TRN_OFF, .attenuator = { RIG_DBLST_END, }, .preamp = { 14, RIG_DBLST_END, }, .rx_range_list1 = { {.start=Hz(1),.end=MHz(65),.modes=SDR1K_MODES, .low_power=-1,.high_power=-1,SDR1K_VFO}, RIG_FRNG_END, }, .tx_range_list1 = { /* restricted to ham band */ FRQ_RNG_HF(1,SDR1K_MODES, W(1),W(1),SDR1K_VFO,SDR1K_ANTS), FRQ_RNG_6m(1,SDR1K_MODES, W(1),W(1),SDR1K_VFO,SDR1K_ANTS), RIG_FRNG_END, }, .rx_range_list2 = { {.start=Hz(1),.end=MHz(65),.modes=SDR1K_MODES, .low_power=-1,.high_power=-1,SDR1K_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { /* restricted to ham band */ FRQ_RNG_HF(2,SDR1K_MODES, W(1),W(1),SDR1K_VFO,SDR1K_ANTS), FRQ_RNG_6m(2,SDR1K_MODES, W(1),W(1),SDR1K_VFO,SDR1K_ANTS), RIG_FRNG_END, }, .tuning_steps = { {SDR1K_MODES,1}, RIG_TS_END, }, .priv = NULL, /* priv */ .rig_init = sdr1k_init, .rig_open = sdr1k_open, .rig_close = sdr1k_close, .rig_cleanup = sdr1k_cleanup, .set_freq = sdr1k_set_freq, .get_freq = sdr1k_get_freq, .set_ptt = sdr1k_set_ptt, .reset = sdr1k_reset, .set_level= sdr1k_set_level, // .set_func = sdr1k_set_func, }; /* ************************************************************************* */ int sdr1k_init(RIG *rig) { struct sdr1k_priv_data *priv; priv = (struct sdr1k_priv_data*)malloc(sizeof(struct sdr1k_priv_data)); if (!priv) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } priv->dds_freq = RIG_FREQ_NONE; priv->xtal = DEFAULT_XTAL; priv->pll_mult = DEFAULT_PLL_MULT; rig->state.priv = (void*)priv; return RIG_OK; } static void pdelay(RIG *rig) { unsigned char r; par_read_data(&rig->state.rigport, &r); /* ~1us */ } int sdr1k_open(RIG *rig) { struct sdr1k_priv_data *priv = (struct sdr1k_priv_data *)rig->state.priv; priv->shadow[0] = 0; priv->shadow[1] = 0; priv->shadow[2] = 0; priv->shadow[3] = 0; sdr1k_reset(rig, 1); return RIG_OK; } int sdr1k_close(RIG *rig) { /* TODO: release relays? */ return RIG_OK; } int sdr1k_cleanup(RIG *rig) { struct sdr1k_priv_data *priv = (struct sdr1k_priv_data *)rig->state.priv; if (priv) { free(priv); } rig->state.priv = NULL; return RIG_OK; } static int set_band(RIG *rig, freq_t freq) { int band, ret; /* set_band */ if (freq <= MHz(2.25)) band = 0; else if ( freq <= MHz(5.5)) band = 1; else if (freq <= MHz(11)) band = 3; /* due to wiring mistake on board */ else if (freq <= MHz(22)) band = 2; /* due to wiring mistake on board */ else if (freq <= MHz(37.5)) band = 4; else band = 5; ret = write_latch (rig, L_BAND, 1 << band, 0x3f); rig_debug(RIG_DEBUG_VERBOSE, "%s %"PRIll" band %d\n", __FUNCTION__, (int64_t)freq, band); return ret; } /* * set DDS frequency. * NB: due to spur reduction, effective frequency might not be the expected one */ int sdr1k_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct sdr1k_priv_data *priv = (struct sdr1k_priv_data *)rig->state.priv; int i; double ftw; double DDS_step_size; freq_t frqval; int spur_red = 1; int ret; ret = set_band(rig, freq); if (ret != RIG_OK) return ret; /* Calculate DDS step for spu reduction * DDS steps = 3051.7578125Hz */ DDS_step_size = ((double)priv->xtal * priv->pll_mult ) / 65536; rig_debug(RIG_DEBUG_VERBOSE, "%s DDS step size %g %g %g\n", __FUNCTION__, DDS_step_size, (double)freq / DDS_step_size, rint((double)freq / DDS_step_size)); if (spur_red) frqval = (freq_t) (DDS_step_size * rint((double)freq / DDS_step_size)); else frqval = freq; rig_debug(RIG_DEBUG_VERBOSE, "%s curr %"PRIll" frqval %"PRIll"\n", __FUNCTION__, (int64_t)freq, (int64_t)frqval); if (priv->dds_freq == frqval) { return RIG_OK; } /*** */ ftw = (double)frqval / priv->xtal ; for (i = 0; i<6; i++) { unsigned word; if (spur_red && i==2) word = 128; else if (spur_red && i>2) word = 0; else { word = (unsigned)(ftw * 256); ftw = ftw*256 - word; } rig_debug(RIG_DEBUG_TRACE, "DDS %d [%02x]\n", i, word); ret = dds_write_reg (rig, 4+i, word); if (ret != RIG_OK) return ret; } priv->dds_freq = frqval; return ret; } int sdr1k_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct sdr1k_priv_data *priv = (struct sdr1k_priv_data *)rig->state.priv; *freq = priv->dds_freq; rig_debug(RIG_DEBUG_TRACE,"%s: %"PRIll"\n", __FUNCTION__, (int64_t)priv->dds_freq); return RIG_OK; } /* Set DAC multiplier value */ static int DAC_mult(RIG *rig, unsigned mult) { rig_debug(RIG_DEBUG_TRACE, "DAC [%02x,%02x]\n", mult>>8, mult&0xff); /* Output Shape Key I Mult */ dds_write_reg (rig, 0x21, mult >> 8); dds_write_reg (rig, 0x22, mult & 0xff); /* Output Shape Key Q Mult */ dds_write_reg (rig, 0x23, mult >> 8); dds_write_reg (rig, 0x24, mult & 0xff); return RIG_OK; } int sdr1k_reset (RIG *rig, reset_t reset) { /* Reset all Latches (relays off) */ write_latch (rig, L_BAND, 0x00, 0xff); write_latch (rig, L_DDS1, 0x00, 0xff); write_latch (rig, L_DDS0, 0x00, 0xff); write_latch (rig, L_EXT, 0x00, 0xff); /* Reset DDS */ write_latch (rig, L_DDS1, RESET|WRB, 0xff); /* reset the DDS chip */ write_latch (rig, L_DDS1, WRB, 0xff); /* leave WRB high */ dds_write_reg (rig, 0x1d, COMP_PD); /* Power down comparator */ /* TODO: add PLL multiplier property and logic */ dds_write_reg (rig, 0x1e, BYPASS_PLL); /* Bypass PLL */ dds_write_reg (rig, 0x20, BYPASS_SINC|OSK_EN);/* Bypass Inverse Sinc and enable DAC */ DAC_mult(rig, DEFAULT_DAC_MULT); /* Set DAC multiplier value */ return RIG_OK; } int sdr1k_set_ptt (RIG *rig, vfo_t vfo, ptt_t ptt) { return set_bit(rig, L_BAND, 6, ptt == RIG_PTT_ON); } int sdr1k_set_level (RIG *rig, vfo_t vfo, setting_t level, value_t val) { rig_debug(RIG_DEBUG_TRACE,"%s: %s %d\n", __FUNCTION__, rig_strlevel(level), val.i); switch (level) { case RIG_LEVEL_PREAMP: return set_bit(rig, L_EXT, 7, !(val.i == rig->caps->preamp[0])); break; default: return -RIG_EINVAL; } } int write_latch (RIG *rig, latch_t which, unsigned value, unsigned mask) { struct sdr1k_priv_data *priv = (struct sdr1k_priv_data *)rig->state.priv; hamlib_port_t *pport = &rig->state.rigport; if (!(L_EXT <= which && which <= L_DDS1)) return -RIG_EINVAL; par_lock (pport); priv->shadow[which] = (priv->shadow[which] & ~mask) | (value & mask); par_write_data (pport, priv->shadow[which]); pdelay(rig); par_write_control (pport, 0x0F ^ (1 << which)); pdelay(rig); par_write_control (pport, 0x0F); pdelay(rig); par_unlock (pport); return RIG_OK; } int dds_write_reg (RIG *rig, unsigned addr, unsigned data) { #if 0 write_latch (rig, L_DDS1, addr & 0x3f, 0x3f); write_latch (rig, L_DDS0, data, 0xff); write_latch (rig, L_DDS1, 0x40, 0x40); write_latch (rig, L_DDS1, 0x00, 0x40); #else /* set up data bits */ write_latch (rig, L_DDS0, data, 0xff); /* set up address bits with WRB high */ //write_latch (rig, L_DDS1, addr & 0x3f, 0x3f); write_latch (rig, L_DDS1, WRB | addr, 0xff); /* send write command with WRB low */ write_latch (rig, L_DDS1, addr, 0xff); /* return WRB high */ write_latch (rig, L_DDS1, WRB, 0xff); #endif return RIG_OK; } int set_bit (RIG *rig, latch_t reg, unsigned bit, unsigned state) { unsigned val; val = state ? 1< #include #include #include #include #include "hamlib/rotator.h" #include "serial.h" #include "misc.h" #include "register.h" #include "spid.h" #define TOK_AZRES 1 #define TOK_ELRES 2 struct spid_rot2prog_priv_data { int az_resolution; int el_resolution; }; static int spid_rot_init(ROT *rot) { struct spid_rot2prog_priv_data *priv; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); if (!rot || !rot->caps) return -RIG_EINVAL; if (rot->caps->rot_model == ROT_MODEL_SPID_ROT2PROG) { priv = (struct spid_rot2prog_priv_data*)malloc(sizeof(struct spid_rot2prog_priv_data)); if (!priv) { return -RIG_ENOMEM; } rot->state.priv = (void*)priv; priv->az_resolution = 0; priv->el_resolution = 0; } return RIG_OK; } static int spid_rot_cleanup(ROT *rot) { rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); if (!rot) return -RIG_EINVAL; if (rot->state.priv && rot->caps->rot_model == ROT_MODEL_SPID_ROT2PROG) free(rot->state.priv); rot->state.priv = NULL; return RIG_OK; } static int spid_get_conf(ROT *rot, token_t token, char *val) { struct spid_rot2prog_priv_data *priv = (struct spid_rot2prog_priv_data*)rot->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s called %d\n", __FUNCTION__, token); if (rot->caps->rot_model != ROT_MODEL_SPID_ROT2PROG) return -RIG_EINVAL; switch(token) { case TOK_AZRES: sprintf(val, "%d", priv->az_resolution); break; case TOK_ELRES: sprintf(val, "%d", priv->el_resolution); break; default: return -RIG_EINVAL; } return RIG_OK; } static int spid_set_conf(ROT *rot, token_t token, const char *val) { struct spid_rot2prog_priv_data *priv = (struct spid_rot2prog_priv_data*)rot->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s called %d %s\n", __FUNCTION__, token, val); if (rot->caps->rot_model != ROT_MODEL_SPID_ROT2PROG) return -RIG_EINVAL; switch(token) { case TOK_AZRES: priv->az_resolution = atoi(val); break; case TOK_ELRES: priv->el_resolution = atoi(val); break; default: return -RIG_EINVAL; } return RIG_OK; } static int spid_rot1prog_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) { struct rot_state *rs = &rot->state; int retval; char cmdstr[13]; unsigned int u_az; rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __FUNCTION__, az, el); u_az = 360 + az; cmdstr[0] = 0x57; /* S */ cmdstr[1] = 0x30 + u_az/100; /* H1 */ cmdstr[2] = 0x30 + (u_az % 100) / 10; /* H2 */ cmdstr[3] = 0x30 + (u_az % 10); /* H3 */ cmdstr[4] = 0x30; /* H4 */ cmdstr[5] = 0x00; /* PH */ cmdstr[6] = 0x00; /* V1 */ cmdstr[7] = 0x00; /* V2 */ cmdstr[8] = 0x00; /* V3 */ cmdstr[9] = 0x00; /* V4 */ cmdstr[10] = 0x00; /* PV */ cmdstr[11] = 0x2F; /* K */ cmdstr[12] = 0x20; /* END */ retval = write_block(&rs->rotport, cmdstr, 13); if (retval != RIG_OK) { return retval; } return RIG_OK; } static int spid_rot2prog_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) { struct rot_state *rs = &rot->state; struct spid_rot2prog_priv_data *priv = (struct spid_rot2prog_priv_data*)rs->priv; int retval; int retry_read = 0; char cmdstr[13]; unsigned int u_az, u_el; rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __FUNCTION__, az, el); if (!priv->az_resolution || !priv->el_resolution) { do { retval = write_block(&rs->rotport, "\x57\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1F\x20", 13); if (retval != RIG_OK) { return retval; } memset(cmdstr, 0, 12); retval = read_block(&rs->rotport, cmdstr, 12); } while (retval < 0 && retry_read++ < rot->state.rotport.retry); if (retval < 0) return retval; } else { cmdstr[5] = priv->az_resolution; /* PH */ cmdstr[10] = priv->el_resolution; /* PV */ } u_az = cmdstr[5]*(360 + az); u_el = cmdstr[10]*(360 + el); cmdstr[0] = 0x57; /* S */ cmdstr[1] = 0x30 + u_az/1000; /* H1 */ cmdstr[2] = 0x30 + (u_az % 1000) / 100; /* H2 */ cmdstr[3] = 0x30 + (u_az % 100) / 10; /* H3 */ cmdstr[4] = 0x30 + (u_az % 10); /* H4 */ cmdstr[6] = 0x30 + u_el / 1000; /* V1 */ cmdstr[7] = 0x30 + (u_el % 1000) / 100; /* V2 */ cmdstr[8] = 0x30 + (u_el % 100) / 10; /* V3 */ cmdstr[9] = 0x30 + (u_el % 10); /* V4 */ cmdstr[11] = 0x2F; /* K */ cmdstr[12] = 0x20; /* END */ retval = write_block(&rs->rotport, cmdstr, 13); if (retval != RIG_OK) { return retval; } return RIG_OK; } static int spid_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { struct rot_state *rs = &rot->state; int retval; int retry_read = 0; char posbuf[12]; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); do { retval = write_block(&rs->rotport, "\x57\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1F\x20", 13); if (retval != RIG_OK) { return retval; } memset(posbuf, 0, 12); if (rot->caps->rot_model == ROT_MODEL_SPID_ROT1PROG) retval = read_block(&rs->rotport, posbuf, 5); else if (rot->caps->rot_model == ROT_MODEL_SPID_ROT2PROG) retval = read_block(&rs->rotport, posbuf, 12); else retval = -RIG_EINVAL; } while (retval < 0 && retry_read++ < rot->state.rotport.retry); if (retval < 0) return retval; *az = posbuf[1] * 100; *az += posbuf[2] * 10; *az += posbuf[3]; if (rot->caps->rot_model == ROT_MODEL_SPID_ROT2PROG) *az += posbuf[4] / 10.0; *az -= 360; *el = 0.0; if (rot->caps->rot_model == ROT_MODEL_SPID_ROT2PROG) { *el = posbuf[6] * 100; *el += posbuf[7] * 10; *el += posbuf[8]; *el += posbuf[9] / 10.0; *el -= 360; } rig_debug(RIG_DEBUG_TRACE, "%s: (az, el) = (%.1f, %.1f)\n", __FUNCTION__, *az, *el); return RIG_OK; } static int spid_rot_stop(ROT *rot) { struct rot_state *rs = &rot->state; int retval; int retry_read = 0; char posbuf[12]; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); do { retval = write_block(&rs->rotport, "\x57\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0F\x20", 13); if (retval != RIG_OK) { return retval; } memset(posbuf, 0, 12); if (rot->caps->rot_model == ROT_MODEL_SPID_ROT1PROG) retval = read_block(&rs->rotport, posbuf, 5); else if (rot->caps->rot_model == ROT_MODEL_SPID_ROT2PROG) retval = read_block(&rs->rotport, posbuf, 12); } while (retval < 0 && retry_read++ < rot->state.rotport.retry); if (retval < 0) return retval; return RIG_OK; } const struct confparams spid_cfg_params[] = { { TOK_AZRES, "az_resolution", "Azimuth resolution", "Number of pulses per degree, 0 = auto sense", "0", RIG_CONF_NUMERIC, { .n = { 0, 0xff, 1 } } }, { TOK_ELRES, "el_resolution", "Eleveation resolution", "Number of pulses per degree, 0 = auto sense", "0", RIG_CONF_NUMERIC, { .n = { 0, 0xff, 1 } } }, { RIG_CONF_END, NULL, } }; const struct rot_caps spid_rot1prog_rot_caps = { .rot_model = ROT_MODEL_SPID_ROT1PROG, .model_name = "Rot1Prog", .mfg_name = "SPID", .version = "1.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rot_type = ROT_TYPE_AZIMUTH, .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 = 400, .retry = 3, .min_az = -180.0, .max_az = 540.0, .min_el = 0.0, .max_el = 0.0, .cfgparams = spid_cfg_params, .get_conf = spid_get_conf, .set_conf = spid_set_conf, .rot_init = spid_rot_init, .rot_cleanup = spid_rot_cleanup, .get_position = spid_rot_get_position, .set_position = spid_rot1prog_rot_set_position, .stop = spid_rot_stop, }; const struct rot_caps spid_rot2prog_rot_caps = { .rot_model = ROT_MODEL_SPID_ROT2PROG, .model_name = "Rot2Prog", .mfg_name = "SPID", .version = "1.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rot_type = ROT_TYPE_AZEL, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 600, .serial_rate_max = 600, .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 = 400, .retry = 3, .min_az = -180.0, .max_az = 540.0, .min_el = -20.0, .max_el = 210.0, .cfgparams = spid_cfg_params, .get_conf = spid_get_conf, .set_conf = spid_set_conf, .rot_init = spid_rot_init, .rot_cleanup = spid_rot_cleanup, .get_position = spid_rot_get_position, .set_position = spid_rot2prog_rot_set_position, .stop = spid_rot_stop, }; DECLARE_INITROT_BACKEND(spid) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); rot_register(&spid_rot1prog_rot_caps); rot_register(&spid_rot2prog_rot_caps); return RIG_OK; } hamlib-1.2.15.3/spid/spid.txt0000644000175000017500000002050112044564477012570 00000000000000SPID Rot1Prog & Rot2Prog Protocol ================================= This is an attempt at documenting the protocol of the Rot1Prog and Rot2Prog rotator controller from SPID Elektronik (spid@alpha.pl). Rot1Prog controls only azimuth, while Rot2Prog controls both azimuth and elevation. GENERAL INFO ------------ The SPID protocol supports 3 commands: stop, status and set. The stop command stops the rotator in its current position. The status command returns the current position of the rotator, and the set command tells the rotator to rotate to a given position. The rotator controller communicates with the PC using a serial port. Communication parameters are 1200 bps (Rot1Prog) or 600 bps (Rot2Prog), 8 bits, no parity and 1 stop bit. All commands are issued as 13 byte packets, and responses are received as 5 byte packets (Rot1Prog) or 12 byte packets (Rot2Prog). COMMAND PACKETS --------------- Command packets are 13 byte long. Byte: 0 1 2 3 4 5 6 7 8 9 10 11 12 ----------------------------------------------------------------- Field: | S | H1 | H2 | H3 | H4 | PH | V1 | V2 | V3 | V4 | PV | K | END | ----------------------------------------------------------------- Value: 57 3x 3x 3x 3x 0x 3x 3x 3x 3x 0x xF 20 (hex) S: Start byte. This is always 0x57 ('W') H1-H4: Azimuth as ASCII characters 0-9 PH: Azimuth resolution in pulses per degree (ignored!) V1-V4: Elevation as ASCII characters 0-9 PV: Elevation resolution in pulses per degree (ignored!) K: Command (0x0F=stop, 0x1F=status, 0x2F=set) END: End byte. This is always 0x20 (space) Positions are encoded as number of pulses in ASCII numbers '0000'-'9999' (see set command for formula). Rot1Prog does not control elevation and does not support different resolutions, so V1-V4, PH and PV are set to 0x00. Also, since only whole degrees are supported, H4 is always set to 0x30 (0 tenths of degrees). RESPONSE PACKETS ---------------- Rot1Prog response packets are 5 bytes long. Byte: 0 1 2 3 4 -------------------------- Field: | S | H1 | H2 | H3 | END | -------------------------- Value: 57 0x 0x 0x 20 (hex) S: Start byte. This is always 0x57 ('W') H1-H3: Azimuth as byte values END: End byte. This is always 0x20 (space) Positions are decoded using the following formula: az = H1 * 100 + H2 * 10 + H3 - 360 Rot2Prog response packets are 12 bytes long. Byte: 0 1 2 3 4 5 6 7 8 9 10 11 ------------------------------------------------------------- Field: | S | H1 | H2 | H3 | H4 | PH | V1 | V2 | V3 | V4 | PV | END | ------------------------------------------------------------- Value: 57 0x 0x 0x 0x 0x 0x 0x 0x 0x 0x 20 (hex) S: Start byte. This is always 0x57 ('W') H1-H4: Azimuth as byte values PH: Azimuth resolution in pulses per degree (controller setting) V1-V4: Elevation as byte values PV: Elevation resolution in pulses per degree (controller setting) END: End byte. This is always 0x20 (space) Positions are decoded using the following formulas: az = H1 * 100 + H2 * 10 + H3 + H4 / 10 - 360 el = V1 * 100 + V2 * 10 + V3 + V4 / 10 - 360 The PH and PV values in the response packet reflect the settings of the rotator controller. The Rot2Prog supports the following resolutions (always the same for azimuth and elevation): 1 deg/pulse: PH=0x01, PV=0x01 0.5 deg/pulse: PH=0x02, PV=0x02 0.25 deg/pulse: PH=0x04, PV=0x04 STOP COMMAND ------------ The stop command stops the rotator immediately in the current position and returns the current position. (The position returned does not seem to be entirely correct, often off by a degree or two.) The H1-H4, PH, V1-V4 and PV fields are ignored, so only the S, K and END fields are used. E.g.: Command: ----------------------------------------------------------------- | S | H1 | H2 | H3 | H4 | PH | V1 | V2 | V3 | V4 | PV | K | END | ----------------------------------------------------------------- | 57| 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 0F| 20 | (hex) ----------------------------------------------------------------- Rotator stops Rot1Prog response: -------------------------- | S | H1 | H2 | H3 | END | -------------------------- | 57| 03 | 07 | 02 | 20 | (hex) -------------------------- az=372-360=12 Rot2Prog response: ------------------------------------------------------------- | S | H1 | H2 | H3 | H4 | PH | V1 | V2 | V3 | V4 | PV | END | ------------------------------------------------------------- | 57| 03 | 07 | 02 | 05 | 02 | 03 | 09 | 04 | 00 | 02 | 20 | (hex) ------------------------------------------------------------- az=372.5-360=12.5, el=394.0-360=34.0 PH=PV=0x02 (pulse for each 0.5 deg) STATUS COMMAND -------------- The status command returns the current position of the antenna. The H1-H4, PH, V1-V4 and PV fields are ignored, so only the S, K and END fields are used. E.g.: Command: ----------------------------------------------------------------- | S | H1 | H2 | H3 | H4 | PH | V1 | V2 | V3 | V4 | PV | K | END | ----------------------------------------------------------------- | 57| 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 1F| 20 | (hex) ----------------------------------------------------------------- Rot1Prog response: -------------------------- | S | H1 | H2 | H3 | END | -------------------------- | 57| 03 | 07 | 02 | 20 | (hex) -------------------------- az=372-360=12 Rot2Prog response: ------------------------------------------------------------- | S | H1 | H2 | H3 | H4 | PH | V1 | V2 | V3 | V4 | PV | END | ------------------------------------------------------------- | 57| 03 | 07 | 02 | 05 | 02 | 03 | 09 | 04 | 00 | 02 | 20 | (hex) ------------------------------------------------------------- az=372.5-360=12.5, el=394.0-360=34.0 PH=PV=0x02 (pulse for each 0.5 deg) Status commands can be issued while the rotator is moving and will always return the current position. SET COMMAND ----------- The set command tells the rotator to turn to a specific position. The controller does not send a response to this command. Azimuth and elevation is calculated as number of pulses, with a +360 degree offset (so that negative position can be encoded with positive numbers). Rot1Prog supports only whole degree positions: H = 360 + az Rot2Prog supports different resolutions: H = PH * (360 + az) V = PV * (360 + el) H1-H4 and V1-V4 are these numbers encoded as ASCII (0x30-0x39, i.e. '0'-'9'). E.g., when pointing a Rot1Prog to azimuth 123: H = 360 + 123 = 483 ----------------------------------------------------------------- | S | H1 | H2 | H3 | H4 | PH | V1 | V2 | V3 | V4 | PV | K | END | ----------------------------------------------------------------- | 57| 34 | 38 | 33 | 30 | 00 | 00 | 00 | 00 | 00 | 00 | 2F| 20 | (hex) ----------------------------------------------------------------- Note that H4 is not used and always set to 0x30. E.g., when pointing a Rot2Prog to azimuth 123.5, elevation 77.0 when the rotator sends one pulse per 0.5 degree (PH=PV=2): H = 2 * (360 + 123.5) = 967 V = 2 * (360 + 77.0) = 874 ----------------------------------------------------------------- | S | H1 | H2 | H3 | H4 | PH | V1 | V2 | V3 | V4 | PV | K | END | ----------------------------------------------------------------- | 57| 30 | 39 | 36 | 37 | 02 | 30 | 38 | 37 | 34 | 02 | 2F| 20 | (hex) ----------------------------------------------------------------- The PH and PV values sent are ignored. The values used by the rotator control unit are set by choosing resolution in the setup menu. Luckily, these values can be read using the status command (Rot2Prog only). Note that H1-H4 is interpreted differently by Rot1Prog and Rot2Prog in the set command: Rot1Prog Rot2Prog H1 *100 *1000 H2 *10 *100 H3 *1 *10 H4 *0 *1 Rot1Prog does not use H4 and uses H1 for houndres, while Rot2Prog uses H4 for ones and H1 for thousands. SEE ALSO -------- http://alfaradio.ca/downloads/program_info/ AUTHOR ------ Norvald H. Ryeng, LA6YKA norvald@ryeng.name 2009-05-21, updated 2011-01-29 hamlib-1.2.15.3/spid/Makefile.am0000644000175000017500000000035412044564477013130 00000000000000 pkglib_LTLIBRARIES = hamlib-spid.la hamlib_spid_la_SOURCES = spid.c hamlib_spid_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_spid_la_LIBADD = $(top_builddir)/src/libhamlib.la EXTRA_DIST = spid.txt noinst_HEADERS = spid.h hamlib-1.2.15.3/spid/spid.h0000644000175000017500000000202712044564477012203 00000000000000/* * Hamlib Rotator backend - SPID Rot2Prog * Copyright (c) 2009 by Norvald H. Ryeng, LA6YKA * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROT_SPID_H #define _ROT_SPID_H 1 extern const struct rot_caps spid_rot1prog_rot_caps; extern const struct rot_caps spid_rot2prog_rot_caps; #endif /* _ROT_SPID_H */ hamlib-1.2.15.3/drake/0000755000175000017500000000000012044565026011270 500000000000000hamlib-1.2.15.3/drake/r8b.c0000644000175000017500000001134212044564477012061 00000000000000/* * Hamlib Drake backend - R-8B description * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "drake.h" #define R8B_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_AM|RIG_MODE_ECSS|RIG_MODE_FM) #define R8B_FUNC (RIG_FUNC_MN|RIG_FUNC_LOCK|RIG_FUNC_NB) #define R8B_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH) #define R8B_PARM_ALL (RIG_PARM_TIME) #define R8B_VFO (RIG_VFO_A|RIG_VFO_B|RIG_VFO_VFO|RIG_VFO_MEM) #define R8B_VFO_OPS (RIG_OP_UP|RIG_OP_DOWN|RIG_OP_TO_VFO|RIG_OP_FROM_VFO|RIG_OP_MCL|RIG_OP_CPY) #define R8B_ANTS (RIG_ANT_1|RIG_ANT_2|RIG_ANT_3) #define R8B_STR_CAL { 16, { \ { 0, -60 }, \ { 1, -48 }, \ { 11, -42 }, \ { 27, -36 }, \ { 39, -30 }, \ { 51, -24 }, \ { 64, -18 }, \ { 80, -12 }, \ { 97, -6 }, \ { 116, 0 }, \ { 138, 10 }, \ { 163, 20 }, \ { 195, 30 }, \ { 217, 40 }, \ { 228, 50 }, \ { 255, 60 }, \ } } /* * channel caps. */ #define DRAKE_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .ant = 1, \ .funcs = 1, \ .levels = RIG_LEVEL_AGC|RIG_LEVEL_ATT|RIG_LEVEL_PREAMP, \ .channel_desc = 1, \ } /* * R-8B rig capabilities. * * manual: http://www.rldrake.com/swl/R8B.pdf * */ const struct rig_caps r8b_caps = { .rig_model = RIG_MODEL_DKR8B, .model_name = "R-8B", .mfg_name = "Drake", .version = BACKEND_VER, .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER, .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_HARDWARE, .write_delay = 0, .post_write_delay = 1, .timeout = 200, .retry = 3, .has_get_func = R8B_FUNC, .has_set_func = R8B_FUNC, .has_get_level = R8B_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(R8B_LEVEL_ALL), .has_get_parm = R8B_PARM_ALL, .has_set_parm = RIG_PARM_SET(R8B_PARM_ALL), .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { 10, RIG_DBLST_END }, .attenuator = { 10, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_OFF, /* TODO: acutally has RIG_TRN_RIG */ .bank_qty = 0, .chan_desc_sz = 7, .vfo_ops = R8B_VFO_OPS, .chan_list = { { 0, 999, RIG_MTYPE_MEM, DRAKE_MEM_CAP }, RIG_CHAN_END }, .rx_range_list1 = { {kHz(10),MHz(30),R8B_MODES,-1,-1,R8B_VFO,R8B_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(10),MHz(30),R8B_MODES,-1,-1,R8B_VFO,R8B_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {R8B_MODES,10}, {R8B_MODES,100}, {R8B_MODES,kHz(1)}, {R8B_MODES,kHz(10)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_FM, kHz(12)}, {RIG_MODE_AM|RIG_MODE_ECSS, kHz(6)}, {RIG_MODE_AM|RIG_MODE_ECSS, kHz(4)}, {RIG_MODE_SSB|RIG_MODE_RTTY, kHz(2.3)}, {RIG_MODE_SSB|RIG_MODE_RTTY, kHz(1.8)}, {RIG_MODE_SSB|RIG_MODE_RTTY, kHz(4)}, {RIG_MODE_CW, Hz(500)}, {RIG_MODE_CW, kHz(1.8)}, RIG_FLT_END, }, .str_cal = R8B_STR_CAL, .priv = NULL, .rig_init = drake_init, .rig_cleanup = drake_cleanup, .set_freq = drake_set_freq, .get_freq = drake_get_freq, .set_vfo = drake_set_vfo, .get_vfo = drake_get_vfo, .set_mode = drake_set_mode, .get_mode = drake_get_mode, .set_func = drake_set_func, .get_func = drake_get_func, .set_level = drake_set_level, .get_level = drake_get_level, .set_ant = drake_set_ant, .get_ant = drake_get_ant, .set_mem = drake_set_mem, .get_mem = drake_get_mem, .set_channel = drake_set_chan, .get_channel = drake_get_chan, .vfo_op = drake_vfo_op, .set_powerstat = drake_set_powerstat, .get_powerstat = drake_get_powerstat, .get_info = drake_get_info, }; /* * Function definitions below */ hamlib-1.2.15.3/drake/drake.c0000644000175000017500000005551012044564477012461 00000000000000/* * Hamlib Drake backend - main file * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "cal.h" #include "register.h" #include "drake.h" /* * Protocol information available at http://www.rldrake.com/swl/R8B.pdf */ #define BUFSZ 64 #define CR "\x0d" #define LF "\x0a" #define EOM CR #define MD_USB '1' #define MD_LSB '2' #define MD_RTTY '3' #define MD_CW '4' #define MD_FM '5' #define MD_AM '6' /* * drake_transaction * We assume that rig!=NULL, rig->state!= NULL, data!=NULL, data_len!=NULL */ int drake_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval; struct rig_state *rs; rs = &rig->state; serial_flush(&rs->rigport); 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; retval = read_string(&rs->rigport, data, BUFSZ, LF, 1); if (retval == -RIG_ETIMEOUT) retval = 0; if (retval < 0) return retval; *data_len = retval; return RIG_OK; } int drake_init(RIG *rig) { struct drake_priv_data *priv; priv = malloc(sizeof(struct drake_priv_data)); if (!priv) return -RIG_ENOMEM; priv->curr_ch = 0; rig->state.priv = priv; return RIG_OK; } int drake_cleanup(RIG *rig) { struct drake_priv_data *priv = rig->state.priv; free(priv); return RIG_OK; } /* * drake_set_freq * Assumes rig!=NULL */ int drake_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned char freqbuf[16], ackbuf[16]; int freq_len, ack_len, retval; /* * 10Hz resolution * TODO: round nearest? */ freq_len = sprintf((char *) freqbuf,"F%07d" EOM, (unsigned int)freq/10); retval = drake_transaction(rig, (char *) freqbuf, freq_len, (char *) ackbuf, &ack_len); return retval; } /* * drake_get_freq * Assumes rig!=NULL, freq!=NULL */ int drake_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { int freq_len, retval; char freqbuf[BUFSZ]; double f; char fmult; retval = drake_transaction (rig, "RF" EOM, 3, freqbuf, &freq_len); if (retval != RIG_OK) return retval; /* RA command returns *fffff.ff*mHz */ if (freq_len != 15) { rig_debug(RIG_DEBUG_ERR,"drake_get_freq: wrong answer %s, " "len=%d\n", freqbuf, freq_len); return -RIG_ERJCTED; } fmult = freqbuf[10]; freqbuf[9] = '\0'; /* extract freq */ sscanf(freqbuf+1, "%lf", &f); f *= 1000.0; if (fmult=='M'||fmult=='m') f *= 1000.0; *freq = (freq_t)f; return RIG_OK; } /* * drake_set_vfo * Assumes rig!=NULL */ int drake_set_vfo(RIG *rig, vfo_t vfo) { unsigned char cmdbuf[16], ackbuf[16]; int cmd_len, ack_len, retval; char vfo_function; switch (vfo) { case RIG_VFO_A : vfo_function = 'A'; break; case RIG_VFO_B : vfo_function = 'B'; break; case RIG_VFO_VFO: vfo_function = 'F'; break; case RIG_VFO_MEM: vfo_function = 'C'; break; default: rig_debug(RIG_DEBUG_ERR,"drake_set_vfo: unsupported VFO %d\n", vfo); return -RIG_EINVAL; } cmd_len = 0; if ((vfo_function=='A')||(vfo_function=='B')) cmd_len = sprintf((char *) cmdbuf, "V%c" EOM, vfo_function); if ((vfo_function=='F')||(vfo_function=='C')) cmd_len = sprintf((char *) cmdbuf, "%c" EOM, vfo_function); retval = drake_transaction (rig, (char *) cmdbuf, cmd_len, (char *) ackbuf, &ack_len); return retval; } /* * drake_get_vfo * Assumes rig!=NULL */ int drake_get_vfo(RIG *rig, vfo_t *vfo) { int mdbuf_len, retval; char mdbuf[BUFSZ]; char cvfo; retval = drake_transaction (rig, "RA" EOM, 3, mdbuf, &mdbuf_len); if (retval != RIG_OK) return retval; if (mdbuf_len < 35) { rig_debug(RIG_DEBUG_ERR,"drake_get_vfo: wrong answer %s, " "len=%d\n", mdbuf, mdbuf_len); return -RIG_ERJCTED; } if (mdbuf[0]=='*') *vfo = RIG_VFO_MEM; else { cvfo = (mdbuf[9] & 0x38); switch (cvfo) { case '0' : *vfo = RIG_VFO_B; break; case '8' : *vfo = RIG_VFO_A; break; default : rig_debug(RIG_DEBUG_ERR, "drake_get_vfo: unsupported vfo %c\n", cvfo); *vfo = RIG_VFO_VFO; return -RIG_EINVAL; } } return RIG_OK; } /* * drake_set_mode * Assumes rig!=NULL */ int drake_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { unsigned char mdbuf[16], ackbuf[16]; unsigned char mode_sel, width_sel; int mdbuf_len, ack_len, retval; switch (mode) { case RIG_MODE_CW: mode_sel = MD_CW; break; case RIG_MODE_ECSSUSB: case RIG_MODE_USB: mode_sel = MD_USB; break; case RIG_MODE_ECSSLSB: case RIG_MODE_LSB: mode_sel = MD_LSB; break; case RIG_MODE_FM: mode_sel = MD_FM; break; case RIG_MODE_AMS: case RIG_MODE_AM: mode_sel = MD_AM; break; case RIG_MODE_RTTY: mode_sel = MD_RTTY; break; default: rig_debug(RIG_DEBUG_ERR,"drake_set_mode: " "unsupported mode %d\n", mode); return -RIG_EINVAL; } mdbuf_len = sprintf((char *) mdbuf, "M%c" EOM, mode_sel); retval = drake_transaction (rig, (char *) mdbuf, mdbuf_len, (char *) ackbuf, &ack_len); if (retval != RIG_OK) return retval; if (mode != RIG_MODE_FM) { if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); switch (width) { case 500: width_sel = '0'; break; case 1800: width_sel = '1'; break; case 2300: width_sel = '2'; break; case 4000: width_sel = '4'; break; case 6000: width_sel = '6'; break; default: rig_debug(RIG_DEBUG_ERR,"drake_set_mode: " "unsupported width %d\n", width); return -RIG_EINVAL; } mdbuf_len = sprintf((char *) mdbuf, "W%c" EOM, width_sel); retval = drake_transaction (rig, (char *) mdbuf, mdbuf_len, (char *) ackbuf, &ack_len); } if ((mode == RIG_MODE_AMS) || (mode == RIG_MODE_ECSSUSB) || (mode == RIG_MODE_ECSSLSB) || (mode == RIG_MODE_AM) || (mode == RIG_MODE_USB) || (mode == RIG_MODE_LSB)) { mdbuf_len = sprintf((char *) mdbuf, "S%c" EOM, ((mode == RIG_MODE_AMS) || (mode==RIG_MODE_ECSSUSB) || (mode==RIG_MODE_ECSSLSB))?'O':'F'); retval = drake_transaction (rig, (char *) mdbuf, mdbuf_len, (char *) ackbuf, &ack_len); } return retval; } /* * drake_get_mode * Assumes rig!=NULL */ int drake_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { int mdbuf_len, retval; char mdbuf[BUFSZ]; char cmode; char cwidth; char csynch; retval = drake_transaction (rig, "RM" EOM, 3, mdbuf, &mdbuf_len); if (retval != RIG_OK) return retval; if (mdbuf_len != 8) { rig_debug(RIG_DEBUG_ERR,"drake_get_mode: wrong answer %s, " "len=%d\n", mdbuf, mdbuf_len); return -RIG_ERJCTED; } cmode = mdbuf[3]; cwidth = mdbuf[4]; csynch = mdbuf[5]; switch(cwidth & 0x37){ case '0': *width = s_Hz(500); break; case '1': *width = s_Hz(1800); break; case '2': *width = s_Hz(2300); break; case '3': *width = s_Hz(4000); break; case '4': *width = s_Hz(6000); break; default : rig_debug(RIG_DEBUG_ERR, "drake_get_mode: unsupported width %c\n", cwidth); *width = RIG_PASSBAND_NORMAL; return -RIG_EINVAL; } if ((cwidth >= '0') && (cwidth <= '4')) { switch(cmode & 0x33){ case '0': *mode = RIG_MODE_LSB; break; case '1': *mode = RIG_MODE_RTTY; break; case '2': *mode = RIG_MODE_FM; *width = s_Hz(12000); break; default : rig_debug(RIG_DEBUG_ERR, "drake_get_mode: unsupported mode %c\n", cmode); *mode = RIG_MODE_NONE; return -RIG_EINVAL; } } else { switch(cmode & 0x33){ case '0': *mode = RIG_MODE_USB; break; case '1': *mode = RIG_MODE_CW; break; case '2': *mode = RIG_MODE_AM; break; default : rig_debug(RIG_DEBUG_ERR, "drake_get_mode: unsupported mode %c\n", cmode); *mode = RIG_MODE_NONE; return -RIG_EINVAL; } } if ((csynch & 0x34) == '4') { if (*mode == RIG_MODE_AM) *mode = RIG_MODE_AMS; else if (*mode == RIG_MODE_USB) *mode = RIG_MODE_ECSSUSB; else if (*mode == RIG_MODE_LSB) *mode = RIG_MODE_ECSSLSB; } return RIG_OK; } /* * drake_set_ant * Assumes rig!=NULL */ int drake_set_ant(RIG *rig, vfo_t vfo, ant_t ant) { unsigned char buf[16], ackbuf[16]; int len, ack_len, retval; len = sprintf((char *) buf,"A%c" EOM, ant==RIG_ANT_1?'1':(ant==RIG_ANT_2?'2':'C')); retval = drake_transaction(rig, (char *) buf, len, (char *) ackbuf, &ack_len); return retval; } /* * drake_get_ant * Assumes rig!=NULL */ int drake_get_ant(RIG *rig, vfo_t vfo, ant_t *ant) { int mdbuf_len, retval; char mdbuf[BUFSZ]; char cant; retval = drake_transaction (rig, "RM" EOM, 3, mdbuf, &mdbuf_len); if (retval != RIG_OK) return retval; if (mdbuf_len != 8) { rig_debug(RIG_DEBUG_ERR,"drake_get_ant: wrong answer %s, " "len=%d\n", mdbuf, mdbuf_len); return -RIG_ERJCTED; } cant = mdbuf[3]; switch(cant & 0x3c){ case '0': *ant = RIG_ANT_1; break; case '4': *ant = RIG_ANT_3; break; case '8': *ant = RIG_ANT_2; break; default : rig_debug(RIG_DEBUG_ERR, "drake_get_ant: unsupported antenna %c\n", cant); *ant = RIG_ANT_NONE; return -RIG_EINVAL; } return RIG_OK; } /* * drake_set_mem * Assumes rig!=NULL */ int drake_set_mem(RIG *rig, vfo_t vfo, int ch) { int len, ack_len, retval; char buf[16], ackbuf[16]; struct drake_priv_data *priv = rig->state.priv; priv->curr_ch = ch; len = sprintf(buf, "C%03d" EOM, ch); retval = drake_transaction (rig, buf, len, ackbuf, &ack_len); if (ack_len != 2) { rig_debug(RIG_DEBUG_ERR,"drake_set_mem: could not set channel %03d.\n", ch); retval = -RIG_ERJCTED; } return retval; } /* * drake_get_mem * Assumes rig!=NULL */ int drake_get_mem(RIG *rig, vfo_t vfo, int *ch) { struct drake_priv_data *priv = rig->state.priv; int mdbuf_len, retval; char mdbuf[BUFSZ]; int chan; retval = drake_transaction (rig, "RC" EOM, 3, mdbuf, &mdbuf_len); if (retval != RIG_OK) return retval; if (mdbuf_len != 6) { rig_debug(RIG_DEBUG_ERR,"drake_get_mem: wrong answer %s, " "len=%d\n", mdbuf, mdbuf_len); return -RIG_ERJCTED; } mdbuf[4] = '\0'; /* extract channel no */ sscanf(mdbuf+1, "%03d", &chan); *ch = chan; priv->curr_ch = chan; return RIG_OK; } /* * drake_set_chan * Assumes rig!=NULL */ int drake_set_chan(RIG *rig, const channel_t *chan) { struct drake_priv_data *priv = rig->state.priv; vfo_t old_vfo; int old_chan; char mdbuf[16], ackbuf[16]; int mdbuf_len, ack_len, retval; drake_get_vfo(rig, &old_vfo); old_chan = 0; /* set to vfo if needed */ if (old_vfo == RIG_VFO_MEM){ old_chan = priv->curr_ch; retval = drake_set_vfo(rig, RIG_VFO_VFO); if (retval != RIG_OK) return retval; } /* set all memory features */ drake_set_ant(rig, RIG_VFO_CURR, chan->ant); drake_set_freq(rig, RIG_VFO_CURR, chan->freq); drake_set_mode(rig, RIG_VFO_CURR, chan->mode, chan->width); drake_set_func(rig, RIG_VFO_CURR, RIG_FUNC_NB, (chan->funcs & RIG_FUNC_NB) == RIG_FUNC_NB); drake_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_AGC, chan->levels[rig_setting2idx(RIG_LEVEL_AGC)]); drake_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, chan->levels[rig_setting2idx(RIG_LEVEL_PREAMP)]); drake_set_level(rig, RIG_VFO_CURR, RIG_LEVEL_ATT, chan->levels[rig_setting2idx(RIG_LEVEL_ATT)]); drake_set_func(rig, RIG_VFO_CURR, RIG_FUNC_MN, (chan->funcs & RIG_FUNC_MN) == RIG_FUNC_MN); mdbuf_len = sprintf(mdbuf, "PR" EOM "%03d" EOM, chan->channel_num); retval = drake_transaction (rig, mdbuf, mdbuf_len, ackbuf, &ack_len); if (old_vfo == RIG_VFO_MEM) drake_set_mem(rig, RIG_VFO_CURR, old_chan); return retval; } /* * drake_get_chan * Assumes rig!=NULL */ int drake_get_chan(RIG *rig, channel_t *chan) { struct drake_priv_data *priv = rig->state.priv; vfo_t old_vfo; int old_chan; char mdbuf[BUFSZ],freqstr[BUFSZ]; int mdbuf_len, retval; chan->vfo = RIG_VFO_MEM; chan->ant = RIG_ANT_NONE; chan->freq = 0; chan->mode = RIG_MODE_NONE; chan->width = RIG_PASSBAND_NORMAL; chan->tx_freq = 0; chan->tx_mode = RIG_MODE_NONE; chan->tx_width = RIG_PASSBAND_NORMAL; chan->split = RIG_SPLIT_OFF; chan->tx_vfo = RIG_VFO_NONE; chan->rptr_shift = RIG_RPT_SHIFT_NONE; chan->rptr_offs = 0; chan->tuning_step = 0; chan->rit = 0; chan->xit = 0; chan->funcs = 0; chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i = RIG_AGC_OFF; chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i = 0; chan->levels[rig_setting2idx(RIG_LEVEL_PREAMP)].i = 0; chan->ctcss_tone = 0; chan->ctcss_sql = 0; chan->dcs_code = 0; chan->dcs_sql = 0; chan->scan_group = 0; chan->flags = RIG_CHFLAG_SKIP; strcpy(chan->channel_desc, " "); drake_get_vfo(rig, &old_vfo); old_chan = 0; if (old_vfo == RIG_VFO_MEM) old_chan = priv->curr_ch; //go to new channel retval = drake_set_mem(rig, RIG_VFO_CURR, chan->channel_num); if (retval != RIG_OK) return RIG_OK; //now decypher it retval = drake_transaction (rig, "RA" EOM, 3, mdbuf, &mdbuf_len); if (retval != RIG_OK) return retval; if (mdbuf_len < 35) { rig_debug(RIG_DEBUG_ERR,"drake_get_channel: wrong answer %s, " "len=%d\n", mdbuf, mdbuf_len); return -RIG_ERJCTED; } if ((mdbuf[5] >= '4') && (mdbuf[5] <= '?')) chan->funcs |= RIG_FUNC_NB; switch(mdbuf[5] & 0x33){ case '0': chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i = RIG_AGC_OFF; break; case '2': chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i = RIG_AGC_FAST; break; case '3': chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i = RIG_AGC_SLOW; break; default : chan->levels[rig_setting2idx(RIG_LEVEL_AGC)].i = RIG_AGC_FAST; } if ((mdbuf[6] & 0x3c) == '8') chan->levels[rig_setting2idx(RIG_LEVEL_PREAMP)].i = 10; if ((mdbuf[6] & 0x3c) == '4') chan->levels[rig_setting2idx(RIG_LEVEL_ATT)].i = 10; if ((mdbuf[6] & 0x32) =='2'); chan->funcs |= RIG_FUNC_MN; switch(mdbuf[7] & 0x3c){ case '0': chan->ant = RIG_ANT_1; break; case '4': chan->ant = RIG_ANT_3; break; case '8': chan->ant = RIG_ANT_2; break; default : chan->ant = RIG_ANT_NONE; } switch(mdbuf[8] & 0x37){ case '0': chan->width = s_Hz(500); break; case '1': chan->width = s_Hz(1800); break; case '2': chan->width = s_Hz(2300); break; case '3': chan->width = s_Hz(4000); break; case '4': chan->width = s_Hz(6000); break; default : chan->width = RIG_PASSBAND_NORMAL; } if ((mdbuf[8] >= '0') && (mdbuf[8] <= '4')) { switch(mdbuf[7] & 0x33){ case '0': chan->mode = RIG_MODE_LSB; break; case '1': chan->mode = RIG_MODE_RTTY; break; case '2': chan->mode = RIG_MODE_FM; chan->width = s_Hz(12000); break; default : chan->mode = RIG_MODE_NONE; } } else { switch(mdbuf[7] & 0x33){ case '0': chan->mode = RIG_MODE_USB; break; case '1': chan->mode = RIG_MODE_CW; break; case '2': chan->mode = RIG_MODE_AM; break; default : chan->mode = RIG_MODE_NONE; } } if ((mdbuf[9] & 0x34) == '4') { if (chan->mode == RIG_MODE_AM) chan->mode = RIG_MODE_AMS; else if (chan->mode == RIG_MODE_USB) chan->mode = RIG_MODE_ECSSUSB; else if (chan->mode == RIG_MODE_LSB) chan->mode = RIG_MODE_ECSSLSB; } strncpy(freqstr,mdbuf+11,9); freqstr[9] = 0x00; if ((mdbuf[21] == 'k') || (mdbuf[21] == 'K')) chan->freq = strtod(freqstr,NULL) * 1000.0; if ((mdbuf[21] == 'm') || (mdbuf[21] == 'M')) chan->freq = strtod(freqstr,NULL) * 1000000.0; strncpy(chan->channel_desc, mdbuf+25, 7); //now put the radio back the way it was if (old_vfo != RIG_VFO_MEM) { retval = drake_set_vfo(rig, RIG_VFO_VFO); if (retval != RIG_OK) return retval; } else { retval = drake_set_mem(rig, RIG_VFO_CURR, old_chan); if (retval != RIG_OK) return retval; } return RIG_OK; } /* * drake_vfo_op * Assumes rig!=NULL */ int drake_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { struct drake_priv_data *priv = rig->state.priv; char buf[16], ackbuf[16]; int len, ack_len, retval; switch(op) { case RIG_OP_UP: len = sprintf(buf,"U"); break; case RIG_OP_DOWN: len = sprintf(buf,"D"); break; case RIG_OP_CPY: len = sprintf(buf,"A E B" EOM); break; case RIG_OP_TO_VFO: /* len = sprintf(buf,"C%03d" EOM, priv->curr_ch); */ len = sprintf(buf,"F" EOM); break; case RIG_OP_MCL: len = sprintf(buf,"EC%03d" EOM, priv->curr_ch); break; case RIG_OP_FROM_VFO: len = sprintf(buf,"PR" EOM "%03d" EOM, priv->curr_ch); break; default: return -RIG_EINVAL; } retval = drake_transaction(rig, buf, len, buf[len-1]==0x0d ?ackbuf:NULL, &ack_len); return retval; } /* * drake_set_func * Assumes rig!=NULL */ int drake_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { char buf[16], ackbuf[16]; int len, ack_len, retval; switch(func) { case RIG_FUNC_MN: len = sprintf(buf,"N%c" EOM, status?'O':'F'); break; case RIG_FUNC_LOCK: len = sprintf(buf,"L%c" EOM, status?'O':'F'); break; case RIG_FUNC_NB: /* TODO: NB narrow */ len = sprintf(buf,"B%c" EOM, status?'W':'F'); break; default: return -RIG_EINVAL; } retval = drake_transaction(rig, buf, len, ackbuf, &ack_len); return retval; } /* * drake_get_func * Assumes rig!=NULL */ int drake_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { int mdbuf_len, retval; char mdbuf[BUFSZ]; char mc; retval = drake_transaction (rig, "RM" EOM, 3, mdbuf, &mdbuf_len); if (retval != RIG_OK) return retval; if (mdbuf_len != 8) { rig_debug(RIG_DEBUG_ERR,"drake_get_func: wrong answer %s, " "len=%d\n", mdbuf, mdbuf_len); return -RIG_ERJCTED; } switch(func) { case RIG_FUNC_MN: mc = mdbuf[2]; *status = ((mc & 0x32) =='2'); break; case RIG_FUNC_NB: /* TODO: NB narrow */ mc = mdbuf[1]; *status = ((mc >= '4') && (mc <= '?')); break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get func %d\n",func); return -RIG_EINVAL; } return RIG_OK; } /* * drake_set_level * Assumes rig!=NULL */ int drake_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { char buf[16], ackbuf[16]; int len, ack_len, retval; switch(level) { case RIG_LEVEL_PREAMP: len = sprintf(buf,"G%c" EOM, val.i?'+':'0'); break; case RIG_LEVEL_ATT: len = sprintf(buf,"G%c" EOM, val.i?'-':'0'); break; case RIG_LEVEL_AGC: len = sprintf(buf,"A%c" EOM, val.i==RIG_AGC_OFF?'O': (val.i==RIG_AGC_FAST?'F':'S')); break; default: return -RIG_EINVAL; } retval = drake_transaction(rig, buf, len, ackbuf, &ack_len); return retval; } /* * drake_get_level * Assumes rig!=NULL */ int drake_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int lvl_len, retval, ss; char lvlbuf[BUFSZ]; char mc; if ((level != RIG_LEVEL_RAWSTR)&&(level != RIG_LEVEL_STRENGTH)) { retval = drake_transaction (rig, "RM" EOM, 3, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 8) { rig_debug(RIG_DEBUG_ERR,"drake_get_level: wrong answer %s, " "len=%d\n", lvlbuf, lvl_len); return -RIG_ERJCTED; } } switch(level) { case RIG_LEVEL_RAWSTR: retval = drake_transaction (rig, "RSS" EOM, 4, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 5) { rig_debug(RIG_DEBUG_ERR,"drake_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } lvlbuf[3] = '\0'; val->i = strtol(lvlbuf+1, (char **)NULL, 16); break; case RIG_LEVEL_STRENGTH: retval = drake_transaction (rig, "RSS" EOM, 4, lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 5) { rig_debug(RIG_DEBUG_ERR,"drake_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } lvlbuf[3] = '\0'; ss = strtol(lvlbuf+1, (char **)NULL, 16); val->i = (int)rig_raw2val(ss,&rig->caps->str_cal); break; case RIG_LEVEL_PREAMP: mc = lvlbuf[2]; if ((mc & 0x3c) == '8') val->i = 10; else val->i = 0; break; case RIG_LEVEL_ATT: mc = lvlbuf[2]; if ((mc & 0x3c) =='4') val->i = 10; else val->i = 0; break; case RIG_LEVEL_AGC: mc = lvlbuf[1]; switch(mc & 0x33){ case '0': val->i = RIG_AGC_OFF; break; case '2': val->i = RIG_AGC_FAST; break; case '3': val->i = RIG_AGC_SLOW; break; default : val->i = RIG_AGC_FAST; } break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_level %d\n",level); return -RIG_EINVAL; } return RIG_OK; } int drake_set_powerstat (RIG * rig, powerstat_t status) { char buf[16], ackbuf[16]; int len, ack_len, retval; len = sprintf(buf,"P%c" EOM, status==RIG_POWER_OFF?'F':'O'); retval = drake_transaction(rig, buf, len, ackbuf, &ack_len); return retval; } int drake_get_powerstat (RIG * rig, powerstat_t *status) { int mdlen, retval; char mdbuf[BUFSZ]; retval = drake_transaction (rig, "RM" EOM, 3, mdbuf, &mdlen); if (retval != RIG_OK) return retval; *status = (mdlen == 8); return RIG_OK; } /* * drake_set_freq * Assumes rig!=NULL */ const char *drake_get_info(RIG *rig) { static char idbuf[BUFSZ]; int retval, id_len; retval = drake_transaction(rig, "ID" EOM, 3, idbuf, &id_len); if (retval != RIG_OK) return NULL; idbuf[id_len] = '\0'; return idbuf; } /* * initrigs_drake is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(drake) { rig_debug(RIG_DEBUG_VERBOSE, "drake: _init called\n"); rig_register(&r8a_caps); rig_register(&r8b_caps); return RIG_OK; } /* * probe_drake(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data) */ DECLARE_PROBERIG_BACKEND(drake) { static char idbuf[BUFSZ]; int retval, id_len; if (!port) return RIG_MODEL_NONE; if (port->type.rig != RIG_PORT_SERIAL) return RIG_MODEL_NONE; port->parm.serial.rate = r8b_caps.serial_rate_max; port->write_delay = port->post_write_delay = 0; port->timeout = 50; port->retry = 1; retval = serial_open(port); if (retval != RIG_OK) return RIG_MODEL_NONE; retval = write_block(port, "ID" EOM, 3); id_len = read_string(port, idbuf, BUFSZ, LF, 1); close(port->fd); if (retval != RIG_OK || id_len <= 0 || id_len >= BUFSZ) return RIG_MODEL_NONE; idbuf[id_len] = '\0'; if (!strcmp(idbuf, "R8B")) { if (cfunc) (*cfunc)(port, RIG_MODEL_DKR8B, data); return RIG_MODEL_DKR8B; } if (!strcmp(idbuf, "R8A")) { /* TBC */ if (cfunc) (*cfunc)(port, RIG_MODEL_DKR8A, data); return RIG_MODEL_DKR8A; } /* * not found... */ if (memcmp(idbuf, "ID" EOM, 3)) /* catch loopback serial */ rig_debug(RIG_DEBUG_VERBOSE,"probe_drake: found unknown device " "with ID '%s', please report to Hamlib " "developers.\n", idbuf); return RIG_MODEL_NONE; } hamlib-1.2.15.3/drake/r8a.c0000644000175000017500000001134612044564477012064 00000000000000/* * Hamlib Drake backend - R-8A description * Copyright (c) 2001-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "drake.h" #define R8A_MODES (RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_AM|RIG_MODE_AMS|RIG_MODE_FM) #define R8A_FUNC (RIG_FUNC_MN|RIG_FUNC_LOCK|RIG_FUNC_NB) #define R8A_LEVEL_ALL (RIG_LEVEL_PREAMP|RIG_LEVEL_ATT|RIG_LEVEL_AGC|RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH) #define R8A_PARM_ALL (RIG_PARM_TIME) #define R8A_VFO (RIG_VFO_A|RIG_VFO_B|RIG_VFO_VFO|RIG_VFO_MEM) #define R8A_VFO_OPS (RIG_OP_UP|RIG_OP_DOWN|RIG_OP_TO_VFO|RIG_OP_FROM_VFO|RIG_OP_MCL|RIG_OP_CPY) #define R8A_ANTS (RIG_ANT_1|RIG_ANT_2|RIG_ANT_3) #define R8A_STR_CAL { 16, { \ { 0, -60 }, \ { 1, -48 }, \ { 11, -42 }, \ { 27, -36 }, \ { 39, -30 }, \ { 51, -24 }, \ { 64, -18 }, \ { 80, -12 }, \ { 97, -6 }, \ { 116, 0 }, \ { 138, 10 }, \ { 163, 20 }, \ { 195, 30 }, \ { 217, 40 }, \ { 228, 50 }, \ { 255, 60 }, \ } } /* * channel caps. */ #define DRAKE_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .ant = 1, \ .funcs = R8A_FUNC, \ .levels = RIG_LEVEL_AGC|RIG_LEVEL_ATT|RIG_LEVEL_PREAMP, \ .channel_desc = 1, \ } /* * R-8A rig capabilities. * * specs: http://www.dxing.com/rx/r8.htm * */ const struct rig_caps r8a_caps = { .rig_model = RIG_MODEL_DKR8A, .model_name = "R-8A", .mfg_name = "Drake", .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_RECEIVER, .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_HARDWARE, .write_delay = 0, .post_write_delay = 1, .timeout = 200, .retry = 3, .has_get_func = R8A_FUNC, .has_set_func = R8A_FUNC, .has_get_level = R8A_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(R8A_LEVEL_ALL), .has_get_parm = R8A_PARM_ALL, .has_set_parm = RIG_PARM_SET(R8A_PARM_ALL), .level_gran = {}, /* FIXME: granularity */ .parm_gran = {}, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { 10, RIG_DBLST_END }, .attenuator = { 10, RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_OFF, /* TODO: acutally has RIG_TRN_RIG */ .bank_qty = 0, .chan_desc_sz = 7, .vfo_ops = R8A_VFO_OPS, .chan_list = { { 0, 439, RIG_MTYPE_MEM, DRAKE_MEM_CAP }, RIG_CHAN_END }, .rx_range_list1 = { {kHz(100),MHz(30),R8A_MODES,-1,-1,R8A_VFO,R8A_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(30),R8A_MODES,-1,-1,R8A_VFO,R8A_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { RIG_FRNG_END, }, .tuning_steps = { {R8A_MODES,10}, {R8A_MODES,100}, {R8A_MODES,kHz(1)}, {R8A_MODES,kHz(10)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_FM, kHz(12)}, {RIG_MODE_AM|RIG_MODE_AMS, kHz(6)}, {RIG_MODE_AM|RIG_MODE_AMS, kHz(4)}, {RIG_MODE_SSB|RIG_MODE_RTTY, kHz(2.3)}, {RIG_MODE_SSB|RIG_MODE_RTTY, kHz(1.8)}, {RIG_MODE_SSB|RIG_MODE_RTTY, kHz(4)}, {RIG_MODE_CW, Hz(500)}, {RIG_MODE_CW, kHz(1.8)}, RIG_FLT_END, }, .str_cal = R8A_STR_CAL, .priv = NULL, .rig_init = drake_init, .rig_cleanup = drake_cleanup, .set_freq = drake_set_freq, .get_freq = drake_get_freq, .set_vfo = drake_set_vfo, .get_vfo = drake_get_vfo, .set_mode = drake_set_mode, .get_mode = drake_get_mode, .set_func = drake_set_func, .get_func = drake_get_func, .set_level = drake_set_level, .get_level = drake_get_level, .set_ant = drake_set_ant, .get_ant = drake_get_ant, .set_mem = drake_set_mem, .get_mem = drake_get_mem, .set_channel = drake_set_chan, .get_channel = drake_get_chan, .vfo_op = drake_vfo_op, .set_powerstat = drake_set_powerstat, .get_powerstat = drake_get_powerstat, .get_info = drake_get_info, }; /* * Function definitions below */ hamlib-1.2.15.3/drake/Makefile.in0000644000175000017500000004767612044564551013303 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = drake DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_drake_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = r8a.lo r8b.lo am_hamlib_drake_la_OBJECTS = $(am__objects_1) drake.lo hamlib_drake_la_OBJECTS = $(am_hamlib_drake_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_drake_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_drake_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_drake_la_SOURCES) DIST_SOURCES = $(hamlib_drake_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DRAKESRC = r8a.c r8b.c pkglib_LTLIBRARIES = hamlib-drake.la hamlib_drake_la_SOURCES = $(DRAKESRC) drake.c hamlib_drake_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_drake_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = drake.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu drake/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu drake/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-drake.la: $(hamlib_drake_la_OBJECTS) $(hamlib_drake_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_drake_la_LINK) -rpath $(pkglibdir) $(hamlib_drake_la_OBJECTS) $(hamlib_drake_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drake.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r8a.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/r8b.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/drake/drake.h0000644000175000017500000000435112044564477012463 00000000000000/* * Hamlib Drake backend - main header * Copyright (c) 2001-2004 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _DRAKE_H #define _DRAKE_H 1 #include #define BACKEND_VER "0.5" struct drake_priv_data { int curr_ch; }; int drake_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int drake_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int drake_set_vfo(RIG *rig, vfo_t vfo); int drake_get_vfo(RIG *rig, vfo_t *vfo); int drake_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int drake_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int drake_init(RIG *rig); int drake_cleanup(RIG *rig); int drake_set_ant(RIG *rig, vfo_t vfo, ant_t ant); int drake_get_ant(RIG *rig, vfo_t vfo, ant_t *ant); int drake_set_mem(RIG *rig, vfo_t vfo, int ch); int drake_get_mem(RIG *rig, vfo_t vfo, int *ch); int drake_set_chan(RIG *rig, const channel_t *chan); int drake_get_chan(RIG *rig, channel_t *chan); int drake_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); int drake_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int drake_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); int drake_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int drake_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int drake_set_powerstat (RIG * rig, powerstat_t status); int drake_get_powerstat (RIG * rig, powerstat_t *status); const char *drake_get_info(RIG *rig); extern const struct rig_caps r8a_caps; extern const struct rig_caps r8b_caps; #endif /* _DRAKE_H */ hamlib-1.2.15.3/drake/Makefile.am0000644000175000017500000000037612044564477013263 00000000000000DRAKESRC = r8a.c r8b.c pkglib_LTLIBRARIES = hamlib-drake.la hamlib_drake_la_SOURCES = $(DRAKESRC) drake.c hamlib_drake_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_drake_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = drake.h hamlib-1.2.15.3/doc/0000755000175000017500000000000012044565010010740 500000000000000hamlib-1.2.15.3/doc/footer.html0000644000175000017500000000064712044564477013073 00000000000000


Generated by doxygen $doxygenversion

Hamlib documentation for version $projectnumber -- $datetime
Project page: http://www.hamlib.org

hamlib-1.2.15.3/doc/hamlib.cfg0000644000175000017500000000161512044564742012613 00000000000000## hamlib.cfg.in--converted into hamlib.cfg by configure PROJECT_NAME = "Hamlib" PROJECT_NUMBER = 1.2.15.3 # Output OUTPUT_DIRECTORY= . OUTPUT_LANGUAGE = English GENERATE_HTML = YES GENERATE_LATEX = NO GENERATE_RTF = NO GENERATE_MAN = NO # User can set to YES for local man pages MAN_EXTENSION = .3 # Input CASE_SENSE_NAMES = NO FULL_PATH_NAMES = NO INPUT = ../doc/index.doxygen \ ../src/ ../include/hamlib/ INCLUDE_PATH = ../include EXAMPLE_PATH = ../tests/testrig.c \ .. QUIET = YES HTML_STYLESHEET = ../doc/hamlib.css HTML_FOOTER = ../doc/footer.html EXTRACT_ALL = NO EXTRACT_STATIC = NO HIDE_UNDOC_MEMBERS = NO SHOW_INCLUDE_FILES = YES INHERIT_DOCS = YES ENABLED_SECTIONS = "" PREDEFINED = DOXYGEN "DOC_HIDDEN" JAVADOC_AUTOBRIEF = NO OPTIMIZE_OUTPUT_FOR_C = YES # doxygen 1.2.6 option MAN_LINKS = NO MACRO_EXPANSION = YES hamlib-1.2.15.3/doc/hamlib.cfg.in0000644000175000017500000000173612044564477013231 00000000000000## hamlib.cfg.in--converted into hamlib.cfg by configure PROJECT_NAME = "Hamlib" PROJECT_NUMBER = @VERSION@ # Output OUTPUT_DIRECTORY= . OUTPUT_LANGUAGE = English GENERATE_HTML = YES GENERATE_LATEX = NO GENERATE_RTF = NO GENERATE_MAN = NO # User can set to YES for local man pages MAN_EXTENSION = .3 # Input CASE_SENSE_NAMES = NO FULL_PATH_NAMES = NO INPUT = @top_srcdir@/doc/index.doxygen \ @top_srcdir@/src/ @top_srcdir@/include/hamlib/ INCLUDE_PATH = @top_srcdir@/include EXAMPLE_PATH = @top_srcdir@/tests/testrig.c \ @top_srcdir@ QUIET = YES HTML_STYLESHEET = @top_srcdir@/doc/hamlib.css HTML_FOOTER = @top_srcdir@/doc/footer.html EXTRACT_ALL = NO EXTRACT_STATIC = NO HIDE_UNDOC_MEMBERS = NO SHOW_INCLUDE_FILES = YES INHERIT_DOCS = YES ENABLED_SECTIONS = "" PREDEFINED = DOXYGEN "DOC_HIDDEN" JAVADOC_AUTOBRIEF = NO OPTIMIZE_OUTPUT_FOR_C = YES # doxygen 1.2.6 option MAN_LINKS = NO MACRO_EXPANSION = YES hamlib-1.2.15.3/doc/index.doxygen0000644000175000017500000000524512044564477013414 00000000000000/*! \mainpage Hamlib API Reference \section auth Authors Stéphane Fillod, F8CFE, and Frank Singleton, VK3FCS and the Hamlib Group \n Documentation revisions by Martin Ewing, AA6E, Nate Bargmann, N0NB \section s1 Preface This document describes the Hamlib library Application Programming Interface (API) for this distribution. We attempt to document the complete API of the core modules of Hamlib, i.e., the API seen by end-user application developers. You may navigate the documentation through the tabs at the top of this page. Please report any problems to hamlib-developer@lists.sourceforge.net. \section txtfil Distributed information files These text files are distributed with the Hamlib package. Readme files: \subpage Rdme "General"; \subpage Rdmebeta "Beta tester"; \subpage Rdmedevel "Developer"; \subpage Rdmewin32 "Win32" Other files: \subpage INSTALL; \subpage AUTHORS; \subpage COPYING; \subpage COPYING.LIB; \subpage LICENSE; \subpage NEWS; \subpage PLAN; \subpage THANKS; \subpage TODO \section lnks Internet links \li http://www.hamlib.org -- project Wiki, including list of supported rigs. \li http://sourceforge.net/projects/hamlib/ -- SourceForge.net project page. \li http://hamlib.git.sourceforge.net/git/gitweb-index.cgi -- Git repository via Web \li http://hamlib.svn.sourceforge.net/viewvc/hamlib/ -- SVN repository via Web \section slic Documentation License \li \subpage doclicense */ /*! \page doclicense License for Documentation This documentation is free; you can redistribute it without any restrictions. The modification or derived work must retain copyright and list all authors. This documentation 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. */ /*! \page Rdme README (general) \verbinclude README */ /*! \page Rdmebeta README.betatester \verbinclude README.betatester */ /*! \page Rdmedevel README.developer \verbinclude README.developer */ /*! \page Rdmewin32 README.win32 \verbinclude README.win32 */ /*! \page INSTALL INSTALL \verbinclude INSTALL */ /*! \page AUTHORS AUTHORS \verbinclude AUTHORS */ /*! \page COPYING COPYING \verbinclude COPYING */ /*! \page COPYING.LIB COPYING.LIB \verbinclude COPYING.LIB */ /*! \page LICENSE LICENSE \verbinclude LICENSE */ /*! \page NEWS NEWS \verbinclude NEWS */ /*! \page PLAN PLAN \verbinclude PLAN */ /*! \page THANKS THANKS \verbinclude THANKS */ /*! \page TODO TO DO \verbinclude TODO */ /*! Define groups for Doxygen * \defgroup rig Rig (transceiver) API * \defgroup rotator Rotator API * \defgroup utilities Utility Routines API * \defgroup rig_internal Rig Internal API */ hamlib-1.2.15.3/doc/Makefile.in0000644000175000017500000003072612044564551012746 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = doc DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/hamlib.cfg.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = hamlib.cfg CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = hamlib.cfg index.doxygen hamlib.css footer.html SRCDOCLST = ../src/rig.c ../src/rotator.c ../src/tones.c ../src/locator.c \ ../src/event.c ../src/conf.c ../src/mem.c ../src/settings.c all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): hamlib.cfg: $(top_builddir)/config.status $(srcdir)/hamlib.cfg.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am doc: hamlib.cfg $(SRCDOCLST) doxygen hamlib.cfg #man_MANS= man/man3/rig.c.3 # 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: hamlib-1.2.15.3/doc/hamlib.css0000644000175000017500000002250412044564477012651 00000000000000/* The standard CSS for doxygen */ body, table, div, p, dl { font-family: sans-serif; font-size: 100%; } /* @group Heading Levels */ h1 { font-size: 2.5em; } h2 { font-size: 1.875em; } h3 { font-size: 1.20em; } dt { font-weight: bold; } div.multicol { -moz-column-gap: 1em; -webkit-column-gap: 1em; -moz-column-count: 3; -webkit-column-count: 3; } p.startli, p.startdd, p.starttd { margin-top: 2px; } p.endli { margin-bottom: 0px; } p.enddd { margin-bottom: 4px; } p.endtd { margin-bottom: 2px; } /* @end */ caption { font-weight: bold; } span.legend { font-size: 70%; text-align: center; } h3.version { font-size: 90%; text-align: center; } div.qindex, div.navtab{ background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; margin: 2px; padding: 2px; } div.qindex, div.navpath { width: 100%; line-height: 140%; } div.navtab { margin-right: 15px; } /* @group Link Styling */ a { color: #3D578C; font-weight: normal; text-decoration: none; } .contents a:visited { color: #4665A2; } a:hover { text-decoration: none; background-color: #f0f0fd; } a.qindex { font-weight: bold; } a.qindexHL { font-weight: bold; background-color: #9CAFD4; color: #ffffff; border: 1px double #869DCA; } .contents a.qindexHL:visited { color: #ffffff; } a.el { font-weight: bold; } a.elRef { } a.code { color: #4665A2; } a.codeRef { color: #4665A2; } /* @end */ dl.el { margin-left: -1cm; } .fragment { font-family: monospace, fixed; font-size: 105%; } pre.fragment { border: 1px solid #C4CFE5; background-color: #FBFCFD; padding: 4px 6px; margin: 4px 8px 4px 2px; overflow: auto; word-wrap: break-word; font-size: 90%; line-height: 125%; } div.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px; padding: 0.2em; border: solid thin #333; border-radius: 0.5em; -webkit-border-radius: .5em; -moz-border-radius: .5em; -webkit-box-shadow: 2px 2px 3px #999; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); } div.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold; } div.groupText { margin-left: 16px; font-style: italic; } body { background: white; color: black; margin: 0; } div.contents { margin-top: 10px; margin-left: 10px; margin-right: 10px; } td.indexkey { background-color: #EBEFF6; font-weight: bold; border: 1px solid #C4CFE5; margin: 2px 0px 2px 0; padding: 2px 10px; } td.indexvalue { background-color: #EBEFF6; border: 1px solid #C4CFE5; padding: 2px 10px; margin: 2px 0px; } tr.memlist { background-color: #EEF1F7; } p.formulaDsp { text-align: center; } img.formulaDsp { } img.formulaInl { vertical-align: middle; } div.center { text-align: center; margin-top: 0px; margin-bottom: 0px; padding: 0px; } div.center img { border: 0px; } address.footer { text-align: right; padding-right: 12px; } img.footer { border: 0px; vertical-align: middle; } /* @group Code Colorization */ span.keyword { color: #008000 } span.keywordtype { color: #604020 } span.keywordflow { color: #e08000 } span.comment { color: #800000 } span.preprocessor { color: #806020 } span.stringliteral { color: #002080 } span.charliteral { color: #008080 } span.vhdldigit { color: #ff00ff } span.vhdlchar { color: #000000 } span.vhdlkeyword { color: #700070 } span.vhdllogic { color: #ff0000 } /* @end */ /* .search { color: #003399; font-weight: bold; } form.search { margin-bottom: 0px; margin-top: 0px; } input.search { font-size: 75%; color: #000080; font-weight: normal; background-color: #e8eef2; } */ td.tiny { font-size: 75%; } .dirtab { padding: 4px; border-collapse: collapse; border: 1px solid #A3B4D7; } th.dirtab { background: #EBEFF6; font-weight: bold; } hr { height: 0px; border: none; border-top: 1px solid #4A6AAA; } hr.footer { height: 1px; } /* @group Member Descriptions */ table.memberdecls { border-spacing: 0px; padding: 0px; } .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { background-color: #F9FAFC; border: none; margin: 4px; padding: 1px 0 0 8px; } .mdescLeft, .mdescRight { padding: 0px 8px 4px 8px; color: #555; } .memItemLeft, .memItemRight, .memTemplParams { border-top: 1px solid #C4CFE5; } .memItemLeft, .memTemplItemLeft { white-space: nowrap; } .memTemplParams { color: #4665A2; white-space: nowrap; } /* @end */ /* @group Member Details */ /* Styles for detailed member documentation */ .memtemplate { font-size: 80%; color: #4665A2; font-weight: normal; margin-left: 3px; } .memnav { background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; margin: 2px; margin-right: 15px; padding: 2px; } .memitem { padding: 0; margin-bottom: 10px; } .memname { white-space: nowrap; font-weight: bold; margin-left: 6px; } .memproto { border-top: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 0px 6px 0px; color: #253555; font-weight: bold; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); /* firefox specific markup */ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; -moz-border-radius-topright: 8px; -moz-border-radius-topleft: 8px; /* webkit specific markup */ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -webkit-border-top-right-radius: 8px; -webkit-border-top-left-radius: 8px; background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; } .memdoc { border-bottom: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 2px 5px; background-color: #FBFCFD; border-top-width: 0; /* firefox specific markup */ -moz-border-radius-bottomleft: 8px; -moz-border-radius-bottomright: 8px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7); /* webkit specific markup */ -webkit-border-bottom-left-radius: 8px; -webkit-border-bottom-right-radius: 8px; -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7)); } .paramkey { text-align: right; } .paramtype { white-space: nowrap; } .paramname { color: #602020; white-space: nowrap; } .paramname em { font-style: normal; } /* @end */ /* @group Directory (tree) */ /* for the tree view */ .ftvtree { font-family: sans-serif; margin: 0px; } /* these are for tree view when used as main index */ .directory { font-size: 9pt; font-weight: bold; margin: 5px; } .directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } /* The following two styles can be used to replace the root node title with an image of your choice. Simply uncomment the next two styles, specify the name of your image and be sure to set 'height' to the proper pixel height of your image. */ /* .directory h3.swap { height: 61px; background-repeat: no-repeat; background-image: url("yourimage.gif"); } .directory h3.swap span { display: none; } */ .directory > h3 { margin-top: 0; } .directory p { margin: 0px; white-space: nowrap; } .directory div { display: none; margin: 0px; } .directory img { vertical-align: -30%; } /* these are for tree view when not used as main index */ .directory-alt { font-size: 100%; font-weight: bold; } .directory-alt h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } .directory-alt > h3 { margin-top: 0; } .directory-alt p { margin: 0px; white-space: nowrap; } .directory-alt div { display: none; margin: 0px; } .directory-alt img { vertical-align: -30%; } /* @end */ div.dynheader { margin-top: 8px; } address { font-style: normal; color: #2A3D61; } table.doxtable { border-collapse:collapse; } table.doxtable td, table.doxtable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } table.doxtable th { background-color: #374F7F; color: #FFFFFF; font-size: 110%; padding-bottom: 4px; padding-top: 5px; text-align:left; } .tabsearch { top: 0px; left: 10px; height: 36px; background-image: url('tab_b.png'); z-index: 101; overflow: hidden; font-size: 13px; } .navpath ul { font-size: 11px; background-image:url('tab_b.png'); background-repeat:repeat-x; height:30px; line-height:30px; color:#8AA0CC; border:solid 1px #C2CDE4; overflow:hidden; margin:0px; padding:0px; } .navpath li { list-style-type:none; float:left; padding-left:10px; padding-right: 15px; background-image:url('bc_s.png'); background-repeat:no-repeat; background-position:right; color:#364D7C; } .navpath a { height:32px; display:block; text-decoration: none; outline: none; } .navpath a:hover { color:#6884BD; } div.summary { float: right; font-size: 8pt; padding-right: 5px; width: 50%; text-align: right; } div.summary a { white-space: nowrap; } div.header { background-image:url('nav_h.png'); background-repeat:repeat-x; background-color: #F9FAFC; margin: 0px; border-bottom: 1px solid #C4CFE5; } div.headertitle { padding: 5px 5px 5px 10px; } div.doxy { float: right; font-size: 75%; } hamlib-1.2.15.3/doc/Makefile.am0000644000175000017500000000045712044564477012742 00000000000000 INCLUDES = @INCLUDES@ EXTRA_DIST = hamlib.cfg index.doxygen hamlib.css footer.html SRCDOCLST = ../src/rig.c ../src/rotator.c ../src/tones.c ../src/locator.c \ ../src/event.c ../src/conf.c ../src/mem.c ../src/settings.c doc: hamlib.cfg $(SRCDOCLST) doxygen hamlib.cfg #man_MANS= man/man3/rig.c.3 hamlib-1.2.15.3/heathkit/0000755000175000017500000000000012044565036012004 500000000000000hamlib-1.2.15.3/heathkit/hd1780.c0000644000175000017500000001557112044564477013024 00000000000000/* * Hamlib backend library for the HD 1780 Intellirotor command set. * * hd1780.c - (C) Nate Bargmann 2003 (n0nb at arrl.net) * (C) Rob Frohne 2008 (kl7na at arrl.net) * * This shared library provides an API for communicating * via serial interface to a Heathkit HD 1780 Intellirotor. * * Heathkit is a trademark of Heath Company * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* Standard library definitions */ #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rotator.h" #include "serial.h" #include "misc.h" #include "register.h" #include "hd1780.h" /* * Private data structure */ struct hd1780_rot_priv_data { azimuth_t az; }; /* * Private helper function prototypes */ static int hd1780_send_priv_cmd(ROT *rot, const char *cmd); /* * HD 1780 Intellirotor rotor capabilities */ const struct rot_caps hd1780_rot_caps = { .rot_model = ROT_MODEL_HD1780, .model_name = "HD 1780 Intellirotor", .mfg_name = "Heathkit", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_OTHER, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 300, .serial_rate_max = 9600, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 10, .post_write_delay = 500, .timeout = 60000, .retry = 0, .min_az = -180, .max_az = 180, .min_el = 0, .max_el = 0, .priv = NULL, /* priv */ .rot_init = hd1780_rot_init, .rot_cleanup = hd1780_rot_cleanup, .set_position = hd1780_rot_set_position, .get_position = hd1780_rot_get_position, }; /* ************************************ * * API functions * * ************************************ */ /* * Initialize data structures */ static int hd1780_rot_init(ROT *rot) { struct hd1780_rot_priv_data *priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rot) return -RIG_EINVAL; priv = (struct hd1780_rot_priv_data*) malloc(sizeof(struct hd1780_rot_priv_data)); if (!priv) return -RIG_ENOMEM; rot->state.priv = (void*)priv; rot->state.rotport.type.rig = RIG_PORT_SERIAL; priv->az = 0; return RIG_OK; } /* * Clean up allocated memory structures */ static int hd1780_rot_cleanup(ROT *rot) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rot) return -RIG_EINVAL; if (rot->state.priv) free(rot->state.priv); rot->state.priv = NULL; return RIG_OK; } /* * Set position * HD 1780 protocol supports azimuth only--elevation is ignored * Range is converted to an integer string, 0 to 360 degrees */ static int hd1780_rot_set_position(ROT *rot, azimuth_t azimuth, elevation_t elevation) { struct rot_state *rs; char cmdstr[8]; char execstr[5] = "\r", ok[3]; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rot) return -RIG_EINVAL; if (azimuth < hd1780_rot_caps.min_az || azimuth > hd1780_rot_caps.max_az) return -RIG_EINVAL; if(azimuth < 0) azimuth = azimuth + 360; sprintf(cmdstr, "%03.0f", azimuth); /* Target bearing */ err = hd1780_send_priv_cmd(rot, cmdstr); if (err != RIG_OK) return err; err = hd1780_send_priv_cmd(rot, execstr); /* Execute command */ if (err != RIG_OK) return err; /* We need to look for the + to signify that everything finished. The HD 1780 * sends a when it is finished rotating. */ rs = &rot->state; err = read_block(&rs->rotport, ok, 2); if (err != 2) return -RIG_ETRUNC; if ((ok[0] != '\r')||(ok[1] != '\n')) return -RIG_ETRUNC; return RIG_OK; } /* * Get position * Returns current azimuth position in whole degrees. * Range returned from Rotor-EZ is an integer, 0 to 359 degrees * Elevation is set to 0 */ static int hd1780_rot_get_position(ROT *rot, azimuth_t *azimuth, elevation_t *elevation) { struct rot_state *rs; char cmdstr[3] = "b\r"; char az[7]; /* read azimuth string */ char *p; azimuth_t tmp = 0; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rot) return -RIG_EINVAL; err = hd1780_send_priv_cmd(rot, cmdstr); if (err != RIG_OK) return err; rs = &rot->state; err = read_block(&rs->rotport, az, AZ_READ_LEN); if (err != AZ_READ_LEN) return -RIG_ETRUNC; /* * HD 1780 returns a four octet string consisting of * three octets containing the rotor's position in degrees followed by a * space and a and a . The * space is ignored when passing the string to atof(). */ az[4] = 0x00; /* NULL terminated string */ p = az; /* for hd1780 */ tmp = (azimuth_t)atof(p); rig_debug(RIG_DEBUG_TRACE, "%s: \"%s\" after conversion = %.1f\n", __func__, p, tmp); if (tmp < 0 || tmp > 359) return -RIG_EINVAL; *azimuth = tmp; *elevation = 0; /* assume aiming at the horizon */ rig_debug(RIG_DEBUG_TRACE, "%s: azimuth = %.1f deg; elevation = %.1f deg\n", __func__, *azimuth, *elevation); return RIG_OK; } /* * Send command string to rotor. * * To make sure that the rotor is ready to take a command, we send it a and * it will normally reply with a ? . If you don't do this, using the * w: command of rotctl it is possible to get it out of sequence. This kind of * resets its command buffer before sending the command. */ static int hd1780_send_priv_cmd(ROT *rot, const char *cmdstr) { struct rot_state *rs; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rot) return -RIG_EINVAL; rs = &rot->state; err = write_block(&rs->rotport, cmdstr, strlen(cmdstr)); if (err != RIG_OK) return err; return RIG_OK; } /* * Initialize backend */ DECLARE_INITROT_BACKEND(heathkit) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rot_register(&hd1780_rot_caps); return RIG_OK; } hamlib-1.2.15.3/heathkit/Makefile.in0000644000175000017500000004744712044564552014013 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = heathkit DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_heathkit_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am_hamlib_heathkit_la_OBJECTS = hd1780.lo hamlib_heathkit_la_OBJECTS = $(am_hamlib_heathkit_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_heathkit_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_heathkit_la_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_heathkit_la_SOURCES) DIST_SOURCES = $(hamlib_heathkit_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = hamlib-heathkit.la hamlib_heathkit_la_SOURCES = hd1780.c hamlib_heathkit_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_heathkit_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = hd1780.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu heathkit/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu heathkit/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-heathkit.la: $(hamlib_heathkit_la_OBJECTS) $(hamlib_heathkit_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_heathkit_la_LINK) -rpath $(pkglibdir) $(hamlib_heathkit_la_OBJECTS) $(hamlib_heathkit_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hd1780.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/heathkit/hd1780.h0000644000175000017500000000277712044564477013035 00000000000000/* * Hamlib backend library for the Heathkit HD 1780 Intellirotor command set. * * hd1780.h - (C) Nate Bargmann 2003 (n0nb at arrl.net) * (C) Rob Frohne 2008 (kl7na at arrl.net) * * This shared library provides an API for communicating * via serial interface to a Heathkit Intellirotor HD 1780 * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROT_HD1780_H #define _ROT_HD1780_H 1 #define AZ_READ_LEN 6 extern const struct rot_caps hd1780_rot_caps; /* * API local implementation * */ static int hd1780_rot_init(ROT *rot); static int hd1780_rot_cleanup(ROT *rot); static int hd1780_rot_set_position(ROT *rot, azimuth_t azimuth, elevation_t elevation); static int hd1780_rot_get_position(ROT *rot, azimuth_t *azimuth, elevation_t *elevation); #endif /* _ROT_HD1780_H */ hamlib-1.2.15.3/heathkit/Makefile.am0000644000175000017500000000035112044564477013767 00000000000000 pkglib_LTLIBRARIES = hamlib-heathkit.la hamlib_heathkit_la_SOURCES = hd1780.c hamlib_heathkit_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_heathkit_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = hd1780.h hamlib-1.2.15.3/fodtrack/0000755000175000017500000000000012044565025011776 500000000000000hamlib-1.2.15.3/fodtrack/fodtrack.h0000644000175000017500000000176512044564477013707 00000000000000/* * Hamlib Rotator backend - Fodtrack interface protocol * Copyright (c) 2001-2003 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROT_FODTRACK_H #define _ROT_FODTRACK_H 1 extern const struct rot_caps fodtrack_rot_caps; #endif /* _ROT_FODTRACK_H */ hamlib-1.2.15.3/fodtrack/Makefile.in0000644000175000017500000004756712044564552014012 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = fodtrack DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_fodtrack_la_DEPENDENCIES = $(top_builddir)/lib/libmisc.la \ $(top_builddir)/src/libhamlib.la am_hamlib_fodtrack_la_OBJECTS = fodtrack.lo hamlib_fodtrack_la_OBJECTS = $(am_hamlib_fodtrack_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_fodtrack_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_fodtrack_la_LDFLAGS) \ $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_fodtrack_la_SOURCES) DIST_SOURCES = $(hamlib_fodtrack_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = hamlib-fodtrack.la hamlib_fodtrack_la_SOURCES = fodtrack.c hamlib_fodtrack_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_fodtrack_la_LIBADD = $(top_builddir)/lib/libmisc.la \ $(top_builddir)/src/libhamlib.la noinst_HEADERS = fodtrack.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu fodtrack/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu fodtrack/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-fodtrack.la: $(hamlib_fodtrack_la_OBJECTS) $(hamlib_fodtrack_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_fodtrack_la_LINK) -rpath $(pkglibdir) $(hamlib_fodtrack_la_OBJECTS) $(hamlib_fodtrack_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fodtrack.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/fodtrack/Makefile.am0000644000175000017500000000042212044564477013762 00000000000000 pkglib_LTLIBRARIES = hamlib-fodtrack.la hamlib_fodtrack_la_SOURCES = fodtrack.c hamlib_fodtrack_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_fodtrack_la_LIBADD = $(top_builddir)/lib/libmisc.la \ $(top_builddir)/src/libhamlib.la noinst_HEADERS = fodtrack.h hamlib-1.2.15.3/fodtrack/fodtrack.c0000644000175000017500000000743112044564477013676 00000000000000/* * Hamlib Rotator backend - Fodtrack parallel port * Copyright (c) 2001-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #ifdef HAVE_SYS_IOCTL_H #include #endif #ifdef HAVE_LINUX_PARPORT_H #include #endif #include "hamlib/rotator.h" #include "parallel.h" #include "misc.h" #include "register.h" #include "fodtrack.h" #ifndef CP_ACTIVE_LOW_BITS #define CP_ACTIVE_LOW_BITS 0x0B #endif /* ************************************************************************* */ /** outputs an direction to the interface */ static int setDirection(hamlib_port_t *port, unsigned char outputvalue, int direction) { unsigned char outputstatus; par_lock (port); // set the data bits par_write_data(port, outputvalue); // autofd=true --> azimuth otherwhise elevation if(direction) outputstatus = PARPORT_CONTROL_AUTOFD; else outputstatus=0; par_write_control(port, outputstatus^CP_ACTIVE_LOW_BITS); // and now the strobe impulse usleep(1); if(direction) outputstatus = PARPORT_CONTROL_AUTOFD | PARPORT_CONTROL_STROBE; else outputstatus = PARPORT_CONTROL_STROBE; par_write_control(port, outputstatus^CP_ACTIVE_LOW_BITS); usleep(1); if (direction) outputstatus= PARPORT_CONTROL_AUTOFD; else outputstatus=0; par_write_control(port, outputstatus^CP_ACTIVE_LOW_BITS); par_unlock (port); return RIG_OK; } static int fodtrack_set_position(ROT *rot, azimuth_t az, elevation_t el) { int retval; hamlib_port_t *pport; rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __FUNCTION__, az, el); pport = &rot->state.rotport; retval = setDirection(pport, el/(float)rot->state.max_el*255.0, 0); if (retval != RIG_OK) return retval; retval = setDirection(pport, az/(float)rot->state.max_az*255.0, 1); if (retval != RIG_OK) return retval; return RIG_OK; } /* ************************************************************************* */ /* * Fodtrack rotator capabilities. */ /** Fodtrack implement essentially only the set position function. */ const struct rot_caps fodtrack_rot_caps = { .rot_model = ROT_MODEL_FODTRACK, .model_name = "Fodtrack", .mfg_name = "XQ2FOD", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rot_type = ROT_TYPE_OTHER, .port_type = RIG_PORT_PARALLEL, .write_delay = 0, .post_write_delay = 0, .timeout = 200, .retry = 3, .min_az = 0, .max_az = 450, .min_el = 0, .max_el = 180, .priv = NULL, /* priv */ .set_position = fodtrack_set_position, }; /* ************************************************************************* */ DECLARE_INITROT_BACKEND(fodtrack) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); rot_register(&fodtrack_rot_caps); return RIG_OK; } /* ************************************************************************* */ /* end of file */ hamlib-1.2.15.3/config.sub0000755000175000017500000010344512044564547012123 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. timestamp='2010-01-22' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | ubicom32 \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile-* | tilegx-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; # This must be matched before tile*. tilegx*) basic_machine=tilegx-unknown os=-linux-gnu ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: hamlib-1.2.15.3/compile0000755000175000017500000000727112044564547011516 00000000000000#! /bin/sh # Wrapper for compilers which do not understand `-c -o'. scriptversion=2009-10-06.20; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software # Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand `-c -o'. Remove `-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file `INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; esac ofile= cfile= eat= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as `compile cc -o foo foo.c'. # So we strip `-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no `-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # `.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use `[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: hamlib-1.2.15.3/alinco/0000755000175000017500000000000012044565017011447 500000000000000hamlib-1.2.15.3/alinco/alinco.c0000644000175000017500000005356712044564477013031 00000000000000/* * Hamlib Alinco backend - main file * Copyright (c) 2001-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include #include #include #include #include "alinco.h" /* Line Feed */ #define EOM "\x0d" #define LF "\x0a" #define BUFSZ 32 /* * modes in use by the "2G" command */ #define MD_LSB '0' #define MD_USB '1' #define MD_CWL '2' #define MD_CWU '3' #define MD_AM '4' #define MD_FM '5' #define AL "AL" #define CMD_TXFREQ "0A" /* Transmit frequency */ #define CMD_RXFREQ "0B" /* Receive frequency */ #define CMD_VFO "1A" #define CMD_MEMMD "1B" /* Memory mode */ #define CMD_CHAN "1D" /* Channel Display */ #define CMD_UPDWN "2A" /* UP/DOWN */ #define CMD_MON "2B" /* Check Transmit Frequency */ #define CMD_PWR "2C" /* Transmit Output Power */ #define CMD_SCAN "2D" /* Scanning */ #define CMD_PRIO "2E" /* Priority */ #define CMD_SPLT "2F" /* Split */ #define CMD_MODE "2G" /* Mode */ #define CMD_RFGAIN "2H" /* RF Gain */ #define CMD_AGC "2I" #define CMD_FLTER "2J" /* Filter */ #define CMD_NB "2K" #define CMD_CTCSS "2L" #define CMD_TUNE "2M" #define CMD_SELECT "2N" #define CMD_MCALL "2V" /* Memory Channel Call Up */ #define CMD_SDATA "2W" /* Set Data */ /* Data Output Commands */ #define CMD_SMETER "3A" /* S-meter read */ #define CMD_PTT "3B" /* PTT status read */ #define CMD_SQL "3C" /* Squelch status */ #define CMD_RIT "3D" /* RIT status */ #define CMD_RMEM "3E" /* Current Memory-channel Number read */ #define CMD_RMV "3G" /* Memory/VFO -mode read */ #define CMD_RDATA "3H" /* Current Data read */ #define CMD_RSPLT "3I" /* Split read */ #define CMD_RPOWER "3J" /* Transmitter Output read */ #define CMD_RSELECT "3K" /* SELECT Postion read */ /* * alinco_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! * TODO: error case handling */ int alinco_transaction(RIG *rig, const char *cmd, int cmd_len, char *data, int *data_len) { int retval; struct rig_state *rs; char echobuf[BUFSZ+1]; rs = &rig->state; serial_flush(&rs->rigport); retval = write_block(&rs->rigport, cmd, cmd_len); if (retval != RIG_OK) return retval; /* * Transceiver sends an echo of cmd followed by a CR/LF * TODO: check whether cmd and echobuf match (optional) */ retval = read_string(&rs->rigport, echobuf, BUFSZ, LF, strlen(LF)); if (retval < 0) return retval; /* no data expected, check for OK returned */ if (!data || !data_len) { retval = read_string(&rs->rigport, echobuf, BUFSZ, LF, strlen(LF)); if (retval < 0) return retval; retval -= 2; echobuf[retval] = 0; if (strcmp(echobuf, "OK") == 0) return RIG_OK; else return -RIG_ERJCTED; } retval = read_string(&rs->rigport, data, BUFSZ, LF, strlen(LF)); if (retval < 0) return retval; *data_len = retval; /* strip CR/LF from string */ *data_len -= 2; data[*data_len] = 0; return RIG_OK; } /* * alinco_set_vfo * Assumes rig!=NULL */ int alinco_set_vfo(RIG *rig, vfo_t vfo) { char cmdbuf[BUFSZ]; int cmd_len; char vfo_num; switch (vfo) { case RIG_VFO_A: vfo_num = '1'; break; case RIG_VFO_B: vfo_num = '2'; break; case RIG_VFO_MEM: return alinco_transaction (rig, AL CMD_MEMMD "0" EOM, strlen(AL CMD_MEMMD "0" EOM), NULL, NULL); default: rig_debug(RIG_DEBUG_ERR,"alinco_set_vfo: unsupported VFO %d\n", vfo); return -RIG_EINVAL; } cmd_len = sprintf(cmdbuf, AL CMD_VFO "%c" EOM, vfo_num); return alinco_transaction (rig, cmdbuf, cmd_len, NULL, NULL); } /* * alinco_get_vfo * Assumes rig!=NULL, !vfo */ int alinco_get_vfo(RIG *rig, vfo_t *vfo) { char vfobuf[BUFSZ]; int vfo_len, retval; retval = alinco_transaction(rig, AL CMD_RMV EOM, strlen(AL CMD_RMV EOM), vfobuf, &vfo_len); if (retval != RIG_OK) return retval; if (vfo_len != 4) { rig_debug(RIG_DEBUG_ERR,"alinco_get_vfo: wrong answer %s, " "len=%d\n", vfobuf, vfo_len); return -RIG_ERJCTED; } vfobuf[vfo_len] = '\0'; if (!strcmp(vfobuf, "VFOA")) *vfo = RIG_VFO_A; else if (!strcmp(vfobuf, "VFOB")) *vfo = RIG_VFO_B; else if (!strcmp(vfobuf, "MEMO")) *vfo = RIG_VFO_MEM; else { rig_debug(RIG_DEBUG_ERR,"alinco_get_vfo: unsupported VFO %s\n", vfobuf); return -RIG_EPROTO; } return RIG_OK; } /* * alinco_set_freq * Assumes rig!=NULL */ int alinco_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { char freqbuf[BUFSZ]; int freq_len; /* max 10 digits */ if (freq >= GHz(10)) return -RIG_EINVAL; /* at least 6 digits */ freq_len = sprintf(freqbuf, AL CMD_RXFREQ "%06"PRIll EOM, (int64_t)freq); return alinco_transaction (rig, freqbuf, freq_len, NULL, NULL); } /* * where databuf points to a 26 char long buffer */ static int current_data_read(RIG *rig, char *databuf) { int data_len, retval; retval = alinco_transaction (rig, AL CMD_RDATA EOM, strlen(AL CMD_RDATA EOM), databuf, &data_len); if (retval != RIG_OK) return retval; if (data_len != 26) { rig_debug(RIG_DEBUG_ERR,"alinco_current_data_read: " "wrong answer %s, len=%d\n", databuf, data_len); return -RIG_ERJCTED; } return RIG_OK; } /* * alinco_get_freq * Assumes rig!=NULL, freq!=NULL */ int alinco_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { int retval; char freqbuf[BUFSZ]; retval = current_data_read(rig, freqbuf); if (retval != RIG_OK) return retval; /* extract RX freq */ freqbuf[16] = '\0'; sscanf(freqbuf+6, "%"SCNfreq, freq); return RIG_OK; } /* * alinco_set_mode * Assumes rig!=NULL */ int alinco_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { char mdbuf[BUFSZ]; int mdbuf_len, wide_filter, retval; char amode; switch (mode) { /* FIXME: MD_CWL or MD_CWU? */ case RIG_MODE_CW: amode = MD_CWU; break; case RIG_MODE_USB: amode = MD_USB; break; case RIG_MODE_LSB: amode = MD_LSB; break; case RIG_MODE_FM: amode = MD_FM; break; case RIG_MODE_AM: amode = MD_AM; break; default: rig_debug(RIG_DEBUG_ERR, "alinco_set_mode: unsupported mode %d\n", mode); return -RIG_EINVAL; } mdbuf_len = sprintf(mdbuf, AL CMD_MODE "%c" EOM, amode); retval = alinco_transaction (rig, mdbuf, mdbuf_len, NULL, NULL); if (retval != RIG_OK) return retval; /* * TODO: please DX77 owners, check this, I'm not sure * which passband is default! */ if (width != RIG_PASSBAND_NORMAL && width < rig_passband_normal(rig, mode)) wide_filter = 0; else wide_filter = 1; mdbuf_len = sprintf(mdbuf, AL CMD_FLTER "%02d" EOM, wide_filter); retval = alinco_transaction (rig, mdbuf, mdbuf_len, NULL, NULL); return retval; } /* * alinco_get_mode * Assumes rig!=NULL, mode!=NULL */ int alinco_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { int retval; int settings; char modebuf[BUFSZ]; retval = current_data_read(rig, modebuf); if (retval != RIG_OK) return retval; /* FIXME: CWL&CWU: what are they? CW & CWR? */ switch (modebuf[3]) { case MD_CWL: case MD_CWU: *mode = RIG_MODE_CW; break; case MD_USB: *mode = RIG_MODE_USB; break; case MD_LSB: *mode = RIG_MODE_LSB; break; case MD_AM: *mode = RIG_MODE_AM; break; case MD_FM: *mode = RIG_MODE_FM; break; default: rig_debug(RIG_DEBUG_ERR, "alinco_get_mode: unknown mode %c%c\n", modebuf[2],modebuf[3]); return -RIG_EINVAL; } modebuf[2] = '\0'; settings = strtol(modebuf, (char **)NULL, 16); /* * TODO: please DX77 owners, check this, I'm not sure * which passband is default! */ if (settings & 0x02) *width = rig_passband_narrow(rig, *mode); else *width = rig_passband_normal(rig, *mode); return RIG_OK; } /* * alinco_set_split * Assumes rig!=NULL */ int alinco_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { int cmd_len; char cmdbuf[BUFSZ]; cmd_len = sprintf(cmdbuf, AL CMD_SPLT "%d" EOM, split==RIG_SPLIT_ON ? 1 : 0); return alinco_transaction (rig, cmdbuf, cmd_len, NULL, NULL); } /* * alinco_get_split * Assumes rig!=NULL, split!=NULL */ int alinco_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { int splt_len, retval; char spltbuf[BUFSZ]; retval = alinco_transaction (rig, AL CMD_RSPLT EOM, strlen(AL CMD_RSPLT EOM), spltbuf, &splt_len); if (retval != RIG_OK) return retval; if (splt_len != 2) { rig_debug(RIG_DEBUG_ERR,"alinco_get_split: wrong answer %s, " "len=%d\n", spltbuf, splt_len); return -RIG_ERJCTED; } spltbuf[splt_len] = '\0'; if (!strcmp(spltbuf, "OF")) *split = RIG_SPLIT_OFF; else if (!strcmp(spltbuf, "ON")) *split = RIG_SPLIT_ON; else { rig_debug(RIG_DEBUG_ERR,"alinco_get_split: unsupported SPLIT %s\n", spltbuf); return -RIG_EPROTO; } return RIG_OK; } /* * alinco_set_split_freq * Assumes rig!=NULL */ int alinco_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) { char freqbuf[BUFSZ]; int freq_len; int retval; /* max 10 digits */ if (tx_freq >= GHz(10)) return -RIG_EINVAL; /* at least 6 digits */ freq_len = sprintf(freqbuf, AL CMD_TXFREQ "%06"PRIll EOM, (int64_t)tx_freq); retval = alinco_transaction (rig, freqbuf, freq_len, NULL, NULL); return retval; } /* * alinco_get_split_freq * Assumes rig!=NULL, rx_freq!=NULL, tx_freq!=NULL */ int alinco_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) { int retval; char freqbuf[BUFSZ]; retval = current_data_read(rig, freqbuf); if (retval != RIG_OK) return retval; /* extract TX freq first, as RX kills freqbuf[16] */ freqbuf[26] = '\0'; sscanf(freqbuf+16, "%"SCNfreq, tx_freq); return RIG_OK; } /* * alinco_get_rit * Assumes rig!=NULL, split!=NULL */ int alinco_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { int rit_len, retval; char ritbuf[BUFSZ]; /* read in Hertz unit */ retval = alinco_transaction (rig, AL CMD_RIT "0" EOM, strlen(AL CMD_RIT "0" EOM), ritbuf, &rit_len); if (retval != RIG_OK) return retval; if (rit_len != 8) { /* || (ritbuf[0] != '+' && ritbuf[0] != '-')) { */ rig_debug(RIG_DEBUG_ERR,"alinco_get_rit: wrong answer %s, " "len=%d\n", ritbuf, rit_len); return -RIG_ERJCTED; } ritbuf[rit_len] = '\0'; ritbuf[0] = ' '; ritbuf[1] = ' '; ritbuf[2] = ' '; *rit = atoi(ritbuf); return RIG_OK; } /* * alinco_set_func * Assumes rig!=NULL */ int alinco_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { int cmd_len; char cmdbuf[BUFSZ]; /* Optimize: * sort the switch cases with the most frequent first */ switch (func) { case RIG_FUNC_TONE: cmd_len = sprintf(cmdbuf, AL CMD_CTCSS "%02d" EOM, status?51:0); return alinco_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_FUNC_FAGC: cmd_len = sprintf(cmdbuf, AL CMD_AGC "%02d" EOM, status?1:2); return alinco_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_FUNC_NB: cmd_len = sprintf(cmdbuf, AL CMD_NB "%d" EOM, status?1:0); return alinco_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_FUNC_COMP: cmd_len = sprintf(cmdbuf, AL CMD_SDATA "C%d" EOM, status?1:0); return alinco_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_FUNC_MON: cmd_len = sprintf(cmdbuf, AL CMD_MON "%d" EOM, status?1:0); return alinco_transaction (rig, cmdbuf, cmd_len, NULL, NULL); default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_func %d\n", func); return -RIG_EINVAL; } return RIG_OK; } /* * alinco_get_func * Assumes rig!=NULL, status!=NULL */ int alinco_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { int retval; int settings; char funcbuf[BUFSZ]; /* Optimize: * sort the switch cases with the most frequent first */ switch (func) { case RIG_FUNC_TONE: retval = current_data_read(rig, funcbuf); if (retval != RIG_OK) return retval; funcbuf[2] = '\0'; settings = strtol(funcbuf, (char **)NULL, 16); *status = settings & 0x08 ? 1 : 0; break; case RIG_FUNC_FAGC: retval = current_data_read(rig, funcbuf); if (retval != RIG_OK) return retval; funcbuf[2] = '\0'; settings = strtol(funcbuf, (char **)NULL, 16); *status = settings & 0x01 ? 1 : 0; break; case RIG_FUNC_NB: retval = current_data_read(rig, funcbuf); if (retval != RIG_OK) return retval; funcbuf[2] = '\0'; settings = strtol(funcbuf, (char **)NULL, 16); *status = settings & 0x04 ? 1 : 0; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_func %d\n", func); return -RIG_EINVAL; } return RIG_OK; } /* * alinco_set_level * Assumes rig!=NULL * FIXME: cannot support PREAMP and ATT both at same time (make sense though) */ int alinco_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { int cmd_len, lvl; char cmdbuf[BUFSZ]; /* Optimize: * sort the switch cases with the most frequent first */ switch (level) { case RIG_LEVEL_PREAMP: switch (val.i) { case 0: lvl = 0; break; case 10: lvl = 1; break; default: rig_debug(RIG_DEBUG_ERR, "Unsupported Preamp %d\n", val.i); return -RIG_EINVAL; } cmd_len = sprintf(cmdbuf, AL CMD_RFGAIN "%02d" EOM, lvl); return alinco_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_LEVEL_ATT: switch (val.i) { case 0: lvl = 0; break; case 10: lvl = 11; break; case 20: lvl = 10; break; default: rig_debug(RIG_DEBUG_ERR, "Unsupported Att %d\n", val.i); return -RIG_EINVAL; } cmd_len = sprintf(cmdbuf, AL CMD_RFGAIN "%02d" EOM, lvl); return alinco_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_LEVEL_RFPOWER: cmd_len = sprintf(cmdbuf, AL CMD_PWR "%1d" EOM, val.f<0.5 ? 1 : 0); return alinco_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_LEVEL_KEYSPD: if (val.i < 6) { lvl = 31; } else if(val.i >= 6 && val.i < 20) { lvl = val.i + 25; } else if(val.i >= 20 && val.i <= 50) { lvl = val.i - 20; } else { lvl = 30; } cmd_len = sprintf(cmdbuf, AL CMD_SDATA "P%02d" EOM, lvl); return alinco_transaction (rig, cmdbuf, cmd_len, NULL, NULL); case RIG_LEVEL_CWPITCH: if(val.i < 426) { lvl = 5; } else if(val.i >= 426 && val.i <= 475) { lvl = 6; } else if(val.i >= 476 && val.i <= 525) { lvl = 7; } else if(val.i >= 526 && val.i <= 575) { lvl = 8; } else if(val.i >= 576 && val.i <= 625) { lvl = 9; } else if(val.i >= 626 && val.i <= 675) { lvl = 10; } else if(val.i >= 676 && val.i <= 725) { lvl = 11; } else if(val.i >= 726 && val.i <= 775) { lvl = 12; } else if(val.i >= 776 && val.i <= 825) { lvl = 0; } else if(val.i >= 826 && val.i <= 875) { lvl = 1; } else if(val.i >= 876 && val.i <= 925) { lvl = 2; } else if(val.i >= 926 && val.i <= 975) { lvl = 3; } else if(val.i >= 976 && val.i <= 1025) { lvl = 4; } else { lvl = 4; } cmd_len = sprintf(cmdbuf, AL CMD_SDATA "M%02d" EOM, lvl); return alinco_transaction (rig, cmdbuf, cmd_len, NULL, NULL); default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_level %d\n", level); return -RIG_EINVAL; } return RIG_OK; } /* * alinco_get_level * Assumes rig!=NULL, val!=NULL */ int alinco_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int retval, lvl_len; char lvlbuf[BUFSZ]; /* Optimize: * sort the switch cases with the most frequent first */ switch (level) { case RIG_LEVEL_RAWSTR: /* read A/D converted value */ retval = alinco_transaction (rig, AL CMD_SMETER "1" EOM, strlen(AL CMD_SMETER "1" EOM), lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 6) { rig_debug(RIG_DEBUG_ERR,"alinco_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } lvlbuf[6] = '\0'; val->i = atoi(lvlbuf+3); break; case RIG_LEVEL_PREAMP: retval = current_data_read(rig, lvlbuf); if (retval != RIG_OK) return retval; switch (lvlbuf[5]) { case '2': case '3': case '0': val->i = 0; break; case '1': val->i = 10; break; default: rig_debug(RIG_DEBUG_ERR, "Unknown RF Gain %c%c\n", lvlbuf[4], lvlbuf[5]); } break; case RIG_LEVEL_ATT: retval = current_data_read(rig, lvlbuf); if (retval != RIG_OK) return retval; switch (lvlbuf[5]) { case '1': case '0': val->i = 0; break; case '2': val->i = 20; break; case '3': val->i = 10; break; default: rig_debug(RIG_DEBUG_ERR, "Unknown RF Gain %c%c\n", lvlbuf[4], lvlbuf[5]); } break; case RIG_LEVEL_RFPOWER: retval = alinco_transaction (rig, AL CMD_RPOWER EOM, strlen(AL CMD_RPOWER EOM), lvlbuf, &lvl_len); if (retval != RIG_OK) return retval; if (lvl_len != 1) { rig_debug(RIG_DEBUG_ERR,"alinco_get_level: wrong answer" "len=%d\n", lvl_len); return -RIG_ERJCTED; } /* H or L */ val->f = lvlbuf[0] == 'H' ? 1.0 : 0.0; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_level %d\n", level); return -RIG_EINVAL; } return RIG_OK; } /* * alinco_set_parm */ int alinco_set_parm(RIG *rig, setting_t parm, value_t val) { int cmd_len; char cmdbuf[BUFSZ]; /* Optimize: * sort the switch cases with the most frequent first */ switch (parm) { case RIG_PARM_BEEP: rig_debug(RIG_DEBUG_ERR,"val is %d\n", val.i); cmd_len = sprintf(cmdbuf, AL CMD_SDATA "A%d" EOM, val.i?1:0); return alinco_transaction(rig, cmdbuf, cmd_len, NULL, NULL); case RIG_PARM_BACKLIGHT: rig_debug(RIG_DEBUG_ERR,"val is %0f\n", val.f); cmd_len = sprintf(cmdbuf, AL CMD_SDATA "O%d" EOM, (int)(val.f * 5)); return alinco_transaction(rig, cmdbuf, cmd_len, NULL, NULL); default: rig_debug(RIG_DEBUG_ERR,"Unsupported set_parm %d\n", parm); return -RIG_EINVAL; } return RIG_OK; } /* * alinco_set_ctcss_tone * Assumes rig!=NULL, rig->caps->ctcss_list != NULL */ int alinco_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone) { const struct rig_caps *caps; unsigned char tonebuf[BUFSZ]; int tone_len; int i; caps = rig->caps; /* TODO: replace 200 by something like RIGTONEMAX */ for (i = 0; caps->ctcss_list[i] != 0 && i<200; i++) { if (caps->ctcss_list[i] == tone) break; } if (caps->ctcss_list[i] != tone) return -RIG_EINVAL; tone_len = sprintf((char *) tonebuf, AL CMD_CTCSS "%02d" EOM, i+1); return alinco_transaction (rig, (char *) tonebuf, tone_len, NULL, NULL); } /* * alinco_get_ptt * Assumes rig!=NULL, ptt!=NULL */ int alinco_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { char pttbuf[BUFSZ]; int ptt_len, retval; retval = alinco_transaction (rig, AL CMD_PTT EOM, strlen(AL CMD_PTT EOM), pttbuf, &ptt_len); if (retval != RIG_OK) return retval; if (ptt_len != 3 || ptt_len != 4) { rig_debug(RIG_DEBUG_ERR,"alinco_get_ptt: wrong answer %s, " "len=%d\n", pttbuf, ptt_len); return -RIG_ERJCTED; } pttbuf[ptt_len] = '\0'; if (!strcmp(pttbuf, "SEND")) *ptt = RIG_PTT_OFF; else if (!strcmp(pttbuf, "REV")) *ptt = RIG_PTT_ON; else { rig_debug(RIG_DEBUG_ERR,"alinco_get_ptt: unknown PTT %s\n", pttbuf); return -RIG_EPROTO; } return RIG_OK; } /* * alinco_get_dcd * Assumes rig!=NULL, dcd!=NULL */ int alinco_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { char dcdbuf[BUFSZ]; int dcd_len, retval; retval = alinco_transaction (rig, AL CMD_SQL EOM, strlen(AL CMD_SQL EOM), dcdbuf, &dcd_len); if (retval != RIG_OK) return retval; if (dcd_len != 4 || dcd_len != 5) { rig_debug(RIG_DEBUG_ERR,"alinco_get_dcd: wrong answer %s, " "len=%d\n", dcdbuf, dcd_len); return -RIG_ERJCTED; } dcdbuf[dcd_len] = '\0'; if (!strcmp(dcdbuf, "OPEN")) *dcd = RIG_DCD_ON; else if (!strcmp(dcdbuf, "CLOSE")) *dcd = RIG_DCD_OFF; else { rig_debug(RIG_DEBUG_ERR,"alinco_get_dcd: unknown SQL %s\n", dcdbuf); return -RIG_EPROTO; } return RIG_OK; } /* * alinco_set_mem * Assumes rig!=NULL * FIXME: check we're in memory mode first */ int alinco_set_mem(RIG *rig, vfo_t vfo, int ch) { char cmdbuf[BUFSZ]; int cmd_len; if (ch < 0 || ch > 99) return -RIG_EINVAL; cmd_len = sprintf(cmdbuf, AL CMD_MCALL "%02d" EOM, ch); return alinco_transaction (rig, cmdbuf, cmd_len, NULL, NULL); } /* * alinco_get_mem * Assumes rig!=NULL, !vfo */ int alinco_get_mem(RIG *rig, vfo_t vfo, int *ch) { char membuf[BUFSZ]; int mem_len, retval; retval = alinco_transaction (rig, AL CMD_RMEM EOM, strlen(AL CMD_RMEM EOM), membuf, &mem_len); if (retval != RIG_OK) return retval; if (mem_len != 2) { rig_debug(RIG_DEBUG_ERR,"alinco_get_mem: wrong answer %s, " "len=%d\n", membuf, mem_len); return -RIG_ERJCTED; } membuf[mem_len] = '\0'; *ch = atoi(membuf); if (*ch < 0 || *ch > 99) { rig_debug(RIG_DEBUG_ERR,"alinco_get_mem: unknown mem %s\n", membuf); return -RIG_EPROTO; } return RIG_OK; } /* * initrigs_alinco is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(alinco) { rig_debug(RIG_DEBUG_VERBOSE, "alinco: _init called\n"); rig_register(&dx77_caps); return RIG_OK; } hamlib-1.2.15.3/alinco/Makefile.in0000644000175000017500000004762312044564550013451 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = alinco DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_alinco_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am__objects_1 = dx77.lo am_hamlib_alinco_la_OBJECTS = $(am__objects_1) alinco.lo hamlib_alinco_la_OBJECTS = $(am_hamlib_alinco_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_alinco_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_alinco_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_alinco_la_SOURCES) DIST_SOURCES = $(hamlib_alinco_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ALINCOSRCLIST = dx77.c pkglib_LTLIBRARIES = hamlib-alinco.la hamlib_alinco_la_SOURCES = $(ALINCOSRCLIST) alinco.c hamlib_alinco_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_alinco_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = alinco.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu alinco/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu alinco/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-alinco.la: $(hamlib_alinco_la_OBJECTS) $(hamlib_alinco_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_alinco_la_LINK) -rpath $(pkglibdir) $(hamlib_alinco_la_OBJECTS) $(hamlib_alinco_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alinco.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dx77.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/alinco/alinco.h0000644000175000017500000000450712044564477013024 00000000000000/* * Hamlib Alinco backend - main header * Copyright (c) 2001-2003 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ALINCO_H #define _ALINCO_H 1 #include #include int alinco_set_vfo(RIG *rig, vfo_t vfo); int alinco_get_vfo(RIG *rig, vfo_t *vfo); int alinco_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int alinco_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int alinco_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int alinco_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int alinco_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); int alinco_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); int alinco_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq); int alinco_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq); int alinco_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int alinco_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); int alinco_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); int alinco_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int alinco_set_parm(RIG *rig, setting_t parm, value_t val); int alinco_get_parm(RIG *rig, setting_t parm, value_t *val); int alinco_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone); int alinco_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit); int alinco_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); int alinco_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); int alinco_set_mem(RIG *rig, vfo_t vfo, int ch); int alinco_get_mem(RIG *rig, vfo_t vfo, int *ch); extern const struct rig_caps dx77_caps; #endif /* _ALINCO_H */ hamlib-1.2.15.3/alinco/Makefile.am0000644000175000017500000000041112044564477013430 00000000000000ALINCOSRCLIST = dx77.c pkglib_LTLIBRARIES = hamlib-alinco.la hamlib_alinco_la_SOURCES = $(ALINCOSRCLIST) alinco.c hamlib_alinco_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_alinco_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = alinco.h hamlib-1.2.15.3/alinco/dx77.c0000644000175000017500000001336312044564477012343 00000000000000/* * Hamlib Alinco backend - DX77 description * Copyright (c) 2001-2005 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "idx_builtin.h" #include "alinco.h" #define DX77_ALL_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define DX77_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define DX77_AM_TX_MODES RIG_MODE_AM #define DX77_FUNC (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_TONE) #define DX77_LEVEL_ALL (RIG_LEVEL_RAWSTR|RIG_LEVEL_RFPOWER|RIG_LEVEL_KEYSPD|RIG_LEVEL_BKINDL|RIG_LEVEL_CWPITCH) #define DX77_PARM_ALL (RIG_PARM_BEEP|RIG_PARM_BACKLIGHT) #define DX77_VFO (RIG_VFO_A|RIG_VFO_B) /* 90 is S9 */ #define DX77_STR_CAL { 13, { \ { 0, -60 }, \ { 28, -48 }, \ { 36, -42 }, \ { 42, -36 }, \ { 50, -30 }, \ { 58, -24 }, \ { 66, -18 }, \ { 74, -12 }, \ { 82, -6 }, \ { 90, 0 }, \ { 132, 20 }, \ { 174, 40 }, \ { 216, 60 }, \ } } /* * dx77 rig capabilities. * * protocol is documented at * http://www.alinco.com/pdf.files/DX77-77_SOFTWARE_MANUAL.pdf * * This backend was a pleasure to develop. Documentation is clear, * and the protocol logical. I'm wondering is the rig's good too. --SF * * TODO: * - get_parm/set_parm and some LEVELs left (Set Data "2W" command). * - tuner * - up/down * - scan */ const struct rig_caps dx77_caps = { .rig_model = RIG_MODEL_DX77, .model_name = "DX-77", .mfg_name = "Alinco", .version = "0.7", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 9600, .serial_rate_max = 9600, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 0, .timeout = 200, .retry = 3, .has_get_func = DX77_FUNC, .has_set_func = DX77_FUNC|RIG_FUNC_MON|RIG_FUNC_COMP, .has_get_level = DX77_LEVEL_ALL, .has_set_level = RIG_LEVEL_SET(DX77_LEVEL_ALL), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_SET(DX77_PARM_ALL), .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, }, .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, RIG_DBLST_END }, .attenuator = { 10, 20, RIG_DBLST_END }, .max_rit = kHz(1), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 99, RIG_MTYPE_MEM }, RIG_CHAN_END, }, .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { {kHz(500),MHz(30),DX77_ALL_MODES,-1,-1,DX77_VFO}, RIG_FRNG_END, }, .tx_range_list2 = { {kHz(1800),MHz(2)-100,DX77_OTHER_TX_MODES,W(10),W(100),DX77_VFO}, {kHz(1800),MHz(2)-100,DX77_AM_TX_MODES,W(4),W(40),DX77_VFO}, {kHz(3500),MHz(4)-100,DX77_OTHER_TX_MODES,W(10),W(100),DX77_VFO}, {kHz(3500),MHz(4)-100,DX77_AM_TX_MODES,W(4),W(40),DX77_VFO}, {MHz(7),kHz(7300),DX77_OTHER_TX_MODES,W(10),W(100),DX77_VFO}, {MHz(7),kHz(7300),DX77_AM_TX_MODES,W(4),W(40),DX77_VFO}, {kHz(10100),kHz(10150),DX77_OTHER_TX_MODES,W(10),W(100),DX77_VFO}, {kHz(10100),kHz(10150),DX77_AM_TX_MODES,W(4),W(40),DX77_VFO}, {MHz(14),kHz(14350),DX77_OTHER_TX_MODES,W(10),W(100),DX77_VFO}, {MHz(14),kHz(14350),DX77_AM_TX_MODES,W(4),W(40),DX77_VFO}, {kHz(18068),kHz(18168),DX77_OTHER_TX_MODES,W(10),W(100),DX77_VFO}, {kHz(18068),kHz(18168),DX77_AM_TX_MODES,W(4),W(40),DX77_VFO}, {MHz(21),kHz(21450),DX77_OTHER_TX_MODES,W(10),W(100),DX77_VFO}, {MHz(21),kHz(21450),DX77_AM_TX_MODES,W(4),W(40),DX77_VFO}, {kHz(24890),kHz(24990),DX77_OTHER_TX_MODES,W(10),W(100),DX77_VFO}, {kHz(24890),kHz(24990),DX77_AM_TX_MODES,W(4),W(40),DX77_VFO}, {MHz(28),kHz(29700),DX77_OTHER_TX_MODES,W(10),W(100),DX77_VFO}, {MHz(28),kHz(29700),DX77_AM_TX_MODES,W(4),W(40),DX77_VFO}, RIG_FRNG_END, }, .tuning_steps = { {DX77_ALL_MODES,10}, /* FIXME: add other ts */ RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.7)}, {RIG_MODE_CW, kHz(0.5)}, {RIG_MODE_AM|RIG_MODE_FM, kHz(8)}, {RIG_MODE_AM, kHz(2.7)}, RIG_FLT_END, }, .str_cal = DX77_STR_CAL, .set_freq = alinco_set_freq, .get_freq = alinco_get_freq, .set_mode = alinco_set_mode, .get_mode = alinco_get_mode, .set_vfo = alinco_set_vfo, .get_vfo = alinco_get_vfo, .set_split_vfo = alinco_set_split_vfo, .get_split_vfo = alinco_get_split_vfo, .set_split_freq = alinco_set_split_freq, .get_split_freq = alinco_get_split_freq, .set_ctcss_tone = alinco_set_ctcss_tone, .get_rit = alinco_get_rit, .get_ptt = alinco_get_ptt, .get_dcd = alinco_get_dcd, .set_func = alinco_set_func, .get_func = alinco_get_func, .set_parm = alinco_set_parm, .set_level = alinco_set_level, .get_level = alinco_get_level, .set_mem = alinco_set_mem, .get_mem = alinco_get_mem, }; /* * Function definitions below */ hamlib-1.2.15.3/amsat/0000755000175000017500000000000012044565040011303 500000000000000hamlib-1.2.15.3/amsat/if100.c0000644000175000017500000000643612044564477012234 00000000000000/* * Hamlib Rotator backend - IF-100 parallel port * Copyright (c) 2011 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #ifdef HAVE_SYS_IOCTL_H #include #endif #include "hamlib/rotator.h" #include "parallel.h" #include "misc.h" #include "register.h" #include "math.h" static int if100_set_position(ROT *rot, azimuth_t az, elevation_t el) { hamlib_port_t *port = &rot->state.rotport; int retval; int az_i; int el_i; int dataout, i; float az_scale, el_scale; rig_debug(RIG_DEBUG_TRACE, "%s called: %f %f\n", __func__, az, el); az_scale = 255./(rot->state.max_az - rot->state.min_az); el_scale = 255./180; az_i = (int)round((az - rot->state.min_az) * az_scale); el_i = (int)round(el * el_scale); rig_debug(RIG_DEBUG_TRACE, "%s output az: %d el: %d\n", __func__, az_i, el_i); dataout = ((el_i & 0xff) << 8) + (az_i & 0xff); #define DAT0 0x01 #define CLK 0x02 #define TRACK 0x08 rig_debug(RIG_DEBUG_TRACE, "%s: shifting dataout 0x%04x to parallel port\n", __func__, dataout); retval = par_lock (port); if (retval != RIG_OK) return retval; for (i = 0; i < 16; i++) { if (dataout & 0x8000) { par_write_data(port, TRACK|DAT0); par_write_data(port, TRACK|DAT0|CLK); par_write_data(port, TRACK|DAT0); } else { par_write_data(port, TRACK); par_write_data(port, TRACK|CLK); par_write_data(port, TRACK); } dataout = (dataout << 1) & 0xffff; } par_write_data(port, TRACK); par_unlock (port); return RIG_OK; } /** IF-100 implements essentially only the set position function. */ const struct rot_caps if100_rot_caps = { .rot_model = ROT_MODEL_IF100, .model_name = "IF-100", .mfg_name = "AMSAT", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rot_type = ROT_TYPE_OTHER, .port_type = RIG_PORT_PARALLEL, .write_delay = 0, .post_write_delay = 0, .timeout = 200, .retry = 3, .min_az = 0, .max_az = 360, .min_el = 0, .max_el = 180, .set_position = if100_set_position, }; /* ************************************************************************* */ DECLARE_INITROT_BACKEND(amsat) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rot_register(&if100_rot_caps); return RIG_OK; } hamlib-1.2.15.3/amsat/Makefile.in0000644000175000017500000004732612044564550013311 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = amsat DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_amsat_la_DEPENDENCIES = $(top_builddir)/lib/libmisc.la \ $(top_builddir)/src/libhamlib.la am_hamlib_amsat_la_OBJECTS = if100.lo hamlib_amsat_la_OBJECTS = $(am_hamlib_amsat_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_amsat_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_amsat_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_amsat_la_SOURCES) DIST_SOURCES = $(hamlib_amsat_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = hamlib-amsat.la hamlib_amsat_la_SOURCES = if100.c hamlib_amsat_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_amsat_la_LIBADD = $(top_builddir)/lib/libmisc.la \ $(top_builddir)/src/libhamlib.la all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu amsat/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu amsat/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-amsat.la: $(hamlib_amsat_la_OBJECTS) $(hamlib_amsat_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_amsat_la_LINK) -rpath $(pkglibdir) $(hamlib_amsat_la_OBJECTS) $(hamlib_amsat_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/if100.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/amsat/Makefile.am0000644000175000017500000000034712044564477013300 00000000000000 pkglib_LTLIBRARIES = hamlib-amsat.la hamlib_amsat_la_SOURCES = if100.c hamlib_amsat_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_amsat_la_LIBADD = $(top_builddir)/lib/libmisc.la \ $(top_builddir)/src/libhamlib.la hamlib-1.2.15.3/ts7400/0000755000175000017500000000000012044565041011140 500000000000000hamlib-1.2.15.3/ts7400/ts7400.h0000644000175000017500000000201012044564477012177 00000000000000/* * Hamlib Dummy backend - main header * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROT_ts7400_H #define _ROT_ts7400_H 1 extern const struct rot_caps ts7400_rot_caps; extern const struct rot_caps netrotctl_caps; #endif /* _ROT_DUMMY_H */ hamlib-1.2.15.3/ts7400/include/0000755000175000017500000000000012044565042012564 500000000000000hamlib-1.2.15.3/ts7400/include/readADC.c0000644000175000017500000002214412044564477014111 00000000000000 #include #include #include #include #include #include #include #include "peekpoke.h" #include "ep93xx_adc.h" #define DATA_PAGE 0x12C00000 #define CALIB_LOC 2027 //location of calibration values #define NUM_SAMPLES 5 #define NUM_CHANNELS 4 /* globals */ static unsigned long adc_page, syscon_page; char *dr_page; double el,az; /*Calculate the adc value corresponding to 0V*/ //val1 is the ADC val coresponding to 0.833V //val2 is the ADC val corresponging to 2.5V int calcZeroVal(int val1, int val2) { val2 += 0x10000; return (int)(val1-(((val2-val1)/(2.5-0.833))*0.833)); } //return value of 1 indicates the board has no calibration values //return value of 0 indicates the board has calibration values int read_calibration(int buf[NUM_CHANNELS][2]) { int i,j,k = 0; unsigned short cal[NUM_CHANNELS*2]; // read 16 calibration bytes into buffer FILE *f = fopen("/etc/ADC-calibration.dat","r"); if (!f) goto empty_calibration; printf("Non-virgin board detected, evaluating stored " "calibration values\n"); printf("Stored Calibration values ["); if (fread(cal,NUM_CHANNELS*4,1,f) == 1) { for(j=0;j<2;j++) for(i=0;i 10) { printf("Calculated calibration " "values out of range...\n"); exit(-1); } } } write_calibration(cal); } else //calibration values read { for(j=0;j<2;j++) { for(i=0;i 0.25) { if(!failure) { printf("Calibration values out" "of range\n"); failure = 1; erase_cal = 1; } printf("\tChannel %d: %3.3f%%\n",i , pcnt_diff); } } } } if(erase_cal) erase_calibration(); if(failure) return 0; return 1; } void setDR(char *x,int n,int val) { if (n < 0 || n > 8) return; x[0] = (x[0] & ~(1 << n)) | (val ? (1< 8) return; x[2] = (x[2] & ~(1 << n)) | (val ? (1< 2.65)) { if(!failure) { failure = 1; //printf("EP93XX ADC out of range\n"); } //printf("\tChannel %d: %3.3fV" //"(expected 2.5V +- 150mV)\n", i, voltage); //odd channels 0.833(+-50mV) } else if(i % 2 == 1 && (voltage < 0.333 || voltage > 1.333)) { if(!failure) { failure = 1; //printf( "EP93xx ADC out of range\n"); } //printf("\tChannel %d: %3.3fV" // "(expected 0.833V +- 50mV)\n", i, voltage); } //use the datasheet values voltage = get_volts(adc_result_2[i][j], 0x9E58, 0xC350); //odd channels 2.5V(+-150mV) if(i % 2 == 1 && (voltage < 2.35 || voltage > 2.65)) { if(!failure) { failure = 1; //printf("EP93XX ADC out of range\n"); } //printf("\tChannel %d: %3.3fV" //"(expected 2.5V +- 150mV)\n", i, voltage); //even channels 0.833(+-50mV) } else if(i % 2 == 0 && (voltage < 0.333 || voltage > 1.333)) { if(!failure) { failure = 1; //printf( "EP93xx ADC out of range\n"); } ///printf("\tChannel %d: %3.3fV" "(expected 0.833V +- 50mV)\n", i, voltage); } } } calc_calibration(calibration, adc_result_1, adc_result_2); if(failure) return_val = 0; else return_val = 1; return return_val; } int main(void) { int calibration[NUM_CHANNELS][2]; int stored_calibration[NUM_CHANNELS][2]; int ret_val, state; int devmem = open("/dev/mem", O_RDWR|O_SYNC); assert(devmem != -1); dr_page = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, devmem, DATA_PAGE); assert(&dr_page != MAP_FAILED); adc_page = (unsigned long)mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, devmem, ADC_PAGE); assert(&adc_page != MAP_FAILED); syscon_page = (unsigned long)mmap(0, getpagesize(), PROT_READ|PROT_WRITE , MAP_SHARED, devmem, SYSCON_PAGE); assert(&syscon_page != MAP_FAILED); init_ADC(adc_page, syscon_page); setDR(dr_page, 0, 1); setDR(dr_page, 1, 0); setDR(dr_page, 2, 1); setDR(dr_page, 3, 0); if(test_ADC(calibration)) { printf("ADC tested ok(data sheet values)\n"); state = read_calibration(stored_calibration); if(check_calibration(calibration, stored_calibration, state)) ret_val = 0; else ret_val = 1; } else ret_val = 1; printf("\t El.: %3.1f Az.: %3.1f \n", el, az); close(devmem); return ret_val; } hamlib-1.2.15.3/ts7400/include/io.h0000644000175000017500000000000012044564477013265 00000000000000hamlib-1.2.15.3/ts7400/include/readADC.h0000644000175000017500000000000012044564477014101 00000000000000hamlib-1.2.15.3/ts7400/include/io.c0000644000175000017500000000302212044564477013267 00000000000000// filename button.c // connect a button to DIO pin 1 and ground // blinks green and red led on the ts-7200 when button is pressed // // compile arm-linux-gcc -o button button.c // #include #include #include #include #include #include int main(int argc, char **argv) { volatile unsigned int *PEDR, *PEDDR, *PBDR, *PBDDR, *GPIOBDB; int i; unsigned char state; unsigned char *start; int fd = open("/dev/mem", O_RDWR|O_SYNC); start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0x80840000); PBDR = (unsigned int *)(start + 0x04); // port b PBDDR = (unsigned int *)(start + 0x14); // port b direction register PEDR = (unsigned int *)(start + 0x20); // port e data PEDDR = (unsigned int *)(start + 0x24); // port e direction register GPIOBDB = (unsigned int *)(start + 0xC4); // debounce on port b *PBDDR = 0xf0; // upper nibble output, lower nibble input *PEDDR = 0xff; // all output (just 2 bits) *GPIOBDB = 0x01; // enable debounce on bit 0 state = *PBDR; // read initial state while (state & 0x01) { // wait until button goes low state = *PBDR; // remember bit 0 is pulled up with 4.7k ohm } // blink 5 times, sleep 1 second so it's visible for (i = 0; i < 5; i++) { *PEDR = 0xff; sleep(1); *PEDR = 0x00; sleep(1); } close(fd); return 0; } hamlib-1.2.15.3/ts7400/include/test7400ADC.c0000644000175000017500000002135312044564477014471 00000000000000#include #include #include #include #include #include #include #include "peekpoke.h" #include "ep93xx_adc.h" #define DATA_PAGE 0x12C00000 #define CALIB_LOC 2027 //location of calibration values #define NUM_SAMPLES 5 #define NUM_CHANNELS 4 /* globals */ static unsigned long adc_page, syscon_page; char *dr_page; /*Calculate the adc value corresponding to 0V*/ //val1 is the ADC val coresponding to 0.833V //val2 is the ADC val corresponging to 2.5V int calcZeroVal(int val1, int val2) { val2 += 0x10000; return (int)(val1-(((val2-val1)/(2.5-0.833))*0.833)); } //return value of 1 indicates the board has no calibration values //return value of 0 indicates the board has calibration values int read_calibration(int buf[NUM_CHANNELS][2]) { int i,j,k = 0; unsigned short cal[NUM_CHANNELS*2]; // read 16 calibration bytes into buffer FILE *f = fopen("/etc/ADC-calibration.dat","r"); if (!f) goto empty_calibration; printf("Non-virgin board detected, evaluating stored " "calibration values\n"); printf("Stored Calibration values ["); if (fread(cal,NUM_CHANNELS*4,1,f) == 1) { for(j=0;j<2;j++) for(i=0;i 10) { printf("Calculated calibration " "values out of range...\n"); exit(-1); } } } write_calibration(cal); } else //calibration values read { for(j=0;j<2;j++) { for(i=0;i 0.25) { if(!failure) { printf("Calibration values out" "of range\n"); failure = 1; erase_cal = 1; } printf("\tChannel %d: %3.3f%%\n",i , pcnt_diff); } } } } if(erase_cal) erase_calibration(); if(failure) return 0; return 1; } void setDR(char *x,int n,int val) { if (n < 0 || n > 8) return; x[0] = (x[0] & ~(1 << n)) | (val ? (1< 8) return; x[2] = (x[2] & ~(1 << n)) | (val ? (1< 2.65)) { if(!failure) { failure = 1; printf("EP93XX ADC out of range\n"); } printf("\tChannel %d: %3.3fV" "(expected 2.5V +- 150mV)\n", i, voltage); //odd channels 0.833(+-50mV) } else if(i % 2 == 1 && (voltage < 0.333 || voltage > 1.333)) { if(!failure) { failure = 1; printf( "EP93xx ADC out of range\n"); } printf("\tChannel %d: %3.3fV" "(expected 0.833V +- 50mV)\n", i, voltage); } //use the datasheet values voltage = get_volts(adc_result_2[i][j], 0x9E58, 0xC350); //odd channels 2.5V(+-150mV) if(i % 2 == 1 && (voltage < 2.35 || voltage > 2.65)) { if(!failure) { failure = 1; printf("EP93XX ADC out of range\n"); } printf("\tChannel %d: %3.3fV" "(expected 2.5V +- 150mV)\n", i, voltage); //even channels 0.833(+-50mV) } else if(i % 2 == 0 && (voltage < 0.333 || voltage > 1.333)) { if(!failure) { failure = 1; printf( "EP93xx ADC out of range\n"); } printf("\tChannel %d: %3.3fV" "(expected 0.833V +- 50mV)\n", i, voltage); } } } calc_calibration(calibration, adc_result_1, adc_result_2); if(failure) return_val = 0; else return_val = 1; return return_val; } int main(void) { int calibration[NUM_CHANNELS][2]; int stored_calibration[NUM_CHANNELS][2]; int ret_val, state; int devmem = open("/dev/mem", O_RDWR|O_SYNC); assert(devmem != -1); dr_page = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, devmem, DATA_PAGE); assert(&dr_page != MAP_FAILED); adc_page = (unsigned long)mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, devmem, ADC_PAGE); assert(&adc_page != MAP_FAILED); syscon_page = (unsigned long)mmap(0, getpagesize(), PROT_READ|PROT_WRITE , MAP_SHARED, devmem, SYSCON_PAGE); assert(&syscon_page != MAP_FAILED); init_ADC(adc_page, syscon_page); setDR(dr_page, 0, 1); setDR(dr_page, 1, 0); setDR(dr_page, 2, 1); setDR(dr_page, 3, 0); if(test_ADC(calibration)) { printf("ADC tested ok(data sheet values)\n"); state = read_calibration(stored_calibration); if(check_calibration(calibration, stored_calibration, state)) ret_val = 0; else ret_val = 1; } else ret_val = 1; close(devmem); return ret_val; } hamlib-1.2.15.3/ts7400/include/peekpoke.h0000644000175000017500000000330012044564477014467 00000000000000// We can't expect that a dereference of an unsigned short * always // produces a ldrh or strh since the compiler may choose to use // a byte write instead. Hence, we emit the peeks and pokes using // inline assembler. --JO static inline unsigned short PEEK16(unsigned long addr) { unsigned short ret; asm volatile ( "ldrh %0, [ %1 ]\n" : "=r" (ret) : "r" (addr) : "memory" ); return ret; } static inline void POKE16(unsigned long addr, unsigned short dat) { asm volatile ( "strh %1, [ %0 ]\n" : : "r" (addr), "r" (dat) : "memory" ); } static inline unsigned long PEEK32(unsigned long addr) { unsigned long ret; asm volatile ( "ldr %0, [ %1 ]\n" : "=r" (ret) : "r" (addr) : "memory" ); return ret; } static inline void POKE32(unsigned long addr, unsigned long dat) { asm volatile ( "str %1, [ %0 ]\n" : : "r" (addr), "r" (dat) : "memory" ); } static inline unsigned char PEEK8(unsigned long addr) { unsigned char ret; asm volatile ( "ldrb %0, [ %1 ]\n" : "=r" (ret) : "r" (addr) : "memory" ); return ret; } static inline void POKE8(unsigned long addr, unsigned char dat) { asm volatile ( "strb %1, [ %0 ]\n" : : "r" (addr), "r" (dat) : "memory" ); } #define TRUE 0x01 #define FALSE 0x00 hamlib-1.2.15.3/ts7400/include/peekpoke.c0000644000175000017500000000506112044564477014470 00000000000000#include #include #include #include #include unsigned int parseBinary(char *str) { unsigned int val = 0; if (*str == 'b') { str++; while (*str) { if (*str == '0') { val <<= 1; } else if (*str == '1') { val = (val << 1) + 1; } else { goto binaryError; } } } return val; binaryError: fprintf(stderr,"Unrecognized numeric value: %s\n",str); exit(0); } unsigned int parseNumber(char *str) { unsigned int addr = 0; if (!sscanf(str, "0x%x", &addr)) { if (!sscanf(str, "%u", &addr)) { addr = parseBinary(str); } } return addr; } /* Features that the old peekXX/pokeXX did not have: 1. Support for 8/16/32 bit READ/WRITE in one function 2. Support for decimal and binary values 3. The value return is returned (to become the status code) */ int main(int argc, char **argv) { off_t addr, page; int fd,bits,dowrite=0,doread=1; unsigned char *start; unsigned char *chardat, charval; unsigned short *shortdat, shortval; unsigned int *intdat, intval; if (argc < 3 || argc > 5) { fprintf(stderr,"Usage: peekpoke BIT_WIDTH ADDRESS >\n"); fprintf(stderr," can be anything; supresses read-back on write\n"); return 0; } sscanf(argv[1], "%d", &bits); if (bits != 8 && bits != 16 && bits != 32) { fprintf(stderr,"Error: BIT_WIDTH must be 8, 16, or 32\n"); return 0; } addr = parseNumber(argv[2]); if (argc > 3 ) { // peekpoke BITS ADDRESS VALUE x intval = parseNumber(argv[3]); if (argc > 4) doread = 0; dowrite = 1; } fd = open("/dev/mem", O_RDWR|O_SYNC); if (fd == -1) { perror("open(/dev/mem):"); return 0; } page = addr & 0xfffff000; start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, page); if (start == MAP_FAILED) { perror("mmap:"); return 0; } if (bits == 8) { charval = (unsigned char)intval; chardat = start + (addr & 0xfff); if (dowrite) { *chardat = charval; } if (doread) { intval = (unsigned int)*chardat; } } else if (bits == 16) { shortval = (unsigned short)intval; shortdat = (unsigned short *)(start + (addr & 0xfff)); if (dowrite) { *shortdat = shortval; } if (doread) { intval = (unsigned int)*shortdat; } } else { // bits == 32 intdat = (unsigned int *)(start + (addr & 0xfff)); if (dowrite) { *intdat = intval; } if (doread) { intval = *intdat; } } if (doread) { printf("0x%X\n", intval); } close(fd); return intval; } hamlib-1.2.15.3/ts7400/include/ep93xx_adc.h0000644000175000017500000000421612044564477014642 00000000000000#define ADC_PAGE 0x80900000 #define ADCRESULT_OFFSET 0x0008 #define SDR_MASK 0x80000000 #define DATA_OFFSET 0x0008 #define DATA_MASK 0xFFFF #define ADCSWITCH_OFFSET 0x0018 #define ADC_CH0 0x0608 #define ADC_CH1 0x0680 #define ADC_CH2 0x0640 #define ADC_CH3 0x0620 #define ADC_CH4 0x0610 #define ADCSWLOCK_OFFSET 0x0020 #define UNLOCK_VAL 0xAA #define SYSCON_PAGE 0x80930000 #define ADCCLKDIV_OFFSET 0x0090 #define SYSCON_UNLOCK 0x00C0 #define TSEN_MASK 0x80000000 #define DEVICECFG_OFFSET 0x0080 #define ADCPD_MASK 0x04 #define ADCEN_MASK 0x20000 /* prototypes */ void init_ADC(unsigned long adc_page, unsigned long syscon_page); int read_channel(unsigned long adc_page, unsigned short channel); static char is_ADC_busy(unsigned long adc_page); void init_ADC(unsigned long adc_page, unsigned long syscon_page) { unsigned long val; /* set TSEN bit */ val = PEEK32(syscon_page + ADCCLKDIV_OFFSET); //unlock the software lock POKE32(syscon_page + SYSCON_UNLOCK, UNLOCK_VAL); POKE32(syscon_page + ADCCLKDIV_OFFSET, TSEN_MASK | val); /* set ADCEN bit */ val = PEEK32(syscon_page + DEVICECFG_OFFSET); POKE32(syscon_page + SYSCON_UNLOCK, UNLOCK_VAL); //unlock the soft lock POKE32(syscon_page + DEVICECFG_OFFSET, val | ADCEN_MASK); /* clear ADCPD bit */ val = PEEK32(syscon_page + DEVICECFG_OFFSET); POKE32(adc_page + SYSCON_UNLOCK, UNLOCK_VAL); //unlock the soft lock POKE32(syscon_page + DEVICECFG_OFFSET, val & ~ADCPD_MASK); } int read_channel(unsigned long adc_page, unsigned short channel) { unsigned long val; POKE32(adc_page + ADCSWLOCK_OFFSET, UNLOCK_VAL); //unlock the soft lock //write ADCSwitch reg to select channel POKE32(adc_page + ADCSWITCH_OFFSET, channel); while(is_ADC_busy(adc_page)); //poll ADCResult //read result from data regisyyter val = PEEK32(adc_page + DATA_OFFSET) ; val = val & DATA_MASK; return val; } static char is_ADC_busy(unsigned long adc_page) { unsigned long val; val = PEEK32(adc_page + ADCRESULT_OFFSET); if((val & SDR_MASK) == SDR_MASK) return TRUE; return FALSE; } hamlib-1.2.15.3/ts7400/Makefile.in0000644000175000017500000004766312044564557013160 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = ts7400 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_ts7400_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am_hamlib_ts7400_la_OBJECTS = ts7400.lo hamlib_ts7400_la_OBJECTS = $(am_hamlib_ts7400_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_ts7400_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_ts7400_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_ts7400_la_SOURCES) DIST_SOURCES = $(hamlib_ts7400_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = include/ep93xx_adc.h include/io.h include/peekpoke.h \ include/readADC.h include/io.c include/peekpoke.c include/readADC.c \ include/test7400ADC.c pkglib_LTLIBRARIES = hamlib-ts7400.la hamlib_ts7400_la_SOURCES = ts7400.c hamlib_ts7400_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_ts7400_la_LIBADD = $(top_builddir)/src/libhamlib.la \ @MATH_LIBS@ noinst_HEADERS = ts7400.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ts7400/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu ts7400/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-ts7400.la: $(hamlib_ts7400_la_OBJECTS) $(hamlib_ts7400_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_ts7400_la_LINK) -rpath $(pkglibdir) $(hamlib_ts7400_la_OBJECTS) $(hamlib_ts7400_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ts7400.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/ts7400/ts7400.c0000644000175000017500000001446212044564477012210 00000000000000/* * Hamlib ts7400 backend - main file * Copyright (c) 2001-2009 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include #include #include #include "serial.h" #include "misc.h" #include "register.h" #include "ts7400.h" struct ts7400_rot_priv_data { azimuth_t az; elevation_t el; struct timeval tv; /* time last az/el update */ azimuth_t target_az; elevation_t target_el; }; static int ts7400_rot_init(ROT *rot) { struct ts7400_rot_priv_data *priv; priv = (struct ts7400_rot_priv_data*) malloc(sizeof(struct ts7400_rot_priv_data)); if (!priv) return -RIG_ENOMEM; rot->state.priv = (void*)priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rot->state.rotport.type.rig = RIG_PORT_NONE; priv->az = priv->el = 0; priv->target_az = priv->target_el = 0; return RIG_OK; } static int ts7400_rot_cleanup(ROT *rot) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (rot->state.priv) free(rot->state.priv); rot->state.priv = NULL; return RIG_OK; } static int ts7400_rot_open(ROT *rot) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return RIG_OK; } static int ts7400_rot_close(ROT *rot) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return RIG_OK; } static int ts7400_rot_set_position(ROT *rot, azimuth_t az, elevation_t el) { struct ts7400_rot_priv_data *priv = (struct ts7400_rot_priv_data *)rot->state.priv; rig_debug(RIG_DEBUG_VERBOSE,"%s called: %.2f %.2f\n", __func__, az, el); priv->target_az = az; priv->target_el = el; gettimeofday(&priv->tv, NULL); return RIG_OK; } /* * Get position of rotor, simulating slow rotation */ static int ts7400_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el) { struct ts7400_rot_priv_data *priv = (struct ts7400_rot_priv_data *)rot->state.priv; struct timeval tv; unsigned elapsed; /* ms */ rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (priv->az == priv->target_az && priv->el == priv->target_el) { *az = priv->az; *el = priv->el; return RIG_OK; } gettimeofday(&tv, NULL); elapsed = (tv.tv_sec - priv->tv.tv_sec) * 1000 + (tv.tv_usec - priv->tv.tv_usec) / 1000; /* * Simulate rotation speed of 360 deg per minute */ #define DEG_PER_MS (360./60/1000) if (fabs(priv->target_az - priv->az)/DEG_PER_MS <= elapsed) { /* target reached */ priv->az = priv->target_az; } else { if (priv->az < priv->target_az) priv->az += (azimuth_t)elapsed*DEG_PER_MS; else priv->az -= (azimuth_t)elapsed*DEG_PER_MS; } if (fabs(priv->target_el - priv->el)/DEG_PER_MS <= elapsed) { /* target reached */ priv->el = priv->target_el; } else { if (priv->el < priv->target_el) priv->el += (elevation_t)elapsed*DEG_PER_MS; else priv->el -= (elevation_t)elapsed*DEG_PER_MS; } *az = priv->az; *el = priv->el; priv->tv = tv; return RIG_OK; } static int ts7400_rot_stop(ROT *rot) { struct ts7400_rot_priv_data *priv = (struct ts7400_rot_priv_data *)rot->state.priv; azimuth_t az; elevation_t el; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); ts7400_rot_get_position(rot, &az, &el); priv->target_az = priv->az = az; priv->target_el = priv->el = el; return RIG_OK; } static int ts7400_rot_park(ROT *rot) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); /* Assume home is 0,0 */ ts7400_rot_set_position(rot, 0, 0); return RIG_OK; } static int ts7400_rot_reset(ROT *rot, rot_reset_t reset) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return RIG_OK; } static int ts7400_rot_move(ROT *rot, int direction, int speed) { struct ts7400_rot_priv_data *priv = (struct ts7400_rot_priv_data *)rot->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: Direction = %d, Speed = %d\n", __func__, direction, speed); switch(direction) { case ROT_MOVE_UP: return ts7400_rot_set_position(rot, priv->target_az, 90); case ROT_MOVE_DOWN: return ts7400_rot_set_position(rot, priv->target_az, 0); case ROT_MOVE_CCW: return ts7400_rot_set_position(rot, -180, priv->target_el); case ROT_MOVE_CW: return ts7400_rot_set_position(rot, 180, priv->target_el); default: return -RIG_EINVAL; } return RIG_OK; } static const char *ts7400_rot_get_info(ROT *rot) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return "ts7400 rotator"; } /* * ts7400 rotator capabilities. */ const struct rot_caps ts7400_rot_caps = { .rot_model = ROT_MODEL_TS7400, .model_name = "ts7400", .mfg_name = "LA7LKA", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_AZEL, .port_type = RIG_PORT_NONE, .min_az = -180., .max_az = 180., .min_el = 0., .max_el = 90., .priv = NULL, /* priv */ .rot_init = ts7400_rot_init, .rot_cleanup = ts7400_rot_cleanup, .rot_open = ts7400_rot_open, .rot_close = ts7400_rot_close, .set_position = ts7400_rot_set_position, .get_position = ts7400_rot_get_position, .park = ts7400_rot_park, .stop = ts7400_rot_stop, .reset = ts7400_rot_reset, .move = ts7400_rot_move, .get_info = ts7400_rot_get_info, }; DECLARE_INITROT_BACKEND(ts7400) { rig_debug(RIG_DEBUG_VERBOSE, "ts7400: _init called\n"); rot_register(&ts7400_rot_caps); return RIG_OK; } hamlib-1.2.15.3/ts7400/Makefile.am0000644000175000017500000000062512044564477013133 00000000000000EXTRA_DIST = include/ep93xx_adc.h include/io.h include/peekpoke.h \ include/readADC.h include/io.c include/peekpoke.c include/readADC.c \ include/test7400ADC.c pkglib_LTLIBRARIES = hamlib-ts7400.la hamlib_ts7400_la_SOURCES = ts7400.c hamlib_ts7400_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_ts7400_la_LIBADD = $(top_builddir)/src/libhamlib.la \ @MATH_LIBS@ noinst_HEADERS = ts7400.h hamlib-1.2.15.3/Makefile.am0000644000175000017500000000152312044564477012170 00000000000000## Process this file with automake to produce Makefile.in aclocaldir = $(datadir)/aclocal aclocal_DATA = hamlib.m4 pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = hamlib.pc EXTRA_DIST = PLAN TODO LICENSE hamlib.m4 hamlib.pc.in README.developer \ README.betatester README.win32 # BINDINGS_LIST subdirs are no longer built SUBDIRS = macros include lib $(subdirs) src @BACKEND_LIST@ @ROT_BACKEND_LIST@ \ @BINDINGS@ tests doc # perl and kylix subdirs are no longer distributed DIST_SUBDIRS = macros include lib $(subdirs) src c++ bindings tests doc \ icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc \ rpcrig winradio adat easycomm fodtrack rpcrot drake rotorez \ flexradio sartek lowe rft rs tapr kit skanti prm80 wj racal tuner \ gs232a heathkit spid ars m2 amsat scripts ts7400 celestron ACLOCAL_AMFLAGS = -I macros hamlib-1.2.15.3/lib/0000755000175000017500000000000012044565000010740 500000000000000hamlib-1.2.15.3/lib/termios.c0000644000175000017500000023075012044564477012536 00000000000000#ifdef HAVE_CONFIG_H #include #endif #if defined(WIN32) && !defined(HAVE_TERMIOS_H) #ifdef HAVE_UNISTD_H #include /* usleep() */ #endif #undef DEBUG #undef TRACE #ifdef DEBUG #define DEBUG_VERBOSE #define DEBUG_ERRORS #define report(a) fprintf(stderr,a) #define report_warning(a) fprintf(stderr,a) #define report_error(a) fprintf(stderr,a) #else #define report(a) do {} while (0) #define report_warning(a) do {} while (0) #define report_error(a) do {} while (0) #endif /* DEBUG */ /*------------------------------------------------------------------------- | rxtx is a native interface to serial ports in java. | Copyright 1997-2002 by Trent Jarvi taj@www.linux.org.uk. | Copyright 1997-2006 by Trent Jarvi taj@www.linux.org.uk. | | This library is free software; you can redistribute it and/or | modify it under the terms of the GNU Lesser General Public | License as published by the Free Software Foundation; either | version 2.1 of the License, or (at your option) any later version. | | If you compile this program with cygwin32 tools this package falls | under the GPL. See COPYING.CYGNUS for details. | | This library 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 | Lesser General Public License for more details. | | You should have received a copy of the GNU Lesser General Public | License along with this library; if not, write to the Free Software | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | | This file was taken from rxtx-2.1-7 and adapted for Hamlib. --------------------------------------------------------------------------*/ #include #include #include #include #include #include "win32termios.h" /* * odd malloc.h error with lcc compiler * winsock has FIONREAD with lcc */ #ifdef __LCC__ # include #else # include #endif /* __LCC__ */ #define SIGIO 0 int my_errno; #if 0 extern int errno; #endif struct termios_list { char filename[80]; int my_errno; int interrupt; int event_flag; int tx_happened; unsigned long *hComm; struct termios *ttyset; struct serial_struct *sstruct; /* for DTR DSR */ unsigned char MSR; struct async_struct *astruct; struct serial_icounter_struct *sis; int open_flags; OVERLAPPED rol; OVERLAPPED wol; OVERLAPPED sol; int fd; struct termios_list *next; struct termios_list *prev; }; struct termios_list *first_tl = NULL; static struct termios_list *find_port( int ); /*---------------------------------------------------------- serial_test accept: filename to test perform: return: 1 on success 0 on failure exceptions: win32api: CreateFile CloseHandle comments: if the file opens it should be ok. ----------------------------------------------------------*/ int win32_serial_test( char * filename ) { unsigned long *hcomm; int ret; hcomm = CreateFile( filename, GENERIC_READ |GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0 ); if ( hcomm == INVALID_HANDLE_VALUE ) { if (GetLastError() == ERROR_ACCESS_DENIED) { ret = 1; } else { ret = 0; } } else { ret = 1; } CloseHandle( hcomm ); return(ret); } static void termios_setflags( int fd, int termios_flags[] ) { struct termios_list *index = find_port( fd ); int i, result; int windows_flags[11] = { 0, EV_RXCHAR, EV_TXEMPTY, EV_CTS, EV_DSR, EV_RING|0x2000, EV_RLSD, EV_ERR, EV_ERR, EV_ERR, EV_BREAK }; if( !index ) { LEAVE( "termios_setflags" ); return; } index->event_flag = 0; for(i=0;i<11;i++) if( termios_flags[i] ) index->event_flag |= windows_flags[i]; result = SetCommMask( index->hComm, index->event_flag ); /* This is rank. 0x2000 was used to detect the trailing edge of ring. The leading edge is detedted by EV_RING. The trailing edge is reliable. The leading edge is not. Softie no longer allows the trailing edge to be detected in NTsp2 and beyond. So... Try the reliable option above and if it fails, use the less reliable means. The screams for a giveio solution that bypasses the kernel. */ if( index->event_flag & 0x2000 && result == 0 ) { index->event_flag &= ~0x2000; SetCommMask( index->hComm, index->event_flag ); } } #if 0 /*---------------------------------------------------------- get_fd() accept: filename perform: find the file descriptor associated with the filename return: fd exceptions: win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ int get_fd( char *filename ) { struct termios_list *index = first_tl; ENTER( "get_fd" ); if( !index ) { return -1; } while( strcmp( index->filename, filename ) ) { index = index->next; if( !index->next ) return( -1 ); } LEAVE( "get_fd" ); return( index->fd ); } /*---------------------------------------------------------- get_filename() accept: file descriptor perform: find the filename associated with the file descriptor return: the filename associated with the fd exceptions: None win32api: None comments: This is not currently called by anything ----------------------------------------------------------*/ char *get_filename( int fd ) { struct termios_list *index = first_tl; ENTER( "get_filename" ); if( !index ) return( "bad" ); while( index->fd != fd ) { if( index->next == NULL ) return( "bad" ); index = index->next; } LEAVE( "get_filename" ); return( index->filename ); } /*---------------------------------------------------------- dump_termios_list() accept: string to print out. perform: return: exceptions: win32api: None comments: used only for debugging eg serial_close() ----------------------------------------------------------*/ void dump_termios_list( char *foo ) { #ifdef DEBUG struct termios_list *index = first_tl; printf( "============== %s start ===============\n", foo ); if ( index ) { printf( "%i filename | %s\n", index->fd, index->filename ); } /* if ( index->next ) { printf( "%i filename | %s\n", index->fd, index->filename ); } */ printf( "============== %s end ===============\n", foo ); #endif } #endif /*---------------------------------------------------------- set_errno() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ static void set_errno( int error ) { my_errno = error; } #if 0 /*---------------------------------------------------------- usleep() accept: perform: return: exceptions: win32api: Sleep() comments: ----------------------------------------------------------*/ static void usleep( unsigned long usec ) { Sleep( usec/1000 ); } #endif /*---------------------------------------------------------- CBR_toB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ static int CBR_to_B( int Baud ) { ENTER( "CBR_to_B" ); switch ( Baud ) { case 0: return( B0 ); case 50: return( B50 ); case 75: return( B75 ); case CBR_110: return( B110 ); case 134: return( B134 ); case 150: return( B150 ); case 200: return( B200 ); case CBR_300: return( B300 ); case CBR_600: return( B600 ); case CBR_1200: return( B1200 ); case 1800: return( B1800 ); case CBR_2400: return( B2400 ); case CBR_4800: return( B4800 ); case CBR_9600: return( B9600 ); case CBR_14400: return( B14400 ); case CBR_19200: return( B19200 ); case CBR_28800: return( B28800 ); case CBR_38400: return( B38400 ); case CBR_57600: return( B57600 ); case CBR_115200: return( B115200 ); case CBR_128000: return( B128000 ); case CBR_230400: return( B230400 ); case CBR_256000: return( B256000 ); case CBR_460800: return( B460800 ); case CBR_500000: return( B500000 ); case CBR_576000: return( B576000 ); case CBR_921600: return( B921600 ); case CBR_1000000: return( B1000000 ); case CBR_1152000: return( B1152000 ); case CBR_1500000: return( B1500000 ); case CBR_2000000: return( B2000000 ); case CBR_2500000: return( B2500000 ); case CBR_3000000: return( B3000000 ); case CBR_3500000: return( B3500000 ); case CBR_4000000: return( B4000000 ); default: /* assume custom baudrate */ return( Baud ); } } /*---------------------------------------------------------- B_to_CBR() accept: perform: return: exceptions: win32api: comments: None ----------------------------------------------------------*/ static int B_to_CBR( int Baud ) { int ret; ENTER( "B_to_CBR" ); switch ( Baud ) { case 0: ret = 0; break; case B50: ret = 50; break; case B75: ret = 75; break; case B110: ret = CBR_110; break; case B134: ret = 134; break; case B150: ret = 150; break; case B200: ret = 200; break; case B300: ret = CBR_300; break; case B600: ret = CBR_600; break; case B1200: ret = CBR_1200; break; case B1800: ret = 1800; break; case B2400: ret = CBR_2400; break; case B4800: ret = CBR_4800; break; case B9600: ret = CBR_9600; break; case B14400: ret = CBR_14400; break; case B19200: ret = CBR_19200; break; case B28800: ret = CBR_28800; break; case B38400: ret = CBR_38400; break; case B57600: ret = CBR_57600; break; case B115200: ret = CBR_115200; break; case B128000: ret = CBR_128000; break; case B230400: ret = CBR_230400; break; case B256000: ret = CBR_256000; break; case B460800: ret = CBR_460800; break; case B500000: ret = CBR_500000; break; case B576000: ret = CBR_576000; break; case B921600: ret = CBR_921600; break; case B1000000: ret = CBR_1000000; break; case B1152000: ret = CBR_1152000; break; case B1500000: ret = CBR_1500000; break; case B2000000: ret = CBR_2000000; break; case B2500000: ret = CBR_2500000; break; case B3000000: ret = CBR_3000000; break; case B3500000: ret = CBR_3500000; break; case B4000000: ret = CBR_4000000; break; default: /* assume custom baudrate */ return Baud; } LEAVE( "B_to_CBR" ); return ret; } /*---------------------------------------------------------- bytesize_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ static int bytesize_to_termios( int ByteSize ) { ENTER( "bytesize_to_termios" ); switch ( ByteSize ) { case 5: return( CS5 ); case 6: return( CS6 ); case 7: return( CS7 ); case 8: default: return( CS8 ); } } /*---------------------------------------------------------- termios_to_bytesize() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ static int termios_to_bytesize( int cflag ) { ENTER( "termios_to_bytesize" ); switch ( cflag & CSIZE ) { case CS5: return( 5 ); case CS6: return( 6 ); case CS7: return( 7 ); case CS8: default: return( 8 ); } } #if 0 /*---------------------------------------------------------- get_dos_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ static const char *get_dos_port( char const *name ) { ENTER( "get_dos_port" ); if ( !strcmp( name, "/dev/cua0" ) ) return( "COM1" ); if ( !strcmp( name, "/dev/cua1" ) ) return( "COM2" ); if ( !strcmp( name, "/dev/cua2" ) ) return( "COM3" ); if ( !strcmp( name, "/dev/cua3" ) ) return( "COM4" ); LEAVE( "get_dos_port" ); return( ( const char * ) name ); } #endif /*---------------------------------------------------------- ClearErrors() accept: perform: keep track of errors for the eventLoop() (SerialImp.c) return: the return value of ClearCommError() exceptions: win32api: ClearCommError() comments: ----------------------------------------------------------*/ static int ClearErrors( struct termios_list *index, COMSTAT *Stat ) { unsigned long ErrCode; int ret; ret = ClearCommError( index->hComm, &ErrCode, Stat ); if ( ret == 0 ) { YACK(); return( ret ); } #ifdef DEBUG_ERRORS if ( ErrCode ) { printf("%i frame %i %i overrun %i %i parity %u %i brk %i %i\n", (int) ErrCode, (int) ErrCode & CE_FRAME, index->sis->frame, (int) (ErrCode & CE_OVERRUN) | ( ErrCode & CE_RXOVER ), index->sis->overrun, (int) ErrCode & CE_RXPARITY, index->sis->parity, (int) ErrCode & CE_BREAK, index->sis->brk ); } #endif /* DEBUG_ERRORS */ if( ErrCode & CE_FRAME ) { index->sis->frame++; ErrCode &= ~CE_FRAME; } #ifdef LIFE_IS_GOOD FIXME OVERRUN is spewing if( ErrCode & CE_OVERRUN ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } /* should this be here? */ else if( ErrCode & CE_RXOVER ) { index->sis->overrun++; ErrCode &= ~CE_OVERRUN; } #endif /* LIFE_IS_GOOD */ if( ErrCode & CE_RXPARITY ) { index->sis->parity++; ErrCode &= ~CE_RXPARITY; } if( ErrCode & CE_BREAK ) { index->sis->brk++; ErrCode &= ~CE_BREAK; } return( ret ); } #if 0 /*---------------------------------------------------------- FillDCB() accept: perform: return: exceptions: win32api: GetCommState(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ static BOOL FillDCB( DCB *dcb, unsigned long *hCommPort, COMMTIMEOUTS Timeout ) { ENTER( "FillDCB" ); dcb->DCBlength = sizeof( dcb ); if ( !GetCommState( hCommPort, dcb ) ) { report( "GetCommState\n" ); return( -1 ); } dcb->BaudRate = CBR_9600 ; dcb->ByteSize = 8; dcb->Parity = NOPARITY; dcb->StopBits = ONESTOPBIT; dcb->fDtrControl = DTR_CONTROL_ENABLE; dcb->fRtsControl = RTS_CONTROL_ENABLE; dcb->fOutxCtsFlow = FALSE; dcb->fOutxDsrFlow = FALSE; dcb->fDsrSensitivity = FALSE; dcb->fOutX = FALSE; dcb->fInX = FALSE; dcb->fTXContinueOnXoff = FALSE; dcb->XonChar = 0x11; dcb->XoffChar = 0x13; dcb->XonLim = 0; dcb->XoffLim = 0; dcb->fParity = TRUE; if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING|( EV_RLSD & EV_RXFLAG ) ) dcb->EvtChar = '\n'; else dcb->EvtChar = '\0'; if ( !SetCommState( hCommPort, dcb ) ) { report( "SetCommState\n" ); YACK(); return( -1 ); } if ( !SetCommTimeouts( hCommPort, &Timeout ) ) { YACK(); report( "SetCommTimeouts\n" ); return( -1 ); } LEAVE( "FillDCB" ); return ( TRUE ) ; } #endif /*---------------------------------------------------------- serial_close() accept: perform: return: exceptions: win32api: SetCommMask(), CloseHandle() comments: ----------------------------------------------------------*/ int win32_serial_close( int fd ) { struct termios_list *index; /* char message[80]; */ ENTER( "serial_close" ); if( !first_tl || !first_tl->hComm ) { report( "gotit!" ); return( 0 ); } index = find_port( fd ); if ( !index ) { LEAVE( "serial_close" ); return -1; } /* WaitForSingleObject( index->wol.hEvent, INFINITE ); */ /* if ( index->hComm != INVALID_HANDLE_VALUE ) { if ( !SetCommMask( index->hComm, EV_RXCHAR ) ) { YACK(); report( "eventLoop hung\n" ); } CloseHandle( index->hComm ); } else { sprintf( message, "serial_ close(): Invalid Port Reference for %s\n", index->filename ); report( message ); } */ if ( index->next && index->prev ) { index->next->prev = index->prev; index->prev->next = index->next; } else if ( index->prev ) { index->prev->next = NULL; } else if ( index->next ) { index->next->prev = NULL; first_tl = index->next; } else first_tl = NULL; if ( index ) { if ( index->rol.hEvent ) CloseHandle( index->rol.hEvent ); if ( index->wol.hEvent ) CloseHandle( index->wol.hEvent ); if ( index->sol.hEvent ) CloseHandle( index->sol.hEvent ); if ( index->hComm ) CloseHandle( index->hComm ); if ( index->ttyset ) free( index->ttyset ); if ( index->astruct ) free( index->astruct ); if ( index->sstruct ) free( index->sstruct ); if ( index->sis ) free( index->sis ); /* had problems with strdup if ( index->filename ) free( index->filename ); */ free( index ); } LEAVE( "serial_close" ); return 0; } /*---------------------------------------------------------- cfmakeraw() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ void cfmakeraw( struct termios *s_termios ) { ENTER( "cfmakeraw" ); s_termios->c_iflag &= ~( IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON ); s_termios->c_oflag &= ~OPOST; s_termios->c_lflag &= ~( ECHO|ECHONL|ICANON|ISIG|IEXTEN ); s_termios->c_cflag &= ~( CSIZE|PARENB ); s_termios->c_cflag |= CS8; LEAVE( "cfmakeraw" ); } /*---------------------------------------------------------- init_serial_struct() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ static BOOL init_serial_struct( struct serial_struct *sstruct ) { ENTER( "init_serial_struct" ); /* FIXME This needs to use inb() to read the actual baud_base and divisor from the UART registers. Question is how far do we take this? */ sstruct->custom_divisor = 0; sstruct->baud_base = 115200; /* not currently used check values before using */ /* unsigned short */ sstruct->close_delay = 0; sstruct->closing_wait = 0; sstruct->iomem_reg_shift = 0; /* int */ sstruct->type = 0; sstruct->line = 0; sstruct->irq = 0; sstruct->flags = 0; sstruct->xmit_fifo_size = 0; sstruct->hub6 = 0; /* unsigned int */ sstruct->port = 0; sstruct->port_high = 0; /* char */ sstruct->io_type = 0; /* unsigned char * */ sstruct->iomem_base = NULL; LEAVE( "init_serial_struct" ); return TRUE; } /*---------------------------------------------------------- init_termios() accept: perform: return: exceptions: win32api: comments: ----------------------------------------------------------*/ static BOOL init_termios(struct termios *ttyset ) { ENTER( "init_termios" ); if ( !ttyset ) return FALSE; memset( ttyset, 0, sizeof( struct termios ) ); cfsetospeed( ttyset, B9600 ); cfmakeraw( ttyset ); ttyset->c_cc[VINTR] = 0x03; /* 0: C-c */ ttyset->c_cc[VQUIT] = 0x1c; /* 1: C-\ */ ttyset->c_cc[VERASE] = 0x7f; /* 2: */ ttyset->c_cc[VKILL] = 0x15; /* 3: C-u */ ttyset->c_cc[VEOF] = 0x04; /* 4: C-d */ ttyset->c_cc[VTIME] = 0; /* 5: read timeout */ ttyset->c_cc[VMIN] = 1; /* 6: read returns after this many bytes */ ttyset->c_cc[VSUSP] = 0x1a; /* 10: C-z */ ttyset->c_cc[VEOL] = '\r'; /* 11: */ ttyset->c_cc[VREPRINT] = 0x12; /* 12: C-r */ /* ttyset->c_cc[VDISCARD] = 0x; 13: IEXTEN only */ ttyset->c_cc[VWERASE] = 0x17; /* 14: C-w */ ttyset->c_cc[VLNEXT] = 0x16; /* 15: C-w */ ttyset->c_cc[VEOL2] = '\n'; /* 16: */ LEAVE( "init_termios" ); return TRUE; /* default VTIME = 0, VMIN = 1: read blocks forever until one byte */ } /*---------------------------------------------------------- port_opened() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ static int port_opened( const char *filename ) { struct termios_list *index = first_tl; ENTER( "port_opened" ); if ( ! index ) return 0; if( !strcmp( index->filename, filename ) ) return index->fd; while ( index->next ) { index = index->next; if( !strcmp( index->filename, filename ) ) return index->fd; } LEAVE( "port_opened" ); return 0; } /*---------------------------------------------------------- open_port() accept: perform: return: exceptions: win32api: CreateFile(), SetupComm(), CreateEvent() comments: FILE_FLAG_OVERLAPPED allows one to break out the select() so RXTXPort.close() does not hang. The setDTR() and setDSR() are the functions that noticed to be blocked in the java close. Basically ioctl(TIOCM[GS]ET) are where it hangs. FILE_FLAG_OVERLAPPED also means we need to create valid OVERLAPPED structure in Serial_select. ----------------------------------------------------------*/ static int open_port( struct termios_list *port ) { ENTER( "open_port" ); port->hComm = CreateFile( port->filename, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0 ); if ( port->hComm == INVALID_HANDLE_VALUE ) { YACK(); set_errno( EINVAL ); /* printf( "serial_open failed %s\n", port->filename ); */ return -1; } if( !SetupComm( port->hComm, 2048, 1024 ) ) { YACK(); return -1; } memset( &port->rol, 0, sizeof( OVERLAPPED ) ); memset( &port->wol, 0, sizeof( OVERLAPPED ) ); memset( &port->sol, 0, sizeof( OVERLAPPED ) ); port->rol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->rol.hEvent ) { YACK(); report( "Could not create read overlapped\n" ); goto fail; } port->sol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->sol.hEvent ) { YACK(); report( "Could not create select overlapped\n" ); goto fail; } port->wol.hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); if ( !port->wol.hEvent ) { YACK(); report( "Could not create write overlapped\n" ); goto fail; } LEAVE( "open_port" ); return( 0 ); fail: return( -1 ); } /*---------------------------------------------------------- termios_list() accept: fd which is a fake # for the port assigned when the port is opened perform: walk through a double linked list to see if the given fd is in any of the termios_list members. return: the termios_list if it is found. NULL if no matches are found. exceptions: None win32api: None comments: ----------------------------------------------------------*/ static struct termios_list *find_port( int fd ) { char message[80]; struct termios_list *index = first_tl; ENTER( "find_port" ); if ( fd <= 0 || !first_tl ) goto fail; while( index->fd ) { if ( index->fd == fd ) { LEAVE( "find_port" ); return index; } if ( !index->next ) break; index = index->next; } fail: sprintf( message, "No info known about the port. %i\n", fd ); report( message ); set_errno( EBADF ); LEAVE( "find_port" ); return NULL; } /*---------------------------------------------------------- get_free_fd() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ static int get_free_fd() { int next, last; struct termios_list *index = first_tl; ENTER( "get_free_fd" ); if ( !index ) { return( 1 ); } if ( !index->fd ) { report( "!index->fd\n" ); return( 1 ); } if ( index->fd > 1) { first_tl = index; return ( 1 ); } last = index->fd; while( index->next ) { next = index->next->fd; if ( next != last + 1 ) { return( last + 1 ); } index = index->next; last = next; } LEAVE( "get_free_fd" ); return( index->fd + 1 ); } /*---------------------------------------------------------- add_port() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ static struct termios_list *add_port( const char *filename ) { struct termios_list *index = first_tl; struct termios_list *port; ENTER( "add_port" ); port = malloc( sizeof( struct termios_list ) ); if( !port ) goto fail; memset( port, 0, sizeof( struct termios_list ) ); port->ttyset = malloc( sizeof( struct termios ) ); if( ! port->ttyset ) goto fail; memset( port->ttyset, 0, sizeof( struct termios ) ); port->sstruct = malloc( sizeof( struct serial_struct ) ); if( ! port->sstruct ) goto fail; memset( port->sstruct, 0, sizeof( struct serial_struct ) ); port->sis = malloc( sizeof( struct serial_icounter_struct ) ); if( ! port->sis ) goto fail; memset( port->sis, 0, sizeof( struct serial_icounter_struct ) ); /* FIXME the async_struct is being defined by mingw32 headers? port->astruct = malloc( sizeof( struct async_struct ) ); if( ! port->astruct ) goto fail; memset( port->astruct, 0, sizeof( struct async_struct ) ); */ port->MSR = 0; strncpy(port->filename, filename, sizeof(port->filename)-1); /* didnt free well? strdup( filename ); */ if( ! port->filename ) goto fail; port->fd = get_free_fd(); if ( !first_tl ) { port->prev = NULL; first_tl = port; } else { while ( index->next ) index = index->next; if ( port == first_tl ) { port->prev = NULL; port->next = first_tl; first_tl->prev = port; first_tl = port; } else { port->prev = index; index->next = port; } } port->next = NULL; LEAVE( "add_port" ); return port; fail: report( "add_port: Out Of Memory\n"); if ( port->ttyset ) free( port->ttyset ); if ( port->astruct ) free( port->astruct ); if ( port->sstruct ) free( port->sstruct ); if ( port->sis ) free( port->sis ); /* had problems with strdup if ( port->filename ) free( port->filename ); */ if ( port ) free( port ); return port; } /*---------------------------------------------------------- check_port_capabilities() accept: perform: return: exceptions: win32api: GetCommProperties(), GetCommState() comments: ----------------------------------------------------------*/ static int check_port_capabilities( struct termios_list *index ) { COMMPROP cp; DCB dcb; char message[80]; ENTER( "check_port_capabilities" ); /* check for capabilities */ GetCommProperties( index->hComm, &cp ); if ( !( cp.dwProvCapabilities & PCF_DTRDSR ) ) { sprintf( message, "%s: no DTR & DSR support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RLSD ) ) { sprintf( message, "%s: no carrier detect (RLSD) support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_RTSCTS ) ) { sprintf( message, "%s: no RTS & CTS support\n", index->filename ); report( message ); } if ( !( cp.dwProvCapabilities & PCF_TOTALTIMEOUTS ) ) { sprintf( message, "%s: no timeout support\n", index->filename ); report( message ); } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "GetCommState\n" ); return -1; } LEAVE( "check_port_capabilities" ); return 0; } /*---------------------------------------------------------- serial_open() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int win32_serial_open( const char *filename, int flags, ... ) { struct termios_list *index; char message[80]; char fullfilename[80]; ENTER( "serial_open" ); fullfilename[sizeof(fullfilename)-1] = '\0'; /* according to http://support.microsoft.com/kb/115831 * this is necessary for COM ports larger than COM9 */ if (memcmp(filename, "\\\\.\\", 4) != 0) snprintf(fullfilename, sizeof(fullfilename)-1, "\\\\.\\%s", filename); else strncpy(fullfilename, filename, sizeof(fullfilename)-1); if ( port_opened( fullfilename ) ) { report( "Port is already opened\n" ); return( -1 ); } index = add_port( fullfilename ); if( !index ) { report( "serial_open !index\n" ); return( -1 ); } index->interrupt = 0; index->tx_happened = 0; if ( open_port( index ) ) { sprintf( message, "serial_open(): Invalid Port Reference for %s\n", fullfilename ); report( message ); win32_serial_close( index->fd ); return -1; } if( check_port_capabilities( index ) ) { report( "check_port_capabilities!" ); win32_serial_close( index->fd ); return -1; } init_termios( index->ttyset ); init_serial_struct( index->sstruct ); /* set default condition */ tcsetattr( index->fd, 0, index->ttyset ); /* if opened with non-blocking, then operating non-blocking */ if ( flags & O_NONBLOCK ) index->open_flags = O_NONBLOCK; else index->open_flags = 0; if( !first_tl->hComm ) { sprintf( message, "open(): Invalid Port Reference for %s\n", index->filename ); report( message ); } if ( first_tl->hComm == INVALID_HANDLE_VALUE ) report( "serial_open: test\n" ); LEAVE( "serial_open" ); return( index->fd ); } /*---------------------------------------------------------- serial_write() accept: perform: return: exceptions: win32api: WriteFile(), GetLastError(), WaitForSingleObject(), GetOverlappedResult(), FlushFileBuffers(), Sleep() comments: ----------------------------------------------------------*/ int win32_serial_write( int fd, const char *Str, int length ) { unsigned long nBytes; struct termios_list *index; /* COMSTAT Stat; */ int old_flag; ENTER( "serial_write" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_write"); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ index->wol.Offset = index->wol.OffsetHigh = 0; ResetEvent( index->wol.hEvent ); if ( !WriteFile( index->hComm, Str, length, &nBytes, &index->wol ) ) { WaitForSingleObject( index->wol.hEvent,100 ); if ( GetLastError() != ERROR_IO_PENDING ) { /* ClearErrors( index, &Stat ); */ report( "serial_write error\n" ); /* report("Condition 1 Detected in write()\n"); */ YACK(); errno = EIO; nBytes=-1; goto end; } /* This is breaking on Win2K, WinXP for some reason */ else while( !GetOverlappedResult( index->hComm, &index->wol, &nBytes, TRUE ) ) { if ( GetLastError() != ERROR_IO_INCOMPLETE ) { /* report("Condition 2 Detected in write()\n"); */ YACK(); errno = EIO; nBytes = -1; goto end; /* ClearErrors( index, &Stat ); */ } } } else { /* Write finished synchronously. That is ok! * I have seen this with USB to Serial * devices like TI's. */ } end: /* FlushFileBuffers( index->hComm ); */ index->event_flag |= EV_TXEMPTY; /* ClearErrors( index, &Stat ); */ SetCommMask( index->hComm, index->event_flag ); /* ClearErrors( index, &Stat ); */ index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "serial_write" ); return nBytes; } /*---------------------------------------------------------- serial_read() accept: perform: return: exceptions: win32api: ReadFile(), GetLastError(), WaitForSingleObject() GetOverLappedResult() comments: If setting errno make sure not to use EWOULDBLOCK In that case use EAGAIN. See SerialImp.c:testRead() ----------------------------------------------------------*/ int win32_serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0; /* unsigned long waiting = 0; */ int err; struct termios_list *index; char message[80]; COMSTAT stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read" ); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ if ( index->open_flags & O_NONBLOCK ) { /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ClearErrors( index, &stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ return total; /* read timeout */ } } while( stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ /* vmin = index->ttyset->c_cc[VMIN]; */ c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { ClearErrors( index, &stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ClearErrors( index, &stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &stat); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &stat); return( total ); } } LEAVE( "serial_read" ); return total; } #ifdef asdf int win32_serial_read( int fd, void *vb, int size ) { long start, now; unsigned long nBytes = 0, total = 0, error; /* unsigned long waiting = 0; */ int err, vmin; struct termios_list *index; char message[80]; COMSTAT Stat; clock_t c; unsigned char *dest = vb; start = GetTickCount(); ENTER( "serial_read" ); if ( fd <= 0 ) { printf("1\n"); return 0; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_read 7" ); errno = EIO; printf("2\n"); return -1; } /* FIXME: CREAD: without this, data cannot be read FIXME: PARMRK: mark framing & parity errors FIXME: IGNCR: ignore \r FIXME: ICRNL: convert \r to \n FIXME: INLCR: convert \n to \r */ ClearErrors( index, &Stat ); if ( index->open_flags & O_NONBLOCK ) { vmin = 0; /* pull mucho-cpu here? */ do { #ifdef DEBUG_VERBOSE report( "vmin=0\n" ); #endif /* DEBUG_VERBOSE */ ClearErrors( index, &Stat); /* usleep(1000); usleep(50); */ /* we should use -1 instead of 0 for disabled timeout */ now = GetTickCount(); if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { /* sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total); report( message ); */ errno = EAGAIN; printf("3\n"); return -1; /* read timeout */ } } while( Stat.cbInQue < size && size > 1 ); } else { /* VTIME is in units of 0.1 seconds */ #ifdef DEBUG_VERBOSE report( "vmin!=0\n" ); #endif /* DEBUG_VERBOSE */ vmin = index->ttyset->c_cc[VMIN]; c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10; do { error = ClearErrors( index, &Stat); usleep(1000); } while ( c > clock() ); } total = 0; while ( size > 0 ) { nBytes = 0; /* ClearErrors( index, &Stat); */ index->rol.Offset = index->rol.OffsetHigh = 0; ResetEvent( index->rol.hEvent ); err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol ); #ifdef DEBUG_VERBOSE /* warning Roy Rogers! */ sprintf(message, " ========== ReadFile = %i %s\n", ( int ) nBytes, (char *) dest + total ); report( message ); #endif /* DEBUG_VERBOSE */ size -= nBytes; total += nBytes; if ( !err ) { switch ( GetLastError() ) { case ERROR_BROKEN_PIPE: report( "ERROR_BROKEN_PIPE\n "); nBytes = 0; break; case ERROR_MORE_DATA: /* usleep(1000); */ report( "ERROR_MORE_DATA\n" ); break; case ERROR_IO_PENDING: while( ! GetOverlappedResult( index->hComm, &index->rol, &nBytes, TRUE ) ) { if( GetLastError() != ERROR_IO_INCOMPLETE ) { ClearErrors( index, &Stat); printf("4\n"); return( total ); } } size -= nBytes; total += nBytes; if (size > 0) { now = GetTickCount(); sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100); report( message ); /* we should use -1 for disabled timouts */ if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) { report( "TO " ); /* read timeout */ printf("5\n"); return total; } } sprintf(message, "end nBytes=%ld] ", nBytes); report( message ); /* usleep(1000); */ report( "ERROR_IO_PENDING\n" ); break; default: /* usleep(1000); */ YACK(); errno = EIO; printf("6\n"); return -1; } } else { /* usleep(1000); */ ClearErrors( index, &Stat); printf("7\n"); return( total ); } } LEAVE( "serial_read" ); ClearErrors( index, &Stat); return total; } #endif /* asdf */ /*---------------------------------------------------------- cfsetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetospeed( struct termios *s_termios, speed_t speed ) { char message[80]; ENTER( "cfsetospeed" ); /* clear baudrate */ s_termios->c_cflag &= ~CBAUD; if ( speed & ~CBAUD ) { sprintf( message, "cfsetospeed: not speed: %#o\n", speed ); report( message ); /* continue assuming its a custom baudrate */ s_termios->c_cflag |= B38400; /* use 38400 during custom */ s_termios->c_cflag |= CBAUDEX; /* use CBAUDEX for custom */ } else if( speed ) { s_termios->c_cflag |= speed; } else { /* PC blows up with speed 0 handled in Java */ s_termios->c_cflag |= B9600; } s_termios->c_ispeed = s_termios->c_ospeed = speed; LEAVE( "cfsetospeed" ); return 1; } /*---------------------------------------------------------- cfsetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetispeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfsetspeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int cfsetspeed( struct termios *s_termios, speed_t speed ) { return cfsetospeed( s_termios, speed ); } /*---------------------------------------------------------- cfgetospeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetospeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ospeed; } /*---------------------------------------------------------- cfgetispeed() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ speed_t cfgetispeed( struct termios *s_termios ) { ENTER( "cfgetospeed" ); return s_termios->c_ispeed; } /*---------------------------------------------------------- serial_struct_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int serial_struct_to_DCB( struct serial_struct *sstruct, DCB *dcb ) { /* 5 Baud rate fix sstruct.baud_base sstruct.custom_divisor = ( sstruct.baud_base/cspeed ); */ return(0); } /*---------------------------------------------------------- termios_to_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ static int termios_to_DCB( struct termios *s_termios, DCB *dcb ) { ENTER( "termios_to_DCB" ); if ( !(s_termios->c_cflag & CBAUDEX) ) s_termios->c_ispeed = s_termios->c_ospeed = s_termios->c_cflag & CBAUD; dcb->BaudRate = B_to_CBR( s_termios->c_ispeed ); dcb->ByteSize = termios_to_bytesize( s_termios->c_cflag ); if ( s_termios->c_cflag & PARENB ) { if ( s_termios->c_cflag & PARODD && s_termios->c_cflag & CMSPAR ) { dcb->Parity = MARKPARITY; } else if ( s_termios->c_cflag & PARODD ) { dcb->Parity = ODDPARITY; } else if ( s_termios->c_cflag & CMSPAR ) { dcb->Parity = SPACEPARITY; } else { dcb->Parity = EVENPARITY; } } else { dcb->Parity = NOPARITY; } if ( s_termios->c_cflag & CSTOPB ) dcb->StopBits = TWOSTOPBITS; else dcb->StopBits = ONESTOPBIT; if ( s_termios->c_cflag & HARDWARE_FLOW_CONTROL ) { dcb->fRtsControl = RTS_CONTROL_HANDSHAKE; dcb->fOutxCtsFlow = TRUE; } else { dcb->fRtsControl = RTS_CONTROL_DISABLE; dcb->fOutxCtsFlow = FALSE; } LEAVE( "termios_to_DCB" ); return 0; } /*---------------------------------------------------------- DCB_to_serial_struct() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ int DCB_to_serial_struct( DCB *dcb, struct serial_struct *sstruct ) { return( 0 ); } /*---------------------------------------------------------- DCB_to_termios() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ static void DCB_to_termios( DCB *dcb, struct termios *s_termios ) { ENTER( "DCB_to_termios" ); s_termios->c_ispeed = CBR_to_B( dcb->BaudRate ); s_termios->c_ospeed = s_termios->c_ispeed; s_termios->c_cflag |= s_termios->c_ispeed & CBAUD; LEAVE( "DCB_to_termios" ); } /*---------------------------------------------------------- show_DCB() accept: perform: return: exceptions: win32api: None comments: ----------------------------------------------------------*/ static void show_DCB( DCB myDCB ) { #ifdef DEBUG_HOSED char message[80]; sprintf( message, "DCBlength: %ld\n", myDCB.DCBlength ); report( message ); sprintf( "BaudRate: %ld\n", myDCB.BaudRate ); report( message ); if ( myDCB.fBinary ) report( "fBinary\n" ); if ( myDCB.fParity ) { report( "fParity: " ); if ( myDCB.fErrorChar ) { sprintf( message, "fErrorChar: %#x\n", myDCB.ErrorChar ); report( message ); } else { report( "fErrorChar == false\n" ); } } if ( myDCB.fOutxCtsFlow ) report( "fOutxCtsFlow\n" ); if ( myDCB.fOutxDsrFlow ) report( "fOutxDsrFlow\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_HANDSHAKE ); report( "DTR_CONTROL_HANDSHAKE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_ENABLE ); report( "DTR_CONTROL_ENABLE\n" ); if ( myDCB.fDtrControl & DTR_CONTROL_DISABLE ); report( "DTR_CONTROL_DISABLE\n" ); if ( myDCB.fDsrSensitivity ) report( "fDsrSensitivity\n" ); if ( myDCB.fTXContinueOnXoff ) report( "fTXContinueOnXoff\n" ); if ( myDCB.fOutX ) report( "fOutX\n" ); if ( myDCB.fInX ) report( "fInX\n" ); if ( myDCB.fNull ) report( "fNull\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_TOGGLE ) report( "RTS_CONTROL_TOGGLE\n" ); if ( myDCB.fRtsControl == 0 ) report( "RTS_CONTROL_HANDSHAKE ( fRtsControl==0 )\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_HANDSHAKE ) report( "RTS_CONTROL_HANDSHAKE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_ENABLE ) report( "RTS_CONTROL_ENABLE\n" ); if ( myDCB.fRtsControl & RTS_CONTROL_DISABLE ) report( "RTS_CONTROL_DISABLE\n" ); if ( myDCB.fAbortOnError ) report( "fAbortOnError\n" ); sprintf( message, "XonLim: %d\n", myDCB.XonLim ); report( message ); sprintf( message, "XoffLim: %d\n", myDCB.XoffLim ); report( message ); sprintf( message, "ByteSize: %d\n", myDCB.ByteSize ); report( message ); switch ( myDCB.Parity ) { case EVENPARITY: report( "EVENPARITY" ); break; case MARKPARITY: report( "MARKPARITY" ); break; case NOPARITY: report( "NOPARITY" ); break; case ODDPARITY: report( "ODDPARITY" ); break; default: sprintf( message, "unknown Parity (%#x ):", myDCB.Parity ); report( message ); break; } report( "\n" ); switch( myDCB.StopBits ) { case ONESTOPBIT: report( "ONESTOPBIT" ); break; case ONE5STOPBITS: report( "ONE5STOPBITS" ); break; case TWOSTOPBITS: report( "TWOSTOPBITS" ); break; default: report( "unknown StopBits (%#x ):", myDCB.StopBits ); break; } report( "\n" ); sprintf( message, "XonChar: %#x\n", myDCB.XonChar ); report( message ); sprintf( message, "XoffChar: %#x\n", myDCB.XoffChar ); report( message ); sprintf( message, "EofChar: %#x\n", myDCB.EofChar ); report( message ); sprintf( message, "EvtChar: %#x\n", myDCB.EvtChar ); report( message ); report( "\n" ); #endif /* DEBUG_HOSED */ } /*---------------------------------------------------------- tcgetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts() comments: ----------------------------------------------------------*/ int tcgetattr( int fd, struct termios *s_termios ) { DCB myDCB; COMMTIMEOUTS timeouts; struct termios_list *index; char message[80]; ENTER( "tcgetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcgetattr" ); return -1; } if ( !GetCommState( index->hComm, &myDCB ) ) { sprintf( message, "GetCommState failed\n" ); report( message ); return -1; } memcpy( s_termios, index->ttyset, sizeof( struct termios ) ); show_DCB( myDCB ); /***** input mode flags (c_iflag ) ****/ /* parity check enable */ if ( myDCB.fParity ) { s_termios->c_iflag |= INPCK; s_termios->c_iflag &= ~IGNPAR; } else { s_termios->c_iflag &= ~INPCK; s_termios->c_iflag |= IGNPAR; } /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( myDCB.fOutX ) { s_termios->c_iflag |= IXON; } else { /* IXON: output start/stop control */ s_termios->c_iflag &= ~IXON; } if ( myDCB.fInX ) { s_termios->c_iflag |= IXOFF; } else { /* IXOFF: input start/stop control */ s_termios->c_iflag &= ~IXOFF; } if ( myDCB.fTXContinueOnXoff ) { s_termios->c_iflag |= IXANY; } else { /* IXANY: any char restarts output */ s_termios->c_iflag &= ~IXANY; } /* FIXME: IMAXBEL: if input buffer full, send bell */ /***** control mode flags (c_cflag ) *****/ /* FIXME: CLOCAL: DONT send SIGHUP on modem disconnect */ /* FIXME: HUPCL: generate modem disconnect when all has closed or exited */ /* CSTOPB two stop bits ( otherwise one) */ if ( myDCB.StopBits == TWOSTOPBITS ) { s_termios->c_cflag |= CSTOPB; } if ( myDCB.StopBits == ONESTOPBIT ) { s_termios->c_cflag &= ~CSTOPB; } /* PARENB enable parity bit */ s_termios->c_cflag &= ~( PARENB | PARODD | CMSPAR ); myDCB.fParity = 1; if( myDCB.fParity ) { report( "tcgetattr getting parity\n" ); s_termios->c_cflag |= PARENB; if ( myDCB.Parity == MARKPARITY ) { s_termios->c_cflag |= ( PARODD | CMSPAR ); } else if ( myDCB.Parity == SPACEPARITY ) { s_termios->c_cflag |= CMSPAR; } else if ( myDCB.Parity == ODDPARITY ) { report( "ODDPARITY\n" ); s_termios->c_cflag |= PARODD; } else if ( myDCB.Parity == EVENPARITY ) { report( "EVENPARITY\n" ); s_termios->c_cflag &= ~PARODD; } else if ( myDCB.Parity == NOPARITY ) { s_termios->c_cflag &= ~(PARODD | CMSPAR | PARENB); } } else { s_termios->c_cflag &= ~PARENB; } /* CSIZE */ s_termios->c_cflag |= bytesize_to_termios( myDCB.ByteSize ); /* HARDWARE_FLOW_CONTROL: hardware flow control */ if (( myDCB.fOutxCtsFlow == TRUE ) || ( myDCB.fRtsControl == RTS_CONTROL_HANDSHAKE)) { s_termios->c_cflag |= HARDWARE_FLOW_CONTROL; } else { s_termios->c_cflag &= ~HARDWARE_FLOW_CONTROL; } /* MDMBUF: carrier based flow control of output */ /* CIGNORE: tcsetattr will ignore control modes & baudrate */ /***** NOT SUPPORTED: local mode flags (c_lflag) *****/ /* ICANON: canonical (not raw) mode */ /* ECHO: echo back to terminal */ /* ECHOE: echo erase */ /* ECHOPRT: hardcopy echo erase */ /* ECHOK: show KILL char */ /* ECHOKE: BSD ECHOK */ /* ECHONL: ICANON only: echo newline even with no ECHO */ /* ECHOCTL: if ECHO, then control-A are printed as '^A' */ /* ISIG: recognize INTR, QUIT & SUSP */ /* IEXTEN: implmentation defined */ /* NOFLSH: dont clear i/o queues on INTR, QUIT or SUSP */ /* TOSTOP: background process generate SIGTTOU */ /* ALTWERASE: alt-w erase distance */ /* FLUSHO: user DISCARD char */ /* NOKERNINFO: disable STATUS char */ /* PENDIN: input line needsd reprinting, set by REPRINT char */ /***** END - NOT SUPPORTED *****/ /***** control characters (c_cc[NCCS] ) *****/ if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "GetCommTimeouts\n" ); return -1; } s_termios->c_cc[VTIME] = timeouts.ReadTotalTimeoutConstant/100; /* handled in SerialImp.c? s_termios->c_cc[VMIN] = ? */ s_termios->c_cc[VSTART] = myDCB.XonChar; s_termios->c_cc[VSTOP] = myDCB.XoffChar; s_termios->c_cc[VEOF] = myDCB.EofChar; #ifdef DEBUG_VERBOSE sprintf( message, "tcgetattr: VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); #endif /* DEBUG_VERBOSE */ /***** line discipline ( c_line ) ( == c_cc[33] ) *****/ DCB_to_termios( &myDCB, s_termios ); /* baudrate */ LEAVE( "tcgetattr" ); return 0; } /* `TCSANOW' Make the change immediately. `TCSADRAIN' Make the change after waiting until all queued output has been written. You should usually use this option when changing parameters that affect output. `TCSAFLUSH' This is like `TCSADRAIN', but also discards any queued input. `TCSASOFT' This is a flag bit that you can add to any of the above alternatives. Its meaning is to inhibit alteration of the state of the terminal hardware. It is a BSD extension; it is only supported on BSD systems and the GNU system. Using `TCSASOFT' is exactly the same as setting the `CIGNORE' bit in the `c_cflag' member of the structure TERMIOS-P points to. *Note Control Modes::, for a description of `CIGNORE'. */ /*---------------------------------------------------------- tcsetattr() accept: perform: return: exceptions: win32api: GetCommState(), GetCommTimeouts(), SetCommState(), SetCommTimeouts() comments: ----------------------------------------------------------*/ int tcsetattr( int fd, int when, struct termios *s_termios ) { int vtime; DCB dcb; COMMTIMEOUTS timeouts; struct termios_list *index; ENTER( "tcsetattr" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "tcsetattr" ); return -1; } fflush( stdout ); if ( s_termios->c_lflag & ICANON ) { report( "tcsetattr: no canonical mode support\n" ); /* and all other c_lflags too */ return -1; } if ( !GetCommState( index->hComm, &dcb ) ) { YACK(); report( "tcsetattr:GetCommState\n" ); return -1; } if ( !GetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "tcsetattr:GetCommTimeouts\n" ); return -1; } /*** control flags, c_cflag **/ if ( !( s_termios->c_cflag & CIGNORE ) ) { dcb.fParity=1; /* CIGNORE: ignore control modes and baudrate */ /* baudrate */ if ( termios_to_DCB( s_termios, &dcb ) < 0 ) return -1; } else { } /*** input flags, c_iflag **/ /* This is wrong. It disables Parity FIXME if( ( s_termios->c_iflag & INPCK ) && !( s_termios->c_iflag & IGNPAR ) ) { dcb.fParity = TRUE; } else { dcb.fParity = FALSE; } */ /* not in win95? Some years later... eww.. FIXME This is used for changing the Parity error character I think this code is hosed. See VEOF below Trent */ if ( s_termios->c_iflag & ISTRIP ) dcb.fBinary = FALSE; /* ISTRIP: strip to seven bits */ else dcb.fBinary = TRUE; /* FIXME: IGNBRK: ignore break */ /* FIXME: BRKINT: interrupt on break */ if ( s_termios->c_iflag & IXON ) { dcb.fOutX = TRUE; } else { dcb.fOutX = FALSE; } if ( s_termios->c_iflag & IXOFF ) { dcb.fInX = TRUE; } else { dcb.fInX = FALSE; } dcb.fTXContinueOnXoff = ( s_termios->c_iflag & IXANY ) ? TRUE : FALSE; /* FIXME: IMAXBEL: if input buffer full, send bell */ /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_DISABLE; /* no DSR control in termios? */ dcb.fOutxDsrFlow = FALSE; /* DONT ignore rx bytes when DSR is OFF */ dcb.fDsrSensitivity = FALSE; dcb.XonChar = s_termios->c_cc[VSTART]; dcb.XoffChar = s_termios->c_cc[VSTOP]; dcb.XonLim = 0; /* ? */ dcb.XoffLim = 0; /* ? */ dcb.EofChar = s_termios->c_cc[VEOF]; if( dcb.EofChar != '\0' ) { dcb.fBinary = 0; } else { dcb.fBinary = 1; } if ( EV_BREAK|EV_CTS|EV_DSR|EV_ERR|EV_RING | ( EV_RLSD & EV_RXFLAG ) ) dcb.EvtChar = '\n'; else dcb.EvtChar = '\0'; if ( !SetCommState( index->hComm, &dcb ) ) { report( "SetCommState error\n" ); YACK(); return -1; } #ifdef DEBUG_VERBOSE { char message[32]; sprintf( message, "VTIME:%d, VMIN:%d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); } #endif /* DEBUG_VERBOSE */ vtime = s_termios->c_cc[VTIME] * 100; timeouts.ReadTotalTimeoutConstant = vtime; timeouts.ReadIntervalTimeout = 0; timeouts.ReadTotalTimeoutMultiplier = 0; timeouts.WriteTotalTimeoutConstant = vtime; timeouts.WriteTotalTimeoutMultiplier = 0; /* max between bytes */ if ( s_termios->c_cc[VMIN] > 0 && vtime > 0 ) { /* read blocks forever on VMIN chars */ } else if ( s_termios->c_cc[VMIN] == 0 && vtime == 0 ) { /* read returns immediately */ timeouts.ReadIntervalTimeout = MAXDWORD; timeouts.ReadTotalTimeoutConstant = 0; timeouts.ReadTotalTimeoutMultiplier = 0; } #ifdef DEBUG_VERBOSE { char message[64]; sprintf( message, "ReadIntervalTimeout=%ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "c_cc[VTIME] = %d, c_cc[VMIN] = %d\n", s_termios->c_cc[VTIME], s_termios->c_cc[VMIN] ); report( message ); sprintf( message, "ReadTotalTimeoutConstant: %ld\n", timeouts.ReadTotalTimeoutConstant ); report( message ); sprintf( message, "ReadIntervalTimeout : %ld\n", timeouts.ReadIntervalTimeout ); report( message ); sprintf( message, "ReadTotalTimeoutMultiplier: %ld\n", timeouts.ReadTotalTimeoutMultiplier ); report( message ); } #endif /* DEBUG_VERBOSE */ if ( !SetCommTimeouts( index->hComm, &timeouts ) ) { YACK(); report( "SetCommTimeouts\n" ); return -1; } memcpy( index->ttyset, s_termios, sizeof( struct termios ) ); LEAVE( "tcsetattr" ); return 0; } /*---------------------------------------------------------- tcsendbreak() accept: perform: return: exceptions: win32api: None comments: break for duration*0.25 seconds or 0.25 seconds if duration = 0. ----------------------------------------------------------*/ int tcsendbreak( int fd, int duration ) { struct termios_list *index; COMSTAT Stat; ENTER( "tcsendbreak" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } if ( duration <= 0 ) duration = 1; if( !SetCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); /* 0.25 seconds == 250000 usec */ usleep( duration * 250000 ); if( !ClearCommBreak( index->hComm ) ) ClearErrors( index, &Stat ); LEAVE( "tcsendbreak" ); return 1; } /*---------------------------------------------------------- tcdrain() accept: file descriptor perform: wait for ouput to be written. return: 0 on success, -1 otherwise exceptions: None win32api: FlushFileBuffers comments: ----------------------------------------------------------*/ int tcdrain ( int fd ) { struct termios_list *index; char message[80]; int old_flag; ENTER( "tcdrain" ); index = find_port( fd ); if ( !index ) { LEAVE( "tcdrain" ); return -1; } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ if ( !FlushFileBuffers( index->hComm ) ) { /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them Something funky is happening on NT. GetLastError = 0. */ sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); if( GetLastError() == 0 ) { set_errno( 0 ); return(0); } set_errno( EAGAIN ); YACK(); LEAVE( "tcdrain" ); return -1; } /* sprintf( message, "FlushFileBuffers() %i\n", (int) GetLastError() ); report( message ); */ LEAVE( "tcdrain success" ); index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; /* index->tx_happened = 1; */ return 0; } /*---------------------------------------------------------- tcflush() accept: file descriptor, queue_selector perform: discard data not transmitted or read TCIFLUSH: flush data not read TCOFLUSH: flush data not transmitted TCIOFLUSH: flush both return: 0 on success, -1 on error exceptions: none win32api: PurgeComm comments: ----------------------------------------------------------*/ int tcflush( int fd, int queue_selector ) { struct termios_list *index; int old_flag; ENTER( "tcflush" ); index = find_port( fd ); if( !index) { LEAVE( "tclflush" ); return(-1); } old_flag = index->event_flag; /* index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->tx_happened = 1; */ index->tx_happened = 1; switch( queue_selector ) { case TCIFLUSH: if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; case TCOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } break; case TCIOFLUSH: if ( !PurgeComm( index->hComm, PURGE_TXABORT ) ) { goto fail; } if ( !PurgeComm( index->hComm, PURGE_RXABORT ) ) { goto fail; } break; default: /* set_errno( ENOTSUP ); */ report( "tcflush: Unknown queue_selector\n" ); LEAVE( "tcflush" ); return -1; } index->event_flag |= EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; index->tx_happened = 1; LEAVE( "tcflush" ); return( 0 ); /* FIXME Need to figure out what the various errors are in windows. YACK() should report them and we can handle them as we find them */ fail: LEAVE( "tcflush" ); set_errno( EAGAIN ); YACK(); return -1; } /*---------------------------------------------------------- tcflow() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int tcflow( int fd, int action ) { ENTER( "tcflow" ); switch ( action ) { /* Suspend transmission of output */ case TCOOFF: break; /* Restart transmission of output */ case TCOON: break; /* Transmit a STOP character */ case TCIOFF: break; /* Transmit a START character */ case TCION: break; default: return -1; } LEAVE( "tcflow" ); return 1; } /*---------------------------------------------------------- fstat() accept: perform: return: exceptions: win32api: comments: this is just to keep the eventLoop happy. ----------------------------------------------------------*/ #if 0 int fstat( int fd, ... ) { return( 0 ); } #endif /*---------------------------------------------------------- ioctl() accept: perform: return: exceptions: win32api: GetCommError(), GetCommModemStatus, EscapeCommFunction() comments: FIXME the DCB struct is: typedef struct _DCB { unsigned long DCBlength, BaudRate, fBinary:1, fParity:1; unsigned long fOutxCtsFlow:1, fOutxDsrFlow:1, fDtrControl:2; unsigned long fDsrSensitivity:1, fTXContinueOnXoff:1; unsigned long fOutX:1, fInX:1, fErrorChar:1, fNull:1; unsigned long fRtsControl:2, fAbortOnError:1, fDummy2:17; WORD wReserved, XonLim, XoffLim; BYTE ByteSize, Parity, StopBits; char XonChar, XoffChar, ErrorChar, EofChar, EvtChar; WORD wReserved1; } DCB; ----------------------------------------------------------*/ int win32_serial_ioctl( int fd, int request, ... ) { unsigned long dwStatus = 0; va_list ap; int *arg, ret, old_flag; char message[80]; #ifdef TIOCGSERIAL DCB *dcb; struct serial_struct *sstruct; #endif /* TIOCGSERIAL */ COMSTAT Stat; struct termios_list *index; #ifdef TIOCGICOUNT struct serial_icounter_struct *sistruct; #endif /* TIOCGICOUNT */ ENTER( "ioctl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "ioctl" ); return -1; } va_start( ap, request ); ret = ClearErrors( index, &Stat ); if (ret == 0) { set_errno( EBADFD ); YACK(); report( "ClearError Failed! ernno EBADFD" ); arg = va_arg( ap, int * ); va_end( ap ); return -1; } switch( request ) { case TCSBRK: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TCSBRKP: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCGSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCSSOFTCAR: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; case TIOCCBRK: case TIOCSBRK: arg = va_arg( ap, int * ); if ( EscapeCommFunction( index->hComm, ( request == TIOCSBRK ) ? SETBREAK : CLRBREAK ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); break; case TIOCMGET: arg = va_arg( ap, int * ); /* DORITOS */ if ( !GetCommModemStatus( index->hComm, &dwStatus ) ) report_error( "GetCommMOdemStatus failed!\n" ); if ( dwStatus & MS_RLSD_ON ) *arg |= TIOCM_CAR; else *arg &= ~TIOCM_CAR; if ( dwStatus & MS_RING_ON ) *arg |= TIOCM_RNG; else *arg &= ~TIOCM_RNG; if ( dwStatus & MS_DSR_ON ) *arg |= TIOCM_DSR; else *arg &= ~TIOCM_DSR; if ( dwStatus & MS_CTS_ON ) *arg |= TIOCM_CTS; else *arg &= ~TIOCM_CTS; /* I'm not seeing a way to read the MSR directly we store the state using TIOCM_* Trent */ if ( index->MSR & TIOCM_DTR ) *arg |= TIOCM_DTR; else *arg &= ~TIOCM_DTR; if ( index->MSR & TIOCM_RTS ) *arg |= TIOCM_RTS; else *arg &= ~TIOCM_RTS; /* TIOCM_LE TIOCM_ST TIOCM_SR */ va_end( ap ); return( 0 ); case TIOCMBIS: arg = va_arg( ap, int * ); if ( *arg & TIOCM_DTR ) { index->MSR |= TIOCM_DTR; if (EscapeCommFunction( index->hComm, SETDTR)) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); } if ( *arg & TIOCM_RTS ) { index->MSR |= TIOCM_RTS; if(EscapeCommFunction( index->hComm, SETRTS)) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); } break; case TIOCMBIC: arg = va_arg( ap, int * ); if ( *arg & TIOCM_DTR ) { index->MSR &= ~TIOCM_DTR; if ( EscapeCommFunction( index->hComm, CLRDTR)) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); } if ( *arg & TIOCM_RTS ) { index->MSR &= ~TIOCM_RTS; if( EscapeCommFunction( index->hComm, CLRRTS)) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); } break; case TIOCMSET: arg = va_arg( ap, int * ); if (( *arg & TIOCM_DTR) == (index->MSR & TIOCM_DTR) ) { report( "DTR is unchanged\n" ); } sprintf(message, "DTR %i %i\n", *arg&TIOCM_DTR, index->MSR & TIOCM_DTR ); report( message ); if ( *arg & TIOCM_DTR ) { index->MSR |= TIOCM_DTR; } else { index->MSR &= ~TIOCM_DTR; } if ( EscapeCommFunction( index->hComm, ( *arg & TIOCM_DTR ) ? SETDTR : CLRDTR ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); if ( (*arg & TIOCM_RTS) == ( index->MSR & TIOCM_RTS) ) { report( "RTS is unchanged\n" ); } sprintf( message, "RTS %i %i\n", *arg&TIOCM_RTS, index->MSR & TIOCM_RTS ); report( message ); if ( *arg & TIOCM_RTS ) { index->MSR |= TIOCM_RTS; } else { index->MSR &= ~TIOCM_RTS; } if( EscapeCommFunction( index->hComm, ( *arg & TIOCM_RTS ) ? SETRTS : CLRRTS ) ) report( "EscapeCommFunction: True\n" ); else report( "EscapeCommFunction: False\n" ); break; #ifdef TIOCGSERIAL case TIOCGSERIAL: report( "TIOCGSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); sstruct = va_arg( ap, struct serial_struct * ); if ( DCB_to_serial_struct( dcb, sstruct ) < 0 ) { va_end( ap ); return -1; } index->sstruct = sstruct; report( "TIOCGSERIAL\n" ); free(dcb); break; #endif /* TIOCGSERIAL */ #ifdef TIOCSSERIAL case TIOCSSERIAL: report( "TIOCSSERIAL\n" ); dcb = malloc( sizeof( DCB ) ); if( !dcb ) { va_end( ap ); return -1; } memset( dcb, 0, sizeof( DCB ) ); GetCommState( index->hComm, dcb ); index->sstruct = va_arg( ap, struct serial_struct * ); if ( serial_struct_to_DCB( index->sstruct, dcb ) < 0 ) { va_end( ap ); return -1; } report( "TIOCSSERIAL\n" ); free(dcb); break; #endif /* TIOCSSERIAL */ case TIOCSERCONFIG: case TIOCSERGETLSR: arg = va_arg( ap, int * ); /* do { wait = WaitForSingleObject( index->sol.hEvent, 5000 ); } while ( wait == WAIT_TIMEOUT ); */ ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ set_errno( EBADFD ); YACK(); report( "TIOCSERGETLSR EBADFD" ); va_end( ap ); return -1; } if ( (int ) Stat.cbOutQue == 0 ) { /* output is empty */ if( index->tx_happened == 1 ) { old_flag = index->event_flag; index->event_flag &= ~EV_TXEMPTY; SetCommMask( index->hComm, index->event_flag ); index->event_flag = old_flag; *arg = 1; index->tx_happened = 0; report( "ioctl: ouput empty\n" ); } else { *arg = 0; } ret = 0; } else { /* still data out there */ *arg = 0; ret = 0; } va_end( ap ); return(0); break; case TIOCSERGSTRUCT: case TIOCSERGETMULTI: case TIOCSERSETMULTI: va_end( ap ); return -ENOIOCTLCMD; case TIOCMIWAIT: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; /* On linux this fills a struct with all the line info (data available, bytes sent, ... */ #ifdef TIOCGICOUNT case TIOCGICOUNT: sistruct= va_arg( ap, struct serial_icounter_struct * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "TIOCGICOUNT failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } if( sistruct->frame != index->sis->frame ) { sistruct->frame = index->sis->frame; /* printf( "---------------frame = %i\n", sistruct->frame++ ); */ } if( sistruct->overrun != index->sis->overrun ) { /* printf( "---------------overrun\n" ); */ sistruct->overrun = index->sis->overrun; /* ErrCode &= ~CE_OVERRUN; */ } if( sistruct->parity != index->sis->parity ) { /* printf( "---------------parity\n" ); */ sistruct->parity = index->sis->parity; } if( sistruct->brk != index->sis->brk ) { /* printf( "---------------brk\n" ); */ sistruct->brk = index->sis->brk; } va_end( ap ); return 0; /* abolete ioctls */ #endif /* TIOCGICOUNT */ case TIOCSERGWILD: case TIOCSERSWILD: report( "TIOCSER[GS]WILD absolete\n" ); va_end( ap ); return 0; /* number of bytes available for reading */ case FIONREAD: arg = va_arg( ap, int * ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { /* FIXME ? */ report( "FIONREAD failed\n" ); set_errno( EBADFD ); va_end( ap ); return -1; } *arg = ( int ) Stat.cbInQue; #ifdef DEBUG_VERBOSE sprintf( message, "FIONREAD: %i bytes available\n", (int) Stat.cbInQue ); report( message ); if( *arg ) { sprintf( message, "FIONREAD: %i\n", *arg ); report( message ); } #endif /* DEBUG_VERBOSE */ ret = 0; break; /* pending bytes to be sent */ case TIOCOUTQ: arg = va_arg( ap, int * ); va_end( ap ); return -ENOIOCTLCMD; default: sprintf( message, "FIXME: ioctl: unknown request: %#x\n", request ); report( message ); va_end( ap ); return -ENOIOCTLCMD; } va_end( ap ); LEAVE( "ioctl" ); return 0; } /*---------------------------------------------------------- fcntl() accept: perform: return: exceptions: win32api: None comments: FIXME ----------------------------------------------------------*/ int win32_serial_fcntl( int fd, int command, ... ) { int arg, ret = 0; va_list ap; struct termios_list *index; char message[80]; ENTER( "fcntl" ); if ( fd <= 0 ) return 0; index = find_port( fd ); if ( !index ) { LEAVE( "fcntl" ); return -1; } va_start( ap, command ); arg = va_arg( ap, int ); switch ( command ) { case F_SETOWN: /* set ownership of fd */ break; case F_SETFL: /* set operating flags */ #ifdef DEBUG sprintf( message, "F_SETFL fd=%d flags=%d\n", fd, arg ); report( message ); #endif index->open_flags = arg; break; case F_GETFL: /* get operating flags */ ret = index->open_flags; break; default: sprintf( message, "unknown fcntl command %#x\n", command ); report( message ); break; } va_end( ap ); LEAVE( "fcntl" ); return ret; } #if 0 /*---------------------------------------------------------- termios_interrupt_event_loop() accept: perform: return: let Serial_select break out so the thread can die exceptions: win32api: comments: ----------------------------------------------------------*/ static void termios_interrupt_event_loop( int fd, int flag ) { struct termios_list * index = find_port( fd ); if ( !index ) { LEAVE( "termios_interrupt_event_loop" ); return; } /* index->event_flag = 0; TRENT SetCommMask( index->hComm, index->event_flag ); usleep(2000); tcdrain( index->fd ); SetEvent( index->sol.hEvent ); */ index->interrupt = flag; return; } #endif /*---------------------------------------------------------- Serial_select() accept: perform: return: number of fd's changed on success or -1 on error. exceptions: win32api: SetCommMask(), GetCommEvent(), WaitSingleObject() comments: ----------------------------------------------------------*/ #ifndef __LCC__ int win32_serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; COMSTAT Stat; int ret; ENTER( "serial_select" ); if ( fd <= 0 ) { /* Baby did a bad baad thing */ goto fail; } index = find_port( fd ); if ( !index ) goto fail; #define DATA_AVAILABLE 1 //nativeSetEventFlag( fd, SerialPortEvent.DATA_AVAILABLE, enable ); if (readfds) { int eventflags[12]; memset(eventflags, 0, sizeof(eventflags)); eventflags[DATA_AVAILABLE] = 1; termios_setflags( fd, eventflags ); } if ( !index || !index->event_flag ) { /* still setting up the port? hold off for a Sec so things can fire up this does happen. loops ~twice on a 350 Mzh with usleep(1000000) */ usleep(10000); LEAVE( "serial_uselect" ); return(0); } ResetEvent( index->wol.hEvent ); ResetEvent( index->sol.hEvent ); ResetEvent( index->rol.hEvent ); ret = ClearErrors( index, &Stat ); #if 1 if ( ret == 0 ) { goto fail; } /* look only after read */ if (readfds && !writefds && !exceptfds) { int timeout_usec = timeout ? timeout->tv_sec*1000000 + timeout->tv_usec : INT_MAX; while (timeout_usec > 0) { sprintf( message, "wait for data in read buffer%d\n", (int)Stat.cbInQue ); report( message ); if (Stat.cbInQue != 0) { goto end; } usleep(10000); /* FIXME: not very accurate wrt process time */ timeout_usec -= 10000; report( "sleep...\n" ); ret = ClearErrors( index, &Stat ); if ( ret == 0 ) { goto fail; } } } #endif while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto fail; } SetCommMask( index->hComm, index->event_flag ); ClearErrors( index, &Stat ); if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed probably overlapped though */ if ( GetLastError() != ERROR_IO_PENDING ) { ClearErrors( index, &Stat ); goto fail; } /* thought so... */ } /* could use the select timeout here but it should not be needed */ ClearErrors( index, &Stat ); wait = WaitForSingleObject( index->sol.hEvent, 100 ); switch ( wait ) { case WAIT_OBJECT_0: goto end; case WAIT_TIMEOUT: goto timeout; case WAIT_ABANDONED: default: goto fail; } } end: /* You may want to chop this out for lower latency */ usleep(1000); LEAVE( "serial_select" ); return( 1 ); timeout: LEAVE( "serial_select" ); return( 0 ); fail: YACK(); sprintf( message, "< select called error %i\n", n ); report( message ); errno = EBADFD; LEAVE( "serial_select" ); return( 1 ); } #ifdef asdf int win32_serial_select( int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout ) { unsigned long nBytes, dwCommEvent, wait = WAIT_TIMEOUT; int fd = n-1; struct termios_list *index; char message[80]; ENTER( "serial_select" ); if ( fd <= 0 ) { usleep(1000); return 1; } index = find_port( fd ); if ( !index ) { LEAVE( "serial_select" ); return -1; } if( index->interrupt == 1 ) { goto end; } while(!index->event_flag ) { usleep(1000); return -1; } while ( wait == WAIT_TIMEOUT && index->sol.hEvent ) { if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) { return 1; } if ( !WaitCommEvent( index->hComm, &dwCommEvent, &index->sol ) ) { /* WaitCommEvent failed */ if( index->interrupt == 1 ) { goto end; } if ( GetLastError() != ERROR_IO_PENDING ) { sprintf( message, "WaitCommEvent filename = %s\n", index->filename); report( message ); return(1); /* goto fail; */ } return(1); } if( index->interrupt == 1 ) { goto end; } wait = WaitForSingleObject( index->sol.hEvent, 1000 ); switch ( wait ) { case WAIT_OBJECT_0: if( index->interrupt == 1 ) { goto end; } if( !index->sol.hEvent ) return(1); if (!GetOverlappedResult( index->hComm, &index->sol, &nBytes, TRUE )) { goto end; } else if( index->tx_happened == 1 ) { goto end; } else goto end; break; case WAIT_TIMEOUT: default: return(1); /* WaitFor error */ } } end: /* usleep(1000); */ LEAVE( "serial_select" ); return( 1 ); #ifdef asdf /* FIXME this needs to be cleaned up... */ fail: sprintf( message, "< select called error %i\n", n ); YACK(); report( message ); set_errno( EBADFD ); LEAVE( "serial_select" ); return( 1 ); #endif /* asdf */ } #endif /* asdf */ #endif /* __LCC__ */ #if 0 /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened perform: Get the Parity Error Char return: the Parity Error Char exceptions: none win32api: GetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ static int termiosGetParityErrorChar( int fd ) { struct termios_list *index; DCB dcb; ENTER( "termiosGetParityErrorChar" ); index = find_port( fd ); if( !index ) { LEAVE( "termiosGetParityErrorChar" ); return(-1); } GetCommState( index->hComm, &dcb ); LEAVE( "termiosGetParityErrorChar" ); return( dcb.ErrorChar ); } /*---------------------------------------------------------- termiosSetParityError() accept: fd The device opened, value the new Parity Error Char perform: Set the Parity Error Char return: void exceptions: none win32api: GetCommState(), SetCommState() comments: No idea how to do this in Unix (handle in read?) ----------------------------------------------------------*/ static void termiosSetParityError( int fd, char value ) { DCB dcb; struct termios_list *index; ENTER( "termiosSetParityErrorChar" ); index = find_port( fd ); if ( !index ) { LEAVE( "termiosSetParityError" ); return; } GetCommState( index->hComm, &dcb ); dcb.ErrorChar = value; SetCommState( index->hComm, &dcb ); LEAVE( "termiosSetParityErrorChar" ); } #endif /*----------------------- END OF LIBRARY -----------------*/ #endif /* WIN32 */ hamlib-1.2.15.3/lib/getopt_long.c0000644000175000017500000001016512044564477013371 00000000000000/* getopt_long and getopt_long_only entry points for GNU getopt. Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "getopt.h" #if !__STDC__ && !defined(const) && IN_GCC #define const #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #if defined (_LIBC) || !defined (__GNU_LIBRARY__) /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include #else char *getenv (); #endif #ifndef NULL #define NULL 0 #endif int getopt_long (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 1); } #endif /* _LIBC or not __GNU_LIBRARY__. */ #ifdef TEST #include int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == EOF) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case 'd': printf ("option d with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ #include "getopt.c" hamlib-1.2.15.3/lib/getopt.h0000644000175000017500000001055712044564477012364 00000000000000/* Declarations for getopt. Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef _GETOPT_H #define _GETOPT_H 1 #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { #if __STDC__ const char *name; #else char *name; #endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ #define no_argument 0 #define required_argument 1 #define optional_argument 2 #if __STDC__ #if defined(__GNU_LIBRARY__) /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt (int argc, char *const *argv, const char *shortopts); #else /* not __GNU_LIBRARY__ */ extern int getopt (); #endif /* not __GNU_LIBRARY__ */ extern int getopt_long (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); extern int getopt_long_only (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind, int long_only); #else /* not __STDC__ */ extern int getopt (); extern int getopt_long (); extern int getopt_long_only (); extern int _getopt_internal (); #endif /* not __STDC__ */ #ifdef __cplusplus } #endif #endif /* _GETOPT_H */ hamlib-1.2.15.3/lib/getopt.c0000644000175000017500000005071612044564477012360 00000000000000/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu before changing it! Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* NOTE!!! AIX requires this to be the first thing in the file. Do not put ANYTHING before it! */ #if !defined (__GNUC__) && defined (_AIX) #pragma alloca #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef __GNUC__ #define alloca __builtin_alloca #else /* not __GNUC__ */ #if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(USG) && !defined(SVR4) && !defined(__svr4__)))) #include #else #ifndef _AIX char *alloca (); #endif #endif /* alloca.h */ #endif /* not __GNUC__ */ #if !__STDC__ && !defined(const) && IN_GCC #define const #endif /* This tells Alpha OSF/1 not to define a getopt prototype in . */ #ifndef _NO_PROTO #define _NO_PROTO #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #if defined (_LIBC) || !defined (__GNU_LIBRARY__) /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #undef alloca /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ #include #else /* Not GNU C library. */ #define __alloca alloca #endif /* GNU C library. */ /* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a long-named option. Because this is not POSIX.2 compliant, it is being phased out. */ /* #define GETOPT_COMPAT */ /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg = 0; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* XXX 1003.2 says this must be 1 before any call. */ int optind = 0; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return EOF with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ #include #define my_index strchr #define my_bcopy(src, dst, n) memcpy ((dst), (src), (n)) #else /* Avoid depending on library functions or files whose names are inconsistent. */ char *getenv (); static char * my_index (str, chr) const char *str; int chr; { while (*str) { if (*str == chr) return (char *) str; str++; } return 0; } static void my_bcopy (from, to, size) const char *from; char *to; int size; { int i; for (i = 0; i < size; i++) to[i] = from[i]; } #endif /* GNU C library. */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ static void exchange (argv) char **argv; { int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *); char **temp = (char **) __alloca (nonopts_size); /* Interchange the two blocks of data in ARGV. */ my_bcopy ((char *) &argv[first_nonopt], (char *) temp, nonopts_size); my_bcopy ((char *) &argv[last_nonopt], (char *) &argv[first_nonopt], (optind - last_nonopt) * sizeof (char *)); my_bcopy ((char *) temp, (char *) &argv[first_nonopt + optind - last_nonopt], nonopts_size); /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns `EOF'. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int argc; char *const *argv; const char *optstring; const struct option *longopts; int *longind; int long_only; { int option_index; optarg = 0; /* Initialize the internal data when the first call is made. Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ if (optind == 0) { first_nonopt = last_nonopt = optind = 1; nextchar = NULL; /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (getenv ("POSIXLY_CORRECT") != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; } if (nextchar == NULL || *nextchar == '\0') { if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Now skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && (argv[optind][0] != '-' || argv[optind][1] == '\0') #ifdef GETOPT_COMPAT && (longopts == NULL || argv[optind][0] != '+' || argv[optind][1] == '\0') #endif /* GETOPT_COMPAT */ ) optind++; last_nonopt = optind; } /* Special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return EOF; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if ((argv[optind][0] != '-' || argv[optind][1] == '\0') #ifdef GETOPT_COMPAT && (longopts == NULL || argv[optind][0] != '+' || argv[optind][1] == '\0') #endif /* GETOPT_COMPAT */ ) { if (ordering == REQUIRE_ORDER) return EOF; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Start decoding its characters. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } if (longopts != NULL && ((argv[optind][0] == '-' && (argv[optind][1] == '-' || long_only)) #ifdef GETOPT_COMPAT || argv[optind][0] == '+' #endif /* GETOPT_COMPAT */ )) { const struct option *p; char *s = nextchar; int exact = 0; int ambig = 0; const struct option *pfound = NULL; int indfound; while (*s && *s != '=') s++; /* Test all options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, s - nextchar)) { if (s - nextchar == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, "%s: option `%s' is ambiguous\n", argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*s) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = s + 1; else { if (opterr) { if (argv[optind - 1][1] == '-') /* --option */ fprintf (stderr, "%s: option `--%s' doesn't allow an argument\n", argv[0], pfound->name); else /* +option or -option */ fprintf (stderr, "%s: option `%c%s' doesn't allow an argument\n", argv[0], argv[optind - 1][0], pfound->name); } nextchar += strlen (nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, "%s: option `%s' requires an argument\n", argv[0], argv[optind - 1]); nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' #ifdef GETOPT_COMPAT || argv[optind][0] == '+' #endif /* GETOPT_COMPAT */ || my_index (optstring, *nextchar) == NULL) { if (opterr) { if (argv[optind][1] == '-') /* --option */ fprintf (stderr, "%s: unrecognized option `--%s'\n", argv[0], nextchar); else /* +option or -option */ fprintf (stderr, "%s: unrecognized option `%c%s'\n", argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; optind++; return '?'; } } /* Look at and handle the next option-character. */ { char c = *nextchar++; char *temp = my_index (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (opterr) { #if 0 if (c < 040 || c >= 0177) fprintf (stderr, "%s: unrecognized option, character code 0%o\n", argv[0], c); else fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c); #else /* 1003.2 specifies the format of this message. */ fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c); #endif } optopt = c; return '?'; } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = 0; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { #if 0 fprintf (stderr, "%s: option `-%c' requires an argument\n", argv[0], c); #else /* 1003.2 specifies the format of this message. */ fprintf (stderr, "%s: option requires an argument -- %c\n", argv[0], c); #endif } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } #ifdef GETOPT int getopt (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif #endif /* _LIBC or not __GNU_LIBRARY__. */ #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == EOF) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ hamlib-1.2.15.3/lib/dummy.c0000644000175000017500000000021512044564477012176 00000000000000/* Dummy function to make sure libmisc never become an empty library. * Solaris linker does not like such libs. */ void dummy(void) { } hamlib-1.2.15.3/lib/Makefile.in0000644000175000017500000004331412044564554012747 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = lib DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in dummy.c \ getaddrinfo.c getopt.c getopt_long.c gettimeofday.c termios.c \ usleep.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libmisc_la_DEPENDENCIES = @LTLIBOBJS@ am_libmisc_la_OBJECTS = libmisc_la_OBJECTS = $(am_libmisc_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libmisc_la_SOURCES) DIST_SOURCES = $(libmisc_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = getopt.c getopt.h getopt_long.c usleep.c \ termios.c win32termios.h gettimeofday.c getaddrinfo.c noinst_LTLIBRARIES = libmisc.la libmisc_la_SOURCES = libmisc_la_LIBADD = @LTLIBOBJS@ @NET_LIBS@ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libmisc.la: $(libmisc_la_OBJECTS) $(libmisc_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libmisc_la_OBJECTS) $(libmisc_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/dummy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getaddrinfo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt_long.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/gettimeofday.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/termios.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/usleep.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf $(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf $(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am # 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: hamlib-1.2.15.3/lib/win32termios.h0000644000175000017500000003005612044564477013423 00000000000000/*------------------------------------------------------------------------- | rxtx is a native interface to serial ports in java. | Copyright 1997-2002 by Trent Jarvi taj@www.linux.org.uk. | | This library is free software; you can redistribute it and/or | modify it under the terms of the GNU Lesser General Public | License as published by the Free Software Foundation; either | version 2.1 of the License, or (at your option) any later version. | | If you compile this program with cygwin32 tools this package falls | under the GPL. See COPYING.CYGNUS for details. | | This library 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 | Lesser General Public License for more details. | | You should have received a copy of the GNU Lesser General Public | License along with this library; if not, write to the Free Software | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | | This file was taken from rxtx-2.1-7pre16 and adaptated for Hamlib. --------------------------------------------------------------------------*/ #ifndef _WIN32TERMIOS_H #define _WIN32TERMIOS_H #ifndef _WIN32S_H_ #define _WIN32S_H_ #include #include #include #ifdef TRACE #define ENTER(x) report("entering "x" \n"); #define LEAVE(x) report("leaving "x" \n"); #else #define ENTER(x) #define LEAVE(x) #endif /* TRACE */ #define YACK() \ { \ char *allocTextBuf, message[80]; \ unsigned int errorCode = GetLastError(); \ FormatMessage ( \ FORMAT_MESSAGE_ALLOCATE_BUFFER | \ FORMAT_MESSAGE_FROM_SYSTEM, \ NULL, \ errorCode, \ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), \ (LPSTR)&allocTextBuf, \ 16, \ NULL ); \ sprintf( message, "Error 0x%x at %s(%d): %s\n", errorCode, __FILE__, __LINE__, allocTextBuf); \ report_error( message ); \ LocalFree(allocTextBuf); \ } typedef unsigned char cc_t; typedef unsigned int speed_t; typedef unsigned int tcflag_t; /* structs are from linux includes or linux man pages to match interfaces. */ #ifndef _TIMESPEC_DEFINED struct timespec { time_t tv_sec; long tv_nsec; }; #endif #define NCCS 32 struct termios { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_cc[NCCS]; /* control characters */ cc_t c_line; /* line discipline (== c_cc[33]) */ speed_t c_ispeed; /* input speed */ speed_t c_ospeed; /* output speed */ }; /* for TIOCGSERIAL and TIOCSSERIAL of interest are baud_base and * custom_divisor * --- NOTE: This is not used. Win32 sets custom speeds on the * kernel side. */ struct serial_struct { /* Mainly we are after baud_base/custom_diviser to match the ioctl() in SerialImp.c */ int custom_divisor; /* use to set unsupported speeds */ int baud_base; /* use to set unsupported speeds */ unsigned short close_delay, closing_wait, iomem_reg_shift; int type, line, irq, flags, xmit_fifo_size, hub6; unsigned int port, port_high; char io_type; unsigned char *iomem_base; }; struct serial_icounter_struct { int cts; /* clear to send count */ int dsr; /* data set ready count */ int rng; /* ring count */ int dcd; /* carrier detect count */ int rx; /* recieved byte count */ int tx; /* transmitted byte count */ int frame; /* frame error count */ int overrun; /* hardware overrun error count */ int parity; /* parity error count */ int brk; /* break count */ int buf_overrun; /* buffer overrun count */ int reserved[9]; /* unused */ }; int win32_serial_test( char * ); int win32_serial_open(const char *File, int flags, ... ); int win32_serial_close(int fd); int win32_serial_read(int fd, void *b, int size); int win32_serial_write(int fd, const char *Str, int length); int win32_serial_ioctl(int fd, int request, ... ); int win32_serial_fcntl(int fd, int command, ...); /* * lcc winsock.h conflicts */ #ifndef __LCC__ int win32_serial_select(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *); #define SELECT win32_serial_select #endif #define OPEN win32_serial_open #define CLOSE win32_serial_close #define READ win32_serial_read #define WRITE win32_serial_write #define IOCTL win32_serial_ioctl #define FCNTL win32_serial_fcntl #if 0 /* local functions */ void termios_interrupt_event_loop( int , int ); void termios_setflags( int , int[] ); struct termios_list *find_port( int ); int usleep(unsigned int usec); const char *get_dos_port(const char *); void set_errno(int); char *sterror(int); int B_to_CBR(int); int CBR_to_B(int); int termios_to_bytesize(int); int bytesize_to_termios(int); #endif int tcgetattr(int Fd, struct termios *s_termios); int tcsetattr(int Fd, int when, struct termios *); speed_t cfgetospeed(struct termios *s_termios); speed_t cfgetispeed(struct termios *s_termios); int cfsetspeed(struct termios *, speed_t speed); int cfsetospeed(struct termios *, speed_t speed); int cfsetispeed ( struct termios *, speed_t speed); int tcflush ( int , int ); int tcgetpgrp ( int ); int tcsetpgrp ( int , int ); int tcdrain ( int ); int tcflow ( int , int ); int tcsendbreak ( int , int ); /* int fstat(int fd, ... ); */ void cfmakeraw(struct termios *s_termios); #if 0 int termiosGetParityErrorChar( int ); void termiosSetParityError( int, char ); #endif #define O_NOCTTY 0400 /* not for fcntl */ #define O_NONBLOCK 00004 #define O_NDELAY O_NONBLOCK #define O_SYNC 040000 #define O_FSYNC O_SYNC #define O_ASYNC 020000 /* fcntl, for BSD compatibility */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get f_flags */ #define F_SETFD 2 /* set f_flags */ #define F_GETFL 3 /* more flags (cloexec) */ #define F_SETFL 4 #define F_GETLK 7 #define F_SETLK 8 #define F_SETLKW 9 #define F_SETOWN 5 /* for sockets. */ #define F_GETOWN 6 /* for sockets. */ /* for F_[GET|SET]FL */ #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ /* for posix fcntl() and lockf() */ #define F_RDLCK 1 #define F_WRLCK 2 #define F_UNLCK 8 /* for old implementation of bsd flock () */ #define F_EXLCK 16 /* or 3 */ #define F_SHLCK 32 /* or 4 */ /* operations for bsd flock(), also used by the kernel implementation */ #define LOCK_SH 1 /* shared lock */ #define LOCK_EX 2 /* exclusive lock */ #define LOCK_NB 4 /* or'd with one of the above to prevent blocking */ #define LOCK_UN 8 /* remove lock */ /* c_cc characters */ #define VINTR 0 #define VQUIT 1 #define VERASE 2 #define VKILL 3 #define VEOF 4 #define VTIME 5 #define VMIN 6 #define VSWTC 7 #define VSTART 8 #define VSTOP 9 #define VSUSP 10 #define VEOL 11 #define VREPRINT 12 #define VDISCARD 13 #define VWERASE 14 #define VLNEXT 15 #define VEOL2 16 /* c_iflag bits */ #define IGNBRK 0000001 #define BRKINT 0000002 #define IGNPAR 0000004 #define PARMRK 0000010 #define INPCK 0000020 #define ISTRIP 0000040 #define INLCR 0000100 #define IGNCR 0000200 #define ICRNL 0000400 #define IXON 0002000 #define IXANY 0004000 #define IXOFF 0010000 #define IMAXBEL 0020000 #define CRTS_IFLOW 0040000 #define CCTS_OFLOW 0100000 #define CIGNORE 0400000 #define CRTSCTS 020000000000 /* flow control */ #define HARDWARE_FLOW_CONTROL CRTSCTS #define CRTSXOFF 010000000000 /* c_oflag bits */ #define OPOST 0000001 #define ONLCR 0000002 #define OLCUC 0000004 #define OCRNL 0000010 #define ONOCR 0000020 #define ONLRET 0000040 #define OFILL 00000100 #define OFDEL 00000200 #define NLDLY 00001400 #define NL0 00000000 #define NL1 00000400 #define NL2 00001000 #define NL3 00001400 #define TABDLY 00006000 #define TAB0 00000000 #define TAB1 00002000 #define TAB2 00004000 #define TAB3 00006000 #define CRDLY 00030000 #define CR0 00000000 #define CR1 00010000 #define CR2 00020000 #define CR3 00030000 #define FFDLY 00040000 #define FF0 00000000 #define FF1 00040000 #define BSDLY 00100000 #define BS0 00000000 #define BS1 00100000 #define VTDLY 00200000 #define VT0 00000000 #define VT1 00200000 #define XTABS 01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */ /* c_cflag bit meaning */ # define CBAUD 0010017 #define B0 0000000 /* hang up */ #define B50 0000001 #define B75 0000002 #define B110 0000003 #define B134 0000004 #define B150 0000005 #define B200 0000006 #define B300 0000007 #define B600 0000010 #define B1200 0000011 #define B1800 0000012 #define B2400 0000013 #define B4800 0000014 #define B9600 0000015 #define B19200 0000016 #define B38400 0000017 #define B57600 0010001 #define B115200 0010002 #define B230400 0010003 #define B460800 0010004 #define B500000 0010005 #define B576000 0010006 #define B921600 0010007 #define B1000000 0010010 #define B1152000 0010011 #define B1500000 0010012 #define B2000000 0010013 #define B2500000 0010014 #define B3000000 0010015 #define B3500000 0010016 #define B4000000 0010017 /* glue for unsupported linux speeds see also SerialImp.h.h */ #define B14400 1010001 #define B28800 1010002 #define B128000 1010003 #define B256000 1010004 #define EXTA B19200 #define EXTB B38400 #define CSIZE 0000060 #define CS5 0000000 #define CS6 0000020 #define CS7 0000040 #define CS8 0000060 #define CSTOPB 0000100 #define CREAD 0000200 #define PARENB 0000400 #define PARODD 0001000 #define HUPCL 0002000 #define CLOCAL 0004000 # define CBAUDEX 0010000 # define CIBAUD 002003600000 /* input baud rate (not used) */ # define CRTSCTS 020000000000 /* flow control */ /* c_l flag */ #define ISIG 0000001 #define ICANON 0000002 #define XCASE 0000004 #define ECHO 0000010 #define ECHOE 0000020 #define ECHOK 0000040 #define ECHONL 0000100 #define NOFLSH 0000200 #define TOSTOP 0000400 #define ECHOCTL 0001000 #define ECHOPRT 0002000 #define ECHOKE 0004000 #define FLUSHO 0010000 #define PENDIN 0040000 #define IEXTEN 0100000 /* glue for unsupported windows speeds */ #define CBR_230400 230400 #define CBR_28800 28800 #define CBR_460800 460800 #define CBR_500000 500000 #define CBR_576000 576000 #define CBR_921600 921600 #define CBR_1000000 1000000 #define CBR_1152000 1152000 #define CBR_1500000 1500000 #define CBR_2000000 2000000 #define CBR_2500000 2500000 #define CBR_3000000 3000000 #define CBR_3500000 3500000 #define CBR_4000000 4000000 /* Values for the ACTION argument to `tcflow'. */ #define TCOOFF 0 #define TCOON 1 #define TCIOFF 2 #define TCION 3 /* Values for the QUEUE_SELECTOR argument to `tcflush'. */ #define TCIFLUSH 0 #define TCOFLUSH 1 #define TCIOFLUSH 2 /* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */ #define TCSANOW 0 #define TCSADRAIN 1 #define TCSAFLUSH 2 /* ioctls */ #define TIOCSERGETLSR 0x5459 #endif /*_WIN32S_H_*/ /* unused ioctls */ #define TCSBRK 0x5409 #define TIOCCBRK 0x540a #define TIOCSBRK 0x540b #define TIOCOUTQ 0x5411 #define TIOCMGET 0x5415 #define TIOCMBIS 0x5416 #define TIOCMBIC 0x5417 #define TIOCMSET 0x5418 #define TIOCGSOFTCAR 0x5419 #define TIOCSSOFTCAR 0x541a #define TIOCSER_TEMP 0x01 /* #define FIONREAD 0x541b TIOC[GS]SERIAL is not used on win32. It was dropped after we could not find a way to get/set buad_base and divisor directly. #define TIOCGSERIAL 0x541e #define TIOCSSERIAL 0x541f */ #define TCSBRKP 0x5425 #define TIOCSERCONFIG 0x5453 #define TIOCSERGWILD 0x5454 #define TIOCSERSWILD 0x5455 #define TIOCSERGSTRUCT 0x5458 #define TIOCSERGETMULTI 0x545a #define TIOCSERSETMULTI 0x545b #define TIOCMIWAIT 0x545c /* this would require being able to get the number of overruns ... */ /* FIXME frame and parity errors caused crashes in testing BlackBox */ #define TIOCGICOUNT 0x545d /* ioctl errors */ #define ENOIOCTLCMD 515 #define EBADFD 77 /* modem lines */ #define TIOCM_LE 0x001 #define TIOCM_DTR 0x002 #define TIOCM_RTS 0x004 #define TIOCM_ST 0x008 #define TIOCM_SR 0x010 #define TIOCM_CTS 0x020 #define TIOCM_CAR 0x040 #define TIOCM_RNG 0x080 #define TIOCM_DSR 0x100 #define TIOCM_CD TIOCM_CAR #define TIOCM_RI TIOCM_RNG #define CMSPAR 010000000000 /* mark or space parity */ #endif /* _WIN32TERMIOS_H */ hamlib-1.2.15.3/lib/getaddrinfo.c0000644000175000017500000000713012044564477013334 00000000000000/* * Hamlib Interface - getaddrinfo replacement * Copyright (c) 2000-2010 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* Forcing WINVER in MinGW yanks in getaddrinfo(), but locks out Win95/Win98 */ /* #define WINVER 0x0501 */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* Standard input/output definitions */ #include /* UNIX standard function definitions */ #include /* File control definitions */ #include /* Error number definitions */ #include #include #ifdef HAVE_NETINET_IN_H #include #endif #if HAVE_NETDB_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #elif HAVE_WS2TCPIP_H #include #endif /* * Replacement for getaddrinfo. Only one addrinfo is returned. * Weak checking. * Return 0 when success, otherwise -1. */ #ifndef HAVE_GETADDRINFO int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res) { struct addrinfo *p; int ai_family, ai_socktype, ai_protocol, ai_flags; /* limitation: service must be non null */ if (!service) return -1; if (hints == NULL) { ai_family = AF_UNSPEC; ai_socktype = 0; ai_protocol = 0; ai_flags = 0; } else { ai_family = hints->ai_family; ai_socktype = hints->ai_socktype; ai_protocol = hints->ai_protocol; ai_flags = hints->ai_flags; } /* limitation: this replacement function only for IPv4 */ if (ai_family == AF_UNSPEC) ai_family = AF_INET; if (ai_family != AF_INET) return -1; p = malloc(sizeof(struct addrinfo)); if (!p) return -1; memset(p, 0, sizeof(struct addrinfo)); p->ai_family = ai_family; p->ai_socktype = ai_socktype; p->ai_protocol = ai_protocol; p->ai_addrlen = sizeof(struct sockaddr_in); p->ai_addr = malloc(p->ai_addrlen); if (!p->ai_addr) { free(p); return -1; } memset((char *) p->ai_addr, 0, p->ai_addrlen); ((struct sockaddr_in*)p->ai_addr)->sin_family = p->ai_family; /* limitation: the service must be a port _number_ */ ((struct sockaddr_in*)p->ai_addr)->sin_port = htons(atoi(service)); /* limitation: the node must be in numbers-and-dots notation */ if (!node && (ai_flags & AI_PASSIVE)) ((struct sockaddr_in*)p->ai_addr)->sin_addr.s_addr = INADDR_ANY; else ((struct sockaddr_in*)p->ai_addr)->sin_addr.s_addr = inet_addr(node); *res = p; return 0; } void freeaddrinfo(struct addrinfo *res) { free(res->ai_addr); free(res); } #endif /* !HAVE_GETADDRINFO */ #if !defined(HAVE_DECL_GAI_STRERROR) && !defined(gai_strerror) const char *gai_strerror(int errcode) { return strerror(errcode); } #endif /* !HAVE_DECL_GAI_STRERROR */ hamlib-1.2.15.3/lib/usleep.c0000644000175000017500000000341512044564477012345 00000000000000/* Copyright (C) 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include #ifndef HAVE_USLEEP #include #include #ifdef HAVE_SYS_SELECT_H # include #endif #ifdef HAVE_WINDOWS_H #include #endif #ifdef HAVE_WINBASE_H # include #endif #ifdef apollo # include # include static time_$clock_t DomainTime100mS = { 0, 100000/4 }; static status_$t DomainStatus; #endif /* Sleep USECONDS microseconds, or until a previously set timer goes off. */ int usleep (unsigned long useconds) { #ifdef apollo /* The usleep function does not work under the SYS5.3 environment. Use the Domain/OS time_$wait call instead. */ time_$wait (time_$relative, DomainTime100mS, &DomainStatus); #elif defined(HAVE_SSLEEP) /* Win32 */ Sleep( useconds/1000 ); #else struct timeval delay; delay.tv_sec = 0; delay.tv_usec = useconds; select (0, 0, 0, 0, &delay); #endif return 0; } #endif /* !HAVE_USLEEP */ hamlib-1.2.15.3/lib/Makefile.am0000644000175000017500000000032312044564477012733 00000000000000EXTRA_DIST = getopt.c getopt.h getopt_long.c usleep.c \ termios.c win32termios.h gettimeofday.c getaddrinfo.c noinst_LTLIBRARIES = libmisc.la libmisc_la_SOURCES = libmisc_la_LIBADD = @LTLIBOBJS@ @NET_LIBS@ hamlib-1.2.15.3/lib/gettimeofday.c0000644000175000017500000000062212044564477013526 00000000000000 #include #ifdef HAVE_WINDOWS_H #include #endif #ifdef HAVE_WINBASE_H # include #endif #ifdef HAVE_SYS_TIME_H #include #endif /* * broken implementation for WIN32. * FIXME: usec precision */ int gettimeofday(struct timeval *tv, struct timezone *tz) { if (tv) { time_t tm; time(&tm); tv->tv_sec = tm; tv->tv_usec = 0; } return 0; } hamlib-1.2.15.3/sartek/0000755000175000017500000000000012044565030011466 500000000000000hamlib-1.2.15.3/sartek/Makefile.in0000644000175000017500000004737512044564556013507 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = sartek DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_sartek_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am_hamlib_sartek_la_OBJECTS = sartek.lo hamlib_sartek_la_OBJECTS = $(am_hamlib_sartek_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_sartek_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_sartek_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_sartek_la_SOURCES) DIST_SOURCES = $(hamlib_sartek_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = hamlib-sartek.la hamlib_sartek_la_SOURCES = sartek.c hamlib_sartek_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_sartek_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = sartek.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu sartek/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu sartek/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-sartek.la: $(hamlib_sartek_la_OBJECTS) $(hamlib_sartek_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_sartek_la_LINK) -rpath $(pkglibdir) $(hamlib_sartek_la_OBJECTS) $(hamlib_sartek_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sartek.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/sartek/sartek.c0000644000175000017500000000703012044564477013061 00000000000000/* * Hamlib backend library for the SARtek rotor command set. * * sartek.c - (C) Stephane Fillod 2003 * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* Standard library definitions */ #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rotator.h" #include "serial.h" #include "register.h" #include "sartek.h" /* ************************************* * * Seperate model capabilities * * ************************************* */ /* * SARtek rotor capabilities * * Documentation from: * http://www.hosenose.com/sartek/ifcspecs.htm */ const struct rot_caps sartek_rot_caps = { .rot_model = ROT_MODEL_SARTEK1, .model_name = "SARtek-1", .mfg_name = "SARtek", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rot_type = ROT_TYPE_OTHER, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 1200, .serial_rate_max = 1200, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 0, .timeout = 1000, .retry = 3, .min_az = 0, .max_az = 360, .min_el = 0, .max_el = 0, .priv = NULL, /* priv */ .set_position = sartek_rot_set_position, .stop = sartek_rot_stop, }; /* ************************************ * * API functions * * ************************************ */ /* * Set position * SARtek protocol supports azimuth only--elevation is ignored * Range is converted to an integer string, 0 to 360 degrees */ static int sartek_rot_set_position(ROT *rot, azimuth_t azimuth, elevation_t elevation) { char cmdstr[8]; int len, err; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); if (!rot) return -RIG_EINVAL; if (azimuth < 0 || azimuth > 360) return -RIG_EINVAL; if (azimuth < 2) { azimuth = 2; } else if (azimuth > 358) { azimuth = 358; } len = sprintf(cmdstr, "P%c", (int) ((azimuth * 255) / 360)); err = write_block(&rot->state.rotport, cmdstr, len); if (err != RIG_OK) return err; return RIG_OK; } /* * Stop rotation */ static int sartek_rot_stop(ROT *rot) { int err; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); err = write_block(&rot->state.rotport, "P\0", 2); if (err != RIG_OK) return err; return RIG_OK; } /* * Initialize backend */ DECLARE_INITROT_BACKEND(sartek) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __FUNCTION__); rot_register(&sartek_rot_caps); return RIG_OK; } hamlib-1.2.15.3/sartek/Makefile.am0000644000175000017500000000034112044564477013456 00000000000000 pkglib_LTLIBRARIES = hamlib-sartek.la hamlib_sartek_la_SOURCES = sartek.c hamlib_sartek_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_sartek_la_LIBADD = $(top_builddir)/src/libhamlib.la noinst_HEADERS = sartek.h hamlib-1.2.15.3/sartek/sartek.h0000644000175000017500000000225312044564477013070 00000000000000/* * Hamlib backend library for the SARtek rotor command set. * * sartek.h - (C) Stephane Fillod 2003 * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROT_SARTEK_H #define _ROT_SARTEK_H 1 #define AZ_READ_LEN 4 extern const struct rot_caps sartek_rot_caps; /* * API local implementation * */ static int sartek_rot_set_position(ROT *rot, azimuth_t azimuth, elevation_t elevation); static int sartek_rot_stop(ROT *rot); #endif /* _ROT_SARTEK_H */ hamlib-1.2.15.3/rotorez/0000755000175000017500000000000012044565027011707 500000000000000hamlib-1.2.15.3/rotorez/rotorez.h0000644000175000017500000000331712044564477013520 00000000000000/* * Hamlib backend library for the DCU rotor command set. * * rotorez.h - (C) Nate Bargmann 2003,2009,2010 (n0nb at arrl.net) * * This shared library provides an API for communicating * via serial interface to a Hy-Gain or Yaesu rotor using * the Idiom Press Rotor-EZ or RotorCard interface. It also * supports the Hy-Gain DCU-1. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _ROT_ROTOREZ_H #define _ROT_ROTOREZ_H 1 #include "token.h" #define AZ_READ_LEN 4 extern const struct rot_caps rotorez_rot_caps; extern const struct rot_caps rotorcard_rot_caps; extern const struct rot_caps dcu_rot_caps; extern const struct rot_caps erc_rot_caps; /* * Tokens used by rotorez_rot_set_conf and the 'C' command in rotctl * and rotctld followed by a value of '0' to disable a Rotor-EZ option * and '1' to enable it. */ #define TOK_ENDPT TOKEN_BACKEND(1) #define TOK_JAM TOKEN_BACKEND(2) #define TOK_OVRSHT TOKEN_BACKEND(3) #define TOK_UNSTICK TOKEN_BACKEND(4) #endif /* _ROT_ROTOREZ_H */ hamlib-1.2.15.3/rotorez/rotorez.txt0000644000175000017500000001240512044564477014106 00000000000000January 17, 2009: As of version 0.5 of the rotorez backend, the serial timeout has been shortened to 1500 mS and the retry count reduced to 2 to speed up recovery when flushing the buffer as described below. Also, four tokens have been defined in rotorez.h for the set_conf function used by `rotctl' and `rotctld'. They are: ENDPT, JAM, OVRSHT, UNSTICK and have the integer values of 1-4 respectively. Until tokens are more completely developed in the Hamlib frontend, passing the integers to `rotcrl' and `rotctld' will be necessary. The 'value' given to `rotclt' and `rotctld' is the character '0' or '1' to disable or enable the function. For example, to disable Endpoint Protection give the command 'C 1 0' and to enable it again use 'C 1 1'. ----- Further testing has revealed that the RotorEZ interface will place undocumented characters into the serial buffer. Additions to the rotorez backend now take this into account and test for a valid azimuth reply and flush the buffer if necessary. When the unit is first powered on, it appears as though at least one character is placed into the buffer. I have seen this as 0xE0 although it is possible some other character could be placed there. If the RotorEZ should receive an invalid command, such as an the ';' character while the rotor is not in motion, as sent by the rotorez_rot_stop function ('S' command from `rotctl'), it will output the following string, "C2000 IDIOM V1.4S " into the input buffer. A new function, rotorez_flush_buffer, flushes the buffer by reading it until a timeout occurs. Once the timeout occurs, this function returns and the buffer is presumed to be empty. Should read_block return an IO error, it is passed back to the application. Flushing the buffer is done by reading the buffer until the read_block function times out. By necessity, this means that the delay could be up to a few seconds before the rotorez_rot_get_position function returns a valid azimuth. ======================================================================= January 12, 2003: The following email describes the command set used by the Rotor-EZ interface for Hy-Gain rotors and the RotorCard interface for Yaesu rotors manufactured and sold by Idiom Press, http://www.idiompres.com The Hy-Gain DCU-1/DCU-1X Digital Control Unit supports a subset of these commands--AP1XXX; and AM1; The DCU-1/DCU-1X is manufactured and sold by Hy-Gain, http://www.hy-gain.com From: "sales@idiompress.com" To: "Nate Bargmann" Subject: Re: Rotor Card and Rotor-EZ command reference Date: Fri, 10 Jan 2003 09:38:52 -0800 Here you go: Important note: The program you are using must insert leading zeros into bearing commands, such as "009" degrees, instead of "9" degrees. Most programs are already configured this way, but some are not in their default mode, and in such cases you must change the default setting or the RS-232 portion of Rotor-EZ will not work properly. Rotor-EZ can also be commanded from any terminal having RS232 output, using the following configuration: 4800 baud, 8,N,1 Note that upper case/lower case must be used as listed for the commands below to work: "AP1xxx" sets target bearing to "xxx" degrees where xxx are three digits between 000 and 360, and executes. A typical command to rotate to 080 degrees would be AP1080 Note that the is often labeled on many keyboards. "AP1xxx;" sets the target bearing but does not execute. "AM1;" executes rotation to the bearing set by the "AP1xxx;" command "AI1;" inquires current bearing; and responds with (000-359) degrees ";" terminates rotation "E" enable endpoint option - effective immediately "e" disable endpoint option - effective immediately "O" enable overshoot option - effective immediately "o" disable overshoot option - effective immediately "S" enable unstick option - effective immediately "s" disable unstick option - effective immediately "V" reports version number "J" enable jam protection - effective immediately "j" disable jam protection - effective immediately - NOT recommended! Note that during any rotation initiated by an RS232 command, the rotation can be halted and further rotation cancelled by a momentary press of the Brake paddle. Also, an RS232 operation can be overridden by using the pointing control during rotation; when the control is moved rotation will cease and the control will wait for a new command after the five second brake delay is completed. 73 ----- Original Message ----- From: Nate Bargmann To: Sent: Friday, January 10, 2003 8:23 AM Subject: Rotor Card and Rotor-EZ command reference > Hi! > > I am working with a software project called Hamlib > http://hamlib.sourceforge.net and I would like to add support for the > Rotor Card and Rotor-EZ into our library. In the course of several Web > searches I have downloaded the Hy-Gain DCU-1 manual from their site and > I've also visited the Digital Audio Rotor-EZ troubleshooting site. > Between the two I have found a couple of descrepancies in the command > set. If possible, I would like a copy of the complete command set and > their syntax for these two boards for our project. > > Thanks! > > 73, de Nate >> > hamlib-1.2.15.3/rotorez/rotorez.c0000644000175000017500000004154112044564477013514 00000000000000/* * Hamlib backend library for the DCU rotor command set. * * rotorez.c - (C) Nate Bargmann 2003,2009,2010 (n0nb at arrl.net) * * This shared library provides an API for communicating * via serial interface to a Hy-Gain or Yaesu rotor using * the Idiom Press Rotor-EZ or RotorCard interface. It also * supports the Hy-Gain DCU-1, and DF9GR ERC. * * Rotor-EZ is a trademark of Idiom Press * Hy-Gain is a trademark of MFJ Enterprises * * Tested on a HAM-IV with the Rotor-EZ V1.4S interface installed. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* Standard library definitions */ #include /* String function definitions */ #include /* UNIX standard function definitions */ #include /* for isdigit function */ #include "hamlib/rotator.h" #include "serial.h" #include "misc.h" #include "register.h" #include "iofunc.h" #include "rotorez.h" /* * API local implementation * */ static int rotorez_rot_init(ROT *rot); static int rotorez_rot_cleanup(ROT *rot); static int rotorez_rot_set_position(ROT *rot, azimuth_t azimuth, elevation_t elevation); static int rotorez_rot_get_position(ROT *rot, azimuth_t *azimuth, elevation_t *elevation); static int erc_rot_get_position(ROT *rot, azimuth_t *azimuth, elevation_t *elevation); static int rotorez_rot_reset(ROT *rot, rot_reset_t reset); static int rotorez_rot_stop(ROT *rot); static int dcu1_rot_stop(ROT *rot); static int rotorez_rot_set_conf(ROT *rot, token_t token, const char *val); static const char *rotorez_rot_get_info(ROT *rot); /* * Private data structure */ struct rotorez_rot_priv_data { azimuth_t az; }; /* * Private helper function prototypes */ static int rotorez_send_priv_cmd(ROT *rot, const char *cmd); static int rotorez_flush_buffer(ROT *rot); /* * local configuration parameters */ static const struct confparams rotorez_cfg_params[] = { { TOK_ENDPT, "endpt", "Endpoint option", "Endpoint option", NULL, RIG_CONF_CHECKBUTTON, { } }, { TOK_JAM, "jam", "Jam protection", "Jam protection", NULL, RIG_CONF_CHECKBUTTON, { } }, { TOK_OVRSHT, "oversht", "Overshoot option", "Overshoot option", NULL, RIG_CONF_CHECKBUTTON, { } }, { TOK_UNSTICK, "unstick", "Unstick option", "Unstick option", NULL, RIG_CONF_CHECKBUTTON, { } }, { RIG_CONF_END, NULL, } }; /* ************************************* * * Separate model capabilities * * ************************************* */ /* * Idiom Press Rotor-EZ enhanced rotor capabilities for * Hy-Gain CD45, Ham-II, Ham-III, Ham IV and all TailTwister rotors */ const struct rot_caps rotorez_rot_caps = { .rot_model = ROT_MODEL_ROTOREZ, .model_name = "Rotor-EZ", .mfg_name = "Idiom Press", .version = "2010-02-14", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rot_type = ROT_TYPE_OTHER, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 500, .timeout = 1500, .retry = 2, .min_az = 0, .max_az = 360, .min_el = 0, .max_el = 0, .priv = NULL, /* priv */ .cfgparams = rotorez_cfg_params, .rot_init = rotorez_rot_init, .rot_cleanup = rotorez_rot_cleanup, .set_position = rotorez_rot_set_position, .get_position = rotorez_rot_get_position, .stop = rotorez_rot_stop, .set_conf = rotorez_rot_set_conf, .get_info = rotorez_rot_get_info, }; /* * Idiom Press RotorCard enhanced rotor capabilities for * Yaesu SDX and DXA series rotors */ const struct rot_caps rotorcard_rot_caps = { .rot_model = ROT_MODEL_ROTORCARD, .model_name = "RotorCard", .mfg_name = "Idiom Press", .version = "2010-02-14", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rot_type = ROT_TYPE_OTHER, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 500, .timeout = 1500, .retry = 2, .min_az = 0, .max_az = 360, .min_el = 0, .max_el = 0, .priv = NULL, /* priv */ .cfgparams = rotorez_cfg_params, .rot_init = rotorez_rot_init, .rot_cleanup = rotorez_rot_cleanup, .set_position = rotorez_rot_set_position, .get_position = rotorez_rot_get_position, .stop = rotorez_rot_stop, .set_conf = rotorez_rot_set_conf, .get_info = rotorez_rot_get_info, }; /* * Hy-Gain DCU-1/DCU-1X rotor capabilities */ const struct rot_caps dcu_rot_caps = { .rot_model = ROT_MODEL_DCU, .model_name = "DCU-1/DCU-1X", .mfg_name = "Hy-Gain", .version = "2010-08-23", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rot_type = ROT_TYPE_OTHER, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 500, .timeout = 1500, .retry = 2, .min_az = 0, .max_az = 360, .min_el = 0, .max_el = 0, .priv = NULL, /* priv */ .rot_init = rotorez_rot_init, .rot_cleanup = rotorez_rot_cleanup, .set_position = rotorez_rot_set_position, .stop = dcu1_rot_stop, .reset = rotorez_rot_reset, .get_info = rotorez_rot_get_info, }; /* * Rotor capabilities for DF9GR ERC * * TODO: Learn of additional capabilities of the ERC */ const struct rot_caps erc_rot_caps = { .rot_model = ROT_MODEL_ERC, .model_name = "ERC", .mfg_name = "DF9GR", .version = "2010-08-23b", /* second revision on 23 Aug 2010 */ .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rot_type = ROT_TYPE_OTHER, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 1, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 500, .timeout = 1500, .retry = 2, .min_az = 0, .max_az = 360, .min_el = 0, .max_el = 0, .priv = NULL, /* priv */ // .cfgparams = rotorez_cfg_params, .rot_init = rotorez_rot_init, .rot_cleanup = rotorez_rot_cleanup, .set_position = rotorez_rot_set_position, .get_position = erc_rot_get_position, .stop = dcu1_rot_stop, .reset = rotorez_rot_reset, // .stop = rotorez_rot_stop, // .set_conf = rotorez_rot_set_conf, .get_info = rotorez_rot_get_info, }; /* ************************************ * * API functions * * ************************************ */ /* * Initialize data structures */ static int rotorez_rot_init(ROT *rot) { struct rotorez_rot_priv_data *priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rot) return -RIG_EINVAL; priv = (struct rotorez_rot_priv_data *) malloc(sizeof(struct rotorez_rot_priv_data)); if (!priv) return -RIG_ENOMEM; rot->state.priv = (void *)priv; rot->state.rotport.type.rig = RIG_PORT_SERIAL; priv->az = 0; return RIG_OK; } /* * Clean up allocated memory structures */ static int rotorez_rot_cleanup(ROT *rot) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rot) return -RIG_EINVAL; if (rot->state.priv) free(rot->state.priv); rot->state.priv = NULL; return RIG_OK; } /* * Set position * DCU protocol supports azimuth only--elevation is ignored * Range is converted to an integer string, 0 to 360 degrees */ static int rotorez_rot_set_position(ROT *rot, azimuth_t azimuth, elevation_t elevation) { char cmdstr[8]; char execstr[5] = "AM1;"; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rot) return -RIG_EINVAL; if (azimuth < 0 || azimuth > 360) return -RIG_EINVAL; if (azimuth > 359.4999) /* DCU-1 compatibility */ azimuth = 0; sprintf(cmdstr, "AP1%03.0f;", azimuth); /* Target bearing */ err = rotorez_send_priv_cmd(rot, cmdstr); if (err != RIG_OK) return err; err = rotorez_send_priv_cmd(rot, execstr); /* Execute command */ if (err != RIG_OK) return err; return RIG_OK; } /* * Get position * Returns current azimuth position in whole degrees. * Range returned from Rotor-EZ is an integer, 0 to 359 degrees * Elevation is set to 0 */ static int rotorez_rot_get_position(ROT *rot, azimuth_t *azimuth, elevation_t *elevation) { struct rot_state *rs; char cmdstr[5] = "AI1;"; char az[5]; /* read azimuth string */ char *p; azimuth_t tmp = 0; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rot) return -RIG_EINVAL; do { err = rotorez_send_priv_cmd(rot, cmdstr); if (err != RIG_OK) return err; rs = &rot->state; err = read_block(&rs->rotport, az, AZ_READ_LEN); if (err != AZ_READ_LEN) return -RIG_ETRUNC; /* The azimuth string should be ';xxx' beginning at offset 0. If the * ';' is not there, it's likely the RotorEZ has received an invalid * command and the buffer needs to be flushed. See * rotorez_flush_buffer() definition below for a complete description. */ if (az[0] != ';') { err = rotorez_flush_buffer(rot); if (err == -RIG_EIO) return err; else err = -RIG_EINVAL; } else if (err == AZ_READ_LEN && az[0] == ';') { /* Check if remaining chars are digits if az[0] == ';' */ for (p = az + 1;p < az + 4; p++) if (isdigit(*p)) continue; else err = -RIG_EINVAL; } } while (err == -RIG_EINVAL); /* * Rotor-EZ returns a four octet string consisting of a ';' followed * by three octets containing the rotor's position in degrees. The * semi-colon is ignored when passing the string to atof(). */ az[4] = 0x00; /* NULL terminated string */ p = az + 1; /* advance past leading ';' */ tmp = (azimuth_t)atof(p); rig_debug(RIG_DEBUG_TRACE, "%s: \"%s\" after conversion = %.1f\n", __func__, p, tmp); if (tmp == 360) tmp = 0; else if (tmp < 0 || tmp > 359) return -RIG_EINVAL; *azimuth = tmp; *elevation = 0; /* RotorEZ does not support elevation */ rig_debug(RIG_DEBUG_TRACE, "%s: azimuth = %.1f deg; elevation = %.1f deg\n", __func__, *azimuth, *elevation); return RIG_OK; } /* * Get position for ERC * Returns current azimuth position in whole degrees. * Range returned from ERC is an integer, 0 to 359 degrees * Elevation is set to 0 */ static int erc_rot_get_position(ROT *rot, azimuth_t *azimuth, elevation_t *elevation) { struct rot_state *rs; char cmdstr[5] = "AI1;"; char az[5]; /* read azimuth string */ char *p; azimuth_t tmp = 0; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rot) return -RIG_EINVAL; do { err = rotorez_send_priv_cmd(rot, cmdstr); if (err != RIG_OK) return err; rs = &rot->state; err = read_block(&rs->rotport, az, AZ_READ_LEN); if (err != AZ_READ_LEN) return -RIG_ETRUNC; /* * The azimuth string returned by the ERC should be 'xxx;' * beginning at offset 0. A new version may implement the * Idiom PRess format, hence the test for ';xxx'. */ /* Check if remaining chars are digits if az[3] == ';' */ if (az[3] == ';') { for (p = az; p < az + 3; p++) if (isdigit(*p)) continue; else err = -RIG_EINVAL; } else if (az[0] == ';') { /* Check if remaining chars are digits if az[0] == ';' */ for (p = az + 1;p < az + 4; p++) if (isdigit(*p)) continue; else err = -RIG_EINVAL; } } while (err == -RIG_EINVAL); /* * Old ERC returns a four octet string consisting of three octets * followed by ';' ('xxx;') containing the rotor's position in degrees. * A new version will implement Idiom Press format of ';xxx'. * * We test for either case and pass a string of only digits to atof() */ az[4] = 0x00; /* NULL terminated string */ p = az; if (*p == ';') p++; else az[3] = 0x00; /* truncate trailing ';' */ tmp = (azimuth_t)atof(p); rig_debug(RIG_DEBUG_TRACE, "%s: \"%s\" after conversion = %.1f\n", __func__, p, tmp); if (tmp == 360) tmp = 0; else if (tmp < 0 || tmp > 359) return -RIG_EINVAL; *azimuth = tmp; *elevation = 0; /* ERC does not support elevation */ rig_debug(RIG_DEBUG_TRACE, "%s: azimuth = %.1f deg; elevation = %.1f deg\n", __func__, *azimuth, *elevation); return RIG_OK; } /* * Stop rotation on RotorEZ, reset on DCU-1 * * Sending the ";" string will stop rotation on the RotorEZ and reset the DCU-1 */ static int rotorez_rot_stop(ROT *rot) { char cmdstr[2] = ";"; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rot) return -RIG_EINVAL; err = rotorez_send_priv_cmd(rot, cmdstr); if (err != RIG_OK) return err; return RIG_OK; } static int rotorez_rot_reset(ROT *rot, rot_reset_t reset) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return rotorez_rot_stop(rot); } /* * Stop rotation on DCU-1 */ static int dcu1_rot_stop(ROT *rot) { char cmdstr[5] = "AS1;"; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rot) return -RIG_EINVAL; err = rotorez_send_priv_cmd(rot, cmdstr); if (err != RIG_OK) return err; return RIG_OK; } /* * Send configuration character * * Rotor-EZ interface will act on these commands immediately -- * no other command or command terminator is needed. Expects token * define in rotorez.h and *val of '1' or '0' (enable/disable). */ static int rotorez_rot_set_conf(ROT *rot, token_t token, const char *val) { char cmdstr[2]; char c; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: token = %d, *val = %c\n", __func__, token, *val); if (!rot) return -RIG_EINVAL; if (*val < '0' || *val > '1') return -RIG_EINVAL; switch(token) { case TOK_ENDPT: /* Endpoint option */ if (*val == '1') c = 'E'; else c = 'e'; break; case TOK_JAM: /* Jam protection */ if (*val == '1') c = 'J'; else c = 'j'; break; case TOK_OVRSHT: /* Overshoot option */ if (*val == '1') c = 'O'; else c = 'o'; break; case TOK_UNSTICK: /* Unstick option */ if (*val == '1') c = 'S'; else c = 's'; break; default: return -RIG_EINVAL; } rig_debug(RIG_DEBUG_TRACE, "%s: c = %c, *val = %c\n", __func__, c, *val); snprintf(cmdstr, sizeof(cmdstr), "%c", c); rig_debug(RIG_DEBUG_TRACE, "%s: cmdstr = %s, *val = %c\n", __func__, cmdstr, *val); err = rotorez_send_priv_cmd(rot, cmdstr); if (err != RIG_OK) return err; return RIG_OK; } /* * Get Info * returns the model name string */ static const char *rotorez_rot_get_info(ROT *rot) { const struct rot_caps *rc; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rot) return (const char *)-RIG_EINVAL; rc = rot->caps; return rc->model_name; } /* * Send command string to rotor */ static int rotorez_send_priv_cmd(ROT *rot, const char *cmdstr) { struct rot_state *rs; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rot) return -RIG_EINVAL; rs = &rot->state; err = write_block(&rs->rotport, cmdstr, strlen(cmdstr)); if (err != RIG_OK) return err; return RIG_OK; } /* * Flush the serial input buffer * * If the RotorEZ should receive an invalid command, such as an the ';' * character while the rotor is not in motion, as sent by the rotorez_rot_stop * function or the 'S' command from `rotctl', it will output the following * string, "C2000 IDIOM V1.4S " into the input buffer. This function flushes * the buffer by reading it until a timeout occurs. Once the timeout occurs, * this function returns and the buffer is presumed to be empty. */ static int rotorez_flush_buffer(ROT *rot) { struct rot_state *rs; char garbage[32]; /* read buffer */ int err = 0; size_t MAX = 31; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rot) return -RIG_EINVAL; rs = &rot->state; do { err = read_block(&rs->rotport, garbage, MAX); /* Oops! An IO error was encountered. Bail out! */ if (err == -RIG_EIO) return -RIG_EIO; } while (err != -RIG_ETIMEOUT); return RIG_OK; } /* * Initialize backend */ DECLARE_INITROT_BACKEND(rotorez) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rot_register(&rotorez_rot_caps); rot_register(&rotorcard_rot_caps); rot_register(&dcu_rot_caps); rot_register(&erc_rot_caps); return RIG_OK; } hamlib-1.2.15.3/rotorez/README.rotorez0000644000175000017500000000310512044564477014221 00000000000000Quirks, known bugs, and other notes. ==================================== In this document I'll try to describe the behavior of the Idiom Press Rotor-EZ and RotorCard interfaces as well as the HyGain DCU-1/DCU-1X control units with Hamlib. For background information see rotorez/rotorez.txt. The Idiom Press interfaces are the most capable of the units supported by this backend and all available commands are supported by these units at this time. The HyGain control units only support a subset of the command set involving rotor positioning. This document is organized by Hamlib function calls and documents observed behavior with each call. rot_set_position * Fractional values passed for azimuth are dropped. i.e. 180.6 becomes 180 while a value greater than 359.4999 is converted to 0 for DCU1/ DCU-1X compatibility. * Allowed range for azimuth is 0 to 360. * Values passed for elevation are ignored. The protocol only supports azimuthal positioning rot_get_position * Position reading is returned in whole degrees from 0 to 359. * Not supported by DCU-1/DCU-1X. rotorez_rot_stop * Causes immediate cessation of rotor positioning. * Not supported by DCU-1/DCU-1X. rot_set_conf * Accepts one of E, e, J, j, O, o, S, and s (see rotorez/rotorez.txt) in *val. * The value in token is not used by the backend and may be safely set to TOK_BACKEND_NONE. * Not supported by DCU-1/DCU-1X. BUGS Please report all bugs to Nate Bargmann n0nb at arrl.net hamlib-1.2.15.3/rotorez/Makefile.in0000644000175000017500000004747612044564555013723 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = rotorez DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_rotorez_la_DEPENDENCIES = $(top_builddir)/src/libhamlib.la am_hamlib_rotorez_la_OBJECTS = rotorez.lo hamlib_rotorez_la_OBJECTS = $(am_hamlib_rotorez_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_rotorez_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_rotorez_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_rotorez_la_SOURCES) DIST_SOURCES = $(hamlib_rotorez_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = hamlib-rotorez.la hamlib_rotorez_la_SOURCES = rotorez.c hamlib_rotorez_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_rotorez_la_LIBADD = $(top_builddir)/src/libhamlib.la EXTRA_DIST = README.rotorez rotorez.txt noinst_HEADERS = rotorez.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu rotorez/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu rotorez/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-rotorez.la: $(hamlib_rotorez_la_OBJECTS) $(hamlib_rotorez_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_rotorez_la_LINK) -rpath $(pkglibdir) $(hamlib_rotorez_la_OBJECTS) $(hamlib_rotorez_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rotorez.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/rotorez/Makefile.am0000644000175000017500000000042012044564477013667 00000000000000 pkglib_LTLIBRARIES = hamlib-rotorez.la hamlib_rotorez_la_SOURCES = rotorez.c hamlib_rotorez_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_rotorez_la_LIBADD = $(top_builddir)/src/libhamlib.la EXTRA_DIST = README.rotorez rotorez.txt noinst_HEADERS = rotorez.h hamlib-1.2.15.3/scripts/0000755000175000017500000000000012044565041011666 500000000000000hamlib-1.2.15.3/scripts/build-VB.NET.sh0000644000175000017500000001572412044564477014220 00000000000000#!/bin/bash # A script to build a set of VB.NET 2002 Framework 1.1 binary DLLs from a # Hamlib tarball. This script assumes that the Hamlib tarball has been # extracted to the directory specified in $build_dir and that # libusb-win32-bin-1.x.y.z has also been extracted to $build_dir and a # libusb.pc file has been created. The MS VC++ Toolkit must also be # installed. # # See README.build-VB.NET for complete details. # Set this to a desired directory BUILD_DIR=~/builds # Set this to LibUSB archive extracted in $BUILD_DIR LIBUSB_VER=libusb-win32-bin-1.2.4.0 # Error return codes. See /usr/include/sysexits.h EX_USAGE=64 EX_NOINPUT=66 # Pass name of Hamlib archive extracted in $BUILD_DIR if [ $# -ne 1 ]; then echo -e "\nUsage: `basename $0` hamlib-version\n" echo -e "See README.build-VB.NET for more information.\n" exit $EX_USAGE fi # Make sure the Hamlib archive is where we expect if [ -d ${BUILD_DIR}/$1 ]; then echo -e "\nBuilding VB.NET binaries in ${BUILD_DIR}/$1\n\n" cd ${BUILD_DIR}/$1 else echo -e "\nBuild directory, ${BUILD_DIR}/$1 not found!\nCheck path for $1 or correct the version number.\n" exit $EX_NOINPUT fi RELEASE=`/usr/bin/awk 'BEGIN{FS="["; RS="]"} /\[1\./ {print $2}' ./configure.ac` INST_DIR=`pwd`/mingw-inst ZIP_DIR=`pwd`/hamlib-VB.NET-${RELEASE} LIBUSB_WIN32_BIN_PATH=${BUILD_DIR}/${LIBUSB_VER} # Create VB.NET specific README.VB.NET-bin file cat > README.VB.NET-bin <include/hamlib/rig_dll.h rm include/hamlib/rig_dll.h.orig # Import internal ./libltdl and build it for mingw32 libtoolize --ltdl cd libltdl; ./configure --host=i586-mingw32msvc && make; cd .. # Configure and build hamlib for mingw32, with libusb-win32 ./configure --disable-static \ --host=i586-mingw32msvc \ --prefix=`pwd`/mingw-inst \ --without-rpc-backends \ --without-cxx-binding \ PKG_CONFIG_LIBDIR=${LIBUSB_WIN32_BIN_PATH}/lib/pkgconfig make install mkdir -p ${ZIP_DIR}/bin ${ZIP_DIR}/lib/msvc ${ZIP_DIR}/lib/gcc ${ZIP_DIR}/include cp -a src/libhamlib.def ${ZIP_DIR}/lib/msvc/libhamlib-2.def; todos ${ZIP_DIR}/lib/msvc/libhamlib-2.def cp -a ${INST_DIR}/include/hamlib ${ZIP_DIR}/include/.; todos ${ZIP_DIR}/include/hamlib/*.h # C++ binding is useless on win32 because of ABI rm ${ZIP_DIR}/include/hamlib/{rig,rot}class.h for f in AUTHORS ChangeLog COPYING COPYING.LIB LICENSE README README.betatester README.VB.NET-bin THANKS ; do \ cp -a ${f} ${ZIP_DIR}/${f}.txt ; todos ${ZIP_DIR}/${f}.txt ; done # Copy build files into specific locations for Zip file cp -a ${INST_DIR}/bin/{rigctld.exe,rigctl.exe,rigmem.exe,rigsmtr.exe,rigswr.exe,rotctld.exe,rotctl.exe} ${ZIP_DIR}/bin/. cp -a ${INST_DIR}/lib/hamlib/hamlib-*.dll ${ZIP_DIR}/bin/. cp -a ${INST_DIR}/bin/libhamlib-?.dll ${ZIP_DIR}/bin/. cp -a ${INST_DIR}/lib/libhamlib.dll.a ${ZIP_DIR}/lib/gcc/. # NB: Do not strip libusb0.dll i586-mingw32msvc-strip ${ZIP_DIR}/bin/*.exe ${ZIP_DIR}/bin/*hamlib-*.dll cp -a ${LIBUSB_WIN32_BIN_PATH}/bin/x86/libusb0_x86.dll ${ZIP_DIR}/bin/libusb0.dll # Need VC++ free toolkit installed (default Wine directory installation shown) ( cd ${ZIP_DIR}/lib/msvc/ && wine ~/.wine/drive_c/Program\ Files/Microsoft\ Visual\ C++\ Toolkit\ 2003/bin/link.exe /lib /machine:i386 /def:libhamlib-2.def ) zip -r hamlib-VB.NET-${RELEASE}.zip `basename ${ZIP_DIR}` hamlib-1.2.15.3/scripts/README.build-win320000644000175000017500000000724712044564477014552 00000000000000 This file is a HOWTO for the cross-compiling of Win32 binary DLLs built from a tarball generated by 'make dist' in a Git checkout. The resulting DLLs are built with a cdecl interface compatible with MS VC++. Prerequisites ============= In these steps the release or daily snapshot tarball is unpacked in ~/builds for the Win32 build and all operations are done from there unless otherwise noted. Under Linux you need the mingw32 package to cross-compile it, an internal copy of libltdl (configured and built as below), zip to create the archive, the tofrodos or dos2unix package installed to convert to DOS text format, and Wine plus the free MVC++Toolkit available from: http://uploading.com/files/HNH73WB3/VCToolkitSetup%28v1.01%29%282004.07.06%29.zip.html to create the Win32 .LIB file (unzip and then install it with Wine in the usual way). NB: Debian Squeeze and later users will need at least the mingw32-runtime 3.15 package as the 3.13 package is broken. You can manually install the Ubuntu version from: http://packages.ubuntu.com/maverick/devel/mingw32-runtime Finally, the Win32 version of libusb must be available for the USB backends to be built. Download the latest libusb-win32-bin-1.2.4.0.zip from: https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.4.0/ and unzip the archive in ~/builds/libusb-win32-bin-1.2.4.0 and then copy the following into libusb-win32-bin-1.2.4.0/lib/pkgconfig/libusb.pc (the pkgconfig directory will need to be created): ---------------CUT----------------------------- prefix=/home/USER/builds/libusb-win32-bin-1.2.4.0 exec_prefix=${prefix} libdir=${exec_prefix}/lib/gcc bindir=${exec_prefix}/bin includedir=${prefix}/include Name: libusb Description: USB access library Version: 1.2.4.0 Libs: -L${libdir} -L${bindir} -lusb Cflags: -I${includedir} ---------------CUT----------------------------- Any version of libusb from 1.2.3.0 is known to work. The script generates PDF documents for the included .EXE files using the groff and ps2pdf utilities to convert the nroff formatted man pages. On Debian and derivatives, installing the groff and ghostscript packages will provide them. Build for Win32, cross-compile on Linux: ======================================== Extract the Hamlib tarball into ~/builds (if you prefer another directory be sure to edit the BUILD_DIR variable in the build-win32.sh script): $ tar xvfz ~/Downloads/hamlib-1.2.14~git-72c52d6-20110618.tar.gz Invoke the build-win32.sh script (it requires a Bash shell) with the name of the directory/Hamlib version to build (you need not cd into the hamlib directory, although it won't hurt. The script uses absolute paths): build-win32.sh hamlib-1.2.14~git Note: At this time (18 Jun 2011) the build will fail on Debian Unstable due to a libtool version mismatch between libtool 2.2.6b included in the mingw32/gcc-mingw32 packages and the later libtool 2.4 installed on Unstable and Testing. Users of Debian Stable (Squeeze) and Ubuntu 10.10 (Maverick) should be able to build the Win32 DLLs. Release Info ============ The structure of the archive is: $ tree -d . ├── bin ├── include │   └── hamlib ├── lib │   ├── gcc │   └── msvc └── pdf 7 directories The bin directory is were the executables and DLL files are placed. Header files are under include/Hamlib and compiler specific files are under lib/*. PDF documents for the .EXE programs are in pdf/ while text documents (READMEs and such) are in the main archive directory. The embedded README.win32-bin file generated by the build-win32.sh script describes setting the PATH environment variable in Windows 2000, Windows XP, and Windows 7. 73, Nate, N0NB hamlib-1.2.15.3/scripts/build-win32.sh0000644000175000017500000001763512044564477014231 00000000000000#!/bin/bash # Builds Hamlib 1.2.x Win32 binary distribution. # A script to build a set of Win32 binary DLLs from a Hamlib tarball. # This script assumes that the Hamlib tarball has been extracted to the # directory specified in $build_dir and that libusb-win32-bin-1.x.y.z has also # been extracted to $build_dir and a libusb.pc file has been created. The # MS VC++Toolkit must also be installed. # # See README.build-win32 for complete details. # Set this to a desired directory BUILD_DIR=~/builds # Set this to LibUSB archive extracted in $BUILD_DIR LIBUSB_VER=libusb-win32-bin-1.2.4.0 # Error return codes. See /usr/include/sysexits.h EX_USAGE=64 EX_NOINPUT=66 # Pass name of Hamlib archive extracted in $BUILD_DIR if [ $# -ne 1 ]; then echo -e "\nUsage: `basename $0` hamlib-version\n" echo -e "See README.build-win32 for more information.\n" exit $EX_USAGE fi # Make sure the Hamlib archive is where we expect if [ -d ${BUILD_DIR}/$1 ]; then echo -e "\nBuilding Win32 binaries in ${BUILD_DIR}/$1\n\n" cd ${BUILD_DIR}/$1 else echo -e "\nBuild directory, ${BUILD_DIR}/$1 not found!\nCheck path for $1 or correct the version number.\n" exit $EX_NOINPUT fi RELEASE=`/usr/bin/awk 'BEGIN{FS="["; RS="]"} /\[1\./ {print $2}' ./configure.ac` INST_DIR=`pwd`/mingw-inst ZIP_DIR=`pwd`/hamlib-win32-${RELEASE} LIBUSB_WIN32_BIN_PATH=${BUILD_DIR}/${LIBUSB_VER} # Create Win32 specific README.win32_bin file cat > README.win32-bin < Radio model 120, or Yaesu FT-817 (use 'rigctl -l' for a list) -r -> Radio device, in this case COM1 -v -> Verbosity level. For testing four or five v characters are required. Five 'v's set a debug level of TRACE which generates a lot of screen output showing communication to the radio and values of important variables. These traces are vital information for Hamlib rig backend development. To run rigctl or rotctl open a cmd window (Start|Run|enter 'cmd' in the dialog). If text scrolls off the screen, you can scroll back with the mouse. To copy output text into a mailer or editor (I recommend Notepad++, a free editor also licensed under the GPL), highlight the text as a rectangle in the cmd window, press (or right-click the window icon in the upper left corner and select Edit, then Copy), and paste it into your editor with Ctl-V (or Edit|Paste from the typical GUI menu). All feedback is welcome to the mail address below. Uninstall ========= To uninstall, simply delete the Hamlib directory. You may wish to edit the PATH as above to remove the Hamlib bin path, if desired. Information for Win32 Programmers ================================= There is a .LIB import library for MS-VC++ in lib/msvc. Simply #include (add directory to include path), include the .LIB in your project and you are done. Note: MS-VC++ cannot compile all the Hamlib code, but the API defined by rig.h has been made MSVC friendly :-) As the source code for the library DLLs is licensed under the LGPL, your program is not considered a "derivative work" when using the published Hamlib API and normal linking to the front-end library, and may be of a license of your choosing. The published Hamlib API may be found at: http://sourceforge.net/apps/mediawiki/hamlib/index.php?title=Documentation Thank You! ========== Patches, feedback, and contributions are welcome. Please report problems or success to hamlib-developer@lists.sourceforge.net Cheers, Stephane Fillod - F8CFE Nate Bargmann - N0NB http://www.hamlib.org END_OF_README # Import internal ./libltdl and build it for mingw32 libtoolize --ltdl cd libltdl; ./configure --host=i586-mingw32msvc && make; cd .. # Configure and build hamlib for mingw32, with libusb-win32 ./configure --disable-static \ --host=i586-mingw32msvc \ --prefix=`pwd`/mingw-inst \ --without-rpc-backends \ --without-cxx-binding \ PKG_CONFIG_LIBDIR=${LIBUSB_WIN32_BIN_PATH}/lib/pkgconfig \ LIBTOOL=./libltdl/libtool make install mkdir -p ${ZIP_DIR}/bin ${ZIP_DIR}/lib/msvc ${ZIP_DIR}/lib/gcc ${ZIP_DIR}/include ${ZIP_DIR}/pdf cp -a src/libhamlib.def ${ZIP_DIR}/lib/msvc/libhamlib-2.def; todos ${ZIP_DIR}/lib/msvc/libhamlib-2.def cp -a ${INST_DIR}/include/hamlib ${ZIP_DIR}/include/.; todos ${ZIP_DIR}/include/hamlib/*.h # C++ binding is useless on win32 because of ABI rm ${ZIP_DIR}/include/hamlib/{rig,rot}class.h for f in AUTHORS ChangeLog COPYING COPYING.LIB LICENSE README README.betatester README.win32-bin THANKS ; do \ cp -a ${f} ${ZIP_DIR}/${f}.txt ; todos ${ZIP_DIR}/${f}.txt ; done # Generate PDF documents from nroff formatted man files cd tests for f in rigctl.1 rigctld.8 rigmem.1 rigsmtr.1 rigswr.1 rotctl.1 rotctld.8 ; do \ groff -mandoc >${f}.ps ${f} ; ps2pdf ${f}.ps ; rm ${f}.ps ; \ cp -a ${f}.pdf ${ZIP_DIR}/pdf/. ; done cd ${BUILD_DIR}/$1 # Copy build files into specific locations for Zip file cp -a ${INST_DIR}/bin/{rigctld.exe,rigctl.exe,rigmem.exe,rigsmtr.exe,rigswr.exe,rotctld.exe,rotctl.exe} ${ZIP_DIR}/bin/. cp -a ${INST_DIR}/lib/hamlib/hamlib-*.dll ${ZIP_DIR}/bin/. cp -a ${INST_DIR}/bin/libhamlib-?.dll ${ZIP_DIR}/bin/. cp -a ${INST_DIR}/lib/libhamlib.dll.a ${ZIP_DIR}/lib/gcc/. # NB: Do not strip libusb0.dll i586-mingw32msvc-strip ${ZIP_DIR}/bin/*.exe ${ZIP_DIR}/bin/*hamlib-*.dll cp -a ${LIBUSB_WIN32_BIN_PATH}/bin/x86/libusb0_x86.dll ${ZIP_DIR}/bin/libusb0.dll # Need VC++ free toolkit installed (default Wine directory installation shown) ( cd ${ZIP_DIR}/lib/msvc/ && wine ~/.wine/drive_c/Program\ Files/Microsoft\ Visual\ C++\ Toolkit\ 2003/bin/link.exe /lib /machine:i386 /def:libhamlib-2.def ) zip -r hamlib-win32-${RELEASE}.zip `basename ${ZIP_DIR}` hamlib-1.2.15.3/scripts/Makefile.in0000644000175000017500000003022312044564556013665 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = scripts DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = README.scripts build-win32.sh README.build-win32 \ build-VB.NET.sh README.build-VB.NET all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu scripts/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am # 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: hamlib-1.2.15.3/scripts/README.build-VB.NET0000644000175000017500000000153012044564477014531 00000000000000The build-VB.NET.sh script creates a binary ZIP archive of Hamlib compiled for Win32 using the __stdcall interface for Visual Basic.NET 2002 Framework 1.1. The release is possibly usable by other VB versions, but success has not been reported to the Hamlib team. The script is very similar to the build-win32.sh script and has the same Prerequisites for development tools. The differences are the use of sed(1) to edit include/hamlib.rig_dll.h for __stdcall, output of a customized README.VB.NET-bin file, and naming of the ZIP archive. See README.build-win32 for more information. The Hamlib developers would appreciate help making Hamlib, and the binary release generated by the script, usable by other versions of Visual Basic. Interested developers may contact us by our mailing list: hamlib-developer@lists.sourceforge.net 73, Nate, N0NB hamlib-1.2.15.3/scripts/README.scripts0000644000175000017500000000074412044564477014175 00000000000000The scripts/ directory will contain helper scripts for building Hamlib binary releases for Win32 and possibly other target platforms. Each script should be accompanied by a companion README file with information on the script and build requirements. Scripts: build-win32.sh for building Win32 DLLs and EXEs for use with MS VC++. build-VB.NET.sh for building Win32 DLLs and EXEs for use with MS VB.NET 2002 Framework 1.1 hamlib.nsi for building an executable installer for Win32. hamlib-1.2.15.3/scripts/Makefile.am0000644000175000017500000000015412044564477013656 00000000000000EXTRA_DIST = README.scripts build-win32.sh README.build-win32 \ build-VB.NET.sh README.build-VB.NET hamlib-1.2.15.3/bindings/0000755000175000017500000000000012044565007011776 500000000000000hamlib-1.2.15.3/bindings/hamlibvb.bas.in0000644000175000017500000000570112044564477014613 00000000000000Attribute VB_Name = "modHL2VB" Option Explicit ' Return error codes Public Const RIG_OK As Long = 0 Public Const RIG_EINVAL As Long = 1 Public Const RIG_ECONF As Long = 2 Public Const RIG_ENOMEM As Long = 3 Public Const RIG_ENIMPL As Long = 4 Public Const RIG_ETIMEOUT As Long = 5 Public Const RIG_EIO As Long = 6 Public Const RIG_EINTERNAL As Long = 7 Public Const RIG_EPROTO As Long = 8 Public Const RIG_ERJCTED As Long = 9 Public Const RIG_ETRUNC As Long = 10 Public Const RIG_ENAVAIL As Long = 11 Public Const RIG_ENTARGET As Long = 12 Public Const RIG_BUSERROR As Long = 13 Public Const RIG_BUSBUSY As Long = 14 Public Enum rig_debug_level_e RIG_DEBUG_NONE = 0 RIG_DEBUG_BUG RIG_DEBUG_ERR RIG_DEBUG_WARN RIG_DEBUG_VERBOSE RIG_DEBUG_TRACE End Enum Public Const RIG_VFO_A As Long = 1 Public Const RIG_VFO_B As Long = 2 Public Const RIG_VFO_CURR As Long = 536870912 Public Const RIG_PASSBAND_NORMAL As Long = 0 Public Enum RMode_t RIG_MODE_NONE = 0& RIG_MODE_AM = 1& RIG_MODE_CW = 2& RIG_MODE_USB = 4& RIG_MODE_LSB = 8& RIG_MODE_RTTY = 16& RIG_MODE_FM = 32& RIG_MODE_WFM = 64& RIG_MODE_CWR = 128& RIG_MODE_RTTYR = 256& RIG_MODE_AMS = 512& RIG_MODE_PKTLSB = 1024& RIG_MODE_PKTUSB = 2048& RIG_MODE_PKTFM = 4096& RIG_MODE_ECSSUSB = 8192& RIG_MODE_ECSSLSB = 16384& RIG_MODE_FAX = 32768& End Enum '___________________________________________________________________________________ ' Basic example: ' ' rig_set_debug (RIG_DEBUG_TRACE) ' myrig = rig_init (1) ' rig_open (myrig) ' rig_set_freq (myrig, RIG_VFO_A, 14250000) ' rig_set_mode (myrig, RIG_VFO_A, RIG_MODE_USB, RIG_PASSBAND_NORMAL) ' rig_close (myrig) ' rig_cleanup (myrig) Declare Function rig_set_debug Lib "hamlib@ABI_VERSION@.dll" (ByVal debug_level As rig_debug_level_e) _ As Long Declare Function rig_init Lib "hamlib@ABI_VERSION@.dll" (ByVal rig_model As Long) _ As Long Declare Function rig_open Lib "hamlib@ABI_VERSION@.dll" (ByVal RIGptr As Long) _ As Long Declare Function rig_close Lib "hamlib@ABI_VERSION@.dll" (ByVal RIGptr As Long) _ As Long Declare Function rig_cleanup Lib "hamlib@ABI_VERSION@.dll" (ByVal RIGptr As Long) _ As Long Declare Function rig_set_freq Lib "hamlib@ABI_VERSION@.dll" (ByVal RIGptr As Long, ByVal vfo as Long, ByVal freq As Double) _ As Long Declare Function rig_get_freq Lib "hamlib@ABI_VERSION@.dll" (ByVal RIGptr As Long, ByVal vfo as Long, ByRef freq As Double) _ As Long Declare Function rig_set_mode Lib "hamlib@ABI_VERSION@.dll" (ByVal RIGptr As Long, ByVal vfo as Long, ByVal mode As RMode_t, ByVal width As Long) _ As Long Declare Function rig_get_mode Lib "hamlib@ABI_VERSION@.dll" (ByVal RIGptr As Long, ByVal vfo as Long, ByRef mode As RMode_t, ByRef width As Long) _ As Long Declare Function rig_set_vfo Lib "hamlib@ABI_VERSION@.dll" (ByVal RIGptr As Long, ByVal vfo as Long) _ As Long Declare Function rig_get_vfo Lib "hamlib@ABI_VERSION@.dll" (ByVal RIGptr As Long, ByRef vfop as Long) _ As Long hamlib-1.2.15.3/bindings/rotator.swg0000644000175000017500000000734212044564477014152 00000000000000/* * Hamlib bindings - Rotator interface * Copyright (c) 2001,2002 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ %inline %{ typedef struct Rot { ROT *rot; struct rot_caps *caps; /* shortcut to ROT->caps */ struct rot_state *state; /* shortcut to ROT->state */ int error_status; int do_exception; } Rot; %} /* * decalre wrapper method with 0,1,2 arguments besides ROT* */ #define ROTMETHOD0(f) void f () \ { self->error_status = rot_##f(self->rot); } #define ROTMETHOD1(f, t1) void f (t1 _##t1) \ { self->error_status = rot_##f(self->rot, _##t1); } #define ROTMETHOD2(f, t1, t2) void f (t1 _##t1##_1, t2 _##t2##_2) \ { self->error_status = rot_##f(self->rot, _##t1##_1, _##t2##_2); } %extend Rot { Rot(rot_model_t rot_model) { Rot *r; r = (Rot*)malloc(sizeof(Rot)); if (!r) return NULL; r->rot = rot_init(rot_model); if (!r->rot) { free(r); return NULL; } /* install shortcuts */ r->caps = r->rot->caps; r->state = &r->rot->state; r->do_exception = 0; /* default is disabled */ r->error_status = RIG_OK; return r; } ~Rot () { rot_cleanup(self->rot); free(self); } /* * return code checking */ %exception { arg1->error_status = RIG_OK; $action if (arg1->error_status != RIG_OK && arg1->do_exception) SWIG_exception(SWIG_UnknownError, rigerror(arg1->error_status)); } ROTMETHOD0(open) ROTMETHOD0(close) ROTMETHOD2(set_position, azimuth_t, elevation_t) extern void get_position(azimuth_t *OUTPUT, elevation_t *OUTPUT); ROTMETHOD0(stop) ROTMETHOD0(park) ROTMETHOD1(reset, rot_reset_t) ROTMETHOD2(move, int, int) ROTMETHOD1(token_lookup, const_char_string) /* conf */ void set_conf(const char *name, const char *val) { token_t tok = rot_token_lookup(self->rot, name); if (tok == RIG_CONF_END) self->error_status = -RIG_EINVAL; else self->error_status = rot_set_conf(self->rot, tok, val); } ROTMETHOD2(set_conf, token_t, const_char_string) const char *get_conf(token_t tok) { static char s[128] = ""; self->error_status = rot_get_conf(self->rot, tok, s); return s; } const char *get_conf(const char *name) { token_t tok = rot_token_lookup(self->rot, name); static char s[128] = ""; if (tok == RIG_CONF_END) self->error_status = -RIG_EINVAL; else self->error_status = rot_get_conf(self->rot, tok, s); return s; } const char * get_info(void) { const char *s; s = rot_get_info(self->rot); self->error_status = s ? RIG_OK : -RIG_EINVAL; return s; } /* TODO: get_conf_list, .. */ }; %{ /* * this one returns 2 values, here is a perl example: * ($az, $elevation) = $rig->get_position(); */ void Rot_get_position(Rot *self, azimuth_t *azimuth, elevation_t *elevation) { self->error_status = rot_get_position(self->rot, azimuth, elevation); } %} hamlib-1.2.15.3/bindings/rig.swg0000644000175000017500000003520112044564477013234 00000000000000/* * Hamlib bindings - Rig interface * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ %inline %{ typedef struct Rig { RIG *rig; struct rig_caps *caps; /* shortcut to RIG->caps */ struct rig_state *state; /* shortcut to RIG->state */ int error_status; int do_exception; } Rig; %} %extend channel { channel(vfo_t vfo = RIG_VFO_CURR, int ch = 0) { channel_t *chan; chan = (channel_t*)malloc(sizeof(channel_t)); if (!chan) return NULL; memset(chan, 0, sizeof(channel_t)); chan->vfo = vfo; chan->channel_num = ch; return chan; } ~channel (void) { /* TODO: free ext_levels */ free(self); } } %include "carrays.i" %array_class(struct channel, channelArray); %array_class(tone_t, toneArray); /* * decalre wrapper method with one argument besides RIG* and optional no target vfo */ #define METHOD1(f, t1) void f (t1 _##t1 _VFO_DECL) \ { self->error_status = rig_##f(self->rig _VFO_ARG, _##t1); } #define METHOD2(f, t1, t2) void f (t1 _##t1##_1, t2 _##t2##_2 _VFO_DECL) \ { self->error_status = rig_##f(self->rig _VFO_ARG, _##t1##_1, _##t2##_2); } #define METHOD2_INIT(f, t1, t2, i2) void f (t1 _##t1##_1, t2 _##t2##_2 = i2 _VFO_DECL) \ { self->error_status = rig_##f(self->rig _VFO_ARG, _##t1##_1, _##t2##_2); } /* * decalre wrapper method with one output argument besides RIG* (no target vfo) */ #define METHOD1GET(f, t1) t1 f (void) \ { t1 _##t1; self->error_status = rig_##f(self->rig, &_##t1); return _##t1; } /* * decalre wrapper method with one output argument besides RIG* and vfo */ #define METHOD1VGET(f, t1) t1 f (vfo_t vfo = RIG_VFO_CURR) \ { t1 _##t1; self->error_status = rig_##f(self->rig, vfo, &_##t1); return _##t1; } #define METHODSIMPLESET(f, t1, fld, chk) void set_##f (setting_t stg, t1 fld _VFO_DECL) \ { value_t val; if (chk) { \ self->error_status = -RIG_EINVAL; /* invalid type */ \ return; \ } \ val.fld = fld; \ self->error_status = rig_set_##f(self->rig _VFO_ARG , stg, val); \ } /* * RIG_CONF_ extparm's type: * NUMERIC: val.f * COMBO: val.i, starting from 0 * STRING: val.s * CHECKBUTTON: val.i 0/1 */ #define METHODSUPERSET(f, t1, fld, chk) void set_##f (const char *name, t1 fld _VFO_DECL) \ { setting_t stg; value_t val; \ stg = rig_parse_##f(name); \ if (!rig_has_set_##f(self->rig, stg)) { \ const struct confparams *cfp; \ cfp = rig_ext_lookup(self->rig, name); \ if (!cfp) { \ self->error_status = -RIG_EINVAL; /* no such parameter */ \ return; \ } \ switch (cfp->type) { \ case RIG_CONF_NUMERIC: \ val.fld = fld; \ break; \ case RIG_CONF_CHECKBUTTON: \ case RIG_CONF_COMBO: \ val.i = (int)fld; \ break; \ case RIG_CONF_STRING: \ self->error_status = -RIG_EINVAL; /* invalid type */ \ return; \ default: \ self->error_status = -RIG_ECONF; \ return; \ } \ self->error_status = rig_set_ext_##f(self->rig _VFO_ARG, cfp->token, val); \ return; \ } \ if (chk) { \ self->error_status = -RIG_EINVAL; /* invalid type */ \ return; \ } \ val.fld = fld; \ self->error_status = rig_set_##f(self->rig _VFO_ARG , stg, val); \ } #define METHODSTRSET(f) void set_##f (const char *name, const char *s _VFO_DECL) \ { value_t val; /* only ext_level/parm's can have string values */ \ const struct confparams *cfp; \ cfp = rig_ext_lookup(self->rig, name); \ if (!cfp) { \ self->error_status = -RIG_EINVAL; /* no such parameter */ \ return; \ } \ if (cfp->type != RIG_CONF_STRING) { \ self->error_status = -RIG_EINVAL; /* invalid type */ \ return; \ } \ val.cs = s; \ self->error_status = rig_set_ext_##f(self->rig _VFO_ARG, cfp->token, val); \ } #define METHODSIMPLEGET(f, t1, fld, chk) t1 get_##f##_##fld (setting_t stg _VFO_DECL) \ { value_t val; if (chk) { \ self->error_status = -RIG_EINVAL; /* invalid type */ \ return val.fld; /* undefined value */ \ } \ self->error_status = rig_get_##f(self->rig _VFO_ARG , stg, &val); \ return val.fld; \ } #define METHODSUPERGET(fct, t1, fld, chk) t1 get_##fct##_##fld(const char *name _VFO_DECL) \ { setting_t stg; value_t val; \ stg = rig_parse_##fct(name); \ if (!rig_has_get_##fct(self->rig, stg)) { \ const struct confparams *cfp; \ cfp = rig_ext_lookup(self->rig, name); \ if (!cfp) { \ self->error_status = -RIG_EINVAL; /* no such parameter */ \ return val.fld; /* undefined */ \ } \ if (cfp->type == RIG_CONF_STRING) { \ self->error_status = -RIG_EINVAL; \ return val.fld; /* undefined */ \ } \ self->error_status = rig_get_ext_##fct(self->rig _VFO_ARG, cfp->token, &val); \ switch (cfp->type) { \ case RIG_CONF_NUMERIC: \ return (t1)val.f; \ case RIG_CONF_CHECKBUTTON: \ case RIG_CONF_COMBO: \ return (t1)val.i; \ default: \ self->error_status = -RIG_ECONF; \ return val.fld; /* undefined */ \ } \ } \ if (chk) { \ self->error_status = -RIG_EINVAL; /* invalid type */ \ return val.fld; /* undefined */ \ } \ self->error_status = rig_get_##fct(self->rig _VFO_ARG , stg, &val); \ return val.fld; \ } #define METHODSTRGET(f) void get_##f (const char *name, char *returnstr _VFO_DECL) \ { value_t val; /* only ext_level/parm's can have string values */ \ const struct confparams *cfp; \ returnstr[0] = '\0'; \ cfp = rig_ext_lookup(self->rig, name); \ if (!cfp || cfp->type != RIG_CONF_STRING) { \ self->error_status = -RIG_EINVAL; /* no such parameter/invalid type */ \ return; \ } \ val.s = returnstr; \ self->error_status = rig_get_ext_##f(self->rig _VFO_ARG, cfp->token, &val); \ } /* * string as return value * NB: The %apply has to be outside the %extend, * but the %cstring_bounded_output must be inside. */ %ignore MAX_RETURNSTR; #define MAX_RETURNSTR 256 %apply char *OUTPUT { char *returnstr }; /* * Rig class alike */ %extend Rig { %cstring_bounded_output(char *returnstr, MAX_RETURNSTR); Rig(int rig_model) { Rig *r; r = (Rig*)malloc(sizeof(Rig)); if (!r) return NULL; r->rig = rig_init(rig_model); if (!r->rig) { free(r); return NULL; } /* install shortcuts */ r->caps = r->rig->caps; r->state = &r->rig->state; r->do_exception = 0; /* default is disabled */ r->error_status = RIG_OK; return r; } ~Rig () { rig_cleanup(self->rig); free(self); } /* * return code checking */ %exception { arg1->error_status = RIG_OK; $action if (arg1->error_status != RIG_OK && arg1->do_exception) SWIG_exception(SWIG_UnknownError, rigerror(arg1->error_status)); } void open () { self->error_status = rig_open(self->rig); } void close () { self->error_status = rig_close(self->rig); } /* * group all vfo, and non vfo apart */ #define _VFO_ARG ,vfo #define _VFO_DECL ,vfo_t vfo = RIG_VFO_CURR METHOD1(set_freq, freq_t) METHOD2_INIT(set_mode, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) METHOD1(set_ptt, ptt_t) METHOD1(set_rptr_shift, rptr_shift_t) METHOD1(set_rptr_offs, shortfreq_t) METHOD1(set_ctcss_tone, tone_t) METHOD1(set_dcs_code, tone_t) METHOD1(set_ctcss_sql, tone_t) METHOD1(set_dcs_sql, tone_t) METHOD1(set_split_freq, freq_t) METHOD2_INIT(set_split_mode, rmode_t, pbwidth_t, RIG_PASSBAND_NORMAL) METHOD2(set_split_vfo, split_t, vfo_t) METHOD1(set_rit, shortfreq_t) METHOD1(set_xit, shortfreq_t) METHOD1(set_ts, shortfreq_t) METHOD1(set_ant, ant_t) METHOD2(set_func, setting_t, int) METHOD1(set_bank, int) METHOD1(set_mem, int) METHOD1(send_dtmf, const_char_string) METHOD1(send_morse, const_char_string) METHOD1(vfo_op, vfo_op_t) METHOD2(scan, scan_t, int) METHODSIMPLESET(level, int, i, RIG_LEVEL_IS_FLOAT(stg)) METHODSIMPLESET(level, float, f, !RIG_LEVEL_IS_FLOAT(stg)) METHODSUPERSET(level, int, i, RIG_LEVEL_IS_FLOAT(stg)) METHODSUPERSET(level, float, f, !RIG_LEVEL_IS_FLOAT(stg)) METHODSTRSET(level) METHOD2(set_ext_level, token_t, value_t) METHODSIMPLEGET(level, int, i, RIG_LEVEL_IS_FLOAT(stg)) METHODSIMPLEGET(level, float, f, !RIG_LEVEL_IS_FLOAT(stg)) METHODSUPERGET(level, int, i, RIG_LEVEL_IS_FLOAT(stg)) METHODSUPERGET(level, float, f, !RIG_LEVEL_IS_FLOAT(stg)) METHODSTRGET(level) /* * these ones take no vfo arg */ #undef _VFO_ARG #undef _VFO_DECL #define _VFO_ARG #define _VFO_DECL METHOD1(set_vfo, vfo_t) /* particular case */ METHOD1(set_powerstat, powerstat_t) METHOD1(set_trn, int) METHOD1(has_set_level, setting_t) METHOD1(has_set_parm, setting_t) METHOD1(has_set_func, setting_t) METHOD1(reset, reset_t) METHOD1(has_scan, scan_t) METHOD1(has_vfo_op, vfo_op_t) METHOD1(passband_normal, rmode_t) METHOD1(passband_narrow, rmode_t) METHOD1(passband_wide, rmode_t) METHOD1(ext_token_lookup, const_char_string) /* level & parm */ METHOD1(token_lookup, const_char_string) /* conf */ METHOD2(set_conf, token_t, const_char_string) METHOD2(set_ext_parm, token_t, value_t) METHODSIMPLESET(parm, int, i, RIG_PARM_IS_FLOAT(stg)) METHODSIMPLESET(parm, float, f, !RIG_PARM_IS_FLOAT(stg)) METHODSUPERSET(parm, int, i, RIG_PARM_IS_FLOAT(stg)) METHODSUPERSET(parm, float, f, !RIG_PARM_IS_FLOAT(stg)) METHODSTRSET(parm) METHODSIMPLEGET(parm, int, i, RIG_PARM_IS_FLOAT(stg)) METHODSIMPLEGET(parm, float, f, !RIG_PARM_IS_FLOAT(stg)) METHODSUPERGET(parm, int, i, RIG_PARM_IS_FLOAT(stg)) METHODSUPERGET(parm, float, f, !RIG_PARM_IS_FLOAT(stg)) METHODSTRGET(parm) void set_conf(const char *name, const char *val) { token_t tok = rig_token_lookup(self->rig, name); if (tok == RIG_CONF_END) self->error_status = -RIG_EINVAL; else self->error_status = rig_set_conf(self->rig, tok, val); } /* TODO: get_ext_parm_list, level, conf, .. */ /* get functions */ METHOD1VGET(get_freq, freq_t) extern void get_mode(unsigned int *OUTPUT, int *OUTPUT, vfo_t vfo = RIG_VFO_CURR); extern void get_split_mode(unsigned int *OUTPUT, int *OUTPUT, vfo_t vfo = RIG_VFO_CURR); METHOD1GET(get_vfo, vfo_t) METHOD1VGET(get_ptt, ptt_t) METHOD1VGET(get_rptr_shift, rptr_shift_t) METHOD1VGET(get_rptr_offs, shortfreq_t) METHOD1VGET(get_ctcss_tone, tone_t) METHOD1VGET(get_dcs_code, tone_t) METHOD1VGET(get_ctcss_sql, tone_t) METHOD1VGET(get_dcs_sql, tone_t) METHOD1VGET(get_split_freq, freq_t) void get_split_vfo(split_t *split, vfo_t *tx_vfo, vfo_t vfo = RIG_VFO_CURR) { self->error_status = rig_get_split_vfo(self->rig, vfo, split, tx_vfo); } METHOD1VGET(get_rit, shortfreq_t) METHOD1VGET(get_xit, shortfreq_t) METHOD1VGET(get_ts, shortfreq_t) METHOD1VGET(get_ant, ant_t) METHOD1VGET(get_mem, int) METHOD1GET(get_powerstat, powerstat_t) METHOD1GET(get_trn, int) //METHOD2GET(get_ext_parm, token_t, value_t) int mem_count(void) { return rig_mem_count(self->rig); } const chan_t *lookup_mem_caps(int channel_num = RIG_MEM_CAPS_ALL) { return rig_lookup_mem_caps(self->rig, channel_num); } void set_channel(const struct channel *chan) { self->error_status = rig_set_channel(self->rig, chan); } void get_channel(struct channel *chan) { self->error_status = rig_get_channel(self->rig, chan); /* TODO: handle ext_level's */ } void chan_clear(struct channel *chans, int nb_chans = 1) { memset(chans, 0, sizeof(struct channel)*nb_chans); } void get_chan_all(struct channel *chans) { self->error_status = rig_get_chan_all(self->rig, chans); /* TODO: handle ext_level's */ } /* * Rem: does swig has to be told that returned object need to be handled by gc? */ struct channel *get_chan_all(void); /* get_channel() returns current VFO data * get_channel(10) returns content of memory #10 * get_channel(0, RIG_VFO_A) returns VFO A data * Rem: does swig has to be told that returned object need to be handled by gc? */ struct channel *get_channel(int channel_num = INT_MAX, vfo_t vfo = RIG_VFO_MEM) { struct channel *chan; chan = new_channel(channel_num != INT_MAX ? vfo : RIG_VFO_CURR, channel_num); if (!chan) { self->error_status = -RIG_ENOMEM; return NULL; } self->error_status = rig_get_channel(self->rig, chan); /* TODO: copy ext_level's */ return chan; } void get_conf(token_t tok, char *returnstr) { returnstr[0] = '\0'; self->error_status = rig_get_conf(self->rig, tok, returnstr); } void get_conf(const char *name, char *returnstr) { returnstr[0] = '\0'; token_t tok = rig_token_lookup(self->rig, name); if (tok == RIG_CONF_END) self->error_status = -RIG_EINVAL; else self->error_status = rig_get_conf(self->rig, tok, returnstr); } void recv_dtmf(char *returnstr, vfo_t vfo = RIG_VFO_CURR) { int len = MAX_RETURNSTR; self->error_status = rig_recv_dtmf(self->rig, vfo, returnstr, &len); returnstr[len] = '\0'; } const char * get_info(void) { const char *s; s = rig_get_info(self->rig); self->error_status = s ? RIG_OK : -RIG_EINVAL; return s; } int get_func(setting_t func, vfo_t vfo = RIG_VFO_CURR) { int status; self->error_status = rig_get_func(self->rig, vfo, func, &status); return status; } #ifndef SWIGJAVA /* TODO */ void get_level(setting_t level, vfo_t vfo = RIG_VFO_CURR) { value_t val; self->error_status = rig_get_level(self->rig, vfo, level, &val); //if (RIG_LEVEL_IS_FLOAT(level)) /* TODO: dynamic casting */ } #endif /* TODO also: get_parm */ }; %{ /* * these ones returns 2 values, here is a perl example: * ($mode, $width) = $rig->get_mode(); */ void Rig_get_mode(Rig *self, unsigned *mode, int *width, vfo_t vfo) { rmode_t mode1 = *mode; pbwidth_t width1 = *width; self->error_status = rig_get_mode(self->rig, vfo, &mode1, &width1); *mode = mode1; *width = width1; } void Rig_get_split_mode(Rig *self, unsigned *mode, int *width, vfo_t vfo) { rmode_t mode1 = *mode; pbwidth_t width1 = *width; self->error_status = rig_get_split_mode(self->rig, vfo, &mode1, &width1); *mode = mode1; *width = width1; } struct channel *Rig_get_chan_all(Rig *self) { struct channel *chans; int nb_chans = rig_mem_count(self->rig); /* TODO: memleak: typemap to release that memory */ chans = calloc(sizeof (struct channel), nb_chans); if (!chans) { self->error_status = -RIG_ENOMEM; return NULL; } self->error_status = rig_get_chan_all(self->rig, chans); /* TODO: copy ext_level's */ return chans; } %} hamlib-1.2.15.3/bindings/ignore.swg0000644000175000017500000001115512044564477013740 00000000000000/* unsupported Hamlib's calls */ /* useless macros */ %ignore _RIG_H; %ignore _RIGLIST_H; %ignore _ROTLIST_H; %ignore _ROTATOR_H; %ignore RIG_DUMMY; %ignore RIG_BACKEND_DUMMY; %ignore RIG_YAESU; %ignore RIG_BACKEND_YAESU; %ignore RIG_KENWOOD; %ignore RIG_BACKEND_KENWOOD; %ignore RIG_ICOM; %ignore RIG_BACKEND_ICOM; %ignore RIG_PCR; %ignore RIG_BACKEND_PCR; %ignore RIG_AOR; %ignore RIG_BACKEND_AOR; %ignore RIG_JRC; %ignore RIG_BACKEND_JRC; %ignore RIG_RADIOSHACK; %ignore RIG_BACKEND_RADIOSHACK; %ignore RIG_UNIDEN; %ignore RIG_BACKEND_UNIDEN; %ignore RIG_DRAKE; %ignore RIG_BACKEND_DRAKE; %ignore RIG_LOWE; %ignore RIG_BACKEND_LOWE; %ignore RIG_RACAL; %ignore RIG_BACKEND_RACAL; %ignore RIG_WJ; %ignore RIG_BACKEND_WJ; %ignore RIG_EK; %ignore RIG_BACKEND_EK; %ignore RIG_SKANTI; %ignore RIG_BACKEND_SKANTI; %ignore RIG_PRM80; %ignore RIG_BACKEND_PRM80; %ignore RIG_WINRADIO; %ignore RIG_BACKEND_WINRADIO; %ignore RIG_TENTEC; %ignore RIG_BACKEND_TENTEC; %ignore RIG_ALINCO; %ignore RIG_BACKEND_ALINCO; %ignore RIG_KACHINA; %ignore RIG_BACKEND_KACHINA; %ignore RIG_RPC; %ignore RIG_BACKEND_RPC; %ignore RIG_GNURADIO; %ignore RIG_BACKEND_GNURADIO; %ignore RIG_MICROTUNE; %ignore RIG_BACKEND_MICROTUNE; %ignore RIG_TAPR; %ignore RIG_BACKEND_TAPR; %ignore RIG_FLEXRADIO; %ignore RIG_BACKEND_FLEXRADIO; %ignore RIG_RFT; %ignore RIG_BACKEND_RFT; %ignore RIG_KIT; %ignore RIG_BACKEND_KIT; %ignore RIG_TUNER; %ignore RIG_BACKEND_TUNER; %ignore RIG_RS; %ignore RIG_BACKEND_RS; %ignore RIG_ADAT; %ignore RIG_BACKEND_ADAT; %ignore ROT_DUMMY; %ignore ROT_BACKEND_DUMMY; %ignore ROT_RPC; %ignore ROT_BACKEND_RPC; %ignore ROT_EASYCOMM; %ignore ROT_BACKEND_EASYCOMM; %ignore ROT_FODTRACK; %ignore ROT_BACKEND_FODTRACK; %ignore ROT_ROTOREZ; %ignore ROT_BACKEND_ROTOREZ; %ignore ROT_SARTEK; %ignore ROT_BACKEND_SARTEK; %ignore ROT_GS232A; %ignore ROT_BACKEND_GS232A; %ignore ROT_KIT; %ignore ROT_BACKEND_KIT; %ignore ROT_HEATHKIT; %ignore ROT_BACKEND_HEATHKIT; %ignore ROT_SPID; %ignore ROT_BACKEND_SPID; %ignore ROT_M2; %ignore ROT_BACKEND_M2; %ignore ROT_ARS; %ignore ROT_BACKEND_ARS; %ignore ROT_AMSAT; %ignore ROT_BACKEND_AMSAT; %ignore ROT_TS7400; %ignore ROT_BACKEND_TS7400; %ignore ROT_CELESTRON; %ignore ROT_BACKEND_CELESTRON; %ignore PRIfreq; %ignore SCNfreq; %ignore FREQFMT; %ignore rig_open; %ignore rig_set_freq; %ignore rig_get_freq; %ignore rig_set_mode; %ignore rig_get_mode; %ignore rig_set_vfo; %ignore rig_get_vfo; %ignore rig_set_ptt; %ignore rig_get_ptt; %ignore rig_get_dcd; %ignore rig_set_rptr_shift; %ignore rig_get_rptr_shift; %ignore rig_set_rptr_offs; %ignore rig_get_rptr_offs; %ignore rig_set_ctcss_tone; %ignore rig_get_ctcss_tone; %ignore rig_set_dcs_code; %ignore rig_get_dcs_code; %ignore rig_set_ctcss_sql; %ignore rig_get_ctcss_sql; %ignore rig_set_dcs_sql; %ignore rig_get_dcs_sql; %ignore rig_set_split_freq; %ignore rig_get_split_freq; %ignore rig_set_split_mode; %ignore rig_get_split_mode; %ignore rig_set_split; %ignore rig_get_split; %ignore rig_set_rit; %ignore rig_get_rit; %ignore rig_set_xit; %ignore rig_get_xit; %ignore rig_set_ts; %ignore rig_get_ts; %ignore rig_power2mW; %ignore rig_mW2power; %ignore rig_get_resolution; %ignore rig_set_level; %ignore rig_get_level; %ignore rig_set_parm; %ignore rig_get_parm; %ignore rig_set_conf; %ignore rig_get_conf; %ignore rig_set_powerstat; %ignore rig_get_powerstat; %ignore rig_reset; %ignore rig_set_ext_level; %ignore rig_get_ext_level; %ignore rig_set_ext_parm; %ignore rig_get_ext_parm; %ignore rig_ext_level_foreach; %ignore rig_ext_parm_foreach; %ignore rig_token_lookup; %ignore rig_close; %ignore rig_cleanup; %ignore rig_probe; %ignore rig_set_ant; %ignore rig_get_ant; %ignore rig_has_get_level; %ignore rig_has_set_level; %ignore rig_has_get_parm; %ignore rig_has_set_parm; %ignore rig_has_get_func; %ignore rig_has_set_func; %ignore rig_set_func; %ignore rig_get_func; %ignore rig_send_dtmf; %ignore rig_recv_dtmf; %ignore rig_send_morse; %ignore rig_set_bank; %ignore rig_set_mem; %ignore rig_get_mem; %ignore rig_vfo_op; %ignore rig_has_vfo_op; %ignore rig_scan; %ignore rig_has_scan; %ignore rig_set_channel; %ignore rig_get_channel; %ignore rig_set_trn; %ignore rig_get_trn; %ignore rig_set_freq_callback; %ignore rig_set_mode_callback; %ignore rig_set_vfo_callback; %ignore rig_set_ptt_callback; %ignore rig_set_dcd_callback; %ignore rig_set_pltune_callback; %ignore rig_get_info; %ignore rig_passband_normal; %ignore rig_passband_narrow; %ignore rig_passband_wide; %ignore rot_open; %ignore rot_close; %ignore rot_cleanup; %ignore rot_set_conf; %ignore rot_get_conf; %ignore rot_set_position; %ignore rot_get_position; %ignore rot_stop; %ignore rot_park; %ignore rot_reset; %ignore rot_move; %ignore rot_get_info; hamlib-1.2.15.3/bindings/hamlib.swg0000644000175000017500000000424712044564477013715 00000000000000 %module Hamlib %{ /* * Hamlib bindings - swig interface file * Copyright (c) 2001-2008 by Stephane Fillod * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "misc.h" #include %} /* * symbols that won't be wrapped */ %include "ignore.swg" %include typemaps.i %include exception.i %include cstring.i #ifdef SWIGPYTHON %include python/file.i #endif %apply double *OUTPUT { double *distance, double *azimuth }; %apply int *OUTPUT { int *degrees, int *minutes, double *seconds, int *sw }; %apply int *OUTPUT { int *degrees, double *minutes, int *sw }; %apply double *OUTPUT { double *longitude, double *latitude }; %apply char *OUTPUT { char *locator_res }; /* longlat2locator */ %cstring_bounded_output(char *locator_res, 13) %include %include %include %include %include /* needed because rig.swg and rotator.swg macros require identifiers like arg (no spaces) */ %header %{ typedef char * char_string; typedef const char * const_char_string; typedef channel_t * channel_t_p; typedef channel_t * const_channel_t_p; %} /* * The Rig "class" */ %include "rig.swg" /* * The Rot "class" */ %include "rotator.swg" /* * Put binding specific code in separate files * %include "perl.i" %include "tcl.i" %include "python.i" %include "whatever.i" */ hamlib-1.2.15.3/bindings/Makefile.in0000644000175000017500000007365212044564551014003 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ # Hamlib bindings using SWIG # more information on swig at http://www.swig.org # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ ########################################## # Tcl binding @ENABLE_TCL_TRUE@am__append_1 = hamlibtcl_wrap.c @ENABLE_TCL_TRUE@am__append_2 = hamlibtcl_wrap.c pkgIndex.tcl subdir = bindings DIST_COMMON = $(am__python_PYTHON_DIST) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/hamlibvb.bas.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = hamlibvb.bas CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(_Hamlib_ladir)" "$(DESTDIR)$(libdir)" \ "$(DESTDIR)$(pythondir)" "$(DESTDIR)$(hamlibtcl_ladir)" LTLIBRARIES = $(_Hamlib_la_LTLIBRARIES) $(lib_LTLIBRARIES) @ENABLE_PYTHON_TRUE@_Hamlib_la_DEPENDENCIES = \ @ENABLE_PYTHON_TRUE@ $(top_builddir)/src/libhamlib.la @ENABLE_PYTHON_TRUE@nodist__Hamlib_la_OBJECTS = hamlibpy_wrap.lo _Hamlib_la_OBJECTS = $(nodist__Hamlib_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent _Hamlib_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(_Hamlib_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_PYTHON_TRUE@am__Hamlib_la_rpath = -rpath $(_Hamlib_ladir) @ENABLE_TCL_TRUE@hamlibtcl_la_DEPENDENCIES = \ @ENABLE_TCL_TRUE@ $(top_builddir)/src/libhamlib.la @ENABLE_TCL_TRUE@nodist_hamlibtcl_la_OBJECTS = hamlibtcl_wrap.lo hamlibtcl_la_OBJECTS = $(nodist_hamlibtcl_la_OBJECTS) hamlibtcl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(hamlibtcl_la_LDFLAGS) $(LDFLAGS) -o $@ @ENABLE_TCL_TRUE@am_hamlibtcl_la_rpath = -rpath $(libdir) SCRIPTS = $(noinst_SCRIPTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(nodist__Hamlib_la_SOURCES) $(nodist_hamlibtcl_la_SOURCES) DIST_SOURCES = am__python_PYTHON_DIST = Hamlib.py py_compile = $(top_srcdir)/py-compile DATA = $(hamlibtcl_la_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ #INCLUDES = @INCLUDES@ -Dbool=char -I@PERL_INC_DIR@ @TCL_INCLUDE_SPEC@ -I$(top_srcdir)/bindings INCLUDES = @INCLUDES@ -I$(top_srcdir)/bindings @TCL_INCLUDE_SPEC@ @PYTHON_CPPFLAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SWGFILES = hamlib.swg ignore.swg rig.swg rotator.swg SWGDEP = $(top_srcdir)/include/hamlib/rig.h $(top_srcdir)/include/hamlib/riglist.h \ $(top_srcdir)/include/hamlib/rotator.h $(top_srcdir)/include/hamlib/rotlist.h \ $(SWGFILES) BUILT_SOURCES = $(am__append_1) hamlibpy_wrap.c Hamlib.py \ hamlibperl_wrap.c MOSTLYCLEANFILES = $(am__append_2) hamlibpy_wrap.c Hamlib.py *.pyc \ hamlibperl_wrap.c Hamlib.pm Hamlib.bs AM_CFLAGS = -fno-strict-aliasing @ENABLE_TCL_TRUE@tcl_ltlib = hamlibtcl.la @ENABLE_TCL_TRUE@tcldir = $(prefix)/lib/tcl @ENABLE_TCL_TRUE@PKG_VER = 1.0 @ENABLE_TCL_TRUE@DLL = hamlibtcl-$(PKG_VER)@TCL_SHLIB_SUFFIX@ @ENABLE_TCL_TRUE@nodist_hamlibtcl_la_SOURCES = hamlibtcl_wrap.c @ENABLE_TCL_TRUE@hamlibtcl_la_LDFLAGS = -no-undefined -module -release $(PKG_VER) -avoid-version @TCL_LIB_SPEC@ @ENABLE_TCL_TRUE@hamlibtcl_la_LIBADD = $(top_builddir)/src/libhamlib.la @ENABLE_TCL_TRUE@hamlibtcl_ladir = $(tcldir) @ENABLE_TCL_TRUE@hamlibtcl_la_DATA = pkgIndex.tcl ########################################## # Python binding @ENABLE_PYTHON_TRUE@python_ltlib = _Hamlib.la #pythondir = @pythondir@ @ENABLE_PYTHON_TRUE@nodist__Hamlib_la_SOURCES = hamlibpy_wrap.c @ENABLE_PYTHON_TRUE@_Hamlib_la_LDFLAGS = -no-undefined -module -avoid-version @ENABLE_PYTHON_TRUE@_Hamlib_la_LIBADD = $(top_builddir)/src/libhamlib.la @ENABLE_PYTHON_TRUE@_Hamlib_ladir = $(pythondir) @ENABLE_PYTHON_TRUE@python_PYTHON = Hamlib.py @ENABLE_PYTHON_TRUE@_Hamlib_la_LTLIBRARIES = $(python_ltlib) ########################################## lib_LTLIBRARIES = $(tcl_ltlib) EXTRA_DIST = $(SWGFILES) \ Makefile.PL perltest.pl tcltest.tcl pytest.py DISTCLEANFILES = Hamlib-pl.mk.old noinst_SCRIPTS = perltest.pl tcltest.tcl pytest.py hamlibvb.bas all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu bindings/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu bindings/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): hamlibvb.bas: $(top_builddir)/config.status $(srcdir)/hamlibvb.bas.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-_Hamlib_laLTLIBRARIES: $(_Hamlib_la_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(_Hamlib_ladir)" || $(MKDIR_P) "$(DESTDIR)$(_Hamlib_ladir)" @list='$(_Hamlib_la_LTLIBRARIES)'; test -n "$(_Hamlib_ladir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(_Hamlib_ladir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(_Hamlib_ladir)"; \ } uninstall-_Hamlib_laLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(_Hamlib_la_LTLIBRARIES)'; test -n "$(_Hamlib_ladir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(_Hamlib_ladir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(_Hamlib_ladir)/$$f"; \ done clean-_Hamlib_laLTLIBRARIES: -test -z "$(_Hamlib_la_LTLIBRARIES)" || rm -f $(_Hamlib_la_LTLIBRARIES) @list='$(_Hamlib_la_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done _Hamlib.la: $(_Hamlib_la_OBJECTS) $(_Hamlib_la_DEPENDENCIES) $(AM_V_CCLD)$(_Hamlib_la_LINK) $(am__Hamlib_la_rpath) $(_Hamlib_la_OBJECTS) $(_Hamlib_la_LIBADD) $(LIBS) hamlibtcl.la: $(hamlibtcl_la_OBJECTS) $(hamlibtcl_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlibtcl_la_LINK) $(am_hamlibtcl_la_rpath) $(hamlibtcl_la_OBJECTS) $(hamlibtcl_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hamlibpy_wrap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hamlibtcl_wrap.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-pythonPYTHON: $(python_PYTHON) @$(NORMAL_INSTALL) test -z "$(pythondir)" || $(MKDIR_P) "$(DESTDIR)$(pythondir)" @list='$(python_PYTHON)'; dlist=; list2=; test -n "$(pythondir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \ if test -f $$b$$p; then \ $(am__strip_dir) \ dlist="$$dlist $$f"; \ list2="$$list2 $$b$$p"; \ else :; fi; \ done; \ for file in $$list2; do echo $$file; done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pythondir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pythondir)" || exit $$?; \ done || exit $$?; \ if test -n "$$dlist"; then \ if test -z "$(DESTDIR)"; then \ PYTHON=$(PYTHON) $(py_compile) --basedir "$(pythondir)" $$dlist; \ else \ PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(pythondir)" $$dlist; \ fi; \ else :; fi uninstall-pythonPYTHON: @$(NORMAL_UNINSTALL) @list='$(python_PYTHON)'; test -n "$(pythondir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ filesc=`echo "$$files" | sed 's|$$|c|'`; \ fileso=`echo "$$files" | sed 's|$$|o|'`; \ echo " ( cd '$(DESTDIR)$(pythondir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pythondir)" && rm -f $$files || exit $$?; \ echo " ( cd '$(DESTDIR)$(pythondir)' && rm -f" $$filesc ")"; \ cd "$(DESTDIR)$(pythondir)" && rm -f $$filesc || exit $$?; \ echo " ( cd '$(DESTDIR)$(pythondir)' && rm -f" $$fileso ")"; \ cd "$(DESTDIR)$(pythondir)" && rm -f $$fileso install-hamlibtcl_laDATA: $(hamlibtcl_la_DATA) @$(NORMAL_INSTALL) test -z "$(hamlibtcl_ladir)" || $(MKDIR_P) "$(DESTDIR)$(hamlibtcl_ladir)" @list='$(hamlibtcl_la_DATA)'; test -n "$(hamlibtcl_ladir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(hamlibtcl_ladir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(hamlibtcl_ladir)" || exit $$?; \ done uninstall-hamlibtcl_laDATA: @$(NORMAL_UNINSTALL) @list='$(hamlibtcl_la_DATA)'; test -n "$(hamlibtcl_ladir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(hamlibtcl_ladir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(hamlibtcl_ladir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(SCRIPTS) $(DATA) all-local installdirs: for dir in "$(DESTDIR)$(_Hamlib_ladir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pythondir)" "$(DESTDIR)$(hamlibtcl_ladir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-_Hamlib_laLTLIBRARIES clean-generic \ clean-libLTLIBRARIES clean-libtool clean-local mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-local distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-_Hamlib_laLTLIBRARIES \ install-hamlibtcl_laDATA install-pythonPYTHON install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-exec-local install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-_Hamlib_laLTLIBRARIES \ uninstall-hamlibtcl_laDATA uninstall-libLTLIBRARIES \ uninstall-local uninstall-pythonPYTHON .MAKE: all check check-am install install-am install-strip .PHONY: CTAGS GTAGS all all-am all-local check check-am check-local \ clean clean-_Hamlib_laLTLIBRARIES clean-generic \ clean-libLTLIBRARIES clean-libtool clean-local ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-local distclean-tags distdir dvi dvi-am html html-am \ info info-am install install-_Hamlib_laLTLIBRARIES install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-exec-local \ install-hamlibtcl_laDATA install-html install-html-am \ install-info install-info-am install-libLTLIBRARIES \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-pythonPYTHON install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-_Hamlib_laLTLIBRARIES uninstall-am \ uninstall-hamlibtcl_laDATA uninstall-libLTLIBRARIES \ uninstall-local uninstall-pythonPYTHON ########################################## # Perl binding hamlibperl_wrap.c: hamlib.swg $(SWIGDEP) $(SWIG) -perl5 -shadow @INCLUDES@ -I$(top_srcdir)/bindings -o $@ \ `test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg Hamlib-pl.mk: $(srcdir)/Makefile.PL test -f Makefile.PL || $(LN_S) $(srcdir)/Makefile.PL Makefile.PL perl `test -f Makefile.PL || echo '$(srcdir)/'`Makefile.PL \ MAKEFILE="Hamlib-pl.mk" \ PREFIX="$(prefix)" \ INC="$(INCLUDES)" \ CC="$(CC)" \ OBJECT="hamlibperl_wrap.o" \ VERSION="$(PACKAGE_VERSION)" \ LIBS="-L$(top_builddir)/src/.libs -lhamlib" sed -e 's/^LD_RUN_PATH.*/LD_RUN_PATH =/' Hamlib-pl.mk > Hamlib-pl-norpath.mk mv Hamlib-pl-norpath.mk Hamlib-pl.mk all-perl: Hamlib-pl.mk hamlibperl_wrap.c $(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk all check-perl: all-perl $(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk test clean-perl: Hamlib-pl.mk $(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk clean distclean-perl: ## Hamlib-pl.mk distcheck-perl: Hamlib-pl.mk $(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk distcheck install-perl: Hamlib-pl.mk $(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk install_site uninstall-perl: ## Hamlib-pl.mk @ENABLE_TCL_TRUE@pkgIndex.tcl: Makefile @ENABLE_TCL_TRUE@ echo 'package ifneeded Hamlib $(PKG_VER) [list load [file join $$dir $(DLL)] Hamlib]' > pkgIndex.tcl @ENABLE_TCL_TRUE@hamlibtcl_wrap.c: hamlib.swg $(SWGDEP) @ENABLE_TCL_TRUE@ $(SWIG) -tcl -pkgversion $(PKG_VER) @INCLUDES@ -I$(top_srcdir)/bindings -o $@ \ @ENABLE_TCL_TRUE@ `test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg @ENABLE_TCL_TRUE@all-tcl: pkgIndex.tcl $(tcl_ltlib) @ENABLE_TCL_TRUE@check-tcl: all-tcl @ENABLE_TCL_TRUE@ TCLLIBPATH=$(builddir)/.libs $(srcdir)/tcltest.tcl || echo "Tcl test failed" 1>&2 @ENABLE_TCL_TRUE@install-tcl: @ENABLE_TCL_TRUE@clean-tcl: @ENABLE_TCL_TRUE@distclean-tcl: clean-tcl @ENABLE_TCL_TRUE@uninstall-tcl: @ENABLE_PYTHON_TRUE@all-py: $(python_ltlib) @ENABLE_PYTHON_TRUE@check-py: all-py @ENABLE_PYTHON_TRUE@ $(srcdir)/pytest.py || echo "Python test failed" 1>&2 Hamlib.py: hamlibpy_wrap.c hamlibpy_wrap.c: hamlib.swg $(SWGDEP) $(SWIG) -python @INCLUDES@ -I$(top_srcdir)/bindings -o $@ \ `test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg install-py: clean-py: distclean-py: uninstall-py: # lib_LTLIBRARIES = @BINDING_LIB_TARGETS@ all-local: @BINDING_ALL@ check-local: @BINDING_CHECK@ clean-local: @BINDING_CLEAN@ distclean-local: @BINDING_DISTCLEAN@ distcheck-local: @BINDING_DISTCHECK@ install-exec-local: @BINDING_INSTALL_EXEC@ uninstall-local: @BINDING_UNINSTALL@ # 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: hamlib-1.2.15.3/bindings/perltest.pl0000755000175000017500000000464612044564477014144 00000000000000#!/usr/bin/perl -Iblib/arch -Iblib/lib use Hamlib; print "Perl $] test, version: $Hamlib::hamlib_version\n"; #Hamlib::rig_set_debug($Hamlib::RIG_DEBUG_TRACE); Hamlib::rig_set_debug($Hamlib::RIG_DEBUG_NONE); $rig = new Hamlib::Rig($Hamlib::RIG_MODEL_DUMMY); # replace "/dev/Rig" with your path to serial port $rig->set_conf("retry","50"); $rig->set_conf("rig_pathname","/dev/Rig"); $rig->open(); # 1073741944 is token value for "itu_region" # but using get_conf is much more convenient $region = $rig->get_conf(1073741944); $rpath = $rig->get_conf("rig_pathname"); $retry = $rig->get_conf("retry"); print "get_conf: path=\"$rpath\", retry=$retry, ITU region=$region\n"; $rig->set_freq(14266000, $Hamlib::RIG_VFO_A); $f = $rig->get_freq(); print "freq: $f\n"; ($mode, $width) = $rig->get_mode(); print "get_mode: ".Hamlib::rig_strrmode($mode).", width: $width\n"; $vfo = $rig->get_vfo(); print "get_vfo: ".Hamlib::rig_strvfo($vfo)."\n"; $rig->set_vfo($Hamlib::RIG_VFO_B); #$rig->set_vfo("VFOA"); $rig->set_mode($Hamlib::RIG_MODE_CW, $Hamlib::RIG_PASSBAND_NORMAL); print "ITU region: $rig->{state}->{itu_region}\n"; print "Backend copyright: $rig->{caps}->{copyright}\n"; $inf = $rig->get_info(); print "get_info: $inf\n"; $rig->set_level("VOX", 1); $lvl = $rig->get_level_i("VOX"); print "VOX level: $lvl\n"; $rig->set_level($Hamlib::RIG_LEVEL_VOX, 5); $lvl = $rig->get_level_i($Hamlib::RIG_LEVEL_VOX); print "VOX level: $lvl\n"; $lvl = $rig->get_level_i($Hamlib::RIG_LEVEL_STRENGTH); print "strength: $lvl\n"; $chan = new Hamlib::channel($Hamlib::RIG_VFO_A); $rig->get_channel($chan); print "get_channel status: $rig->{error_status} = ".Hamlib::rigerror($rig->{error_status})."\n"; print "VFO: ".Hamlib::rig_strvfo($chan->{vfo}).", $chan->{freq}\n"; $rig->close(); print "\nSome static functions:\n"; ($err, $long1, $lat1, $sw1) = Hamlib::locator2longlat("IN98EC"); ($err, $long2, $lat2, $sw1) = Hamlib::locator2longlat("DM33DX"); $loc1 = Hamlib::longlat2locator($long1, $lat1, 3); $loc2 = Hamlib::longlat2locator($long2, $lat2, 3); print "Loc1: $loc1\n"; print "Loc2: $loc2\n"; ($err, $dist, $az) = Hamlib::qrb($long1, $lat1, $long2, $lat2); $longpath = Hamlib::distance_long_path($dist); print "Distance: $dist km, azimuth $az, long path: $longpath\n"; ($err, $deg, $min, $sec, $sw) = Hamlib::dec2dms($az); $deg = -$deg if ($sw == 1); $az2 = Hamlib::dms2dec($deg, $min, $sec, $sw); print "Bearing: $az, $deg° $min' $sec\", recoded: $az2\n" hamlib-1.2.15.3/bindings/Makefile.PL0000644000175000017500000000075212044564477013706 00000000000000# Builds Hamlib-pl.mk and is invoked from Makefile use ExtUtils::MakeMaker; WriteMakefile( 'NAME' => 'Hamlib', # Add these new keywords supported since 5.005 ($] >= 5.005 ? ( #ABSTRACT_FROM => 'Hamlib.pm', # retrieve abstract from module AUTHOR => 'Stephane Fillod and the Hamlib Group') : ()), # should use libtool somehow. Otherwise try -Wl,--rpath #'LIBS' => ['-lhamlib'], #'DEFINE' => '', #'INC' => '', #'OBJECT' => 'hamlibperl_wrap.o', # link all the C files too ); hamlib-1.2.15.3/bindings/Hamlib.py0000644000175000017500000045515512044565006013502 00000000000000# This file was automatically generated by SWIG (http://www.swig.org). # Version 1.3.40 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. # This file is compatible with both classic and new-style classes. from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_Hamlib', [dirname(__file__)]) except ImportError: import _Hamlib return _Hamlib if fp is not None: try: _mod = imp.load_module('_Hamlib', fp, pathname, description) finally: fp.close() return _mod _Hamlib = swig_import_helper() del swig_import_helper else: import _Hamlib del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static) or hasattr(self,name): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0) def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0 RIG_MODEL_NONE = _Hamlib.RIG_MODEL_NONE RIG_MODEL_DUMMY = _Hamlib.RIG_MODEL_DUMMY RIG_MODEL_NETRIGCTL = _Hamlib.RIG_MODEL_NETRIGCTL RIG_MODEL_ARMSTRONG = _Hamlib.RIG_MODEL_ARMSTRONG RIG_MODEL_FT847 = _Hamlib.RIG_MODEL_FT847 RIG_MODEL_FT1000 = _Hamlib.RIG_MODEL_FT1000 RIG_MODEL_FT1000D = _Hamlib.RIG_MODEL_FT1000D RIG_MODEL_FT1000MPMKV = _Hamlib.RIG_MODEL_FT1000MPMKV RIG_MODEL_FT747 = _Hamlib.RIG_MODEL_FT747 RIG_MODEL_FT757 = _Hamlib.RIG_MODEL_FT757 RIG_MODEL_FT757GXII = _Hamlib.RIG_MODEL_FT757GXII RIG_MODEL_FT575 = _Hamlib.RIG_MODEL_FT575 RIG_MODEL_FT767 = _Hamlib.RIG_MODEL_FT767 RIG_MODEL_FT736R = _Hamlib.RIG_MODEL_FT736R RIG_MODEL_FT840 = _Hamlib.RIG_MODEL_FT840 RIG_MODEL_FT820 = _Hamlib.RIG_MODEL_FT820 RIG_MODEL_FT900 = _Hamlib.RIG_MODEL_FT900 RIG_MODEL_FT920 = _Hamlib.RIG_MODEL_FT920 RIG_MODEL_FT890 = _Hamlib.RIG_MODEL_FT890 RIG_MODEL_FT990 = _Hamlib.RIG_MODEL_FT990 RIG_MODEL_FRG100 = _Hamlib.RIG_MODEL_FRG100 RIG_MODEL_FRG9600 = _Hamlib.RIG_MODEL_FRG9600 RIG_MODEL_FRG8800 = _Hamlib.RIG_MODEL_FRG8800 RIG_MODEL_FT817 = _Hamlib.RIG_MODEL_FT817 RIG_MODEL_FT100 = _Hamlib.RIG_MODEL_FT100 RIG_MODEL_FT857 = _Hamlib.RIG_MODEL_FT857 RIG_MODEL_FT897 = _Hamlib.RIG_MODEL_FT897 RIG_MODEL_FT1000MP = _Hamlib.RIG_MODEL_FT1000MP RIG_MODEL_FT1000MPMKVFLD = _Hamlib.RIG_MODEL_FT1000MPMKVFLD RIG_MODEL_VR5000 = _Hamlib.RIG_MODEL_VR5000 RIG_MODEL_FT450 = _Hamlib.RIG_MODEL_FT450 RIG_MODEL_FT950 = _Hamlib.RIG_MODEL_FT950 RIG_MODEL_FT2000 = _Hamlib.RIG_MODEL_FT2000 RIG_MODEL_FT9000 = _Hamlib.RIG_MODEL_FT9000 RIG_MODEL_FT980 = _Hamlib.RIG_MODEL_FT980 RIG_MODEL_FTDX5000 = _Hamlib.RIG_MODEL_FTDX5000 RIG_MODEL_VX1700 = _Hamlib.RIG_MODEL_VX1700 RIG_MODEL_TS50 = _Hamlib.RIG_MODEL_TS50 RIG_MODEL_TS440 = _Hamlib.RIG_MODEL_TS440 RIG_MODEL_TS450S = _Hamlib.RIG_MODEL_TS450S RIG_MODEL_TS570D = _Hamlib.RIG_MODEL_TS570D RIG_MODEL_TS690S = _Hamlib.RIG_MODEL_TS690S RIG_MODEL_TS711 = _Hamlib.RIG_MODEL_TS711 RIG_MODEL_TS790 = _Hamlib.RIG_MODEL_TS790 RIG_MODEL_TS811 = _Hamlib.RIG_MODEL_TS811 RIG_MODEL_TS850 = _Hamlib.RIG_MODEL_TS850 RIG_MODEL_TS870S = _Hamlib.RIG_MODEL_TS870S RIG_MODEL_TS940 = _Hamlib.RIG_MODEL_TS940 RIG_MODEL_TS950 = _Hamlib.RIG_MODEL_TS950 RIG_MODEL_TS950SDX = _Hamlib.RIG_MODEL_TS950SDX RIG_MODEL_TS2000 = _Hamlib.RIG_MODEL_TS2000 RIG_MODEL_R5000 = _Hamlib.RIG_MODEL_R5000 RIG_MODEL_TS570S = _Hamlib.RIG_MODEL_TS570S RIG_MODEL_THD7A = _Hamlib.RIG_MODEL_THD7A RIG_MODEL_THD7AG = _Hamlib.RIG_MODEL_THD7AG RIG_MODEL_THF6A = _Hamlib.RIG_MODEL_THF6A RIG_MODEL_THF7E = _Hamlib.RIG_MODEL_THF7E RIG_MODEL_K2 = _Hamlib.RIG_MODEL_K2 RIG_MODEL_TS930 = _Hamlib.RIG_MODEL_TS930 RIG_MODEL_THG71 = _Hamlib.RIG_MODEL_THG71 RIG_MODEL_TS680S = _Hamlib.RIG_MODEL_TS680S RIG_MODEL_TS140S = _Hamlib.RIG_MODEL_TS140S RIG_MODEL_TMD700 = _Hamlib.RIG_MODEL_TMD700 RIG_MODEL_TMV7 = _Hamlib.RIG_MODEL_TMV7 RIG_MODEL_TS480 = _Hamlib.RIG_MODEL_TS480 RIG_MODEL_K3 = _Hamlib.RIG_MODEL_K3 RIG_MODEL_TRC80 = _Hamlib.RIG_MODEL_TRC80 RIG_MODEL_TS590S = _Hamlib.RIG_MODEL_TS590S RIG_MODEL_TRANSFOX = _Hamlib.RIG_MODEL_TRANSFOX RIG_MODEL_THD72A = _Hamlib.RIG_MODEL_THD72A RIG_MODEL_TMD710 = _Hamlib.RIG_MODEL_TMD710 RIG_MODEL_TMV71 = _Hamlib.RIG_MODEL_TMV71 RIG_MODEL_IC1271 = _Hamlib.RIG_MODEL_IC1271 RIG_MODEL_IC1275 = _Hamlib.RIG_MODEL_IC1275 RIG_MODEL_IC271 = _Hamlib.RIG_MODEL_IC271 RIG_MODEL_IC275 = _Hamlib.RIG_MODEL_IC275 RIG_MODEL_IC375 = _Hamlib.RIG_MODEL_IC375 RIG_MODEL_IC471 = _Hamlib.RIG_MODEL_IC471 RIG_MODEL_IC475 = _Hamlib.RIG_MODEL_IC475 RIG_MODEL_IC575 = _Hamlib.RIG_MODEL_IC575 RIG_MODEL_IC706 = _Hamlib.RIG_MODEL_IC706 RIG_MODEL_IC706MKII = _Hamlib.RIG_MODEL_IC706MKII RIG_MODEL_IC706MKIIG = _Hamlib.RIG_MODEL_IC706MKIIG RIG_MODEL_IC707 = _Hamlib.RIG_MODEL_IC707 RIG_MODEL_IC718 = _Hamlib.RIG_MODEL_IC718 RIG_MODEL_IC725 = _Hamlib.RIG_MODEL_IC725 RIG_MODEL_IC726 = _Hamlib.RIG_MODEL_IC726 RIG_MODEL_IC728 = _Hamlib.RIG_MODEL_IC728 RIG_MODEL_IC729 = _Hamlib.RIG_MODEL_IC729 RIG_MODEL_IC731 = _Hamlib.RIG_MODEL_IC731 RIG_MODEL_IC735 = _Hamlib.RIG_MODEL_IC735 RIG_MODEL_IC736 = _Hamlib.RIG_MODEL_IC736 RIG_MODEL_IC737 = _Hamlib.RIG_MODEL_IC737 RIG_MODEL_IC738 = _Hamlib.RIG_MODEL_IC738 RIG_MODEL_IC746 = _Hamlib.RIG_MODEL_IC746 RIG_MODEL_IC751 = _Hamlib.RIG_MODEL_IC751 RIG_MODEL_IC751A = _Hamlib.RIG_MODEL_IC751A RIG_MODEL_IC756 = _Hamlib.RIG_MODEL_IC756 RIG_MODEL_IC756PRO = _Hamlib.RIG_MODEL_IC756PRO RIG_MODEL_IC761 = _Hamlib.RIG_MODEL_IC761 RIG_MODEL_IC765 = _Hamlib.RIG_MODEL_IC765 RIG_MODEL_IC775 = _Hamlib.RIG_MODEL_IC775 RIG_MODEL_IC781 = _Hamlib.RIG_MODEL_IC781 RIG_MODEL_IC820 = _Hamlib.RIG_MODEL_IC820 RIG_MODEL_IC821 = _Hamlib.RIG_MODEL_IC821 RIG_MODEL_IC821H = _Hamlib.RIG_MODEL_IC821H RIG_MODEL_IC970 = _Hamlib.RIG_MODEL_IC970 RIG_MODEL_ICR10 = _Hamlib.RIG_MODEL_ICR10 RIG_MODEL_ICR71 = _Hamlib.RIG_MODEL_ICR71 RIG_MODEL_ICR72 = _Hamlib.RIG_MODEL_ICR72 RIG_MODEL_ICR75 = _Hamlib.RIG_MODEL_ICR75 RIG_MODEL_ICR7000 = _Hamlib.RIG_MODEL_ICR7000 RIG_MODEL_ICR7100 = _Hamlib.RIG_MODEL_ICR7100 RIG_MODEL_ICR8500 = _Hamlib.RIG_MODEL_ICR8500 RIG_MODEL_ICR9000 = _Hamlib.RIG_MODEL_ICR9000 RIG_MODEL_IC910 = _Hamlib.RIG_MODEL_IC910 RIG_MODEL_IC78 = _Hamlib.RIG_MODEL_IC78 RIG_MODEL_IC746PRO = _Hamlib.RIG_MODEL_IC746PRO RIG_MODEL_IC756PROII = _Hamlib.RIG_MODEL_IC756PROII RIG_MODEL_ICID1 = _Hamlib.RIG_MODEL_ICID1 RIG_MODEL_IC703 = _Hamlib.RIG_MODEL_IC703 RIG_MODEL_IC7800 = _Hamlib.RIG_MODEL_IC7800 RIG_MODEL_IC756PROIII = _Hamlib.RIG_MODEL_IC756PROIII RIG_MODEL_ICR20 = _Hamlib.RIG_MODEL_ICR20 RIG_MODEL_IC7000 = _Hamlib.RIG_MODEL_IC7000 RIG_MODEL_IC7200 = _Hamlib.RIG_MODEL_IC7200 RIG_MODEL_IC7700 = _Hamlib.RIG_MODEL_IC7700 RIG_MODEL_IC7600 = _Hamlib.RIG_MODEL_IC7600 RIG_MODEL_IC92D = _Hamlib.RIG_MODEL_IC92D RIG_MODEL_ICR9500 = _Hamlib.RIG_MODEL_ICR9500 RIG_MODEL_IC7410 = _Hamlib.RIG_MODEL_IC7410 RIG_MODEL_IC9100 = _Hamlib.RIG_MODEL_IC9100 RIG_MODEL_ICRX7 = _Hamlib.RIG_MODEL_ICRX7 RIG_MODEL_MINISCOUT = _Hamlib.RIG_MODEL_MINISCOUT RIG_MODEL_XPLORER = _Hamlib.RIG_MODEL_XPLORER RIG_MODEL_OS535 = _Hamlib.RIG_MODEL_OS535 RIG_MODEL_OS456 = _Hamlib.RIG_MODEL_OS456 RIG_MODEL_OMNIVI = _Hamlib.RIG_MODEL_OMNIVI RIG_MODEL_OMNIVIP = _Hamlib.RIG_MODEL_OMNIVIP RIG_MODEL_PARAGON2 = _Hamlib.RIG_MODEL_PARAGON2 RIG_MODEL_DELTAII = _Hamlib.RIG_MODEL_DELTAII RIG_MODEL_PCR1000 = _Hamlib.RIG_MODEL_PCR1000 RIG_MODEL_PCR100 = _Hamlib.RIG_MODEL_PCR100 RIG_MODEL_PCR1500 = _Hamlib.RIG_MODEL_PCR1500 RIG_MODEL_PCR2500 = _Hamlib.RIG_MODEL_PCR2500 RIG_MODEL_AR8200 = _Hamlib.RIG_MODEL_AR8200 RIG_MODEL_AR8000 = _Hamlib.RIG_MODEL_AR8000 RIG_MODEL_AR7030 = _Hamlib.RIG_MODEL_AR7030 RIG_MODEL_AR5000 = _Hamlib.RIG_MODEL_AR5000 RIG_MODEL_AR3030 = _Hamlib.RIG_MODEL_AR3030 RIG_MODEL_AR3000A = _Hamlib.RIG_MODEL_AR3000A RIG_MODEL_AR3000 = _Hamlib.RIG_MODEL_AR3000 RIG_MODEL_AR2700 = _Hamlib.RIG_MODEL_AR2700 RIG_MODEL_AR2500 = _Hamlib.RIG_MODEL_AR2500 RIG_MODEL_AR16 = _Hamlib.RIG_MODEL_AR16 RIG_MODEL_SDU5500 = _Hamlib.RIG_MODEL_SDU5500 RIG_MODEL_SDU5000 = _Hamlib.RIG_MODEL_SDU5000 RIG_MODEL_AR8600 = _Hamlib.RIG_MODEL_AR8600 RIG_MODEL_AR5000A = _Hamlib.RIG_MODEL_AR5000A RIG_MODEL_AR7030P = _Hamlib.RIG_MODEL_AR7030P RIG_MODEL_SR2200 = _Hamlib.RIG_MODEL_SR2200 RIG_MODEL_JST145 = _Hamlib.RIG_MODEL_JST145 RIG_MODEL_JST245 = _Hamlib.RIG_MODEL_JST245 RIG_MODEL_CMH530 = _Hamlib.RIG_MODEL_CMH530 RIG_MODEL_NRD345 = _Hamlib.RIG_MODEL_NRD345 RIG_MODEL_NRD525 = _Hamlib.RIG_MODEL_NRD525 RIG_MODEL_NRD535 = _Hamlib.RIG_MODEL_NRD535 RIG_MODEL_NRD545 = _Hamlib.RIG_MODEL_NRD545 RIG_MODEL_RS64 = _Hamlib.RIG_MODEL_RS64 RIG_MODEL_RS2005 = _Hamlib.RIG_MODEL_RS2005 RIG_MODEL_RS2006 = _Hamlib.RIG_MODEL_RS2006 RIG_MODEL_RS2035 = _Hamlib.RIG_MODEL_RS2035 RIG_MODEL_RS2042 = _Hamlib.RIG_MODEL_RS2042 RIG_MODEL_RS2041 = _Hamlib.RIG_MODEL_RS2041 RIG_MODEL_BC780 = _Hamlib.RIG_MODEL_BC780 RIG_MODEL_BC245 = _Hamlib.RIG_MODEL_BC245 RIG_MODEL_BC895 = _Hamlib.RIG_MODEL_BC895 RIG_MODEL_PRO2052 = _Hamlib.RIG_MODEL_PRO2052 RIG_MODEL_BC235 = _Hamlib.RIG_MODEL_BC235 RIG_MODEL_BC250 = _Hamlib.RIG_MODEL_BC250 RIG_MODEL_BC785 = _Hamlib.RIG_MODEL_BC785 RIG_MODEL_BC786 = _Hamlib.RIG_MODEL_BC786 RIG_MODEL_BCT8 = _Hamlib.RIG_MODEL_BCT8 RIG_MODEL_BCD396T = _Hamlib.RIG_MODEL_BCD396T RIG_MODEL_BCD996T = _Hamlib.RIG_MODEL_BCD996T RIG_MODEL_BC898 = _Hamlib.RIG_MODEL_BC898 RIG_MODEL_DKR8 = _Hamlib.RIG_MODEL_DKR8 RIG_MODEL_DKR8A = _Hamlib.RIG_MODEL_DKR8A RIG_MODEL_DKR8B = _Hamlib.RIG_MODEL_DKR8B RIG_MODEL_HF150 = _Hamlib.RIG_MODEL_HF150 RIG_MODEL_HF225 = _Hamlib.RIG_MODEL_HF225 RIG_MODEL_HF250 = _Hamlib.RIG_MODEL_HF250 RIG_MODEL_HF235 = _Hamlib.RIG_MODEL_HF235 RIG_MODEL_RA3790 = _Hamlib.RIG_MODEL_RA3790 RIG_MODEL_RA3720 = _Hamlib.RIG_MODEL_RA3720 RIG_MODEL_RA6790 = _Hamlib.RIG_MODEL_RA6790 RIG_MODEL_RA3710 = _Hamlib.RIG_MODEL_RA3710 RIG_MODEL_RA3702 = _Hamlib.RIG_MODEL_RA3702 RIG_MODEL_HF1000 = _Hamlib.RIG_MODEL_HF1000 RIG_MODEL_HF1000A = _Hamlib.RIG_MODEL_HF1000A RIG_MODEL_WJ8711 = _Hamlib.RIG_MODEL_WJ8711 RIG_MODEL_WJ8888 = _Hamlib.RIG_MODEL_WJ8888 RIG_MODEL_ESM500 = _Hamlib.RIG_MODEL_ESM500 RIG_MODEL_EK890 = _Hamlib.RIG_MODEL_EK890 RIG_MODEL_EK891 = _Hamlib.RIG_MODEL_EK891 RIG_MODEL_EK895 = _Hamlib.RIG_MODEL_EK895 RIG_MODEL_EK070 = _Hamlib.RIG_MODEL_EK070 RIG_MODEL_TRP7000 = _Hamlib.RIG_MODEL_TRP7000 RIG_MODEL_TRP8000 = _Hamlib.RIG_MODEL_TRP8000 RIG_MODEL_TRP9000 = _Hamlib.RIG_MODEL_TRP9000 RIG_MODEL_TRP8255 = _Hamlib.RIG_MODEL_TRP8255 RIG_MODEL_WR1000 = _Hamlib.RIG_MODEL_WR1000 RIG_MODEL_WR1500 = _Hamlib.RIG_MODEL_WR1500 RIG_MODEL_WR1550 = _Hamlib.RIG_MODEL_WR1550 RIG_MODEL_WR3100 = _Hamlib.RIG_MODEL_WR3100 RIG_MODEL_WR3150 = _Hamlib.RIG_MODEL_WR3150 RIG_MODEL_WR3500 = _Hamlib.RIG_MODEL_WR3500 RIG_MODEL_WR3700 = _Hamlib.RIG_MODEL_WR3700 RIG_MODEL_G303 = _Hamlib.RIG_MODEL_G303 RIG_MODEL_G313 = _Hamlib.RIG_MODEL_G313 RIG_MODEL_G305 = _Hamlib.RIG_MODEL_G305 RIG_MODEL_G315 = _Hamlib.RIG_MODEL_G315 RIG_MODEL_TT550 = _Hamlib.RIG_MODEL_TT550 RIG_MODEL_TT538 = _Hamlib.RIG_MODEL_TT538 RIG_MODEL_RX320 = _Hamlib.RIG_MODEL_RX320 RIG_MODEL_RX340 = _Hamlib.RIG_MODEL_RX340 RIG_MODEL_RX350 = _Hamlib.RIG_MODEL_RX350 RIG_MODEL_TT526 = _Hamlib.RIG_MODEL_TT526 RIG_MODEL_TT516 = _Hamlib.RIG_MODEL_TT516 RIG_MODEL_TT565 = _Hamlib.RIG_MODEL_TT565 RIG_MODEL_TT585 = _Hamlib.RIG_MODEL_TT585 RIG_MODEL_TT588 = _Hamlib.RIG_MODEL_TT588 RIG_MODEL_RX331 = _Hamlib.RIG_MODEL_RX331 RIG_MODEL_TT599 = _Hamlib.RIG_MODEL_TT599 RIG_MODEL_DX77 = _Hamlib.RIG_MODEL_DX77 RIG_MODEL_505DSP = _Hamlib.RIG_MODEL_505DSP RIG_MODEL_RPC = _Hamlib.RIG_MODEL_RPC RIG_MODEL_GNURADIO = _Hamlib.RIG_MODEL_GNURADIO RIG_MODEL_MC4020 = _Hamlib.RIG_MODEL_MC4020 RIG_MODEL_GRAUDIO = _Hamlib.RIG_MODEL_GRAUDIO RIG_MODEL_GRAUDIOIQ = _Hamlib.RIG_MODEL_GRAUDIOIQ RIG_MODEL_USRP_G = _Hamlib.RIG_MODEL_USRP_G RIG_MODEL_MICROTUNE_4937 = _Hamlib.RIG_MODEL_MICROTUNE_4937 RIG_MODEL_MICROTUNE_4702 = _Hamlib.RIG_MODEL_MICROTUNE_4702 RIG_MODEL_MICROTUNE_4707 = _Hamlib.RIG_MODEL_MICROTUNE_4707 RIG_MODEL_DSP10 = _Hamlib.RIG_MODEL_DSP10 RIG_MODEL_SDR1000 = _Hamlib.RIG_MODEL_SDR1000 RIG_MODEL_SDR1000RFE = _Hamlib.RIG_MODEL_SDR1000RFE RIG_MODEL_DTTSP = _Hamlib.RIG_MODEL_DTTSP RIG_MODEL_DTTSP_UDP = _Hamlib.RIG_MODEL_DTTSP_UDP RIG_MODEL_EKD500 = _Hamlib.RIG_MODEL_EKD500 RIG_MODEL_ELEKTOR304 = _Hamlib.RIG_MODEL_ELEKTOR304 RIG_MODEL_DRT1 = _Hamlib.RIG_MODEL_DRT1 RIG_MODEL_DWT = _Hamlib.RIG_MODEL_DWT RIG_MODEL_USRP0 = _Hamlib.RIG_MODEL_USRP0 RIG_MODEL_USRP = _Hamlib.RIG_MODEL_USRP RIG_MODEL_DDS60 = _Hamlib.RIG_MODEL_DDS60 RIG_MODEL_ELEKTOR507 = _Hamlib.RIG_MODEL_ELEKTOR507 RIG_MODEL_MINIVNA = _Hamlib.RIG_MODEL_MINIVNA RIG_MODEL_SI570AVRUSB = _Hamlib.RIG_MODEL_SI570AVRUSB RIG_MODEL_PMSDR = _Hamlib.RIG_MODEL_PMSDR RIG_MODEL_SI570PICUSB = _Hamlib.RIG_MODEL_SI570PICUSB RIG_MODEL_FIFISDR = _Hamlib.RIG_MODEL_FIFISDR RIG_MODEL_FUNCUBEDONGLE = _Hamlib.RIG_MODEL_FUNCUBEDONGLE RIG_MODEL_HIQSDR = _Hamlib.RIG_MODEL_HIQSDR RIG_MODEL_V4L = _Hamlib.RIG_MODEL_V4L RIG_MODEL_V4L2 = _Hamlib.RIG_MODEL_V4L2 RIG_MODEL_ESMC = _Hamlib.RIG_MODEL_ESMC RIG_MODEL_EB200 = _Hamlib.RIG_MODEL_EB200 RIG_MODEL_PRM8060 = _Hamlib.RIG_MODEL_PRM8060 RIG_MODEL_PRM8070 = _Hamlib.RIG_MODEL_PRM8070 RIG_MODEL_ADT_200A = _Hamlib.RIG_MODEL_ADT_200A RIG_OK = _Hamlib.RIG_OK RIG_EINVAL = _Hamlib.RIG_EINVAL RIG_ECONF = _Hamlib.RIG_ECONF RIG_ENOMEM = _Hamlib.RIG_ENOMEM RIG_ENIMPL = _Hamlib.RIG_ENIMPL RIG_ETIMEOUT = _Hamlib.RIG_ETIMEOUT RIG_EIO = _Hamlib.RIG_EIO RIG_EINTERNAL = _Hamlib.RIG_EINTERNAL RIG_EPROTO = _Hamlib.RIG_EPROTO RIG_ERJCTED = _Hamlib.RIG_ERJCTED RIG_ETRUNC = _Hamlib.RIG_ETRUNC RIG_ENAVAIL = _Hamlib.RIG_ENAVAIL RIG_ENTARGET = _Hamlib.RIG_ENTARGET RIG_BUSERROR = _Hamlib.RIG_BUSERROR RIG_BUSBUSY = _Hamlib.RIG_BUSBUSY RIG_EARG = _Hamlib.RIG_EARG RIG_EVFO = _Hamlib.RIG_EVFO RIG_EDOM = _Hamlib.RIG_EDOM NETRIGCTL_RET = _Hamlib.NETRIGCTL_RET RIG_DEBUG_NONE = _Hamlib.RIG_DEBUG_NONE RIG_DEBUG_BUG = _Hamlib.RIG_DEBUG_BUG RIG_DEBUG_ERR = _Hamlib.RIG_DEBUG_ERR RIG_DEBUG_WARN = _Hamlib.RIG_DEBUG_WARN RIG_DEBUG_VERBOSE = _Hamlib.RIG_DEBUG_VERBOSE RIG_DEBUG_TRACE = _Hamlib.RIG_DEBUG_TRACE RIGNAMSIZ = _Hamlib.RIGNAMSIZ RIGVERSIZ = _Hamlib.RIGVERSIZ FILPATHLEN = _Hamlib.FILPATHLEN FRQRANGESIZ = _Hamlib.FRQRANGESIZ MAXCHANDESC = _Hamlib.MAXCHANDESC TSLSTSIZ = _Hamlib.TSLSTSIZ FLTLSTSIZ = _Hamlib.FLTLSTSIZ MAXDBLSTSIZ = _Hamlib.MAXDBLSTSIZ CHANLSTSIZ = _Hamlib.CHANLSTSIZ MAX_CAL_LENGTH = _Hamlib.MAX_CAL_LENGTH RIG_PORT_NONE = _Hamlib.RIG_PORT_NONE RIG_PORT_SERIAL = _Hamlib.RIG_PORT_SERIAL RIG_PORT_NETWORK = _Hamlib.RIG_PORT_NETWORK RIG_PORT_DEVICE = _Hamlib.RIG_PORT_DEVICE RIG_PORT_PACKET = _Hamlib.RIG_PORT_PACKET RIG_PORT_DTMF = _Hamlib.RIG_PORT_DTMF RIG_PORT_ULTRA = _Hamlib.RIG_PORT_ULTRA RIG_PORT_RPC = _Hamlib.RIG_PORT_RPC RIG_PORT_PARALLEL = _Hamlib.RIG_PORT_PARALLEL RIG_PORT_USB = _Hamlib.RIG_PORT_USB RIG_PORT_UDP_NETWORK = _Hamlib.RIG_PORT_UDP_NETWORK RIG_PORT_CM108 = _Hamlib.RIG_PORT_CM108 RIG_PARITY_NONE = _Hamlib.RIG_PARITY_NONE RIG_PARITY_ODD = _Hamlib.RIG_PARITY_ODD RIG_PARITY_EVEN = _Hamlib.RIG_PARITY_EVEN RIG_PARITY_MARK = _Hamlib.RIG_PARITY_MARK RIG_PARITY_SPACE = _Hamlib.RIG_PARITY_SPACE RIG_HANDSHAKE_NONE = _Hamlib.RIG_HANDSHAKE_NONE RIG_HANDSHAKE_XONXOFF = _Hamlib.RIG_HANDSHAKE_XONXOFF RIG_HANDSHAKE_HARDWARE = _Hamlib.RIG_HANDSHAKE_HARDWARE RIG_SIGNAL_UNSET = _Hamlib.RIG_SIGNAL_UNSET RIG_SIGNAL_ON = _Hamlib.RIG_SIGNAL_ON RIG_SIGNAL_OFF = _Hamlib.RIG_SIGNAL_OFF RIG_FLAG_RECEIVER = _Hamlib.RIG_FLAG_RECEIVER RIG_FLAG_TRANSMITTER = _Hamlib.RIG_FLAG_TRANSMITTER RIG_FLAG_SCANNER = _Hamlib.RIG_FLAG_SCANNER RIG_FLAG_MOBILE = _Hamlib.RIG_FLAG_MOBILE RIG_FLAG_HANDHELD = _Hamlib.RIG_FLAG_HANDHELD RIG_FLAG_COMPUTER = _Hamlib.RIG_FLAG_COMPUTER RIG_FLAG_TRUNKING = _Hamlib.RIG_FLAG_TRUNKING RIG_FLAG_APRS = _Hamlib.RIG_FLAG_APRS RIG_FLAG_TNC = _Hamlib.RIG_FLAG_TNC RIG_FLAG_DXCLUSTER = _Hamlib.RIG_FLAG_DXCLUSTER RIG_FLAG_TUNER = _Hamlib.RIG_FLAG_TUNER RIG_TYPE_OTHER = _Hamlib.RIG_TYPE_OTHER RIG_STATUS_ALPHA = _Hamlib.RIG_STATUS_ALPHA RIG_STATUS_UNTESTED = _Hamlib.RIG_STATUS_UNTESTED RIG_STATUS_BETA = _Hamlib.RIG_STATUS_BETA RIG_STATUS_STABLE = _Hamlib.RIG_STATUS_STABLE RIG_STATUS_BUGGY = _Hamlib.RIG_STATUS_BUGGY RIG_RPT_SHIFT_NONE = _Hamlib.RIG_RPT_SHIFT_NONE RIG_RPT_SHIFT_MINUS = _Hamlib.RIG_RPT_SHIFT_MINUS RIG_RPT_SHIFT_PLUS = _Hamlib.RIG_RPT_SHIFT_PLUS RIG_SPLIT_OFF = _Hamlib.RIG_SPLIT_OFF RIG_SPLIT_ON = _Hamlib.RIG_SPLIT_ON RIG_VFO_NONE = _Hamlib.RIG_VFO_NONE RIG_VFO_TX_FLAG = _Hamlib.RIG_VFO_TX_FLAG RIG_VFO_CURR = _Hamlib.RIG_VFO_CURR RIG_VFO_MEM = _Hamlib.RIG_VFO_MEM RIG_VFO_VFO = _Hamlib.RIG_VFO_VFO RIG_VFO_TX = _Hamlib.RIG_VFO_TX RIG_VFO_RX = _Hamlib.RIG_VFO_RX RIG_VFO_MAIN = _Hamlib.RIG_VFO_MAIN RIG_VFO_SUB = _Hamlib.RIG_VFO_SUB RIG_VFO_A = _Hamlib.RIG_VFO_A RIG_VFO_B = _Hamlib.RIG_VFO_B RIG_VFO_C = _Hamlib.RIG_VFO_C RIG_TARGETABLE_NONE = _Hamlib.RIG_TARGETABLE_NONE RIG_TARGETABLE_FREQ = _Hamlib.RIG_TARGETABLE_FREQ RIG_TARGETABLE_MODE = _Hamlib.RIG_TARGETABLE_MODE RIG_TARGETABLE_PURE = _Hamlib.RIG_TARGETABLE_PURE RIG_TARGETABLE_TONE = _Hamlib.RIG_TARGETABLE_TONE RIG_TARGETABLE_FUNC = _Hamlib.RIG_TARGETABLE_FUNC RIG_TARGETABLE_ALL = _Hamlib.RIG_TARGETABLE_ALL RIG_DCD_OFF = _Hamlib.RIG_DCD_OFF RIG_DCD_ON = _Hamlib.RIG_DCD_ON RIG_DCD_NONE = _Hamlib.RIG_DCD_NONE RIG_DCD_RIG = _Hamlib.RIG_DCD_RIG RIG_DCD_SERIAL_DSR = _Hamlib.RIG_DCD_SERIAL_DSR RIG_DCD_SERIAL_CTS = _Hamlib.RIG_DCD_SERIAL_CTS RIG_DCD_SERIAL_CAR = _Hamlib.RIG_DCD_SERIAL_CAR RIG_DCD_PARALLEL = _Hamlib.RIG_DCD_PARALLEL RIG_DCD_CM108 = _Hamlib.RIG_DCD_CM108 RIG_PTT_OFF = _Hamlib.RIG_PTT_OFF RIG_PTT_ON = _Hamlib.RIG_PTT_ON RIG_PTT_ON_MIC = _Hamlib.RIG_PTT_ON_MIC RIG_PTT_ON_DATA = _Hamlib.RIG_PTT_ON_DATA RIG_PTT_NONE = _Hamlib.RIG_PTT_NONE RIG_PTT_RIG = _Hamlib.RIG_PTT_RIG RIG_PTT_SERIAL_DTR = _Hamlib.RIG_PTT_SERIAL_DTR RIG_PTT_SERIAL_RTS = _Hamlib.RIG_PTT_SERIAL_RTS RIG_PTT_PARALLEL = _Hamlib.RIG_PTT_PARALLEL RIG_PTT_RIG_MICDATA = _Hamlib.RIG_PTT_RIG_MICDATA RIG_PTT_CM108 = _Hamlib.RIG_PTT_CM108 RIG_POWER_OFF = _Hamlib.RIG_POWER_OFF RIG_POWER_ON = _Hamlib.RIG_POWER_ON RIG_POWER_STANDBY = _Hamlib.RIG_POWER_STANDBY RIG_RESET_NONE = _Hamlib.RIG_RESET_NONE RIG_RESET_SOFT = _Hamlib.RIG_RESET_SOFT RIG_RESET_VFO = _Hamlib.RIG_RESET_VFO RIG_RESET_MCALL = _Hamlib.RIG_RESET_MCALL RIG_RESET_MASTER = _Hamlib.RIG_RESET_MASTER RIG_OP_NONE = _Hamlib.RIG_OP_NONE RIG_OP_CPY = _Hamlib.RIG_OP_CPY RIG_OP_XCHG = _Hamlib.RIG_OP_XCHG RIG_OP_FROM_VFO = _Hamlib.RIG_OP_FROM_VFO RIG_OP_TO_VFO = _Hamlib.RIG_OP_TO_VFO RIG_OP_MCL = _Hamlib.RIG_OP_MCL RIG_OP_UP = _Hamlib.RIG_OP_UP RIG_OP_DOWN = _Hamlib.RIG_OP_DOWN RIG_OP_BAND_UP = _Hamlib.RIG_OP_BAND_UP RIG_OP_BAND_DOWN = _Hamlib.RIG_OP_BAND_DOWN RIG_OP_LEFT = _Hamlib.RIG_OP_LEFT RIG_OP_RIGHT = _Hamlib.RIG_OP_RIGHT RIG_OP_TUNE = _Hamlib.RIG_OP_TUNE RIG_OP_TOGGLE = _Hamlib.RIG_OP_TOGGLE RIG_SCAN_NONE = _Hamlib.RIG_SCAN_NONE RIG_SCAN_STOP = _Hamlib.RIG_SCAN_STOP RIG_SCAN_MEM = _Hamlib.RIG_SCAN_MEM RIG_SCAN_SLCT = _Hamlib.RIG_SCAN_SLCT RIG_SCAN_PRIO = _Hamlib.RIG_SCAN_PRIO RIG_SCAN_PROG = _Hamlib.RIG_SCAN_PROG RIG_SCAN_DELTA = _Hamlib.RIG_SCAN_DELTA RIG_SCAN_VFO = _Hamlib.RIG_SCAN_VFO RIG_SCAN_PLT = _Hamlib.RIG_SCAN_PLT RIG_CONF_END = _Hamlib.RIG_CONF_END RIG_CONF_STRING = _Hamlib.RIG_CONF_STRING RIG_CONF_COMBO = _Hamlib.RIG_CONF_COMBO RIG_CONF_NUMERIC = _Hamlib.RIG_CONF_NUMERIC RIG_CONF_CHECKBUTTON = _Hamlib.RIG_CONF_CHECKBUTTON RIG_CONF_BUTTON = _Hamlib.RIG_CONF_BUTTON RIG_COMBO_MAX = _Hamlib.RIG_COMBO_MAX class confparams(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, confparams, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, confparams, name) __repr__ = _swig_repr __swig_setmethods__["token"] = _Hamlib.confparams_token_set __swig_getmethods__["token"] = _Hamlib.confparams_token_get if _newclass:token = _swig_property(_Hamlib.confparams_token_get, _Hamlib.confparams_token_set) __swig_setmethods__["name"] = _Hamlib.confparams_name_set __swig_getmethods__["name"] = _Hamlib.confparams_name_get if _newclass:name = _swig_property(_Hamlib.confparams_name_get, _Hamlib.confparams_name_set) __swig_setmethods__["label"] = _Hamlib.confparams_label_set __swig_getmethods__["label"] = _Hamlib.confparams_label_get if _newclass:label = _swig_property(_Hamlib.confparams_label_get, _Hamlib.confparams_label_set) __swig_setmethods__["tooltip"] = _Hamlib.confparams_tooltip_set __swig_getmethods__["tooltip"] = _Hamlib.confparams_tooltip_get if _newclass:tooltip = _swig_property(_Hamlib.confparams_tooltip_get, _Hamlib.confparams_tooltip_set) __swig_setmethods__["dflt"] = _Hamlib.confparams_dflt_set __swig_getmethods__["dflt"] = _Hamlib.confparams_dflt_get if _newclass:dflt = _swig_property(_Hamlib.confparams_dflt_get, _Hamlib.confparams_dflt_set) __swig_setmethods__["type"] = _Hamlib.confparams_type_set __swig_getmethods__["type"] = _Hamlib.confparams_type_get if _newclass:type = _swig_property(_Hamlib.confparams_type_get, _Hamlib.confparams_type_set) __swig_getmethods__["u"] = _Hamlib.confparams_u_get if _newclass:u = _swig_property(_Hamlib.confparams_u_get) def __init__(self): this = _Hamlib.new_confparams() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_confparams __del__ = lambda self : None; confparams_swigregister = _Hamlib.confparams_swigregister confparams_swigregister(confparams) cvar = _Hamlib.cvar hamlib_version = cvar.hamlib_version hamlib_copyright = cvar.hamlib_copyright class confparams_u(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, confparams_u, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, confparams_u, name) __repr__ = _swig_repr __swig_getmethods__["c"] = _Hamlib.confparams_u_c_get if _newclass:c = _swig_property(_Hamlib.confparams_u_c_get) __swig_getmethods__["n"] = _Hamlib.confparams_u_n_get if _newclass:n = _swig_property(_Hamlib.confparams_u_n_get) def __init__(self): this = _Hamlib.new_confparams_u() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_confparams_u __del__ = lambda self : None; confparams_u_swigregister = _Hamlib.confparams_u_swigregister confparams_u_swigregister(confparams_u) class confparams_u_c(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, confparams_u_c, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, confparams_u_c, name) __repr__ = _swig_repr __swig_setmethods__["combostr"] = _Hamlib.confparams_u_c_combostr_set __swig_getmethods__["combostr"] = _Hamlib.confparams_u_c_combostr_get if _newclass:combostr = _swig_property(_Hamlib.confparams_u_c_combostr_get, _Hamlib.confparams_u_c_combostr_set) def __init__(self): this = _Hamlib.new_confparams_u_c() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_confparams_u_c __del__ = lambda self : None; confparams_u_c_swigregister = _Hamlib.confparams_u_c_swigregister confparams_u_c_swigregister(confparams_u_c) class confparams_u_n(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, confparams_u_n, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, confparams_u_n, name) __repr__ = _swig_repr __swig_setmethods__["min"] = _Hamlib.confparams_u_n_min_set __swig_getmethods__["min"] = _Hamlib.confparams_u_n_min_get if _newclass:min = _swig_property(_Hamlib.confparams_u_n_min_get, _Hamlib.confparams_u_n_min_set) __swig_setmethods__["max"] = _Hamlib.confparams_u_n_max_set __swig_getmethods__["max"] = _Hamlib.confparams_u_n_max_get if _newclass:max = _swig_property(_Hamlib.confparams_u_n_max_get, _Hamlib.confparams_u_n_max_set) __swig_setmethods__["step"] = _Hamlib.confparams_u_n_step_set __swig_getmethods__["step"] = _Hamlib.confparams_u_n_step_get if _newclass:step = _swig_property(_Hamlib.confparams_u_n_step_get, _Hamlib.confparams_u_n_step_set) def __init__(self): this = _Hamlib.new_confparams_u_n() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_confparams_u_n __del__ = lambda self : None; confparams_u_n_swigregister = _Hamlib.confparams_u_n_swigregister confparams_u_n_swigregister(confparams_u_n) RIG_ANN_NONE = _Hamlib.RIG_ANN_NONE RIG_ANN_OFF = _Hamlib.RIG_ANN_OFF RIG_ANN_FREQ = _Hamlib.RIG_ANN_FREQ RIG_ANN_RXMODE = _Hamlib.RIG_ANN_RXMODE RIG_ANN_CW = _Hamlib.RIG_ANN_CW RIG_ANN_ENG = _Hamlib.RIG_ANN_ENG RIG_ANN_JAP = _Hamlib.RIG_ANN_JAP RIG_ANT_NONE = _Hamlib.RIG_ANT_NONE RIG_AGC_OFF = _Hamlib.RIG_AGC_OFF RIG_AGC_SUPERFAST = _Hamlib.RIG_AGC_SUPERFAST RIG_AGC_FAST = _Hamlib.RIG_AGC_FAST RIG_AGC_SLOW = _Hamlib.RIG_AGC_SLOW RIG_AGC_USER = _Hamlib.RIG_AGC_USER RIG_AGC_MEDIUM = _Hamlib.RIG_AGC_MEDIUM RIG_AGC_AUTO = _Hamlib.RIG_AGC_AUTO RIG_METER_NONE = _Hamlib.RIG_METER_NONE RIG_METER_SWR = _Hamlib.RIG_METER_SWR RIG_METER_COMP = _Hamlib.RIG_METER_COMP RIG_METER_ALC = _Hamlib.RIG_METER_ALC RIG_METER_IC = _Hamlib.RIG_METER_IC RIG_METER_DB = _Hamlib.RIG_METER_DB RIG_METER_PO = _Hamlib.RIG_METER_PO RIG_METER_VDD = _Hamlib.RIG_METER_VDD class value_t(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, value_t, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, value_t, name) __repr__ = _swig_repr __swig_setmethods__["i"] = _Hamlib.value_t_i_set __swig_getmethods__["i"] = _Hamlib.value_t_i_get if _newclass:i = _swig_property(_Hamlib.value_t_i_get, _Hamlib.value_t_i_set) __swig_setmethods__["f"] = _Hamlib.value_t_f_set __swig_getmethods__["f"] = _Hamlib.value_t_f_get if _newclass:f = _swig_property(_Hamlib.value_t_f_get, _Hamlib.value_t_f_set) __swig_setmethods__["s"] = _Hamlib.value_t_s_set __swig_getmethods__["s"] = _Hamlib.value_t_s_get if _newclass:s = _swig_property(_Hamlib.value_t_s_get, _Hamlib.value_t_s_set) __swig_setmethods__["cs"] = _Hamlib.value_t_cs_set __swig_getmethods__["cs"] = _Hamlib.value_t_cs_get if _newclass:cs = _swig_property(_Hamlib.value_t_cs_get, _Hamlib.value_t_cs_set) def __init__(self): this = _Hamlib.new_value_t() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_value_t __del__ = lambda self : None; value_t_swigregister = _Hamlib.value_t_swigregister value_t_swigregister(value_t) RIG_LEVEL_NONE = _Hamlib.RIG_LEVEL_NONE RIG_LEVEL_PREAMP = _Hamlib.RIG_LEVEL_PREAMP RIG_LEVEL_ATT = _Hamlib.RIG_LEVEL_ATT RIG_LEVEL_VOX = _Hamlib.RIG_LEVEL_VOX RIG_LEVEL_AF = _Hamlib.RIG_LEVEL_AF RIG_LEVEL_RF = _Hamlib.RIG_LEVEL_RF RIG_LEVEL_SQL = _Hamlib.RIG_LEVEL_SQL RIG_LEVEL_IF = _Hamlib.RIG_LEVEL_IF RIG_LEVEL_APF = _Hamlib.RIG_LEVEL_APF RIG_LEVEL_NR = _Hamlib.RIG_LEVEL_NR RIG_LEVEL_PBT_IN = _Hamlib.RIG_LEVEL_PBT_IN RIG_LEVEL_PBT_OUT = _Hamlib.RIG_LEVEL_PBT_OUT RIG_LEVEL_CWPITCH = _Hamlib.RIG_LEVEL_CWPITCH RIG_LEVEL_RFPOWER = _Hamlib.RIG_LEVEL_RFPOWER RIG_LEVEL_MICGAIN = _Hamlib.RIG_LEVEL_MICGAIN RIG_LEVEL_KEYSPD = _Hamlib.RIG_LEVEL_KEYSPD RIG_LEVEL_NOTCHF = _Hamlib.RIG_LEVEL_NOTCHF RIG_LEVEL_COMP = _Hamlib.RIG_LEVEL_COMP RIG_LEVEL_AGC = _Hamlib.RIG_LEVEL_AGC RIG_LEVEL_BKINDL = _Hamlib.RIG_LEVEL_BKINDL RIG_LEVEL_BALANCE = _Hamlib.RIG_LEVEL_BALANCE RIG_LEVEL_METER = _Hamlib.RIG_LEVEL_METER RIG_LEVEL_VOXGAIN = _Hamlib.RIG_LEVEL_VOXGAIN RIG_LEVEL_VOXDELAY = _Hamlib.RIG_LEVEL_VOXDELAY RIG_LEVEL_ANTIVOX = _Hamlib.RIG_LEVEL_ANTIVOX RIG_LEVEL_SLOPE_LOW = _Hamlib.RIG_LEVEL_SLOPE_LOW RIG_LEVEL_SLOPE_HIGH = _Hamlib.RIG_LEVEL_SLOPE_HIGH RIG_LEVEL_BKIN_DLYMS = _Hamlib.RIG_LEVEL_BKIN_DLYMS RIG_LEVEL_RAWSTR = _Hamlib.RIG_LEVEL_RAWSTR RIG_LEVEL_SQLSTAT = _Hamlib.RIG_LEVEL_SQLSTAT RIG_LEVEL_SWR = _Hamlib.RIG_LEVEL_SWR RIG_LEVEL_ALC = _Hamlib.RIG_LEVEL_ALC RIG_LEVEL_STRENGTH = _Hamlib.RIG_LEVEL_STRENGTH RIG_PARM_NONE = _Hamlib.RIG_PARM_NONE RIG_PARM_ANN = _Hamlib.RIG_PARM_ANN RIG_PARM_APO = _Hamlib.RIG_PARM_APO RIG_PARM_BACKLIGHT = _Hamlib.RIG_PARM_BACKLIGHT RIG_PARM_BEEP = _Hamlib.RIG_PARM_BEEP RIG_PARM_TIME = _Hamlib.RIG_PARM_TIME RIG_PARM_BAT = _Hamlib.RIG_PARM_BAT RIG_PARM_KEYLIGHT = _Hamlib.RIG_PARM_KEYLIGHT RIG_SETTING_MAX = _Hamlib.RIG_SETTING_MAX RIG_TRN_OFF = _Hamlib.RIG_TRN_OFF RIG_TRN_RIG = _Hamlib.RIG_TRN_RIG RIG_TRN_POLL = _Hamlib.RIG_TRN_POLL RIG_FUNC_NONE = _Hamlib.RIG_FUNC_NONE RIG_FUNC_FAGC = _Hamlib.RIG_FUNC_FAGC RIG_FUNC_NB = _Hamlib.RIG_FUNC_NB RIG_FUNC_COMP = _Hamlib.RIG_FUNC_COMP RIG_FUNC_VOX = _Hamlib.RIG_FUNC_VOX RIG_FUNC_TONE = _Hamlib.RIG_FUNC_TONE RIG_FUNC_TSQL = _Hamlib.RIG_FUNC_TSQL RIG_FUNC_SBKIN = _Hamlib.RIG_FUNC_SBKIN RIG_FUNC_FBKIN = _Hamlib.RIG_FUNC_FBKIN RIG_FUNC_ANF = _Hamlib.RIG_FUNC_ANF RIG_FUNC_NR = _Hamlib.RIG_FUNC_NR RIG_FUNC_AIP = _Hamlib.RIG_FUNC_AIP RIG_FUNC_APF = _Hamlib.RIG_FUNC_APF RIG_FUNC_MON = _Hamlib.RIG_FUNC_MON RIG_FUNC_MN = _Hamlib.RIG_FUNC_MN RIG_FUNC_RF = _Hamlib.RIG_FUNC_RF RIG_FUNC_ARO = _Hamlib.RIG_FUNC_ARO RIG_FUNC_LOCK = _Hamlib.RIG_FUNC_LOCK RIG_FUNC_MUTE = _Hamlib.RIG_FUNC_MUTE RIG_FUNC_VSC = _Hamlib.RIG_FUNC_VSC RIG_FUNC_REV = _Hamlib.RIG_FUNC_REV RIG_FUNC_SQL = _Hamlib.RIG_FUNC_SQL RIG_FUNC_ABM = _Hamlib.RIG_FUNC_ABM RIG_FUNC_BC = _Hamlib.RIG_FUNC_BC RIG_FUNC_MBC = _Hamlib.RIG_FUNC_MBC RIG_FUNC_AFC = _Hamlib.RIG_FUNC_AFC RIG_FUNC_SATMODE = _Hamlib.RIG_FUNC_SATMODE RIG_FUNC_SCOPE = _Hamlib.RIG_FUNC_SCOPE RIG_FUNC_RESUME = _Hamlib.RIG_FUNC_RESUME RIG_FUNC_TBURST = _Hamlib.RIG_FUNC_TBURST RIG_FUNC_TUNER = _Hamlib.RIG_FUNC_TUNER RIG_MODE_NONE = _Hamlib.RIG_MODE_NONE RIG_MODE_AM = _Hamlib.RIG_MODE_AM RIG_MODE_CW = _Hamlib.RIG_MODE_CW RIG_MODE_USB = _Hamlib.RIG_MODE_USB RIG_MODE_LSB = _Hamlib.RIG_MODE_LSB RIG_MODE_RTTY = _Hamlib.RIG_MODE_RTTY RIG_MODE_FM = _Hamlib.RIG_MODE_FM RIG_MODE_WFM = _Hamlib.RIG_MODE_WFM RIG_MODE_CWR = _Hamlib.RIG_MODE_CWR RIG_MODE_RTTYR = _Hamlib.RIG_MODE_RTTYR RIG_MODE_AMS = _Hamlib.RIG_MODE_AMS RIG_MODE_PKTLSB = _Hamlib.RIG_MODE_PKTLSB RIG_MODE_PKTUSB = _Hamlib.RIG_MODE_PKTUSB RIG_MODE_PKTFM = _Hamlib.RIG_MODE_PKTFM RIG_MODE_ECSSUSB = _Hamlib.RIG_MODE_ECSSUSB RIG_MODE_ECSSLSB = _Hamlib.RIG_MODE_ECSSLSB RIG_MODE_FAX = _Hamlib.RIG_MODE_FAX RIG_MODE_SAM = _Hamlib.RIG_MODE_SAM RIG_MODE_SAL = _Hamlib.RIG_MODE_SAL RIG_MODE_SAH = _Hamlib.RIG_MODE_SAH RIG_MODE_DSB = _Hamlib.RIG_MODE_DSB RIG_MODE_TESTS_MAX = _Hamlib.RIG_MODE_TESTS_MAX RIG_DBLST_END = _Hamlib.RIG_DBLST_END class freq_range_t(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, freq_range_t, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, freq_range_t, name) __repr__ = _swig_repr __swig_setmethods__["start"] = _Hamlib.freq_range_t_start_set __swig_getmethods__["start"] = _Hamlib.freq_range_t_start_get if _newclass:start = _swig_property(_Hamlib.freq_range_t_start_get, _Hamlib.freq_range_t_start_set) __swig_setmethods__["end"] = _Hamlib.freq_range_t_end_set __swig_getmethods__["end"] = _Hamlib.freq_range_t_end_get if _newclass:end = _swig_property(_Hamlib.freq_range_t_end_get, _Hamlib.freq_range_t_end_set) __swig_setmethods__["modes"] = _Hamlib.freq_range_t_modes_set __swig_getmethods__["modes"] = _Hamlib.freq_range_t_modes_get if _newclass:modes = _swig_property(_Hamlib.freq_range_t_modes_get, _Hamlib.freq_range_t_modes_set) __swig_setmethods__["low_power"] = _Hamlib.freq_range_t_low_power_set __swig_getmethods__["low_power"] = _Hamlib.freq_range_t_low_power_get if _newclass:low_power = _swig_property(_Hamlib.freq_range_t_low_power_get, _Hamlib.freq_range_t_low_power_set) __swig_setmethods__["high_power"] = _Hamlib.freq_range_t_high_power_set __swig_getmethods__["high_power"] = _Hamlib.freq_range_t_high_power_get if _newclass:high_power = _swig_property(_Hamlib.freq_range_t_high_power_get, _Hamlib.freq_range_t_high_power_set) __swig_setmethods__["vfo"] = _Hamlib.freq_range_t_vfo_set __swig_getmethods__["vfo"] = _Hamlib.freq_range_t_vfo_get if _newclass:vfo = _swig_property(_Hamlib.freq_range_t_vfo_get, _Hamlib.freq_range_t_vfo_set) __swig_setmethods__["ant"] = _Hamlib.freq_range_t_ant_set __swig_getmethods__["ant"] = _Hamlib.freq_range_t_ant_get if _newclass:ant = _swig_property(_Hamlib.freq_range_t_ant_get, _Hamlib.freq_range_t_ant_set) def __init__(self): this = _Hamlib.new_freq_range_t() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_freq_range_t __del__ = lambda self : None; freq_range_t_swigregister = _Hamlib.freq_range_t_swigregister freq_range_t_swigregister(freq_range_t) RIG_ITU_REGION1 = _Hamlib.RIG_ITU_REGION1 RIG_ITU_REGION2 = _Hamlib.RIG_ITU_REGION2 RIG_ITU_REGION3 = _Hamlib.RIG_ITU_REGION3 class tuning_step_list(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, tuning_step_list, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, tuning_step_list, name) __repr__ = _swig_repr __swig_setmethods__["modes"] = _Hamlib.tuning_step_list_modes_set __swig_getmethods__["modes"] = _Hamlib.tuning_step_list_modes_get if _newclass:modes = _swig_property(_Hamlib.tuning_step_list_modes_get, _Hamlib.tuning_step_list_modes_set) __swig_setmethods__["ts"] = _Hamlib.tuning_step_list_ts_set __swig_getmethods__["ts"] = _Hamlib.tuning_step_list_ts_get if _newclass:ts = _swig_property(_Hamlib.tuning_step_list_ts_get, _Hamlib.tuning_step_list_ts_set) def __init__(self): this = _Hamlib.new_tuning_step_list() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_tuning_step_list __del__ = lambda self : None; tuning_step_list_swigregister = _Hamlib.tuning_step_list_swigregister tuning_step_list_swigregister(tuning_step_list) RIG_TS_ANY = _Hamlib.RIG_TS_ANY class filter_list(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, filter_list, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, filter_list, name) __repr__ = _swig_repr __swig_setmethods__["modes"] = _Hamlib.filter_list_modes_set __swig_getmethods__["modes"] = _Hamlib.filter_list_modes_get if _newclass:modes = _swig_property(_Hamlib.filter_list_modes_get, _Hamlib.filter_list_modes_set) __swig_setmethods__["width"] = _Hamlib.filter_list_width_set __swig_getmethods__["width"] = _Hamlib.filter_list_width_get if _newclass:width = _swig_property(_Hamlib.filter_list_width_get, _Hamlib.filter_list_width_set) def __init__(self): this = _Hamlib.new_filter_list() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_filter_list __del__ = lambda self : None; filter_list_swigregister = _Hamlib.filter_list_swigregister filter_list_swigregister(filter_list) RIG_FLT_ANY = _Hamlib.RIG_FLT_ANY RIG_CHFLAG_NONE = _Hamlib.RIG_CHFLAG_NONE RIG_CHFLAG_SKIP = _Hamlib.RIG_CHFLAG_SKIP RIG_CHFLAG_DATA = _Hamlib.RIG_CHFLAG_DATA class ext_list(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, ext_list, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, ext_list, name) __repr__ = _swig_repr __swig_setmethods__["token"] = _Hamlib.ext_list_token_set __swig_getmethods__["token"] = _Hamlib.ext_list_token_get if _newclass:token = _swig_property(_Hamlib.ext_list_token_get, _Hamlib.ext_list_token_set) __swig_setmethods__["val"] = _Hamlib.ext_list_val_set __swig_getmethods__["val"] = _Hamlib.ext_list_val_get if _newclass:val = _swig_property(_Hamlib.ext_list_val_get, _Hamlib.ext_list_val_set) def __init__(self): this = _Hamlib.new_ext_list() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_ext_list __del__ = lambda self : None; ext_list_swigregister = _Hamlib.ext_list_swigregister ext_list_swigregister(ext_list) class channel(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, channel, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, channel, name) __repr__ = _swig_repr __swig_setmethods__["channel_num"] = _Hamlib.channel_channel_num_set __swig_getmethods__["channel_num"] = _Hamlib.channel_channel_num_get if _newclass:channel_num = _swig_property(_Hamlib.channel_channel_num_get, _Hamlib.channel_channel_num_set) __swig_setmethods__["bank_num"] = _Hamlib.channel_bank_num_set __swig_getmethods__["bank_num"] = _Hamlib.channel_bank_num_get if _newclass:bank_num = _swig_property(_Hamlib.channel_bank_num_get, _Hamlib.channel_bank_num_set) __swig_setmethods__["vfo"] = _Hamlib.channel_vfo_set __swig_getmethods__["vfo"] = _Hamlib.channel_vfo_get if _newclass:vfo = _swig_property(_Hamlib.channel_vfo_get, _Hamlib.channel_vfo_set) __swig_setmethods__["ant"] = _Hamlib.channel_ant_set __swig_getmethods__["ant"] = _Hamlib.channel_ant_get if _newclass:ant = _swig_property(_Hamlib.channel_ant_get, _Hamlib.channel_ant_set) __swig_setmethods__["freq"] = _Hamlib.channel_freq_set __swig_getmethods__["freq"] = _Hamlib.channel_freq_get if _newclass:freq = _swig_property(_Hamlib.channel_freq_get, _Hamlib.channel_freq_set) __swig_setmethods__["mode"] = _Hamlib.channel_mode_set __swig_getmethods__["mode"] = _Hamlib.channel_mode_get if _newclass:mode = _swig_property(_Hamlib.channel_mode_get, _Hamlib.channel_mode_set) __swig_setmethods__["width"] = _Hamlib.channel_width_set __swig_getmethods__["width"] = _Hamlib.channel_width_get if _newclass:width = _swig_property(_Hamlib.channel_width_get, _Hamlib.channel_width_set) __swig_setmethods__["tx_freq"] = _Hamlib.channel_tx_freq_set __swig_getmethods__["tx_freq"] = _Hamlib.channel_tx_freq_get if _newclass:tx_freq = _swig_property(_Hamlib.channel_tx_freq_get, _Hamlib.channel_tx_freq_set) __swig_setmethods__["tx_mode"] = _Hamlib.channel_tx_mode_set __swig_getmethods__["tx_mode"] = _Hamlib.channel_tx_mode_get if _newclass:tx_mode = _swig_property(_Hamlib.channel_tx_mode_get, _Hamlib.channel_tx_mode_set) __swig_setmethods__["tx_width"] = _Hamlib.channel_tx_width_set __swig_getmethods__["tx_width"] = _Hamlib.channel_tx_width_get if _newclass:tx_width = _swig_property(_Hamlib.channel_tx_width_get, _Hamlib.channel_tx_width_set) __swig_setmethods__["split"] = _Hamlib.channel_split_set __swig_getmethods__["split"] = _Hamlib.channel_split_get if _newclass:split = _swig_property(_Hamlib.channel_split_get, _Hamlib.channel_split_set) __swig_setmethods__["tx_vfo"] = _Hamlib.channel_tx_vfo_set __swig_getmethods__["tx_vfo"] = _Hamlib.channel_tx_vfo_get if _newclass:tx_vfo = _swig_property(_Hamlib.channel_tx_vfo_get, _Hamlib.channel_tx_vfo_set) __swig_setmethods__["rptr_shift"] = _Hamlib.channel_rptr_shift_set __swig_getmethods__["rptr_shift"] = _Hamlib.channel_rptr_shift_get if _newclass:rptr_shift = _swig_property(_Hamlib.channel_rptr_shift_get, _Hamlib.channel_rptr_shift_set) __swig_setmethods__["rptr_offs"] = _Hamlib.channel_rptr_offs_set __swig_getmethods__["rptr_offs"] = _Hamlib.channel_rptr_offs_get if _newclass:rptr_offs = _swig_property(_Hamlib.channel_rptr_offs_get, _Hamlib.channel_rptr_offs_set) __swig_setmethods__["tuning_step"] = _Hamlib.channel_tuning_step_set __swig_getmethods__["tuning_step"] = _Hamlib.channel_tuning_step_get if _newclass:tuning_step = _swig_property(_Hamlib.channel_tuning_step_get, _Hamlib.channel_tuning_step_set) __swig_setmethods__["rit"] = _Hamlib.channel_rit_set __swig_getmethods__["rit"] = _Hamlib.channel_rit_get if _newclass:rit = _swig_property(_Hamlib.channel_rit_get, _Hamlib.channel_rit_set) __swig_setmethods__["xit"] = _Hamlib.channel_xit_set __swig_getmethods__["xit"] = _Hamlib.channel_xit_get if _newclass:xit = _swig_property(_Hamlib.channel_xit_get, _Hamlib.channel_xit_set) __swig_setmethods__["funcs"] = _Hamlib.channel_funcs_set __swig_getmethods__["funcs"] = _Hamlib.channel_funcs_get if _newclass:funcs = _swig_property(_Hamlib.channel_funcs_get, _Hamlib.channel_funcs_set) __swig_setmethods__["levels"] = _Hamlib.channel_levels_set __swig_getmethods__["levels"] = _Hamlib.channel_levels_get if _newclass:levels = _swig_property(_Hamlib.channel_levels_get, _Hamlib.channel_levels_set) __swig_setmethods__["ctcss_tone"] = _Hamlib.channel_ctcss_tone_set __swig_getmethods__["ctcss_tone"] = _Hamlib.channel_ctcss_tone_get if _newclass:ctcss_tone = _swig_property(_Hamlib.channel_ctcss_tone_get, _Hamlib.channel_ctcss_tone_set) __swig_setmethods__["ctcss_sql"] = _Hamlib.channel_ctcss_sql_set __swig_getmethods__["ctcss_sql"] = _Hamlib.channel_ctcss_sql_get if _newclass:ctcss_sql = _swig_property(_Hamlib.channel_ctcss_sql_get, _Hamlib.channel_ctcss_sql_set) __swig_setmethods__["dcs_code"] = _Hamlib.channel_dcs_code_set __swig_getmethods__["dcs_code"] = _Hamlib.channel_dcs_code_get if _newclass:dcs_code = _swig_property(_Hamlib.channel_dcs_code_get, _Hamlib.channel_dcs_code_set) __swig_setmethods__["dcs_sql"] = _Hamlib.channel_dcs_sql_set __swig_getmethods__["dcs_sql"] = _Hamlib.channel_dcs_sql_get if _newclass:dcs_sql = _swig_property(_Hamlib.channel_dcs_sql_get, _Hamlib.channel_dcs_sql_set) __swig_setmethods__["scan_group"] = _Hamlib.channel_scan_group_set __swig_getmethods__["scan_group"] = _Hamlib.channel_scan_group_get if _newclass:scan_group = _swig_property(_Hamlib.channel_scan_group_get, _Hamlib.channel_scan_group_set) __swig_setmethods__["flags"] = _Hamlib.channel_flags_set __swig_getmethods__["flags"] = _Hamlib.channel_flags_get if _newclass:flags = _swig_property(_Hamlib.channel_flags_get, _Hamlib.channel_flags_set) __swig_setmethods__["channel_desc"] = _Hamlib.channel_channel_desc_set __swig_getmethods__["channel_desc"] = _Hamlib.channel_channel_desc_get if _newclass:channel_desc = _swig_property(_Hamlib.channel_channel_desc_get, _Hamlib.channel_channel_desc_set) __swig_setmethods__["ext_levels"] = _Hamlib.channel_ext_levels_set __swig_getmethods__["ext_levels"] = _Hamlib.channel_ext_levels_get if _newclass:ext_levels = _swig_property(_Hamlib.channel_ext_levels_get, _Hamlib.channel_ext_levels_set) def __init__(self, *args): this = _Hamlib.new_channel(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_channel __del__ = lambda self : None; channel_swigregister = _Hamlib.channel_swigregister channel_swigregister(channel) class channel_cap(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, channel_cap, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, channel_cap, name) __repr__ = _swig_repr __swig_setmethods__["bank_num"] = _Hamlib.channel_cap_bank_num_set __swig_getmethods__["bank_num"] = _Hamlib.channel_cap_bank_num_get if _newclass:bank_num = _swig_property(_Hamlib.channel_cap_bank_num_get, _Hamlib.channel_cap_bank_num_set) __swig_setmethods__["vfo"] = _Hamlib.channel_cap_vfo_set __swig_getmethods__["vfo"] = _Hamlib.channel_cap_vfo_get if _newclass:vfo = _swig_property(_Hamlib.channel_cap_vfo_get, _Hamlib.channel_cap_vfo_set) __swig_setmethods__["ant"] = _Hamlib.channel_cap_ant_set __swig_getmethods__["ant"] = _Hamlib.channel_cap_ant_get if _newclass:ant = _swig_property(_Hamlib.channel_cap_ant_get, _Hamlib.channel_cap_ant_set) __swig_setmethods__["freq"] = _Hamlib.channel_cap_freq_set __swig_getmethods__["freq"] = _Hamlib.channel_cap_freq_get if _newclass:freq = _swig_property(_Hamlib.channel_cap_freq_get, _Hamlib.channel_cap_freq_set) __swig_setmethods__["mode"] = _Hamlib.channel_cap_mode_set __swig_getmethods__["mode"] = _Hamlib.channel_cap_mode_get if _newclass:mode = _swig_property(_Hamlib.channel_cap_mode_get, _Hamlib.channel_cap_mode_set) __swig_setmethods__["width"] = _Hamlib.channel_cap_width_set __swig_getmethods__["width"] = _Hamlib.channel_cap_width_get if _newclass:width = _swig_property(_Hamlib.channel_cap_width_get, _Hamlib.channel_cap_width_set) __swig_setmethods__["tx_freq"] = _Hamlib.channel_cap_tx_freq_set __swig_getmethods__["tx_freq"] = _Hamlib.channel_cap_tx_freq_get if _newclass:tx_freq = _swig_property(_Hamlib.channel_cap_tx_freq_get, _Hamlib.channel_cap_tx_freq_set) __swig_setmethods__["tx_mode"] = _Hamlib.channel_cap_tx_mode_set __swig_getmethods__["tx_mode"] = _Hamlib.channel_cap_tx_mode_get if _newclass:tx_mode = _swig_property(_Hamlib.channel_cap_tx_mode_get, _Hamlib.channel_cap_tx_mode_set) __swig_setmethods__["tx_width"] = _Hamlib.channel_cap_tx_width_set __swig_getmethods__["tx_width"] = _Hamlib.channel_cap_tx_width_get if _newclass:tx_width = _swig_property(_Hamlib.channel_cap_tx_width_get, _Hamlib.channel_cap_tx_width_set) __swig_setmethods__["split"] = _Hamlib.channel_cap_split_set __swig_getmethods__["split"] = _Hamlib.channel_cap_split_get if _newclass:split = _swig_property(_Hamlib.channel_cap_split_get, _Hamlib.channel_cap_split_set) __swig_setmethods__["tx_vfo"] = _Hamlib.channel_cap_tx_vfo_set __swig_getmethods__["tx_vfo"] = _Hamlib.channel_cap_tx_vfo_get if _newclass:tx_vfo = _swig_property(_Hamlib.channel_cap_tx_vfo_get, _Hamlib.channel_cap_tx_vfo_set) __swig_setmethods__["rptr_shift"] = _Hamlib.channel_cap_rptr_shift_set __swig_getmethods__["rptr_shift"] = _Hamlib.channel_cap_rptr_shift_get if _newclass:rptr_shift = _swig_property(_Hamlib.channel_cap_rptr_shift_get, _Hamlib.channel_cap_rptr_shift_set) __swig_setmethods__["rptr_offs"] = _Hamlib.channel_cap_rptr_offs_set __swig_getmethods__["rptr_offs"] = _Hamlib.channel_cap_rptr_offs_get if _newclass:rptr_offs = _swig_property(_Hamlib.channel_cap_rptr_offs_get, _Hamlib.channel_cap_rptr_offs_set) __swig_setmethods__["tuning_step"] = _Hamlib.channel_cap_tuning_step_set __swig_getmethods__["tuning_step"] = _Hamlib.channel_cap_tuning_step_get if _newclass:tuning_step = _swig_property(_Hamlib.channel_cap_tuning_step_get, _Hamlib.channel_cap_tuning_step_set) __swig_setmethods__["rit"] = _Hamlib.channel_cap_rit_set __swig_getmethods__["rit"] = _Hamlib.channel_cap_rit_get if _newclass:rit = _swig_property(_Hamlib.channel_cap_rit_get, _Hamlib.channel_cap_rit_set) __swig_setmethods__["xit"] = _Hamlib.channel_cap_xit_set __swig_getmethods__["xit"] = _Hamlib.channel_cap_xit_get if _newclass:xit = _swig_property(_Hamlib.channel_cap_xit_get, _Hamlib.channel_cap_xit_set) __swig_setmethods__["funcs"] = _Hamlib.channel_cap_funcs_set __swig_getmethods__["funcs"] = _Hamlib.channel_cap_funcs_get if _newclass:funcs = _swig_property(_Hamlib.channel_cap_funcs_get, _Hamlib.channel_cap_funcs_set) __swig_setmethods__["levels"] = _Hamlib.channel_cap_levels_set __swig_getmethods__["levels"] = _Hamlib.channel_cap_levels_get if _newclass:levels = _swig_property(_Hamlib.channel_cap_levels_get, _Hamlib.channel_cap_levels_set) __swig_setmethods__["ctcss_tone"] = _Hamlib.channel_cap_ctcss_tone_set __swig_getmethods__["ctcss_tone"] = _Hamlib.channel_cap_ctcss_tone_get if _newclass:ctcss_tone = _swig_property(_Hamlib.channel_cap_ctcss_tone_get, _Hamlib.channel_cap_ctcss_tone_set) __swig_setmethods__["ctcss_sql"] = _Hamlib.channel_cap_ctcss_sql_set __swig_getmethods__["ctcss_sql"] = _Hamlib.channel_cap_ctcss_sql_get if _newclass:ctcss_sql = _swig_property(_Hamlib.channel_cap_ctcss_sql_get, _Hamlib.channel_cap_ctcss_sql_set) __swig_setmethods__["dcs_code"] = _Hamlib.channel_cap_dcs_code_set __swig_getmethods__["dcs_code"] = _Hamlib.channel_cap_dcs_code_get if _newclass:dcs_code = _swig_property(_Hamlib.channel_cap_dcs_code_get, _Hamlib.channel_cap_dcs_code_set) __swig_setmethods__["dcs_sql"] = _Hamlib.channel_cap_dcs_sql_set __swig_getmethods__["dcs_sql"] = _Hamlib.channel_cap_dcs_sql_get if _newclass:dcs_sql = _swig_property(_Hamlib.channel_cap_dcs_sql_get, _Hamlib.channel_cap_dcs_sql_set) __swig_setmethods__["scan_group"] = _Hamlib.channel_cap_scan_group_set __swig_getmethods__["scan_group"] = _Hamlib.channel_cap_scan_group_get if _newclass:scan_group = _swig_property(_Hamlib.channel_cap_scan_group_get, _Hamlib.channel_cap_scan_group_set) __swig_setmethods__["flags"] = _Hamlib.channel_cap_flags_set __swig_getmethods__["flags"] = _Hamlib.channel_cap_flags_get if _newclass:flags = _swig_property(_Hamlib.channel_cap_flags_get, _Hamlib.channel_cap_flags_set) __swig_setmethods__["channel_desc"] = _Hamlib.channel_cap_channel_desc_set __swig_getmethods__["channel_desc"] = _Hamlib.channel_cap_channel_desc_get if _newclass:channel_desc = _swig_property(_Hamlib.channel_cap_channel_desc_get, _Hamlib.channel_cap_channel_desc_set) __swig_setmethods__["ext_levels"] = _Hamlib.channel_cap_ext_levels_set __swig_getmethods__["ext_levels"] = _Hamlib.channel_cap_ext_levels_get if _newclass:ext_levels = _swig_property(_Hamlib.channel_cap_ext_levels_get, _Hamlib.channel_cap_ext_levels_set) def __init__(self): this = _Hamlib.new_channel_cap() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_channel_cap __del__ = lambda self : None; channel_cap_swigregister = _Hamlib.channel_cap_swigregister channel_cap_swigregister(channel_cap) RIG_MTYPE_NONE = _Hamlib.RIG_MTYPE_NONE RIG_MTYPE_MEM = _Hamlib.RIG_MTYPE_MEM RIG_MTYPE_EDGE = _Hamlib.RIG_MTYPE_EDGE RIG_MTYPE_CALL = _Hamlib.RIG_MTYPE_CALL RIG_MTYPE_MEMOPAD = _Hamlib.RIG_MTYPE_MEMOPAD RIG_MTYPE_SAT = _Hamlib.RIG_MTYPE_SAT RIG_MTYPE_BAND = _Hamlib.RIG_MTYPE_BAND RIG_MTYPE_PRIO = _Hamlib.RIG_MTYPE_PRIO class chan_list(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, chan_list, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, chan_list, name) __repr__ = _swig_repr __swig_setmethods__["start"] = _Hamlib.chan_list_start_set __swig_getmethods__["start"] = _Hamlib.chan_list_start_get if _newclass:start = _swig_property(_Hamlib.chan_list_start_get, _Hamlib.chan_list_start_set) __swig_setmethods__["end"] = _Hamlib.chan_list_end_set __swig_getmethods__["end"] = _Hamlib.chan_list_end_get if _newclass:end = _swig_property(_Hamlib.chan_list_end_get, _Hamlib.chan_list_end_set) __swig_setmethods__["type"] = _Hamlib.chan_list_type_set __swig_getmethods__["type"] = _Hamlib.chan_list_type_get if _newclass:type = _swig_property(_Hamlib.chan_list_type_get, _Hamlib.chan_list_type_set) __swig_setmethods__["mem_caps"] = _Hamlib.chan_list_mem_caps_set __swig_getmethods__["mem_caps"] = _Hamlib.chan_list_mem_caps_get if _newclass:mem_caps = _swig_property(_Hamlib.chan_list_mem_caps_get, _Hamlib.chan_list_mem_caps_set) def __init__(self): this = _Hamlib.new_chan_list() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_chan_list __del__ = lambda self : None; chan_list_swigregister = _Hamlib.chan_list_swigregister chan_list_swigregister(chan_list) RIG_MEM_CAPS_ALL = _Hamlib.RIG_MEM_CAPS_ALL class gran(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, gran, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, gran, name) __repr__ = _swig_repr __swig_setmethods__["min"] = _Hamlib.gran_min_set __swig_getmethods__["min"] = _Hamlib.gran_min_get if _newclass:min = _swig_property(_Hamlib.gran_min_get, _Hamlib.gran_min_set) __swig_setmethods__["max"] = _Hamlib.gran_max_set __swig_getmethods__["max"] = _Hamlib.gran_max_get if _newclass:max = _swig_property(_Hamlib.gran_max_get, _Hamlib.gran_max_set) __swig_setmethods__["step"] = _Hamlib.gran_step_set __swig_getmethods__["step"] = _Hamlib.gran_step_get if _newclass:step = _swig_property(_Hamlib.gran_step_get, _Hamlib.gran_step_set) def __init__(self): this = _Hamlib.new_gran() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_gran __del__ = lambda self : None; gran_swigregister = _Hamlib.gran_swigregister gran_swigregister(gran) class cal_table(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, cal_table, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, cal_table, name) __repr__ = _swig_repr __swig_setmethods__["size"] = _Hamlib.cal_table_size_set __swig_getmethods__["size"] = _Hamlib.cal_table_size_get if _newclass:size = _swig_property(_Hamlib.cal_table_size_get, _Hamlib.cal_table_size_set) __swig_getmethods__["table"] = _Hamlib.cal_table_table_get if _newclass:table = _swig_property(_Hamlib.cal_table_table_get) def __init__(self): this = _Hamlib.new_cal_table() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_cal_table __del__ = lambda self : None; cal_table_swigregister = _Hamlib.cal_table_swigregister cal_table_swigregister(cal_table) class cal_table_table(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, cal_table_table, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, cal_table_table, name) __repr__ = _swig_repr __swig_setmethods__["raw"] = _Hamlib.cal_table_table_raw_set __swig_getmethods__["raw"] = _Hamlib.cal_table_table_raw_get if _newclass:raw = _swig_property(_Hamlib.cal_table_table_raw_get, _Hamlib.cal_table_table_raw_set) __swig_setmethods__["val"] = _Hamlib.cal_table_table_val_set __swig_getmethods__["val"] = _Hamlib.cal_table_table_val_get if _newclass:val = _swig_property(_Hamlib.cal_table_table_val_get, _Hamlib.cal_table_table_val_set) def __init__(self): this = _Hamlib.new_cal_table_table() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_cal_table_table __del__ = lambda self : None; cal_table_table_swigregister = _Hamlib.cal_table_table_swigregister cal_table_table_swigregister(cal_table_table) class rig_caps(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, rig_caps, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, rig_caps, name) __repr__ = _swig_repr __swig_setmethods__["rig_model"] = _Hamlib.rig_caps_rig_model_set __swig_getmethods__["rig_model"] = _Hamlib.rig_caps_rig_model_get if _newclass:rig_model = _swig_property(_Hamlib.rig_caps_rig_model_get, _Hamlib.rig_caps_rig_model_set) __swig_setmethods__["model_name"] = _Hamlib.rig_caps_model_name_set __swig_getmethods__["model_name"] = _Hamlib.rig_caps_model_name_get if _newclass:model_name = _swig_property(_Hamlib.rig_caps_model_name_get, _Hamlib.rig_caps_model_name_set) __swig_setmethods__["mfg_name"] = _Hamlib.rig_caps_mfg_name_set __swig_getmethods__["mfg_name"] = _Hamlib.rig_caps_mfg_name_get if _newclass:mfg_name = _swig_property(_Hamlib.rig_caps_mfg_name_get, _Hamlib.rig_caps_mfg_name_set) __swig_setmethods__["version"] = _Hamlib.rig_caps_version_set __swig_getmethods__["version"] = _Hamlib.rig_caps_version_get if _newclass:version = _swig_property(_Hamlib.rig_caps_version_get, _Hamlib.rig_caps_version_set) __swig_setmethods__["copyright"] = _Hamlib.rig_caps_copyright_set __swig_getmethods__["copyright"] = _Hamlib.rig_caps_copyright_get if _newclass:copyright = _swig_property(_Hamlib.rig_caps_copyright_get, _Hamlib.rig_caps_copyright_set) __swig_setmethods__["status"] = _Hamlib.rig_caps_status_set __swig_getmethods__["status"] = _Hamlib.rig_caps_status_get if _newclass:status = _swig_property(_Hamlib.rig_caps_status_get, _Hamlib.rig_caps_status_set) __swig_setmethods__["rig_type"] = _Hamlib.rig_caps_rig_type_set __swig_getmethods__["rig_type"] = _Hamlib.rig_caps_rig_type_get if _newclass:rig_type = _swig_property(_Hamlib.rig_caps_rig_type_get, _Hamlib.rig_caps_rig_type_set) __swig_setmethods__["ptt_type"] = _Hamlib.rig_caps_ptt_type_set __swig_getmethods__["ptt_type"] = _Hamlib.rig_caps_ptt_type_get if _newclass:ptt_type = _swig_property(_Hamlib.rig_caps_ptt_type_get, _Hamlib.rig_caps_ptt_type_set) __swig_setmethods__["dcd_type"] = _Hamlib.rig_caps_dcd_type_set __swig_getmethods__["dcd_type"] = _Hamlib.rig_caps_dcd_type_get if _newclass:dcd_type = _swig_property(_Hamlib.rig_caps_dcd_type_get, _Hamlib.rig_caps_dcd_type_set) __swig_setmethods__["port_type"] = _Hamlib.rig_caps_port_type_set __swig_getmethods__["port_type"] = _Hamlib.rig_caps_port_type_get if _newclass:port_type = _swig_property(_Hamlib.rig_caps_port_type_get, _Hamlib.rig_caps_port_type_set) __swig_setmethods__["serial_rate_min"] = _Hamlib.rig_caps_serial_rate_min_set __swig_getmethods__["serial_rate_min"] = _Hamlib.rig_caps_serial_rate_min_get if _newclass:serial_rate_min = _swig_property(_Hamlib.rig_caps_serial_rate_min_get, _Hamlib.rig_caps_serial_rate_min_set) __swig_setmethods__["serial_rate_max"] = _Hamlib.rig_caps_serial_rate_max_set __swig_getmethods__["serial_rate_max"] = _Hamlib.rig_caps_serial_rate_max_get if _newclass:serial_rate_max = _swig_property(_Hamlib.rig_caps_serial_rate_max_get, _Hamlib.rig_caps_serial_rate_max_set) __swig_setmethods__["serial_data_bits"] = _Hamlib.rig_caps_serial_data_bits_set __swig_getmethods__["serial_data_bits"] = _Hamlib.rig_caps_serial_data_bits_get if _newclass:serial_data_bits = _swig_property(_Hamlib.rig_caps_serial_data_bits_get, _Hamlib.rig_caps_serial_data_bits_set) __swig_setmethods__["serial_stop_bits"] = _Hamlib.rig_caps_serial_stop_bits_set __swig_getmethods__["serial_stop_bits"] = _Hamlib.rig_caps_serial_stop_bits_get if _newclass:serial_stop_bits = _swig_property(_Hamlib.rig_caps_serial_stop_bits_get, _Hamlib.rig_caps_serial_stop_bits_set) __swig_setmethods__["serial_parity"] = _Hamlib.rig_caps_serial_parity_set __swig_getmethods__["serial_parity"] = _Hamlib.rig_caps_serial_parity_get if _newclass:serial_parity = _swig_property(_Hamlib.rig_caps_serial_parity_get, _Hamlib.rig_caps_serial_parity_set) __swig_setmethods__["serial_handshake"] = _Hamlib.rig_caps_serial_handshake_set __swig_getmethods__["serial_handshake"] = _Hamlib.rig_caps_serial_handshake_get if _newclass:serial_handshake = _swig_property(_Hamlib.rig_caps_serial_handshake_get, _Hamlib.rig_caps_serial_handshake_set) __swig_setmethods__["write_delay"] = _Hamlib.rig_caps_write_delay_set __swig_getmethods__["write_delay"] = _Hamlib.rig_caps_write_delay_get if _newclass:write_delay = _swig_property(_Hamlib.rig_caps_write_delay_get, _Hamlib.rig_caps_write_delay_set) __swig_setmethods__["post_write_delay"] = _Hamlib.rig_caps_post_write_delay_set __swig_getmethods__["post_write_delay"] = _Hamlib.rig_caps_post_write_delay_get if _newclass:post_write_delay = _swig_property(_Hamlib.rig_caps_post_write_delay_get, _Hamlib.rig_caps_post_write_delay_set) __swig_setmethods__["timeout"] = _Hamlib.rig_caps_timeout_set __swig_getmethods__["timeout"] = _Hamlib.rig_caps_timeout_get if _newclass:timeout = _swig_property(_Hamlib.rig_caps_timeout_get, _Hamlib.rig_caps_timeout_set) __swig_setmethods__["retry"] = _Hamlib.rig_caps_retry_set __swig_getmethods__["retry"] = _Hamlib.rig_caps_retry_get if _newclass:retry = _swig_property(_Hamlib.rig_caps_retry_get, _Hamlib.rig_caps_retry_set) __swig_setmethods__["has_get_func"] = _Hamlib.rig_caps_has_get_func_set __swig_getmethods__["has_get_func"] = _Hamlib.rig_caps_has_get_func_get if _newclass:has_get_func = _swig_property(_Hamlib.rig_caps_has_get_func_get, _Hamlib.rig_caps_has_get_func_set) __swig_setmethods__["has_set_func"] = _Hamlib.rig_caps_has_set_func_set __swig_getmethods__["has_set_func"] = _Hamlib.rig_caps_has_set_func_get if _newclass:has_set_func = _swig_property(_Hamlib.rig_caps_has_set_func_get, _Hamlib.rig_caps_has_set_func_set) __swig_setmethods__["has_get_level"] = _Hamlib.rig_caps_has_get_level_set __swig_getmethods__["has_get_level"] = _Hamlib.rig_caps_has_get_level_get if _newclass:has_get_level = _swig_property(_Hamlib.rig_caps_has_get_level_get, _Hamlib.rig_caps_has_get_level_set) __swig_setmethods__["has_set_level"] = _Hamlib.rig_caps_has_set_level_set __swig_getmethods__["has_set_level"] = _Hamlib.rig_caps_has_set_level_get if _newclass:has_set_level = _swig_property(_Hamlib.rig_caps_has_set_level_get, _Hamlib.rig_caps_has_set_level_set) __swig_setmethods__["has_get_parm"] = _Hamlib.rig_caps_has_get_parm_set __swig_getmethods__["has_get_parm"] = _Hamlib.rig_caps_has_get_parm_get if _newclass:has_get_parm = _swig_property(_Hamlib.rig_caps_has_get_parm_get, _Hamlib.rig_caps_has_get_parm_set) __swig_setmethods__["has_set_parm"] = _Hamlib.rig_caps_has_set_parm_set __swig_getmethods__["has_set_parm"] = _Hamlib.rig_caps_has_set_parm_get if _newclass:has_set_parm = _swig_property(_Hamlib.rig_caps_has_set_parm_get, _Hamlib.rig_caps_has_set_parm_set) __swig_setmethods__["level_gran"] = _Hamlib.rig_caps_level_gran_set __swig_getmethods__["level_gran"] = _Hamlib.rig_caps_level_gran_get if _newclass:level_gran = _swig_property(_Hamlib.rig_caps_level_gran_get, _Hamlib.rig_caps_level_gran_set) __swig_setmethods__["parm_gran"] = _Hamlib.rig_caps_parm_gran_set __swig_getmethods__["parm_gran"] = _Hamlib.rig_caps_parm_gran_get if _newclass:parm_gran = _swig_property(_Hamlib.rig_caps_parm_gran_get, _Hamlib.rig_caps_parm_gran_set) __swig_setmethods__["extparms"] = _Hamlib.rig_caps_extparms_set __swig_getmethods__["extparms"] = _Hamlib.rig_caps_extparms_get if _newclass:extparms = _swig_property(_Hamlib.rig_caps_extparms_get, _Hamlib.rig_caps_extparms_set) __swig_setmethods__["extlevels"] = _Hamlib.rig_caps_extlevels_set __swig_getmethods__["extlevels"] = _Hamlib.rig_caps_extlevels_get if _newclass:extlevels = _swig_property(_Hamlib.rig_caps_extlevels_get, _Hamlib.rig_caps_extlevels_set) __swig_setmethods__["ctcss_list"] = _Hamlib.rig_caps_ctcss_list_set __swig_getmethods__["ctcss_list"] = _Hamlib.rig_caps_ctcss_list_get if _newclass:ctcss_list = _swig_property(_Hamlib.rig_caps_ctcss_list_get, _Hamlib.rig_caps_ctcss_list_set) __swig_setmethods__["dcs_list"] = _Hamlib.rig_caps_dcs_list_set __swig_getmethods__["dcs_list"] = _Hamlib.rig_caps_dcs_list_get if _newclass:dcs_list = _swig_property(_Hamlib.rig_caps_dcs_list_get, _Hamlib.rig_caps_dcs_list_set) __swig_setmethods__["preamp"] = _Hamlib.rig_caps_preamp_set __swig_getmethods__["preamp"] = _Hamlib.rig_caps_preamp_get if _newclass:preamp = _swig_property(_Hamlib.rig_caps_preamp_get, _Hamlib.rig_caps_preamp_set) __swig_setmethods__["attenuator"] = _Hamlib.rig_caps_attenuator_set __swig_getmethods__["attenuator"] = _Hamlib.rig_caps_attenuator_get if _newclass:attenuator = _swig_property(_Hamlib.rig_caps_attenuator_get, _Hamlib.rig_caps_attenuator_set) __swig_setmethods__["max_rit"] = _Hamlib.rig_caps_max_rit_set __swig_getmethods__["max_rit"] = _Hamlib.rig_caps_max_rit_get if _newclass:max_rit = _swig_property(_Hamlib.rig_caps_max_rit_get, _Hamlib.rig_caps_max_rit_set) __swig_setmethods__["max_xit"] = _Hamlib.rig_caps_max_xit_set __swig_getmethods__["max_xit"] = _Hamlib.rig_caps_max_xit_get if _newclass:max_xit = _swig_property(_Hamlib.rig_caps_max_xit_get, _Hamlib.rig_caps_max_xit_set) __swig_setmethods__["max_ifshift"] = _Hamlib.rig_caps_max_ifshift_set __swig_getmethods__["max_ifshift"] = _Hamlib.rig_caps_max_ifshift_get if _newclass:max_ifshift = _swig_property(_Hamlib.rig_caps_max_ifshift_get, _Hamlib.rig_caps_max_ifshift_set) __swig_setmethods__["announces"] = _Hamlib.rig_caps_announces_set __swig_getmethods__["announces"] = _Hamlib.rig_caps_announces_get if _newclass:announces = _swig_property(_Hamlib.rig_caps_announces_get, _Hamlib.rig_caps_announces_set) __swig_setmethods__["vfo_ops"] = _Hamlib.rig_caps_vfo_ops_set __swig_getmethods__["vfo_ops"] = _Hamlib.rig_caps_vfo_ops_get if _newclass:vfo_ops = _swig_property(_Hamlib.rig_caps_vfo_ops_get, _Hamlib.rig_caps_vfo_ops_set) __swig_setmethods__["scan_ops"] = _Hamlib.rig_caps_scan_ops_set __swig_getmethods__["scan_ops"] = _Hamlib.rig_caps_scan_ops_get if _newclass:scan_ops = _swig_property(_Hamlib.rig_caps_scan_ops_get, _Hamlib.rig_caps_scan_ops_set) __swig_setmethods__["targetable_vfo"] = _Hamlib.rig_caps_targetable_vfo_set __swig_getmethods__["targetable_vfo"] = _Hamlib.rig_caps_targetable_vfo_get if _newclass:targetable_vfo = _swig_property(_Hamlib.rig_caps_targetable_vfo_get, _Hamlib.rig_caps_targetable_vfo_set) __swig_setmethods__["transceive"] = _Hamlib.rig_caps_transceive_set __swig_getmethods__["transceive"] = _Hamlib.rig_caps_transceive_get if _newclass:transceive = _swig_property(_Hamlib.rig_caps_transceive_get, _Hamlib.rig_caps_transceive_set) __swig_setmethods__["bank_qty"] = _Hamlib.rig_caps_bank_qty_set __swig_getmethods__["bank_qty"] = _Hamlib.rig_caps_bank_qty_get if _newclass:bank_qty = _swig_property(_Hamlib.rig_caps_bank_qty_get, _Hamlib.rig_caps_bank_qty_set) __swig_setmethods__["chan_desc_sz"] = _Hamlib.rig_caps_chan_desc_sz_set __swig_getmethods__["chan_desc_sz"] = _Hamlib.rig_caps_chan_desc_sz_get if _newclass:chan_desc_sz = _swig_property(_Hamlib.rig_caps_chan_desc_sz_get, _Hamlib.rig_caps_chan_desc_sz_set) __swig_setmethods__["chan_list"] = _Hamlib.rig_caps_chan_list_set __swig_getmethods__["chan_list"] = _Hamlib.rig_caps_chan_list_get if _newclass:chan_list = _swig_property(_Hamlib.rig_caps_chan_list_get, _Hamlib.rig_caps_chan_list_set) __swig_setmethods__["rx_range_list1"] = _Hamlib.rig_caps_rx_range_list1_set __swig_getmethods__["rx_range_list1"] = _Hamlib.rig_caps_rx_range_list1_get if _newclass:rx_range_list1 = _swig_property(_Hamlib.rig_caps_rx_range_list1_get, _Hamlib.rig_caps_rx_range_list1_set) __swig_setmethods__["tx_range_list1"] = _Hamlib.rig_caps_tx_range_list1_set __swig_getmethods__["tx_range_list1"] = _Hamlib.rig_caps_tx_range_list1_get if _newclass:tx_range_list1 = _swig_property(_Hamlib.rig_caps_tx_range_list1_get, _Hamlib.rig_caps_tx_range_list1_set) __swig_setmethods__["rx_range_list2"] = _Hamlib.rig_caps_rx_range_list2_set __swig_getmethods__["rx_range_list2"] = _Hamlib.rig_caps_rx_range_list2_get if _newclass:rx_range_list2 = _swig_property(_Hamlib.rig_caps_rx_range_list2_get, _Hamlib.rig_caps_rx_range_list2_set) __swig_setmethods__["tx_range_list2"] = _Hamlib.rig_caps_tx_range_list2_set __swig_getmethods__["tx_range_list2"] = _Hamlib.rig_caps_tx_range_list2_get if _newclass:tx_range_list2 = _swig_property(_Hamlib.rig_caps_tx_range_list2_get, _Hamlib.rig_caps_tx_range_list2_set) __swig_setmethods__["tuning_steps"] = _Hamlib.rig_caps_tuning_steps_set __swig_getmethods__["tuning_steps"] = _Hamlib.rig_caps_tuning_steps_get if _newclass:tuning_steps = _swig_property(_Hamlib.rig_caps_tuning_steps_get, _Hamlib.rig_caps_tuning_steps_set) __swig_setmethods__["filters"] = _Hamlib.rig_caps_filters_set __swig_getmethods__["filters"] = _Hamlib.rig_caps_filters_get if _newclass:filters = _swig_property(_Hamlib.rig_caps_filters_get, _Hamlib.rig_caps_filters_set) __swig_setmethods__["str_cal"] = _Hamlib.rig_caps_str_cal_set __swig_getmethods__["str_cal"] = _Hamlib.rig_caps_str_cal_get if _newclass:str_cal = _swig_property(_Hamlib.rig_caps_str_cal_get, _Hamlib.rig_caps_str_cal_set) __swig_setmethods__["cfgparams"] = _Hamlib.rig_caps_cfgparams_set __swig_getmethods__["cfgparams"] = _Hamlib.rig_caps_cfgparams_get if _newclass:cfgparams = _swig_property(_Hamlib.rig_caps_cfgparams_get, _Hamlib.rig_caps_cfgparams_set) __swig_setmethods__["priv"] = _Hamlib.rig_caps_priv_set __swig_getmethods__["priv"] = _Hamlib.rig_caps_priv_get if _newclass:priv = _swig_property(_Hamlib.rig_caps_priv_get, _Hamlib.rig_caps_priv_set) __swig_setmethods__["rig_init"] = _Hamlib.rig_caps_rig_init_set __swig_getmethods__["rig_init"] = _Hamlib.rig_caps_rig_init_get if _newclass:rig_init = _swig_property(_Hamlib.rig_caps_rig_init_get, _Hamlib.rig_caps_rig_init_set) __swig_setmethods__["set_freq"] = _Hamlib.rig_caps_set_freq_set __swig_getmethods__["set_freq"] = _Hamlib.rig_caps_set_freq_get if _newclass:set_freq = _swig_property(_Hamlib.rig_caps_set_freq_get, _Hamlib.rig_caps_set_freq_set) __swig_setmethods__["get_freq"] = _Hamlib.rig_caps_get_freq_set __swig_getmethods__["get_freq"] = _Hamlib.rig_caps_get_freq_get if _newclass:get_freq = _swig_property(_Hamlib.rig_caps_get_freq_get, _Hamlib.rig_caps_get_freq_set) __swig_setmethods__["set_mode"] = _Hamlib.rig_caps_set_mode_set __swig_getmethods__["set_mode"] = _Hamlib.rig_caps_set_mode_get if _newclass:set_mode = _swig_property(_Hamlib.rig_caps_set_mode_get, _Hamlib.rig_caps_set_mode_set) __swig_setmethods__["get_mode"] = _Hamlib.rig_caps_get_mode_set __swig_getmethods__["get_mode"] = _Hamlib.rig_caps_get_mode_get if _newclass:get_mode = _swig_property(_Hamlib.rig_caps_get_mode_get, _Hamlib.rig_caps_get_mode_set) __swig_setmethods__["set_vfo"] = _Hamlib.rig_caps_set_vfo_set __swig_getmethods__["set_vfo"] = _Hamlib.rig_caps_set_vfo_get if _newclass:set_vfo = _swig_property(_Hamlib.rig_caps_set_vfo_get, _Hamlib.rig_caps_set_vfo_set) __swig_setmethods__["get_vfo"] = _Hamlib.rig_caps_get_vfo_set __swig_getmethods__["get_vfo"] = _Hamlib.rig_caps_get_vfo_get if _newclass:get_vfo = _swig_property(_Hamlib.rig_caps_get_vfo_get, _Hamlib.rig_caps_get_vfo_set) __swig_setmethods__["set_ptt"] = _Hamlib.rig_caps_set_ptt_set __swig_getmethods__["set_ptt"] = _Hamlib.rig_caps_set_ptt_get if _newclass:set_ptt = _swig_property(_Hamlib.rig_caps_set_ptt_get, _Hamlib.rig_caps_set_ptt_set) __swig_setmethods__["get_ptt"] = _Hamlib.rig_caps_get_ptt_set __swig_getmethods__["get_ptt"] = _Hamlib.rig_caps_get_ptt_get if _newclass:get_ptt = _swig_property(_Hamlib.rig_caps_get_ptt_get, _Hamlib.rig_caps_get_ptt_set) __swig_setmethods__["get_dcd"] = _Hamlib.rig_caps_get_dcd_set __swig_getmethods__["get_dcd"] = _Hamlib.rig_caps_get_dcd_get if _newclass:get_dcd = _swig_property(_Hamlib.rig_caps_get_dcd_get, _Hamlib.rig_caps_get_dcd_set) __swig_setmethods__["set_rptr_shift"] = _Hamlib.rig_caps_set_rptr_shift_set __swig_getmethods__["set_rptr_shift"] = _Hamlib.rig_caps_set_rptr_shift_get if _newclass:set_rptr_shift = _swig_property(_Hamlib.rig_caps_set_rptr_shift_get, _Hamlib.rig_caps_set_rptr_shift_set) __swig_setmethods__["get_rptr_shift"] = _Hamlib.rig_caps_get_rptr_shift_set __swig_getmethods__["get_rptr_shift"] = _Hamlib.rig_caps_get_rptr_shift_get if _newclass:get_rptr_shift = _swig_property(_Hamlib.rig_caps_get_rptr_shift_get, _Hamlib.rig_caps_get_rptr_shift_set) __swig_setmethods__["set_rptr_offs"] = _Hamlib.rig_caps_set_rptr_offs_set __swig_getmethods__["set_rptr_offs"] = _Hamlib.rig_caps_set_rptr_offs_get if _newclass:set_rptr_offs = _swig_property(_Hamlib.rig_caps_set_rptr_offs_get, _Hamlib.rig_caps_set_rptr_offs_set) __swig_setmethods__["get_rptr_offs"] = _Hamlib.rig_caps_get_rptr_offs_set __swig_getmethods__["get_rptr_offs"] = _Hamlib.rig_caps_get_rptr_offs_get if _newclass:get_rptr_offs = _swig_property(_Hamlib.rig_caps_get_rptr_offs_get, _Hamlib.rig_caps_get_rptr_offs_set) __swig_setmethods__["set_split_freq"] = _Hamlib.rig_caps_set_split_freq_set __swig_getmethods__["set_split_freq"] = _Hamlib.rig_caps_set_split_freq_get if _newclass:set_split_freq = _swig_property(_Hamlib.rig_caps_set_split_freq_get, _Hamlib.rig_caps_set_split_freq_set) __swig_setmethods__["get_split_freq"] = _Hamlib.rig_caps_get_split_freq_set __swig_getmethods__["get_split_freq"] = _Hamlib.rig_caps_get_split_freq_get if _newclass:get_split_freq = _swig_property(_Hamlib.rig_caps_get_split_freq_get, _Hamlib.rig_caps_get_split_freq_set) __swig_setmethods__["set_split_mode"] = _Hamlib.rig_caps_set_split_mode_set __swig_getmethods__["set_split_mode"] = _Hamlib.rig_caps_set_split_mode_get if _newclass:set_split_mode = _swig_property(_Hamlib.rig_caps_set_split_mode_get, _Hamlib.rig_caps_set_split_mode_set) __swig_setmethods__["get_split_mode"] = _Hamlib.rig_caps_get_split_mode_set __swig_getmethods__["get_split_mode"] = _Hamlib.rig_caps_get_split_mode_get if _newclass:get_split_mode = _swig_property(_Hamlib.rig_caps_get_split_mode_get, _Hamlib.rig_caps_get_split_mode_set) __swig_setmethods__["set_split_vfo"] = _Hamlib.rig_caps_set_split_vfo_set __swig_getmethods__["set_split_vfo"] = _Hamlib.rig_caps_set_split_vfo_get if _newclass:set_split_vfo = _swig_property(_Hamlib.rig_caps_set_split_vfo_get, _Hamlib.rig_caps_set_split_vfo_set) __swig_setmethods__["get_split_vfo"] = _Hamlib.rig_caps_get_split_vfo_set __swig_getmethods__["get_split_vfo"] = _Hamlib.rig_caps_get_split_vfo_get if _newclass:get_split_vfo = _swig_property(_Hamlib.rig_caps_get_split_vfo_get, _Hamlib.rig_caps_get_split_vfo_set) __swig_setmethods__["set_rit"] = _Hamlib.rig_caps_set_rit_set __swig_getmethods__["set_rit"] = _Hamlib.rig_caps_set_rit_get if _newclass:set_rit = _swig_property(_Hamlib.rig_caps_set_rit_get, _Hamlib.rig_caps_set_rit_set) __swig_setmethods__["get_rit"] = _Hamlib.rig_caps_get_rit_set __swig_getmethods__["get_rit"] = _Hamlib.rig_caps_get_rit_get if _newclass:get_rit = _swig_property(_Hamlib.rig_caps_get_rit_get, _Hamlib.rig_caps_get_rit_set) __swig_setmethods__["set_xit"] = _Hamlib.rig_caps_set_xit_set __swig_getmethods__["set_xit"] = _Hamlib.rig_caps_set_xit_get if _newclass:set_xit = _swig_property(_Hamlib.rig_caps_set_xit_get, _Hamlib.rig_caps_set_xit_set) __swig_setmethods__["get_xit"] = _Hamlib.rig_caps_get_xit_set __swig_getmethods__["get_xit"] = _Hamlib.rig_caps_get_xit_get if _newclass:get_xit = _swig_property(_Hamlib.rig_caps_get_xit_get, _Hamlib.rig_caps_get_xit_set) __swig_setmethods__["set_ts"] = _Hamlib.rig_caps_set_ts_set __swig_getmethods__["set_ts"] = _Hamlib.rig_caps_set_ts_get if _newclass:set_ts = _swig_property(_Hamlib.rig_caps_set_ts_get, _Hamlib.rig_caps_set_ts_set) __swig_setmethods__["get_ts"] = _Hamlib.rig_caps_get_ts_set __swig_getmethods__["get_ts"] = _Hamlib.rig_caps_get_ts_get if _newclass:get_ts = _swig_property(_Hamlib.rig_caps_get_ts_get, _Hamlib.rig_caps_get_ts_set) __swig_setmethods__["set_dcs_code"] = _Hamlib.rig_caps_set_dcs_code_set __swig_getmethods__["set_dcs_code"] = _Hamlib.rig_caps_set_dcs_code_get if _newclass:set_dcs_code = _swig_property(_Hamlib.rig_caps_set_dcs_code_get, _Hamlib.rig_caps_set_dcs_code_set) __swig_setmethods__["get_dcs_code"] = _Hamlib.rig_caps_get_dcs_code_set __swig_getmethods__["get_dcs_code"] = _Hamlib.rig_caps_get_dcs_code_get if _newclass:get_dcs_code = _swig_property(_Hamlib.rig_caps_get_dcs_code_get, _Hamlib.rig_caps_get_dcs_code_set) __swig_setmethods__["set_tone"] = _Hamlib.rig_caps_set_tone_set __swig_getmethods__["set_tone"] = _Hamlib.rig_caps_set_tone_get if _newclass:set_tone = _swig_property(_Hamlib.rig_caps_set_tone_get, _Hamlib.rig_caps_set_tone_set) __swig_setmethods__["get_tone"] = _Hamlib.rig_caps_get_tone_set __swig_getmethods__["get_tone"] = _Hamlib.rig_caps_get_tone_get if _newclass:get_tone = _swig_property(_Hamlib.rig_caps_get_tone_get, _Hamlib.rig_caps_get_tone_set) __swig_setmethods__["set_ctcss_tone"] = _Hamlib.rig_caps_set_ctcss_tone_set __swig_getmethods__["set_ctcss_tone"] = _Hamlib.rig_caps_set_ctcss_tone_get if _newclass:set_ctcss_tone = _swig_property(_Hamlib.rig_caps_set_ctcss_tone_get, _Hamlib.rig_caps_set_ctcss_tone_set) __swig_setmethods__["get_ctcss_tone"] = _Hamlib.rig_caps_get_ctcss_tone_set __swig_getmethods__["get_ctcss_tone"] = _Hamlib.rig_caps_get_ctcss_tone_get if _newclass:get_ctcss_tone = _swig_property(_Hamlib.rig_caps_get_ctcss_tone_get, _Hamlib.rig_caps_get_ctcss_tone_set) __swig_setmethods__["set_dcs_sql"] = _Hamlib.rig_caps_set_dcs_sql_set __swig_getmethods__["set_dcs_sql"] = _Hamlib.rig_caps_set_dcs_sql_get if _newclass:set_dcs_sql = _swig_property(_Hamlib.rig_caps_set_dcs_sql_get, _Hamlib.rig_caps_set_dcs_sql_set) __swig_setmethods__["get_dcs_sql"] = _Hamlib.rig_caps_get_dcs_sql_set __swig_getmethods__["get_dcs_sql"] = _Hamlib.rig_caps_get_dcs_sql_get if _newclass:get_dcs_sql = _swig_property(_Hamlib.rig_caps_get_dcs_sql_get, _Hamlib.rig_caps_get_dcs_sql_set) __swig_setmethods__["set_tone_sql"] = _Hamlib.rig_caps_set_tone_sql_set __swig_getmethods__["set_tone_sql"] = _Hamlib.rig_caps_set_tone_sql_get if _newclass:set_tone_sql = _swig_property(_Hamlib.rig_caps_set_tone_sql_get, _Hamlib.rig_caps_set_tone_sql_set) __swig_setmethods__["get_tone_sql"] = _Hamlib.rig_caps_get_tone_sql_set __swig_getmethods__["get_tone_sql"] = _Hamlib.rig_caps_get_tone_sql_get if _newclass:get_tone_sql = _swig_property(_Hamlib.rig_caps_get_tone_sql_get, _Hamlib.rig_caps_get_tone_sql_set) __swig_setmethods__["set_ctcss_sql"] = _Hamlib.rig_caps_set_ctcss_sql_set __swig_getmethods__["set_ctcss_sql"] = _Hamlib.rig_caps_set_ctcss_sql_get if _newclass:set_ctcss_sql = _swig_property(_Hamlib.rig_caps_set_ctcss_sql_get, _Hamlib.rig_caps_set_ctcss_sql_set) __swig_setmethods__["get_ctcss_sql"] = _Hamlib.rig_caps_get_ctcss_sql_set __swig_getmethods__["get_ctcss_sql"] = _Hamlib.rig_caps_get_ctcss_sql_get if _newclass:get_ctcss_sql = _swig_property(_Hamlib.rig_caps_get_ctcss_sql_get, _Hamlib.rig_caps_get_ctcss_sql_set) __swig_setmethods__["power2mW"] = _Hamlib.rig_caps_power2mW_set __swig_getmethods__["power2mW"] = _Hamlib.rig_caps_power2mW_get if _newclass:power2mW = _swig_property(_Hamlib.rig_caps_power2mW_get, _Hamlib.rig_caps_power2mW_set) __swig_setmethods__["mW2power"] = _Hamlib.rig_caps_mW2power_set __swig_getmethods__["mW2power"] = _Hamlib.rig_caps_mW2power_get if _newclass:mW2power = _swig_property(_Hamlib.rig_caps_mW2power_get, _Hamlib.rig_caps_mW2power_set) __swig_setmethods__["set_powerstat"] = _Hamlib.rig_caps_set_powerstat_set __swig_getmethods__["set_powerstat"] = _Hamlib.rig_caps_set_powerstat_get if _newclass:set_powerstat = _swig_property(_Hamlib.rig_caps_set_powerstat_get, _Hamlib.rig_caps_set_powerstat_set) __swig_setmethods__["get_powerstat"] = _Hamlib.rig_caps_get_powerstat_set __swig_getmethods__["get_powerstat"] = _Hamlib.rig_caps_get_powerstat_get if _newclass:get_powerstat = _swig_property(_Hamlib.rig_caps_get_powerstat_get, _Hamlib.rig_caps_get_powerstat_set) __swig_setmethods__["reset"] = _Hamlib.rig_caps_reset_set __swig_getmethods__["reset"] = _Hamlib.rig_caps_reset_get if _newclass:reset = _swig_property(_Hamlib.rig_caps_reset_get, _Hamlib.rig_caps_reset_set) __swig_setmethods__["set_ant"] = _Hamlib.rig_caps_set_ant_set __swig_getmethods__["set_ant"] = _Hamlib.rig_caps_set_ant_get if _newclass:set_ant = _swig_property(_Hamlib.rig_caps_set_ant_get, _Hamlib.rig_caps_set_ant_set) __swig_setmethods__["get_ant"] = _Hamlib.rig_caps_get_ant_set __swig_getmethods__["get_ant"] = _Hamlib.rig_caps_get_ant_get if _newclass:get_ant = _swig_property(_Hamlib.rig_caps_get_ant_get, _Hamlib.rig_caps_get_ant_set) __swig_setmethods__["set_level"] = _Hamlib.rig_caps_set_level_set __swig_getmethods__["set_level"] = _Hamlib.rig_caps_set_level_get if _newclass:set_level = _swig_property(_Hamlib.rig_caps_set_level_get, _Hamlib.rig_caps_set_level_set) __swig_setmethods__["get_level"] = _Hamlib.rig_caps_get_level_set __swig_getmethods__["get_level"] = _Hamlib.rig_caps_get_level_get if _newclass:get_level = _swig_property(_Hamlib.rig_caps_get_level_get, _Hamlib.rig_caps_get_level_set) __swig_setmethods__["set_func"] = _Hamlib.rig_caps_set_func_set __swig_getmethods__["set_func"] = _Hamlib.rig_caps_set_func_get if _newclass:set_func = _swig_property(_Hamlib.rig_caps_set_func_get, _Hamlib.rig_caps_set_func_set) __swig_setmethods__["get_func"] = _Hamlib.rig_caps_get_func_set __swig_getmethods__["get_func"] = _Hamlib.rig_caps_get_func_get if _newclass:get_func = _swig_property(_Hamlib.rig_caps_get_func_get, _Hamlib.rig_caps_get_func_set) __swig_setmethods__["set_parm"] = _Hamlib.rig_caps_set_parm_set __swig_getmethods__["set_parm"] = _Hamlib.rig_caps_set_parm_get if _newclass:set_parm = _swig_property(_Hamlib.rig_caps_set_parm_get, _Hamlib.rig_caps_set_parm_set) __swig_setmethods__["get_parm"] = _Hamlib.rig_caps_get_parm_set __swig_getmethods__["get_parm"] = _Hamlib.rig_caps_get_parm_get if _newclass:get_parm = _swig_property(_Hamlib.rig_caps_get_parm_get, _Hamlib.rig_caps_get_parm_set) __swig_setmethods__["set_ext_level"] = _Hamlib.rig_caps_set_ext_level_set __swig_getmethods__["set_ext_level"] = _Hamlib.rig_caps_set_ext_level_get if _newclass:set_ext_level = _swig_property(_Hamlib.rig_caps_set_ext_level_get, _Hamlib.rig_caps_set_ext_level_set) __swig_setmethods__["get_ext_level"] = _Hamlib.rig_caps_get_ext_level_set __swig_getmethods__["get_ext_level"] = _Hamlib.rig_caps_get_ext_level_get if _newclass:get_ext_level = _swig_property(_Hamlib.rig_caps_get_ext_level_get, _Hamlib.rig_caps_get_ext_level_set) __swig_setmethods__["set_ext_parm"] = _Hamlib.rig_caps_set_ext_parm_set __swig_getmethods__["set_ext_parm"] = _Hamlib.rig_caps_set_ext_parm_get if _newclass:set_ext_parm = _swig_property(_Hamlib.rig_caps_set_ext_parm_get, _Hamlib.rig_caps_set_ext_parm_set) __swig_setmethods__["get_ext_parm"] = _Hamlib.rig_caps_get_ext_parm_set __swig_getmethods__["get_ext_parm"] = _Hamlib.rig_caps_get_ext_parm_get if _newclass:get_ext_parm = _swig_property(_Hamlib.rig_caps_get_ext_parm_get, _Hamlib.rig_caps_get_ext_parm_set) __swig_setmethods__["set_conf"] = _Hamlib.rig_caps_set_conf_set __swig_getmethods__["set_conf"] = _Hamlib.rig_caps_set_conf_get if _newclass:set_conf = _swig_property(_Hamlib.rig_caps_set_conf_get, _Hamlib.rig_caps_set_conf_set) __swig_setmethods__["get_conf"] = _Hamlib.rig_caps_get_conf_set __swig_getmethods__["get_conf"] = _Hamlib.rig_caps_get_conf_get if _newclass:get_conf = _swig_property(_Hamlib.rig_caps_get_conf_get, _Hamlib.rig_caps_get_conf_set) __swig_setmethods__["send_dtmf"] = _Hamlib.rig_caps_send_dtmf_set __swig_getmethods__["send_dtmf"] = _Hamlib.rig_caps_send_dtmf_get if _newclass:send_dtmf = _swig_property(_Hamlib.rig_caps_send_dtmf_get, _Hamlib.rig_caps_send_dtmf_set) __swig_setmethods__["recv_dtmf"] = _Hamlib.rig_caps_recv_dtmf_set __swig_getmethods__["recv_dtmf"] = _Hamlib.rig_caps_recv_dtmf_get if _newclass:recv_dtmf = _swig_property(_Hamlib.rig_caps_recv_dtmf_get, _Hamlib.rig_caps_recv_dtmf_set) __swig_setmethods__["send_morse"] = _Hamlib.rig_caps_send_morse_set __swig_getmethods__["send_morse"] = _Hamlib.rig_caps_send_morse_get if _newclass:send_morse = _swig_property(_Hamlib.rig_caps_send_morse_get, _Hamlib.rig_caps_send_morse_set) __swig_setmethods__["set_bank"] = _Hamlib.rig_caps_set_bank_set __swig_getmethods__["set_bank"] = _Hamlib.rig_caps_set_bank_get if _newclass:set_bank = _swig_property(_Hamlib.rig_caps_set_bank_get, _Hamlib.rig_caps_set_bank_set) __swig_setmethods__["set_mem"] = _Hamlib.rig_caps_set_mem_set __swig_getmethods__["set_mem"] = _Hamlib.rig_caps_set_mem_get if _newclass:set_mem = _swig_property(_Hamlib.rig_caps_set_mem_get, _Hamlib.rig_caps_set_mem_set) __swig_setmethods__["get_mem"] = _Hamlib.rig_caps_get_mem_set __swig_getmethods__["get_mem"] = _Hamlib.rig_caps_get_mem_get if _newclass:get_mem = _swig_property(_Hamlib.rig_caps_get_mem_get, _Hamlib.rig_caps_get_mem_set) __swig_setmethods__["vfo_op"] = _Hamlib.rig_caps_vfo_op_set __swig_getmethods__["vfo_op"] = _Hamlib.rig_caps_vfo_op_get if _newclass:vfo_op = _swig_property(_Hamlib.rig_caps_vfo_op_get, _Hamlib.rig_caps_vfo_op_set) __swig_setmethods__["scan"] = _Hamlib.rig_caps_scan_set __swig_getmethods__["scan"] = _Hamlib.rig_caps_scan_get if _newclass:scan = _swig_property(_Hamlib.rig_caps_scan_get, _Hamlib.rig_caps_scan_set) __swig_setmethods__["set_trn"] = _Hamlib.rig_caps_set_trn_set __swig_getmethods__["set_trn"] = _Hamlib.rig_caps_set_trn_get if _newclass:set_trn = _swig_property(_Hamlib.rig_caps_set_trn_get, _Hamlib.rig_caps_set_trn_set) __swig_setmethods__["get_trn"] = _Hamlib.rig_caps_get_trn_set __swig_getmethods__["get_trn"] = _Hamlib.rig_caps_get_trn_get if _newclass:get_trn = _swig_property(_Hamlib.rig_caps_get_trn_get, _Hamlib.rig_caps_get_trn_set) __swig_setmethods__["decode_event"] = _Hamlib.rig_caps_decode_event_set __swig_getmethods__["decode_event"] = _Hamlib.rig_caps_decode_event_get if _newclass:decode_event = _swig_property(_Hamlib.rig_caps_decode_event_get, _Hamlib.rig_caps_decode_event_set) __swig_setmethods__["set_channel"] = _Hamlib.rig_caps_set_channel_set __swig_getmethods__["set_channel"] = _Hamlib.rig_caps_set_channel_get if _newclass:set_channel = _swig_property(_Hamlib.rig_caps_set_channel_get, _Hamlib.rig_caps_set_channel_set) __swig_setmethods__["get_channel"] = _Hamlib.rig_caps_get_channel_set __swig_getmethods__["get_channel"] = _Hamlib.rig_caps_get_channel_get if _newclass:get_channel = _swig_property(_Hamlib.rig_caps_get_channel_get, _Hamlib.rig_caps_get_channel_set) __swig_setmethods__["get_info"] = _Hamlib.rig_caps_get_info_set __swig_getmethods__["get_info"] = _Hamlib.rig_caps_get_info_get if _newclass:get_info = _swig_property(_Hamlib.rig_caps_get_info_get, _Hamlib.rig_caps_get_info_set) __swig_setmethods__["set_chan_all_cb"] = _Hamlib.rig_caps_set_chan_all_cb_set __swig_getmethods__["set_chan_all_cb"] = _Hamlib.rig_caps_set_chan_all_cb_get if _newclass:set_chan_all_cb = _swig_property(_Hamlib.rig_caps_set_chan_all_cb_get, _Hamlib.rig_caps_set_chan_all_cb_set) __swig_setmethods__["get_chan_all_cb"] = _Hamlib.rig_caps_get_chan_all_cb_set __swig_getmethods__["get_chan_all_cb"] = _Hamlib.rig_caps_get_chan_all_cb_get if _newclass:get_chan_all_cb = _swig_property(_Hamlib.rig_caps_get_chan_all_cb_get, _Hamlib.rig_caps_get_chan_all_cb_set) __swig_setmethods__["set_mem_all_cb"] = _Hamlib.rig_caps_set_mem_all_cb_set __swig_getmethods__["set_mem_all_cb"] = _Hamlib.rig_caps_set_mem_all_cb_get if _newclass:set_mem_all_cb = _swig_property(_Hamlib.rig_caps_set_mem_all_cb_get, _Hamlib.rig_caps_set_mem_all_cb_set) __swig_setmethods__["get_mem_all_cb"] = _Hamlib.rig_caps_get_mem_all_cb_set __swig_getmethods__["get_mem_all_cb"] = _Hamlib.rig_caps_get_mem_all_cb_get if _newclass:get_mem_all_cb = _swig_property(_Hamlib.rig_caps_get_mem_all_cb_get, _Hamlib.rig_caps_get_mem_all_cb_set) __swig_setmethods__["clone_combo_set"] = _Hamlib.rig_caps_clone_combo_set_set __swig_getmethods__["clone_combo_set"] = _Hamlib.rig_caps_clone_combo_set_get if _newclass:clone_combo_set = _swig_property(_Hamlib.rig_caps_clone_combo_set_get, _Hamlib.rig_caps_clone_combo_set_set) __swig_setmethods__["clone_combo_get"] = _Hamlib.rig_caps_clone_combo_get_set __swig_getmethods__["clone_combo_get"] = _Hamlib.rig_caps_clone_combo_get_get if _newclass:clone_combo_get = _swig_property(_Hamlib.rig_caps_clone_combo_get_get, _Hamlib.rig_caps_clone_combo_get_set) def __init__(self): this = _Hamlib.new_rig_caps() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_rig_caps __del__ = lambda self : None; rig_caps_swigregister = _Hamlib.rig_caps_swigregister rig_caps_swigregister(rig_caps) class hamlib_port_t(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, hamlib_port_t, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, hamlib_port_t, name) __repr__ = _swig_repr __swig_setmethods__["fd"] = _Hamlib.hamlib_port_t_fd_set __swig_getmethods__["fd"] = _Hamlib.hamlib_port_t_fd_get if _newclass:fd = _swig_property(_Hamlib.hamlib_port_t_fd_get, _Hamlib.hamlib_port_t_fd_set) __swig_setmethods__["handle"] = _Hamlib.hamlib_port_t_handle_set __swig_getmethods__["handle"] = _Hamlib.hamlib_port_t_handle_get if _newclass:handle = _swig_property(_Hamlib.hamlib_port_t_handle_get, _Hamlib.hamlib_port_t_handle_set) __swig_setmethods__["write_delay"] = _Hamlib.hamlib_port_t_write_delay_set __swig_getmethods__["write_delay"] = _Hamlib.hamlib_port_t_write_delay_get if _newclass:write_delay = _swig_property(_Hamlib.hamlib_port_t_write_delay_get, _Hamlib.hamlib_port_t_write_delay_set) __swig_setmethods__["post_write_delay"] = _Hamlib.hamlib_port_t_post_write_delay_set __swig_getmethods__["post_write_delay"] = _Hamlib.hamlib_port_t_post_write_delay_get if _newclass:post_write_delay = _swig_property(_Hamlib.hamlib_port_t_post_write_delay_get, _Hamlib.hamlib_port_t_post_write_delay_set) __swig_setmethods__["timeout"] = _Hamlib.hamlib_port_t_timeout_set __swig_getmethods__["timeout"] = _Hamlib.hamlib_port_t_timeout_get if _newclass:timeout = _swig_property(_Hamlib.hamlib_port_t_timeout_get, _Hamlib.hamlib_port_t_timeout_set) __swig_setmethods__["retry"] = _Hamlib.hamlib_port_t_retry_set __swig_getmethods__["retry"] = _Hamlib.hamlib_port_t_retry_get if _newclass:retry = _swig_property(_Hamlib.hamlib_port_t_retry_get, _Hamlib.hamlib_port_t_retry_set) __swig_setmethods__["pathname"] = _Hamlib.hamlib_port_t_pathname_set __swig_getmethods__["pathname"] = _Hamlib.hamlib_port_t_pathname_get if _newclass:pathname = _swig_property(_Hamlib.hamlib_port_t_pathname_get, _Hamlib.hamlib_port_t_pathname_set) __swig_getmethods__["parm"] = _Hamlib.hamlib_port_t_parm_get if _newclass:parm = _swig_property(_Hamlib.hamlib_port_t_parm_get) __swig_getmethods__["post_write_date"] = _Hamlib.hamlib_port_t_post_write_date_get if _newclass:post_write_date = _swig_property(_Hamlib.hamlib_port_t_post_write_date_get) __swig_getmethods__["type"] = _Hamlib.hamlib_port_t_type_get if _newclass:type = _swig_property(_Hamlib.hamlib_port_t_type_get) def __init__(self): this = _Hamlib.new_hamlib_port_t() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_hamlib_port_t __del__ = lambda self : None; hamlib_port_t_swigregister = _Hamlib.hamlib_port_t_swigregister hamlib_port_t_swigregister(hamlib_port_t) class hamlib_port_t_parm(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, hamlib_port_t_parm, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, hamlib_port_t_parm, name) __repr__ = _swig_repr __swig_getmethods__["usb"] = _Hamlib.hamlib_port_t_parm_usb_get if _newclass:usb = _swig_property(_Hamlib.hamlib_port_t_parm_usb_get) __swig_getmethods__["cm108"] = _Hamlib.hamlib_port_t_parm_cm108_get if _newclass:cm108 = _swig_property(_Hamlib.hamlib_port_t_parm_cm108_get) __swig_getmethods__["parallel"] = _Hamlib.hamlib_port_t_parm_parallel_get if _newclass:parallel = _swig_property(_Hamlib.hamlib_port_t_parm_parallel_get) __swig_getmethods__["serial"] = _Hamlib.hamlib_port_t_parm_serial_get if _newclass:serial = _swig_property(_Hamlib.hamlib_port_t_parm_serial_get) def __init__(self): this = _Hamlib.new_hamlib_port_t_parm() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_hamlib_port_t_parm __del__ = lambda self : None; hamlib_port_t_parm_swigregister = _Hamlib.hamlib_port_t_parm_swigregister hamlib_port_t_parm_swigregister(hamlib_port_t_parm) class hamlib_port_t_parm_usb(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, hamlib_port_t_parm_usb, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, hamlib_port_t_parm_usb, name) __repr__ = _swig_repr __swig_setmethods__["vid"] = _Hamlib.hamlib_port_t_parm_usb_vid_set __swig_getmethods__["vid"] = _Hamlib.hamlib_port_t_parm_usb_vid_get if _newclass:vid = _swig_property(_Hamlib.hamlib_port_t_parm_usb_vid_get, _Hamlib.hamlib_port_t_parm_usb_vid_set) __swig_setmethods__["pid"] = _Hamlib.hamlib_port_t_parm_usb_pid_set __swig_getmethods__["pid"] = _Hamlib.hamlib_port_t_parm_usb_pid_get if _newclass:pid = _swig_property(_Hamlib.hamlib_port_t_parm_usb_pid_get, _Hamlib.hamlib_port_t_parm_usb_pid_set) __swig_setmethods__["conf"] = _Hamlib.hamlib_port_t_parm_usb_conf_set __swig_getmethods__["conf"] = _Hamlib.hamlib_port_t_parm_usb_conf_get if _newclass:conf = _swig_property(_Hamlib.hamlib_port_t_parm_usb_conf_get, _Hamlib.hamlib_port_t_parm_usb_conf_set) __swig_setmethods__["iface"] = _Hamlib.hamlib_port_t_parm_usb_iface_set __swig_getmethods__["iface"] = _Hamlib.hamlib_port_t_parm_usb_iface_get if _newclass:iface = _swig_property(_Hamlib.hamlib_port_t_parm_usb_iface_get, _Hamlib.hamlib_port_t_parm_usb_iface_set) __swig_setmethods__["alt"] = _Hamlib.hamlib_port_t_parm_usb_alt_set __swig_getmethods__["alt"] = _Hamlib.hamlib_port_t_parm_usb_alt_get if _newclass:alt = _swig_property(_Hamlib.hamlib_port_t_parm_usb_alt_get, _Hamlib.hamlib_port_t_parm_usb_alt_set) __swig_setmethods__["vendor_name"] = _Hamlib.hamlib_port_t_parm_usb_vendor_name_set __swig_getmethods__["vendor_name"] = _Hamlib.hamlib_port_t_parm_usb_vendor_name_get if _newclass:vendor_name = _swig_property(_Hamlib.hamlib_port_t_parm_usb_vendor_name_get, _Hamlib.hamlib_port_t_parm_usb_vendor_name_set) __swig_setmethods__["product"] = _Hamlib.hamlib_port_t_parm_usb_product_set __swig_getmethods__["product"] = _Hamlib.hamlib_port_t_parm_usb_product_get if _newclass:product = _swig_property(_Hamlib.hamlib_port_t_parm_usb_product_get, _Hamlib.hamlib_port_t_parm_usb_product_set) def __init__(self): this = _Hamlib.new_hamlib_port_t_parm_usb() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_hamlib_port_t_parm_usb __del__ = lambda self : None; hamlib_port_t_parm_usb_swigregister = _Hamlib.hamlib_port_t_parm_usb_swigregister hamlib_port_t_parm_usb_swigregister(hamlib_port_t_parm_usb) class hamlib_port_t_parm_cm108(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, hamlib_port_t_parm_cm108, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, hamlib_port_t_parm_cm108, name) __repr__ = _swig_repr __swig_setmethods__["ptt_bitnum"] = _Hamlib.hamlib_port_t_parm_cm108_ptt_bitnum_set __swig_getmethods__["ptt_bitnum"] = _Hamlib.hamlib_port_t_parm_cm108_ptt_bitnum_get if _newclass:ptt_bitnum = _swig_property(_Hamlib.hamlib_port_t_parm_cm108_ptt_bitnum_get, _Hamlib.hamlib_port_t_parm_cm108_ptt_bitnum_set) def __init__(self): this = _Hamlib.new_hamlib_port_t_parm_cm108() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_hamlib_port_t_parm_cm108 __del__ = lambda self : None; hamlib_port_t_parm_cm108_swigregister = _Hamlib.hamlib_port_t_parm_cm108_swigregister hamlib_port_t_parm_cm108_swigregister(hamlib_port_t_parm_cm108) class hamlib_port_t_parm_parallel(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, hamlib_port_t_parm_parallel, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, hamlib_port_t_parm_parallel, name) __repr__ = _swig_repr __swig_setmethods__["pin"] = _Hamlib.hamlib_port_t_parm_parallel_pin_set __swig_getmethods__["pin"] = _Hamlib.hamlib_port_t_parm_parallel_pin_get if _newclass:pin = _swig_property(_Hamlib.hamlib_port_t_parm_parallel_pin_get, _Hamlib.hamlib_port_t_parm_parallel_pin_set) def __init__(self): this = _Hamlib.new_hamlib_port_t_parm_parallel() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_hamlib_port_t_parm_parallel __del__ = lambda self : None; hamlib_port_t_parm_parallel_swigregister = _Hamlib.hamlib_port_t_parm_parallel_swigregister hamlib_port_t_parm_parallel_swigregister(hamlib_port_t_parm_parallel) class hamlib_port_t_parm_serial(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, hamlib_port_t_parm_serial, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, hamlib_port_t_parm_serial, name) __repr__ = _swig_repr __swig_setmethods__["rate"] = _Hamlib.hamlib_port_t_parm_serial_rate_set __swig_getmethods__["rate"] = _Hamlib.hamlib_port_t_parm_serial_rate_get if _newclass:rate = _swig_property(_Hamlib.hamlib_port_t_parm_serial_rate_get, _Hamlib.hamlib_port_t_parm_serial_rate_set) __swig_setmethods__["data_bits"] = _Hamlib.hamlib_port_t_parm_serial_data_bits_set __swig_getmethods__["data_bits"] = _Hamlib.hamlib_port_t_parm_serial_data_bits_get if _newclass:data_bits = _swig_property(_Hamlib.hamlib_port_t_parm_serial_data_bits_get, _Hamlib.hamlib_port_t_parm_serial_data_bits_set) __swig_setmethods__["stop_bits"] = _Hamlib.hamlib_port_t_parm_serial_stop_bits_set __swig_getmethods__["stop_bits"] = _Hamlib.hamlib_port_t_parm_serial_stop_bits_get if _newclass:stop_bits = _swig_property(_Hamlib.hamlib_port_t_parm_serial_stop_bits_get, _Hamlib.hamlib_port_t_parm_serial_stop_bits_set) __swig_setmethods__["parity"] = _Hamlib.hamlib_port_t_parm_serial_parity_set __swig_getmethods__["parity"] = _Hamlib.hamlib_port_t_parm_serial_parity_get if _newclass:parity = _swig_property(_Hamlib.hamlib_port_t_parm_serial_parity_get, _Hamlib.hamlib_port_t_parm_serial_parity_set) __swig_setmethods__["handshake"] = _Hamlib.hamlib_port_t_parm_serial_handshake_set __swig_getmethods__["handshake"] = _Hamlib.hamlib_port_t_parm_serial_handshake_get if _newclass:handshake = _swig_property(_Hamlib.hamlib_port_t_parm_serial_handshake_get, _Hamlib.hamlib_port_t_parm_serial_handshake_set) __swig_setmethods__["rts_state"] = _Hamlib.hamlib_port_t_parm_serial_rts_state_set __swig_getmethods__["rts_state"] = _Hamlib.hamlib_port_t_parm_serial_rts_state_get if _newclass:rts_state = _swig_property(_Hamlib.hamlib_port_t_parm_serial_rts_state_get, _Hamlib.hamlib_port_t_parm_serial_rts_state_set) __swig_setmethods__["dtr_state"] = _Hamlib.hamlib_port_t_parm_serial_dtr_state_set __swig_getmethods__["dtr_state"] = _Hamlib.hamlib_port_t_parm_serial_dtr_state_get if _newclass:dtr_state = _swig_property(_Hamlib.hamlib_port_t_parm_serial_dtr_state_get, _Hamlib.hamlib_port_t_parm_serial_dtr_state_set) def __init__(self): this = _Hamlib.new_hamlib_port_t_parm_serial() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_hamlib_port_t_parm_serial __del__ = lambda self : None; hamlib_port_t_parm_serial_swigregister = _Hamlib.hamlib_port_t_parm_serial_swigregister hamlib_port_t_parm_serial_swigregister(hamlib_port_t_parm_serial) class hamlib_port_t_post_write_date(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, hamlib_port_t_post_write_date, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, hamlib_port_t_post_write_date, name) __repr__ = _swig_repr __swig_setmethods__["tv_sec"] = _Hamlib.hamlib_port_t_post_write_date_tv_sec_set __swig_getmethods__["tv_sec"] = _Hamlib.hamlib_port_t_post_write_date_tv_sec_get if _newclass:tv_sec = _swig_property(_Hamlib.hamlib_port_t_post_write_date_tv_sec_get, _Hamlib.hamlib_port_t_post_write_date_tv_sec_set) __swig_setmethods__["tv_usec"] = _Hamlib.hamlib_port_t_post_write_date_tv_usec_set __swig_getmethods__["tv_usec"] = _Hamlib.hamlib_port_t_post_write_date_tv_usec_get if _newclass:tv_usec = _swig_property(_Hamlib.hamlib_port_t_post_write_date_tv_usec_get, _Hamlib.hamlib_port_t_post_write_date_tv_usec_set) def __init__(self): this = _Hamlib.new_hamlib_port_t_post_write_date() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_hamlib_port_t_post_write_date __del__ = lambda self : None; hamlib_port_t_post_write_date_swigregister = _Hamlib.hamlib_port_t_post_write_date_swigregister hamlib_port_t_post_write_date_swigregister(hamlib_port_t_post_write_date) class hamlib_port_t_type(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, hamlib_port_t_type, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, hamlib_port_t_type, name) __repr__ = _swig_repr __swig_setmethods__["rig"] = _Hamlib.hamlib_port_t_type_rig_set __swig_getmethods__["rig"] = _Hamlib.hamlib_port_t_type_rig_get if _newclass:rig = _swig_property(_Hamlib.hamlib_port_t_type_rig_get, _Hamlib.hamlib_port_t_type_rig_set) __swig_setmethods__["ptt"] = _Hamlib.hamlib_port_t_type_ptt_set __swig_getmethods__["ptt"] = _Hamlib.hamlib_port_t_type_ptt_get if _newclass:ptt = _swig_property(_Hamlib.hamlib_port_t_type_ptt_get, _Hamlib.hamlib_port_t_type_ptt_set) __swig_setmethods__["dcd"] = _Hamlib.hamlib_port_t_type_dcd_set __swig_getmethods__["dcd"] = _Hamlib.hamlib_port_t_type_dcd_get if _newclass:dcd = _swig_property(_Hamlib.hamlib_port_t_type_dcd_get, _Hamlib.hamlib_port_t_type_dcd_set) def __init__(self): this = _Hamlib.new_hamlib_port_t_type() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_hamlib_port_t_type __del__ = lambda self : None; hamlib_port_t_type_swigregister = _Hamlib.hamlib_port_t_type_swigregister hamlib_port_t_type_swigregister(hamlib_port_t_type) class rig_state(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, rig_state, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, rig_state, name) __repr__ = _swig_repr __swig_setmethods__["rigport"] = _Hamlib.rig_state_rigport_set __swig_getmethods__["rigport"] = _Hamlib.rig_state_rigport_get if _newclass:rigport = _swig_property(_Hamlib.rig_state_rigport_get, _Hamlib.rig_state_rigport_set) __swig_setmethods__["pttport"] = _Hamlib.rig_state_pttport_set __swig_getmethods__["pttport"] = _Hamlib.rig_state_pttport_get if _newclass:pttport = _swig_property(_Hamlib.rig_state_pttport_get, _Hamlib.rig_state_pttport_set) __swig_setmethods__["dcdport"] = _Hamlib.rig_state_dcdport_set __swig_getmethods__["dcdport"] = _Hamlib.rig_state_dcdport_get if _newclass:dcdport = _swig_property(_Hamlib.rig_state_dcdport_get, _Hamlib.rig_state_dcdport_set) __swig_setmethods__["vfo_comp"] = _Hamlib.rig_state_vfo_comp_set __swig_getmethods__["vfo_comp"] = _Hamlib.rig_state_vfo_comp_get if _newclass:vfo_comp = _swig_property(_Hamlib.rig_state_vfo_comp_get, _Hamlib.rig_state_vfo_comp_set) __swig_setmethods__["itu_region"] = _Hamlib.rig_state_itu_region_set __swig_getmethods__["itu_region"] = _Hamlib.rig_state_itu_region_get if _newclass:itu_region = _swig_property(_Hamlib.rig_state_itu_region_get, _Hamlib.rig_state_itu_region_set) __swig_setmethods__["rx_range_list"] = _Hamlib.rig_state_rx_range_list_set __swig_getmethods__["rx_range_list"] = _Hamlib.rig_state_rx_range_list_get if _newclass:rx_range_list = _swig_property(_Hamlib.rig_state_rx_range_list_get, _Hamlib.rig_state_rx_range_list_set) __swig_setmethods__["tx_range_list"] = _Hamlib.rig_state_tx_range_list_set __swig_getmethods__["tx_range_list"] = _Hamlib.rig_state_tx_range_list_get if _newclass:tx_range_list = _swig_property(_Hamlib.rig_state_tx_range_list_get, _Hamlib.rig_state_tx_range_list_set) __swig_setmethods__["tuning_steps"] = _Hamlib.rig_state_tuning_steps_set __swig_getmethods__["tuning_steps"] = _Hamlib.rig_state_tuning_steps_get if _newclass:tuning_steps = _swig_property(_Hamlib.rig_state_tuning_steps_get, _Hamlib.rig_state_tuning_steps_set) __swig_setmethods__["filters"] = _Hamlib.rig_state_filters_set __swig_getmethods__["filters"] = _Hamlib.rig_state_filters_get if _newclass:filters = _swig_property(_Hamlib.rig_state_filters_get, _Hamlib.rig_state_filters_set) __swig_setmethods__["str_cal"] = _Hamlib.rig_state_str_cal_set __swig_getmethods__["str_cal"] = _Hamlib.rig_state_str_cal_get if _newclass:str_cal = _swig_property(_Hamlib.rig_state_str_cal_get, _Hamlib.rig_state_str_cal_set) __swig_setmethods__["chan_list"] = _Hamlib.rig_state_chan_list_set __swig_getmethods__["chan_list"] = _Hamlib.rig_state_chan_list_get if _newclass:chan_list = _swig_property(_Hamlib.rig_state_chan_list_get, _Hamlib.rig_state_chan_list_set) __swig_setmethods__["max_rit"] = _Hamlib.rig_state_max_rit_set __swig_getmethods__["max_rit"] = _Hamlib.rig_state_max_rit_get if _newclass:max_rit = _swig_property(_Hamlib.rig_state_max_rit_get, _Hamlib.rig_state_max_rit_set) __swig_setmethods__["max_xit"] = _Hamlib.rig_state_max_xit_set __swig_getmethods__["max_xit"] = _Hamlib.rig_state_max_xit_get if _newclass:max_xit = _swig_property(_Hamlib.rig_state_max_xit_get, _Hamlib.rig_state_max_xit_set) __swig_setmethods__["max_ifshift"] = _Hamlib.rig_state_max_ifshift_set __swig_getmethods__["max_ifshift"] = _Hamlib.rig_state_max_ifshift_get if _newclass:max_ifshift = _swig_property(_Hamlib.rig_state_max_ifshift_get, _Hamlib.rig_state_max_ifshift_set) __swig_setmethods__["announces"] = _Hamlib.rig_state_announces_set __swig_getmethods__["announces"] = _Hamlib.rig_state_announces_get if _newclass:announces = _swig_property(_Hamlib.rig_state_announces_get, _Hamlib.rig_state_announces_set) __swig_setmethods__["preamp"] = _Hamlib.rig_state_preamp_set __swig_getmethods__["preamp"] = _Hamlib.rig_state_preamp_get if _newclass:preamp = _swig_property(_Hamlib.rig_state_preamp_get, _Hamlib.rig_state_preamp_set) __swig_setmethods__["attenuator"] = _Hamlib.rig_state_attenuator_set __swig_getmethods__["attenuator"] = _Hamlib.rig_state_attenuator_get if _newclass:attenuator = _swig_property(_Hamlib.rig_state_attenuator_get, _Hamlib.rig_state_attenuator_set) __swig_setmethods__["has_get_func"] = _Hamlib.rig_state_has_get_func_set __swig_getmethods__["has_get_func"] = _Hamlib.rig_state_has_get_func_get if _newclass:has_get_func = _swig_property(_Hamlib.rig_state_has_get_func_get, _Hamlib.rig_state_has_get_func_set) __swig_setmethods__["has_set_func"] = _Hamlib.rig_state_has_set_func_set __swig_getmethods__["has_set_func"] = _Hamlib.rig_state_has_set_func_get if _newclass:has_set_func = _swig_property(_Hamlib.rig_state_has_set_func_get, _Hamlib.rig_state_has_set_func_set) __swig_setmethods__["has_get_level"] = _Hamlib.rig_state_has_get_level_set __swig_getmethods__["has_get_level"] = _Hamlib.rig_state_has_get_level_get if _newclass:has_get_level = _swig_property(_Hamlib.rig_state_has_get_level_get, _Hamlib.rig_state_has_get_level_set) __swig_setmethods__["has_set_level"] = _Hamlib.rig_state_has_set_level_set __swig_getmethods__["has_set_level"] = _Hamlib.rig_state_has_set_level_get if _newclass:has_set_level = _swig_property(_Hamlib.rig_state_has_set_level_get, _Hamlib.rig_state_has_set_level_set) __swig_setmethods__["has_get_parm"] = _Hamlib.rig_state_has_get_parm_set __swig_getmethods__["has_get_parm"] = _Hamlib.rig_state_has_get_parm_get if _newclass:has_get_parm = _swig_property(_Hamlib.rig_state_has_get_parm_get, _Hamlib.rig_state_has_get_parm_set) __swig_setmethods__["has_set_parm"] = _Hamlib.rig_state_has_set_parm_set __swig_getmethods__["has_set_parm"] = _Hamlib.rig_state_has_set_parm_get if _newclass:has_set_parm = _swig_property(_Hamlib.rig_state_has_set_parm_get, _Hamlib.rig_state_has_set_parm_set) __swig_setmethods__["level_gran"] = _Hamlib.rig_state_level_gran_set __swig_getmethods__["level_gran"] = _Hamlib.rig_state_level_gran_get if _newclass:level_gran = _swig_property(_Hamlib.rig_state_level_gran_get, _Hamlib.rig_state_level_gran_set) __swig_setmethods__["parm_gran"] = _Hamlib.rig_state_parm_gran_set __swig_getmethods__["parm_gran"] = _Hamlib.rig_state_parm_gran_get if _newclass:parm_gran = _swig_property(_Hamlib.rig_state_parm_gran_get, _Hamlib.rig_state_parm_gran_set) __swig_setmethods__["hold_decode"] = _Hamlib.rig_state_hold_decode_set __swig_getmethods__["hold_decode"] = _Hamlib.rig_state_hold_decode_get if _newclass:hold_decode = _swig_property(_Hamlib.rig_state_hold_decode_get, _Hamlib.rig_state_hold_decode_set) __swig_setmethods__["current_vfo"] = _Hamlib.rig_state_current_vfo_set __swig_getmethods__["current_vfo"] = _Hamlib.rig_state_current_vfo_get if _newclass:current_vfo = _swig_property(_Hamlib.rig_state_current_vfo_get, _Hamlib.rig_state_current_vfo_set) __swig_setmethods__["vfo_list"] = _Hamlib.rig_state_vfo_list_set __swig_getmethods__["vfo_list"] = _Hamlib.rig_state_vfo_list_get if _newclass:vfo_list = _swig_property(_Hamlib.rig_state_vfo_list_get, _Hamlib.rig_state_vfo_list_set) __swig_setmethods__["comm_state"] = _Hamlib.rig_state_comm_state_set __swig_getmethods__["comm_state"] = _Hamlib.rig_state_comm_state_get if _newclass:comm_state = _swig_property(_Hamlib.rig_state_comm_state_get, _Hamlib.rig_state_comm_state_set) __swig_setmethods__["priv"] = _Hamlib.rig_state_priv_set __swig_getmethods__["priv"] = _Hamlib.rig_state_priv_get if _newclass:priv = _swig_property(_Hamlib.rig_state_priv_get, _Hamlib.rig_state_priv_set) __swig_setmethods__["obj"] = _Hamlib.rig_state_obj_set __swig_getmethods__["obj"] = _Hamlib.rig_state_obj_get if _newclass:obj = _swig_property(_Hamlib.rig_state_obj_get, _Hamlib.rig_state_obj_set) __swig_setmethods__["transceive"] = _Hamlib.rig_state_transceive_set __swig_getmethods__["transceive"] = _Hamlib.rig_state_transceive_get if _newclass:transceive = _swig_property(_Hamlib.rig_state_transceive_get, _Hamlib.rig_state_transceive_set) __swig_setmethods__["poll_interval"] = _Hamlib.rig_state_poll_interval_set __swig_getmethods__["poll_interval"] = _Hamlib.rig_state_poll_interval_get if _newclass:poll_interval = _swig_property(_Hamlib.rig_state_poll_interval_get, _Hamlib.rig_state_poll_interval_set) __swig_setmethods__["current_freq"] = _Hamlib.rig_state_current_freq_set __swig_getmethods__["current_freq"] = _Hamlib.rig_state_current_freq_get if _newclass:current_freq = _swig_property(_Hamlib.rig_state_current_freq_get, _Hamlib.rig_state_current_freq_set) __swig_setmethods__["current_mode"] = _Hamlib.rig_state_current_mode_set __swig_getmethods__["current_mode"] = _Hamlib.rig_state_current_mode_get if _newclass:current_mode = _swig_property(_Hamlib.rig_state_current_mode_get, _Hamlib.rig_state_current_mode_set) __swig_setmethods__["current_width"] = _Hamlib.rig_state_current_width_set __swig_getmethods__["current_width"] = _Hamlib.rig_state_current_width_get if _newclass:current_width = _swig_property(_Hamlib.rig_state_current_width_get, _Hamlib.rig_state_current_width_set) __swig_setmethods__["tx_vfo"] = _Hamlib.rig_state_tx_vfo_set __swig_getmethods__["tx_vfo"] = _Hamlib.rig_state_tx_vfo_get if _newclass:tx_vfo = _swig_property(_Hamlib.rig_state_tx_vfo_get, _Hamlib.rig_state_tx_vfo_set) __swig_setmethods__["mode_list"] = _Hamlib.rig_state_mode_list_set __swig_getmethods__["mode_list"] = _Hamlib.rig_state_mode_list_get if _newclass:mode_list = _swig_property(_Hamlib.rig_state_mode_list_get, _Hamlib.rig_state_mode_list_set) def __init__(self): this = _Hamlib.new_rig_state() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_rig_state __del__ = lambda self : None; rig_state_swigregister = _Hamlib.rig_state_swigregister rig_state_swigregister(rig_state) class rig_callbacks(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, rig_callbacks, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, rig_callbacks, name) __repr__ = _swig_repr __swig_setmethods__["freq_event"] = _Hamlib.rig_callbacks_freq_event_set __swig_getmethods__["freq_event"] = _Hamlib.rig_callbacks_freq_event_get if _newclass:freq_event = _swig_property(_Hamlib.rig_callbacks_freq_event_get, _Hamlib.rig_callbacks_freq_event_set) __swig_setmethods__["freq_arg"] = _Hamlib.rig_callbacks_freq_arg_set __swig_getmethods__["freq_arg"] = _Hamlib.rig_callbacks_freq_arg_get if _newclass:freq_arg = _swig_property(_Hamlib.rig_callbacks_freq_arg_get, _Hamlib.rig_callbacks_freq_arg_set) __swig_setmethods__["mode_event"] = _Hamlib.rig_callbacks_mode_event_set __swig_getmethods__["mode_event"] = _Hamlib.rig_callbacks_mode_event_get if _newclass:mode_event = _swig_property(_Hamlib.rig_callbacks_mode_event_get, _Hamlib.rig_callbacks_mode_event_set) __swig_setmethods__["mode_arg"] = _Hamlib.rig_callbacks_mode_arg_set __swig_getmethods__["mode_arg"] = _Hamlib.rig_callbacks_mode_arg_get if _newclass:mode_arg = _swig_property(_Hamlib.rig_callbacks_mode_arg_get, _Hamlib.rig_callbacks_mode_arg_set) __swig_setmethods__["vfo_event"] = _Hamlib.rig_callbacks_vfo_event_set __swig_getmethods__["vfo_event"] = _Hamlib.rig_callbacks_vfo_event_get if _newclass:vfo_event = _swig_property(_Hamlib.rig_callbacks_vfo_event_get, _Hamlib.rig_callbacks_vfo_event_set) __swig_setmethods__["vfo_arg"] = _Hamlib.rig_callbacks_vfo_arg_set __swig_getmethods__["vfo_arg"] = _Hamlib.rig_callbacks_vfo_arg_get if _newclass:vfo_arg = _swig_property(_Hamlib.rig_callbacks_vfo_arg_get, _Hamlib.rig_callbacks_vfo_arg_set) __swig_setmethods__["ptt_event"] = _Hamlib.rig_callbacks_ptt_event_set __swig_getmethods__["ptt_event"] = _Hamlib.rig_callbacks_ptt_event_get if _newclass:ptt_event = _swig_property(_Hamlib.rig_callbacks_ptt_event_get, _Hamlib.rig_callbacks_ptt_event_set) __swig_setmethods__["ptt_arg"] = _Hamlib.rig_callbacks_ptt_arg_set __swig_getmethods__["ptt_arg"] = _Hamlib.rig_callbacks_ptt_arg_get if _newclass:ptt_arg = _swig_property(_Hamlib.rig_callbacks_ptt_arg_get, _Hamlib.rig_callbacks_ptt_arg_set) __swig_setmethods__["dcd_event"] = _Hamlib.rig_callbacks_dcd_event_set __swig_getmethods__["dcd_event"] = _Hamlib.rig_callbacks_dcd_event_get if _newclass:dcd_event = _swig_property(_Hamlib.rig_callbacks_dcd_event_get, _Hamlib.rig_callbacks_dcd_event_set) __swig_setmethods__["dcd_arg"] = _Hamlib.rig_callbacks_dcd_arg_set __swig_getmethods__["dcd_arg"] = _Hamlib.rig_callbacks_dcd_arg_get if _newclass:dcd_arg = _swig_property(_Hamlib.rig_callbacks_dcd_arg_get, _Hamlib.rig_callbacks_dcd_arg_set) __swig_setmethods__["pltune"] = _Hamlib.rig_callbacks_pltune_set __swig_getmethods__["pltune"] = _Hamlib.rig_callbacks_pltune_get if _newclass:pltune = _swig_property(_Hamlib.rig_callbacks_pltune_get, _Hamlib.rig_callbacks_pltune_set) __swig_setmethods__["pltune_arg"] = _Hamlib.rig_callbacks_pltune_arg_set __swig_getmethods__["pltune_arg"] = _Hamlib.rig_callbacks_pltune_arg_get if _newclass:pltune_arg = _swig_property(_Hamlib.rig_callbacks_pltune_arg_get, _Hamlib.rig_callbacks_pltune_arg_set) def __init__(self): this = _Hamlib.new_rig_callbacks() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_rig_callbacks __del__ = lambda self : None; rig_callbacks_swigregister = _Hamlib.rig_callbacks_swigregister rig_callbacks_swigregister(rig_callbacks) class rig(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, rig, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, rig, name) __repr__ = _swig_repr __swig_setmethods__["caps"] = _Hamlib.rig_caps_set __swig_getmethods__["caps"] = _Hamlib.rig_caps_get if _newclass:caps = _swig_property(_Hamlib.rig_caps_get, _Hamlib.rig_caps_set) __swig_setmethods__["state"] = _Hamlib.rig_state_set __swig_getmethods__["state"] = _Hamlib.rig_state_get if _newclass:state = _swig_property(_Hamlib.rig_state_get, _Hamlib.rig_state_set) __swig_setmethods__["callbacks"] = _Hamlib.rig_callbacks_set __swig_getmethods__["callbacks"] = _Hamlib.rig_callbacks_get if _newclass:callbacks = _swig_property(_Hamlib.rig_callbacks_get, _Hamlib.rig_callbacks_set) def __init__(self): this = _Hamlib.new_rig() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_rig __del__ = lambda self : None; rig_swigregister = _Hamlib.rig_swigregister rig_swigregister(rig) def rig_init(*args): return _Hamlib.rig_init(*args) rig_init = _Hamlib.rig_init def rig_set_split_vfo(*args): return _Hamlib.rig_set_split_vfo(*args) rig_set_split_vfo = _Hamlib.rig_set_split_vfo def rig_get_split_vfo(*args): return _Hamlib.rig_get_split_vfo(*args) rig_get_split_vfo = _Hamlib.rig_get_split_vfo def rig_ext_lookup(*args): return _Hamlib.rig_ext_lookup(*args) rig_ext_lookup = _Hamlib.rig_ext_lookup def rig_ext_lookup_tok(*args): return _Hamlib.rig_ext_lookup_tok(*args) rig_ext_lookup_tok = _Hamlib.rig_ext_lookup_tok def rig_ext_token_lookup(*args): return _Hamlib.rig_ext_token_lookup(*args) rig_ext_token_lookup = _Hamlib.rig_ext_token_lookup def rig_token_foreach(*args): return _Hamlib.rig_token_foreach(*args) rig_token_foreach = _Hamlib.rig_token_foreach def rig_confparam_lookup(*args): return _Hamlib.rig_confparam_lookup(*args) rig_confparam_lookup = _Hamlib.rig_confparam_lookup def rig_set_chan_all(*args): return _Hamlib.rig_set_chan_all(*args) rig_set_chan_all = _Hamlib.rig_set_chan_all def rig_get_chan_all(*args): return _Hamlib.rig_get_chan_all(*args) rig_get_chan_all = _Hamlib.rig_get_chan_all def rig_set_chan_all_cb(*args): return _Hamlib.rig_set_chan_all_cb(*args) rig_set_chan_all_cb = _Hamlib.rig_set_chan_all_cb def rig_get_chan_all_cb(*args): return _Hamlib.rig_get_chan_all_cb(*args) rig_get_chan_all_cb = _Hamlib.rig_get_chan_all_cb def rig_set_mem_all_cb(*args): return _Hamlib.rig_set_mem_all_cb(*args) rig_set_mem_all_cb = _Hamlib.rig_set_mem_all_cb def rig_get_mem_all_cb(*args): return _Hamlib.rig_get_mem_all_cb(*args) rig_get_mem_all_cb = _Hamlib.rig_get_mem_all_cb def rig_set_mem_all(*args): return _Hamlib.rig_set_mem_all(*args) rig_set_mem_all = _Hamlib.rig_set_mem_all def rig_get_mem_all(*args): return _Hamlib.rig_get_mem_all(*args) rig_get_mem_all = _Hamlib.rig_get_mem_all def rig_lookup_mem_caps(*args): return _Hamlib.rig_lookup_mem_caps(*args) rig_lookup_mem_caps = _Hamlib.rig_lookup_mem_caps def rig_mem_count(*args): return _Hamlib.rig_mem_count(*args) rig_mem_count = _Hamlib.rig_mem_count def rig_get_caps(*args): return _Hamlib.rig_get_caps(*args) rig_get_caps = _Hamlib.rig_get_caps def rig_get_range(*args): return _Hamlib.rig_get_range(*args) rig_get_range = _Hamlib.rig_get_range def rigerror(*args): return _Hamlib.rigerror(*args) rigerror = _Hamlib.rigerror def rig_setting2idx(*args): return _Hamlib.rig_setting2idx(*args) rig_setting2idx = _Hamlib.rig_setting2idx def rig_set_debug(*args): return _Hamlib.rig_set_debug(*args) rig_set_debug = _Hamlib.rig_set_debug def rig_need_debug(*args): return _Hamlib.rig_need_debug(*args) rig_need_debug = _Hamlib.rig_need_debug def rig_debug(*args): return _Hamlib.rig_debug(*args) rig_debug = _Hamlib.rig_debug def rig_set_debug_callback(*args): return _Hamlib.rig_set_debug_callback(*args) rig_set_debug_callback = _Hamlib.rig_set_debug_callback def rig_set_debug_file(*args): return _Hamlib.rig_set_debug_file(*args) rig_set_debug_file = _Hamlib.rig_set_debug_file def rig_register(*args): return _Hamlib.rig_register(*args) rig_register = _Hamlib.rig_register def rig_unregister(*args): return _Hamlib.rig_unregister(*args) rig_unregister = _Hamlib.rig_unregister def rig_list_foreach(*args): return _Hamlib.rig_list_foreach(*args) rig_list_foreach = _Hamlib.rig_list_foreach def rig_load_backend(*args): return _Hamlib.rig_load_backend(*args) rig_load_backend = _Hamlib.rig_load_backend def rig_check_backend(*args): return _Hamlib.rig_check_backend(*args) rig_check_backend = _Hamlib.rig_check_backend def rig_load_all_backends(): return _Hamlib.rig_load_all_backends() rig_load_all_backends = _Hamlib.rig_load_all_backends def rig_probe_all(*args): return _Hamlib.rig_probe_all(*args) rig_probe_all = _Hamlib.rig_probe_all def rig_strrmode(*args): return _Hamlib.rig_strrmode(*args) rig_strrmode = _Hamlib.rig_strrmode def rig_strvfo(*args): return _Hamlib.rig_strvfo(*args) rig_strvfo = _Hamlib.rig_strvfo def rig_strfunc(*args): return _Hamlib.rig_strfunc(*args) rig_strfunc = _Hamlib.rig_strfunc def rig_strlevel(*args): return _Hamlib.rig_strlevel(*args) rig_strlevel = _Hamlib.rig_strlevel def rig_strparm(*args): return _Hamlib.rig_strparm(*args) rig_strparm = _Hamlib.rig_strparm def rig_strptrshift(*args): return _Hamlib.rig_strptrshift(*args) rig_strptrshift = _Hamlib.rig_strptrshift def rig_strvfop(*args): return _Hamlib.rig_strvfop(*args) rig_strvfop = _Hamlib.rig_strvfop def rig_strscan(*args): return _Hamlib.rig_strscan(*args) rig_strscan = _Hamlib.rig_strscan def rig_strstatus(*args): return _Hamlib.rig_strstatus(*args) rig_strstatus = _Hamlib.rig_strstatus def rig_strmtype(*args): return _Hamlib.rig_strmtype(*args) rig_strmtype = _Hamlib.rig_strmtype def rig_parse_mode(*args): return _Hamlib.rig_parse_mode(*args) rig_parse_mode = _Hamlib.rig_parse_mode def rig_parse_vfo(*args): return _Hamlib.rig_parse_vfo(*args) rig_parse_vfo = _Hamlib.rig_parse_vfo def rig_parse_func(*args): return _Hamlib.rig_parse_func(*args) rig_parse_func = _Hamlib.rig_parse_func def rig_parse_level(*args): return _Hamlib.rig_parse_level(*args) rig_parse_level = _Hamlib.rig_parse_level def rig_parse_parm(*args): return _Hamlib.rig_parse_parm(*args) rig_parse_parm = _Hamlib.rig_parse_parm def rig_parse_vfo_op(*args): return _Hamlib.rig_parse_vfo_op(*args) rig_parse_vfo_op = _Hamlib.rig_parse_vfo_op def rig_parse_scan(*args): return _Hamlib.rig_parse_scan(*args) rig_parse_scan = _Hamlib.rig_parse_scan def rig_parse_rptr_shift(*args): return _Hamlib.rig_parse_rptr_shift(*args) rig_parse_rptr_shift = _Hamlib.rig_parse_rptr_shift def rig_parse_mtype(*args): return _Hamlib.rig_parse_mtype(*args) rig_parse_mtype = _Hamlib.rig_parse_mtype ROT_MODEL_NONE = _Hamlib.ROT_MODEL_NONE ROT_MODEL_DUMMY = _Hamlib.ROT_MODEL_DUMMY ROT_MODEL_NETROTCTL = _Hamlib.ROT_MODEL_NETROTCTL ROT_MODEL_RPC = _Hamlib.ROT_MODEL_RPC ROT_MODEL_EASYCOMM1 = _Hamlib.ROT_MODEL_EASYCOMM1 ROT_MODEL_EASYCOMM2 = _Hamlib.ROT_MODEL_EASYCOMM2 ROT_MODEL_TRAKBOX = _Hamlib.ROT_MODEL_TRAKBOX ROT_MODEL_FODTRACK = _Hamlib.ROT_MODEL_FODTRACK ROT_MODEL_ROTOREZ = _Hamlib.ROT_MODEL_ROTOREZ ROT_MODEL_ROTORCARD = _Hamlib.ROT_MODEL_ROTORCARD ROT_MODEL_DCU = _Hamlib.ROT_MODEL_DCU ROT_MODEL_ERC = _Hamlib.ROT_MODEL_ERC ROT_MODEL_SARTEK1 = _Hamlib.ROT_MODEL_SARTEK1 ROT_MODEL_GS232A = _Hamlib.ROT_MODEL_GS232A ROT_MODEL_GS232 = _Hamlib.ROT_MODEL_GS232 ROT_MODEL_GS232B = _Hamlib.ROT_MODEL_GS232B ROT_MODEL_F1TETRACKER = _Hamlib.ROT_MODEL_F1TETRACKER ROT_MODEL_PCROTOR = _Hamlib.ROT_MODEL_PCROTOR ROT_MODEL_HD1780 = _Hamlib.ROT_MODEL_HD1780 ROT_MODEL_SPID_ROT2PROG = _Hamlib.ROT_MODEL_SPID_ROT2PROG ROT_MODEL_SPID_ROT1PROG = _Hamlib.ROT_MODEL_SPID_ROT1PROG ROT_MODEL_RC2800 = _Hamlib.ROT_MODEL_RC2800 ROT_MODEL_RCI_AZEL = _Hamlib.ROT_MODEL_RCI_AZEL ROT_MODEL_RCI_AZ = _Hamlib.ROT_MODEL_RCI_AZ ROT_MODEL_IF100 = _Hamlib.ROT_MODEL_IF100 ROT_MODEL_TS7400 = _Hamlib.ROT_MODEL_TS7400 ROT_MODEL_NEXSTAR = _Hamlib.ROT_MODEL_NEXSTAR NETROTCTL_RET = _Hamlib.NETROTCTL_RET ROT_RESET_ALL = _Hamlib.ROT_RESET_ALL ROT_FLAG_AZIMUTH = _Hamlib.ROT_FLAG_AZIMUTH ROT_FLAG_ELEVATION = _Hamlib.ROT_FLAG_ELEVATION ROT_TYPE_OTHER = _Hamlib.ROT_TYPE_OTHER ROT_MOVE_UP = _Hamlib.ROT_MOVE_UP ROT_MOVE_DOWN = _Hamlib.ROT_MOVE_DOWN ROT_MOVE_LEFT = _Hamlib.ROT_MOVE_LEFT ROT_MOVE_CCW = _Hamlib.ROT_MOVE_CCW ROT_MOVE_RIGHT = _Hamlib.ROT_MOVE_RIGHT ROT_MOVE_CW = _Hamlib.ROT_MOVE_CW class rot_caps(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, rot_caps, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, rot_caps, name) __repr__ = _swig_repr __swig_setmethods__["rot_model"] = _Hamlib.rot_caps_rot_model_set __swig_getmethods__["rot_model"] = _Hamlib.rot_caps_rot_model_get if _newclass:rot_model = _swig_property(_Hamlib.rot_caps_rot_model_get, _Hamlib.rot_caps_rot_model_set) __swig_setmethods__["model_name"] = _Hamlib.rot_caps_model_name_set __swig_getmethods__["model_name"] = _Hamlib.rot_caps_model_name_get if _newclass:model_name = _swig_property(_Hamlib.rot_caps_model_name_get, _Hamlib.rot_caps_model_name_set) __swig_setmethods__["mfg_name"] = _Hamlib.rot_caps_mfg_name_set __swig_getmethods__["mfg_name"] = _Hamlib.rot_caps_mfg_name_get if _newclass:mfg_name = _swig_property(_Hamlib.rot_caps_mfg_name_get, _Hamlib.rot_caps_mfg_name_set) __swig_setmethods__["version"] = _Hamlib.rot_caps_version_set __swig_getmethods__["version"] = _Hamlib.rot_caps_version_get if _newclass:version = _swig_property(_Hamlib.rot_caps_version_get, _Hamlib.rot_caps_version_set) __swig_setmethods__["copyright"] = _Hamlib.rot_caps_copyright_set __swig_getmethods__["copyright"] = _Hamlib.rot_caps_copyright_get if _newclass:copyright = _swig_property(_Hamlib.rot_caps_copyright_get, _Hamlib.rot_caps_copyright_set) __swig_setmethods__["status"] = _Hamlib.rot_caps_status_set __swig_getmethods__["status"] = _Hamlib.rot_caps_status_get if _newclass:status = _swig_property(_Hamlib.rot_caps_status_get, _Hamlib.rot_caps_status_set) __swig_setmethods__["rot_type"] = _Hamlib.rot_caps_rot_type_set __swig_getmethods__["rot_type"] = _Hamlib.rot_caps_rot_type_get if _newclass:rot_type = _swig_property(_Hamlib.rot_caps_rot_type_get, _Hamlib.rot_caps_rot_type_set) __swig_setmethods__["port_type"] = _Hamlib.rot_caps_port_type_set __swig_getmethods__["port_type"] = _Hamlib.rot_caps_port_type_get if _newclass:port_type = _swig_property(_Hamlib.rot_caps_port_type_get, _Hamlib.rot_caps_port_type_set) __swig_setmethods__["serial_rate_min"] = _Hamlib.rot_caps_serial_rate_min_set __swig_getmethods__["serial_rate_min"] = _Hamlib.rot_caps_serial_rate_min_get if _newclass:serial_rate_min = _swig_property(_Hamlib.rot_caps_serial_rate_min_get, _Hamlib.rot_caps_serial_rate_min_set) __swig_setmethods__["serial_rate_max"] = _Hamlib.rot_caps_serial_rate_max_set __swig_getmethods__["serial_rate_max"] = _Hamlib.rot_caps_serial_rate_max_get if _newclass:serial_rate_max = _swig_property(_Hamlib.rot_caps_serial_rate_max_get, _Hamlib.rot_caps_serial_rate_max_set) __swig_setmethods__["serial_data_bits"] = _Hamlib.rot_caps_serial_data_bits_set __swig_getmethods__["serial_data_bits"] = _Hamlib.rot_caps_serial_data_bits_get if _newclass:serial_data_bits = _swig_property(_Hamlib.rot_caps_serial_data_bits_get, _Hamlib.rot_caps_serial_data_bits_set) __swig_setmethods__["serial_stop_bits"] = _Hamlib.rot_caps_serial_stop_bits_set __swig_getmethods__["serial_stop_bits"] = _Hamlib.rot_caps_serial_stop_bits_get if _newclass:serial_stop_bits = _swig_property(_Hamlib.rot_caps_serial_stop_bits_get, _Hamlib.rot_caps_serial_stop_bits_set) __swig_setmethods__["serial_parity"] = _Hamlib.rot_caps_serial_parity_set __swig_getmethods__["serial_parity"] = _Hamlib.rot_caps_serial_parity_get if _newclass:serial_parity = _swig_property(_Hamlib.rot_caps_serial_parity_get, _Hamlib.rot_caps_serial_parity_set) __swig_setmethods__["serial_handshake"] = _Hamlib.rot_caps_serial_handshake_set __swig_getmethods__["serial_handshake"] = _Hamlib.rot_caps_serial_handshake_get if _newclass:serial_handshake = _swig_property(_Hamlib.rot_caps_serial_handshake_get, _Hamlib.rot_caps_serial_handshake_set) __swig_setmethods__["write_delay"] = _Hamlib.rot_caps_write_delay_set __swig_getmethods__["write_delay"] = _Hamlib.rot_caps_write_delay_get if _newclass:write_delay = _swig_property(_Hamlib.rot_caps_write_delay_get, _Hamlib.rot_caps_write_delay_set) __swig_setmethods__["post_write_delay"] = _Hamlib.rot_caps_post_write_delay_set __swig_getmethods__["post_write_delay"] = _Hamlib.rot_caps_post_write_delay_get if _newclass:post_write_delay = _swig_property(_Hamlib.rot_caps_post_write_delay_get, _Hamlib.rot_caps_post_write_delay_set) __swig_setmethods__["timeout"] = _Hamlib.rot_caps_timeout_set __swig_getmethods__["timeout"] = _Hamlib.rot_caps_timeout_get if _newclass:timeout = _swig_property(_Hamlib.rot_caps_timeout_get, _Hamlib.rot_caps_timeout_set) __swig_setmethods__["retry"] = _Hamlib.rot_caps_retry_set __swig_getmethods__["retry"] = _Hamlib.rot_caps_retry_get if _newclass:retry = _swig_property(_Hamlib.rot_caps_retry_get, _Hamlib.rot_caps_retry_set) __swig_setmethods__["min_az"] = _Hamlib.rot_caps_min_az_set __swig_getmethods__["min_az"] = _Hamlib.rot_caps_min_az_get if _newclass:min_az = _swig_property(_Hamlib.rot_caps_min_az_get, _Hamlib.rot_caps_min_az_set) __swig_setmethods__["max_az"] = _Hamlib.rot_caps_max_az_set __swig_getmethods__["max_az"] = _Hamlib.rot_caps_max_az_get if _newclass:max_az = _swig_property(_Hamlib.rot_caps_max_az_get, _Hamlib.rot_caps_max_az_set) __swig_setmethods__["min_el"] = _Hamlib.rot_caps_min_el_set __swig_getmethods__["min_el"] = _Hamlib.rot_caps_min_el_get if _newclass:min_el = _swig_property(_Hamlib.rot_caps_min_el_get, _Hamlib.rot_caps_min_el_set) __swig_setmethods__["max_el"] = _Hamlib.rot_caps_max_el_set __swig_getmethods__["max_el"] = _Hamlib.rot_caps_max_el_get if _newclass:max_el = _swig_property(_Hamlib.rot_caps_max_el_get, _Hamlib.rot_caps_max_el_set) __swig_setmethods__["cfgparams"] = _Hamlib.rot_caps_cfgparams_set __swig_getmethods__["cfgparams"] = _Hamlib.rot_caps_cfgparams_get if _newclass:cfgparams = _swig_property(_Hamlib.rot_caps_cfgparams_get, _Hamlib.rot_caps_cfgparams_set) __swig_setmethods__["priv"] = _Hamlib.rot_caps_priv_set __swig_getmethods__["priv"] = _Hamlib.rot_caps_priv_get if _newclass:priv = _swig_property(_Hamlib.rot_caps_priv_get, _Hamlib.rot_caps_priv_set) __swig_setmethods__["rot_init"] = _Hamlib.rot_caps_rot_init_set __swig_getmethods__["rot_init"] = _Hamlib.rot_caps_rot_init_get if _newclass:rot_init = _swig_property(_Hamlib.rot_caps_rot_init_get, _Hamlib.rot_caps_rot_init_set) __swig_setmethods__["set_conf"] = _Hamlib.rot_caps_set_conf_set __swig_getmethods__["set_conf"] = _Hamlib.rot_caps_set_conf_get if _newclass:set_conf = _swig_property(_Hamlib.rot_caps_set_conf_get, _Hamlib.rot_caps_set_conf_set) __swig_setmethods__["get_conf"] = _Hamlib.rot_caps_get_conf_set __swig_getmethods__["get_conf"] = _Hamlib.rot_caps_get_conf_get if _newclass:get_conf = _swig_property(_Hamlib.rot_caps_get_conf_get, _Hamlib.rot_caps_get_conf_set) __swig_setmethods__["set_position"] = _Hamlib.rot_caps_set_position_set __swig_getmethods__["set_position"] = _Hamlib.rot_caps_set_position_get if _newclass:set_position = _swig_property(_Hamlib.rot_caps_set_position_get, _Hamlib.rot_caps_set_position_set) __swig_setmethods__["get_position"] = _Hamlib.rot_caps_get_position_set __swig_getmethods__["get_position"] = _Hamlib.rot_caps_get_position_get if _newclass:get_position = _swig_property(_Hamlib.rot_caps_get_position_get, _Hamlib.rot_caps_get_position_set) __swig_setmethods__["stop"] = _Hamlib.rot_caps_stop_set __swig_getmethods__["stop"] = _Hamlib.rot_caps_stop_get if _newclass:stop = _swig_property(_Hamlib.rot_caps_stop_get, _Hamlib.rot_caps_stop_set) __swig_setmethods__["park"] = _Hamlib.rot_caps_park_set __swig_getmethods__["park"] = _Hamlib.rot_caps_park_get if _newclass:park = _swig_property(_Hamlib.rot_caps_park_get, _Hamlib.rot_caps_park_set) __swig_setmethods__["reset"] = _Hamlib.rot_caps_reset_set __swig_getmethods__["reset"] = _Hamlib.rot_caps_reset_get if _newclass:reset = _swig_property(_Hamlib.rot_caps_reset_get, _Hamlib.rot_caps_reset_set) __swig_setmethods__["move"] = _Hamlib.rot_caps_move_set __swig_getmethods__["move"] = _Hamlib.rot_caps_move_get if _newclass:move = _swig_property(_Hamlib.rot_caps_move_get, _Hamlib.rot_caps_move_set) __swig_setmethods__["get_info"] = _Hamlib.rot_caps_get_info_set __swig_getmethods__["get_info"] = _Hamlib.rot_caps_get_info_get if _newclass:get_info = _swig_property(_Hamlib.rot_caps_get_info_get, _Hamlib.rot_caps_get_info_set) def __init__(self): this = _Hamlib.new_rot_caps() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_rot_caps __del__ = lambda self : None; rot_caps_swigregister = _Hamlib.rot_caps_swigregister rot_caps_swigregister(rot_caps) class rot_state(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, rot_state, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, rot_state, name) __repr__ = _swig_repr __swig_setmethods__["min_az"] = _Hamlib.rot_state_min_az_set __swig_getmethods__["min_az"] = _Hamlib.rot_state_min_az_get if _newclass:min_az = _swig_property(_Hamlib.rot_state_min_az_get, _Hamlib.rot_state_min_az_set) __swig_setmethods__["max_az"] = _Hamlib.rot_state_max_az_set __swig_getmethods__["max_az"] = _Hamlib.rot_state_max_az_get if _newclass:max_az = _swig_property(_Hamlib.rot_state_max_az_get, _Hamlib.rot_state_max_az_set) __swig_setmethods__["min_el"] = _Hamlib.rot_state_min_el_set __swig_getmethods__["min_el"] = _Hamlib.rot_state_min_el_get if _newclass:min_el = _swig_property(_Hamlib.rot_state_min_el_get, _Hamlib.rot_state_min_el_set) __swig_setmethods__["max_el"] = _Hamlib.rot_state_max_el_set __swig_getmethods__["max_el"] = _Hamlib.rot_state_max_el_get if _newclass:max_el = _swig_property(_Hamlib.rot_state_max_el_get, _Hamlib.rot_state_max_el_set) __swig_setmethods__["rotport"] = _Hamlib.rot_state_rotport_set __swig_getmethods__["rotport"] = _Hamlib.rot_state_rotport_get if _newclass:rotport = _swig_property(_Hamlib.rot_state_rotport_get, _Hamlib.rot_state_rotport_set) __swig_setmethods__["comm_state"] = _Hamlib.rot_state_comm_state_set __swig_getmethods__["comm_state"] = _Hamlib.rot_state_comm_state_get if _newclass:comm_state = _swig_property(_Hamlib.rot_state_comm_state_get, _Hamlib.rot_state_comm_state_set) __swig_setmethods__["priv"] = _Hamlib.rot_state_priv_set __swig_getmethods__["priv"] = _Hamlib.rot_state_priv_get if _newclass:priv = _swig_property(_Hamlib.rot_state_priv_get, _Hamlib.rot_state_priv_set) __swig_setmethods__["obj"] = _Hamlib.rot_state_obj_set __swig_getmethods__["obj"] = _Hamlib.rot_state_obj_get if _newclass:obj = _swig_property(_Hamlib.rot_state_obj_get, _Hamlib.rot_state_obj_set) def __init__(self): this = _Hamlib.new_rot_state() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_rot_state __del__ = lambda self : None; rot_state_swigregister = _Hamlib.rot_state_swigregister rot_state_swigregister(rot_state) class rot(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, rot, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, rot, name) __repr__ = _swig_repr __swig_setmethods__["caps"] = _Hamlib.rot_caps_set __swig_getmethods__["caps"] = _Hamlib.rot_caps_get if _newclass:caps = _swig_property(_Hamlib.rot_caps_get, _Hamlib.rot_caps_set) __swig_setmethods__["state"] = _Hamlib.rot_state_set __swig_getmethods__["state"] = _Hamlib.rot_state_get if _newclass:state = _swig_property(_Hamlib.rot_state_get, _Hamlib.rot_state_set) def __init__(self): this = _Hamlib.new_rot() try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_rot __del__ = lambda self : None; rot_swigregister = _Hamlib.rot_swigregister rot_swigregister(rot) def rot_init(*args): return _Hamlib.rot_init(*args) rot_init = _Hamlib.rot_init def rot_register(*args): return _Hamlib.rot_register(*args) rot_register = _Hamlib.rot_register def rot_unregister(*args): return _Hamlib.rot_unregister(*args) rot_unregister = _Hamlib.rot_unregister def rot_list_foreach(*args): return _Hamlib.rot_list_foreach(*args) rot_list_foreach = _Hamlib.rot_list_foreach def rot_load_backend(*args): return _Hamlib.rot_load_backend(*args) rot_load_backend = _Hamlib.rot_load_backend def rot_check_backend(*args): return _Hamlib.rot_check_backend(*args) rot_check_backend = _Hamlib.rot_check_backend def rot_load_all_backends(): return _Hamlib.rot_load_all_backends() rot_load_all_backends = _Hamlib.rot_load_all_backends def rot_probe_all(*args): return _Hamlib.rot_probe_all(*args) rot_probe_all = _Hamlib.rot_probe_all def rot_token_foreach(*args): return _Hamlib.rot_token_foreach(*args) rot_token_foreach = _Hamlib.rot_token_foreach def rot_confparam_lookup(*args): return _Hamlib.rot_confparam_lookup(*args) rot_confparam_lookup = _Hamlib.rot_confparam_lookup def rot_token_lookup(*args): return _Hamlib.rot_token_lookup(*args) rot_token_lookup = _Hamlib.rot_token_lookup def rot_get_caps(*args): return _Hamlib.rot_get_caps(*args) rot_get_caps = _Hamlib.rot_get_caps def qrb(*args): return _Hamlib.qrb(*args) qrb = _Hamlib.qrb def distance_long_path(*args): return _Hamlib.distance_long_path(*args) distance_long_path = _Hamlib.distance_long_path def azimuth_long_path(*args): return _Hamlib.azimuth_long_path(*args) azimuth_long_path = _Hamlib.azimuth_long_path def longlat2locator(*args): return _Hamlib.longlat2locator(*args) longlat2locator = _Hamlib.longlat2locator def locator2longlat(*args): return _Hamlib.locator2longlat(*args) locator2longlat = _Hamlib.locator2longlat def dms2dec(*args): return _Hamlib.dms2dec(*args) dms2dec = _Hamlib.dms2dec def dec2dms(*args): return _Hamlib.dec2dms(*args) dec2dms = _Hamlib.dec2dms def dec2dmmm(*args): return _Hamlib.dec2dmmm(*args) dec2dmmm = _Hamlib.dec2dmmm def dmmm2dec(*args): return _Hamlib.dmmm2dec(*args) dmmm2dec = _Hamlib.dmmm2dec class Rig(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, Rig, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, Rig, name) __repr__ = _swig_repr __swig_setmethods__["rig"] = _Hamlib.Rig_rig_set __swig_getmethods__["rig"] = _Hamlib.Rig_rig_get if _newclass:rig = _swig_property(_Hamlib.Rig_rig_get, _Hamlib.Rig_rig_set) __swig_setmethods__["caps"] = _Hamlib.Rig_caps_set __swig_getmethods__["caps"] = _Hamlib.Rig_caps_get if _newclass:caps = _swig_property(_Hamlib.Rig_caps_get, _Hamlib.Rig_caps_set) __swig_setmethods__["state"] = _Hamlib.Rig_state_set __swig_getmethods__["state"] = _Hamlib.Rig_state_get if _newclass:state = _swig_property(_Hamlib.Rig_state_get, _Hamlib.Rig_state_set) __swig_setmethods__["error_status"] = _Hamlib.Rig_error_status_set __swig_getmethods__["error_status"] = _Hamlib.Rig_error_status_get if _newclass:error_status = _swig_property(_Hamlib.Rig_error_status_get, _Hamlib.Rig_error_status_set) __swig_setmethods__["do_exception"] = _Hamlib.Rig_do_exception_set __swig_getmethods__["do_exception"] = _Hamlib.Rig_do_exception_get if _newclass:do_exception = _swig_property(_Hamlib.Rig_do_exception_get, _Hamlib.Rig_do_exception_set) def __init__(self, *args): this = _Hamlib.new_Rig(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_Rig __del__ = lambda self : None; def open(self): return _Hamlib.Rig_open(self) def close(self): return _Hamlib.Rig_close(self) def set_freq(self, *args): return _Hamlib.Rig_set_freq(self, *args) def set_mode(self, *args): return _Hamlib.Rig_set_mode(self, *args) def set_ptt(self, *args): return _Hamlib.Rig_set_ptt(self, *args) def set_rptr_shift(self, *args): return _Hamlib.Rig_set_rptr_shift(self, *args) def set_rptr_offs(self, *args): return _Hamlib.Rig_set_rptr_offs(self, *args) def set_ctcss_tone(self, *args): return _Hamlib.Rig_set_ctcss_tone(self, *args) def set_dcs_code(self, *args): return _Hamlib.Rig_set_dcs_code(self, *args) def set_ctcss_sql(self, *args): return _Hamlib.Rig_set_ctcss_sql(self, *args) def set_dcs_sql(self, *args): return _Hamlib.Rig_set_dcs_sql(self, *args) def set_split_freq(self, *args): return _Hamlib.Rig_set_split_freq(self, *args) def set_split_mode(self, *args): return _Hamlib.Rig_set_split_mode(self, *args) def set_split_vfo(self, *args): return _Hamlib.Rig_set_split_vfo(self, *args) def set_rit(self, *args): return _Hamlib.Rig_set_rit(self, *args) def set_xit(self, *args): return _Hamlib.Rig_set_xit(self, *args) def set_ts(self, *args): return _Hamlib.Rig_set_ts(self, *args) def set_ant(self, *args): return _Hamlib.Rig_set_ant(self, *args) def set_func(self, *args): return _Hamlib.Rig_set_func(self, *args) def set_bank(self, *args): return _Hamlib.Rig_set_bank(self, *args) def set_mem(self, *args): return _Hamlib.Rig_set_mem(self, *args) def send_dtmf(self, *args): return _Hamlib.Rig_send_dtmf(self, *args) def send_morse(self, *args): return _Hamlib.Rig_send_morse(self, *args) def vfo_op(self, *args): return _Hamlib.Rig_vfo_op(self, *args) def scan(self, *args): return _Hamlib.Rig_scan(self, *args) def set_level(self, *args): return _Hamlib.Rig_set_level(self, *args) def set_ext_level(self, *args): return _Hamlib.Rig_set_ext_level(self, *args) def get_level_i(self, *args): return _Hamlib.Rig_get_level_i(self, *args) def get_level_f(self, *args): return _Hamlib.Rig_get_level_f(self, *args) def set_vfo(self, *args): return _Hamlib.Rig_set_vfo(self, *args) def set_powerstat(self, *args): return _Hamlib.Rig_set_powerstat(self, *args) def set_trn(self, *args): return _Hamlib.Rig_set_trn(self, *args) def has_set_level(self, *args): return _Hamlib.Rig_has_set_level(self, *args) def has_set_parm(self, *args): return _Hamlib.Rig_has_set_parm(self, *args) def has_set_func(self, *args): return _Hamlib.Rig_has_set_func(self, *args) def reset(self, *args): return _Hamlib.Rig_reset(self, *args) def has_scan(self, *args): return _Hamlib.Rig_has_scan(self, *args) def has_vfo_op(self, *args): return _Hamlib.Rig_has_vfo_op(self, *args) def passband_normal(self, *args): return _Hamlib.Rig_passband_normal(self, *args) def passband_narrow(self, *args): return _Hamlib.Rig_passband_narrow(self, *args) def passband_wide(self, *args): return _Hamlib.Rig_passband_wide(self, *args) def ext_token_lookup(self, *args): return _Hamlib.Rig_ext_token_lookup(self, *args) def token_lookup(self, *args): return _Hamlib.Rig_token_lookup(self, *args) def set_ext_parm(self, *args): return _Hamlib.Rig_set_ext_parm(self, *args) def set_parm(self, *args): return _Hamlib.Rig_set_parm(self, *args) def get_parm_i(self, *args): return _Hamlib.Rig_get_parm_i(self, *args) def get_parm_f(self, *args): return _Hamlib.Rig_get_parm_f(self, *args) def get_parm(self, *args): return _Hamlib.Rig_get_parm(self, *args) def set_conf(self, *args): return _Hamlib.Rig_set_conf(self, *args) def get_freq(self, *args): return _Hamlib.Rig_get_freq(self, *args) def get_mode(self, *args): return _Hamlib.Rig_get_mode(self, *args) def get_split_mode(self, *args): return _Hamlib.Rig_get_split_mode(self, *args) def get_vfo(self, *args): return _Hamlib.Rig_get_vfo(self, *args) def get_ptt(self, *args): return _Hamlib.Rig_get_ptt(self, *args) def get_rptr_shift(self, *args): return _Hamlib.Rig_get_rptr_shift(self, *args) def get_rptr_offs(self, *args): return _Hamlib.Rig_get_rptr_offs(self, *args) def get_ctcss_tone(self, *args): return _Hamlib.Rig_get_ctcss_tone(self, *args) def get_dcs_code(self, *args): return _Hamlib.Rig_get_dcs_code(self, *args) def get_ctcss_sql(self, *args): return _Hamlib.Rig_get_ctcss_sql(self, *args) def get_dcs_sql(self, *args): return _Hamlib.Rig_get_dcs_sql(self, *args) def get_split_freq(self, *args): return _Hamlib.Rig_get_split_freq(self, *args) def get_split_vfo(self, *args): return _Hamlib.Rig_get_split_vfo(self, *args) def get_rit(self, *args): return _Hamlib.Rig_get_rit(self, *args) def get_xit(self, *args): return _Hamlib.Rig_get_xit(self, *args) def get_ts(self, *args): return _Hamlib.Rig_get_ts(self, *args) def get_ant(self, *args): return _Hamlib.Rig_get_ant(self, *args) def get_mem(self, *args): return _Hamlib.Rig_get_mem(self, *args) def get_powerstat(self, *args): return _Hamlib.Rig_get_powerstat(self, *args) def get_trn(self, *args): return _Hamlib.Rig_get_trn(self, *args) def mem_count(self, *args): return _Hamlib.Rig_mem_count(self, *args) def lookup_mem_caps(self, *args): return _Hamlib.Rig_lookup_mem_caps(self, *args) def set_channel(self, *args): return _Hamlib.Rig_set_channel(self, *args) def chan_clear(self, *args): return _Hamlib.Rig_chan_clear(self, *args) def get_chan_all(self, *args): return _Hamlib.Rig_get_chan_all(self, *args) def get_channel(self, *args): return _Hamlib.Rig_get_channel(self, *args) def get_conf(self, *args): return _Hamlib.Rig_get_conf(self, *args) def recv_dtmf(self, *args): return _Hamlib.Rig_recv_dtmf(self, *args) def get_info(self, *args): return _Hamlib.Rig_get_info(self, *args) def get_func(self, *args): return _Hamlib.Rig_get_func(self, *args) def get_level(self, *args): return _Hamlib.Rig_get_level(self, *args) Rig_swigregister = _Hamlib.Rig_swigregister Rig_swigregister(Rig) class channelArray(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, channelArray, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, channelArray, name) __repr__ = _swig_repr def __init__(self, *args): this = _Hamlib.new_channelArray(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_channelArray __del__ = lambda self : None; def __getitem__(self, *args): return _Hamlib.channelArray___getitem__(self, *args) def __setitem__(self, *args): return _Hamlib.channelArray___setitem__(self, *args) def cast(self): return _Hamlib.channelArray_cast(self) __swig_getmethods__["frompointer"] = lambda x: _Hamlib.channelArray_frompointer if _newclass:frompointer = staticmethod(_Hamlib.channelArray_frompointer) channelArray_swigregister = _Hamlib.channelArray_swigregister channelArray_swigregister(channelArray) def channelArray_frompointer(*args): return _Hamlib.channelArray_frompointer(*args) channelArray_frompointer = _Hamlib.channelArray_frompointer class toneArray(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, toneArray, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, toneArray, name) __repr__ = _swig_repr def __init__(self, *args): this = _Hamlib.new_toneArray(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_toneArray __del__ = lambda self : None; def __getitem__(self, *args): return _Hamlib.toneArray___getitem__(self, *args) def __setitem__(self, *args): return _Hamlib.toneArray___setitem__(self, *args) def cast(self): return _Hamlib.toneArray_cast(self) __swig_getmethods__["frompointer"] = lambda x: _Hamlib.toneArray_frompointer if _newclass:frompointer = staticmethod(_Hamlib.toneArray_frompointer) toneArray_swigregister = _Hamlib.toneArray_swigregister toneArray_swigregister(toneArray) def toneArray_frompointer(*args): return _Hamlib.toneArray_frompointer(*args) toneArray_frompointer = _Hamlib.toneArray_frompointer class Rot(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, Rot, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, Rot, name) __repr__ = _swig_repr __swig_setmethods__["rot"] = _Hamlib.Rot_rot_set __swig_getmethods__["rot"] = _Hamlib.Rot_rot_get if _newclass:rot = _swig_property(_Hamlib.Rot_rot_get, _Hamlib.Rot_rot_set) __swig_setmethods__["caps"] = _Hamlib.Rot_caps_set __swig_getmethods__["caps"] = _Hamlib.Rot_caps_get if _newclass:caps = _swig_property(_Hamlib.Rot_caps_get, _Hamlib.Rot_caps_set) __swig_setmethods__["state"] = _Hamlib.Rot_state_set __swig_getmethods__["state"] = _Hamlib.Rot_state_get if _newclass:state = _swig_property(_Hamlib.Rot_state_get, _Hamlib.Rot_state_set) __swig_setmethods__["error_status"] = _Hamlib.Rot_error_status_set __swig_getmethods__["error_status"] = _Hamlib.Rot_error_status_get if _newclass:error_status = _swig_property(_Hamlib.Rot_error_status_get, _Hamlib.Rot_error_status_set) __swig_setmethods__["do_exception"] = _Hamlib.Rot_do_exception_set __swig_getmethods__["do_exception"] = _Hamlib.Rot_do_exception_get if _newclass:do_exception = _swig_property(_Hamlib.Rot_do_exception_get, _Hamlib.Rot_do_exception_set) def __init__(self, *args): this = _Hamlib.new_Rot(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _Hamlib.delete_Rot __del__ = lambda self : None; def open(self): return _Hamlib.Rot_open(self) def close(self): return _Hamlib.Rot_close(self) def set_position(self, *args): return _Hamlib.Rot_set_position(self, *args) def get_position(self): return _Hamlib.Rot_get_position(self) def stop(self): return _Hamlib.Rot_stop(self) def park(self): return _Hamlib.Rot_park(self) def reset(self, *args): return _Hamlib.Rot_reset(self, *args) def move(self, *args): return _Hamlib.Rot_move(self, *args) def token_lookup(self, *args): return _Hamlib.Rot_token_lookup(self, *args) def set_conf(self, *args): return _Hamlib.Rot_set_conf(self, *args) def get_conf(self, *args): return _Hamlib.Rot_get_conf(self, *args) def get_info(self, *args): return _Hamlib.Rot_get_info(self, *args) Rot_swigregister = _Hamlib.Rot_swigregister Rot_swigregister(Rot) hamlib-1.2.15.3/bindings/Makefile.am0000644000175000017500000001067012044564477013770 00000000000000 # Hamlib bindings using SWIG # more information on swig at http://www.swig.org # #INCLUDES = @INCLUDES@ -Dbool=char -I@PERL_INC_DIR@ @TCL_INCLUDE_SPEC@ -I$(top_srcdir)/bindings INCLUDES = @INCLUDES@ -I$(top_srcdir)/bindings @TCL_INCLUDE_SPEC@ @PYTHON_CPPFLAGS@ SWGFILES = hamlib.swg ignore.swg rig.swg rotator.swg SWGDEP=$(top_srcdir)/include/hamlib/rig.h $(top_srcdir)/include/hamlib/riglist.h \ $(top_srcdir)/include/hamlib/rotator.h $(top_srcdir)/include/hamlib/rotlist.h \ $(SWGFILES) BUILT_SOURCES= MOSTLYCLEANFILES= AM_CFLAGS = -fno-strict-aliasing ########################################## # Perl binding hamlibperl_wrap.c: hamlib.swg $(SWIGDEP) $(SWIG) -perl5 -shadow @INCLUDES@ -I$(top_srcdir)/bindings -o $@ \ `test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg Hamlib-pl.mk: $(srcdir)/Makefile.PL test -f Makefile.PL || $(LN_S) $(srcdir)/Makefile.PL Makefile.PL perl `test -f Makefile.PL || echo '$(srcdir)/'`Makefile.PL \ MAKEFILE="Hamlib-pl.mk" \ PREFIX="$(prefix)" \ INC="$(INCLUDES)" \ CC="$(CC)" \ OBJECT="hamlibperl_wrap.o" \ VERSION="$(PACKAGE_VERSION)" \ LIBS="-L$(top_builddir)/src/.libs -lhamlib" sed -e 's/^LD_RUN_PATH.*/LD_RUN_PATH =/' Hamlib-pl.mk > Hamlib-pl-norpath.mk mv Hamlib-pl-norpath.mk Hamlib-pl.mk all-perl: Hamlib-pl.mk hamlibperl_wrap.c $(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk all check-perl: all-perl $(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk test clean-perl: Hamlib-pl.mk $(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk clean distclean-perl: ## Hamlib-pl.mk ## $(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk distclean distcheck-perl: Hamlib-pl.mk $(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk distcheck install-perl: Hamlib-pl.mk $(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk install_site ## ExtUtils::MakeMaker says uninstall is deprecated and won't remove the files ## anyway, so we'll have to figure out another way to remove the installed files. uninstall-perl: ## Hamlib-pl.mk ## $(MAKE) $(AM_MAKEFLAGS) -f Hamlib-pl.mk uninstall if ENABLE_TCL ########################################## # Tcl binding BUILT_SOURCES+= hamlibtcl_wrap.c MOSTLYCLEANFILES+= hamlibtcl_wrap.c pkgIndex.tcl tcl_ltlib = hamlibtcl.la tcldir = $(prefix)/lib/tcl PKG_VER=1.0 DLL=hamlibtcl-$(PKG_VER)@TCL_SHLIB_SUFFIX@ nodist_hamlibtcl_la_SOURCES = hamlibtcl_wrap.c hamlibtcl_la_LDFLAGS = -no-undefined -module -release $(PKG_VER) -avoid-version @TCL_LIB_SPEC@ hamlibtcl_la_LIBADD = $(top_builddir)/src/libhamlib.la hamlibtcl_ladir = $(tcldir) hamlibtcl_la_DATA = pkgIndex.tcl pkgIndex.tcl: Makefile echo 'package ifneeded Hamlib $(PKG_VER) [list load [file join $$dir $(DLL)] Hamlib]' > pkgIndex.tcl hamlibtcl_wrap.c: hamlib.swg $(SWGDEP) $(SWIG) -tcl -pkgversion $(PKG_VER) @INCLUDES@ -I$(top_srcdir)/bindings -o $@ \ `test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg all-tcl: pkgIndex.tcl $(tcl_ltlib) check-tcl: all-tcl TCLLIBPATH=$(builddir)/.libs $(srcdir)/tcltest.tcl || echo "Tcl test failed" 1>&2 install-tcl: clean-tcl: distclean-tcl: clean-tcl uninstall-tcl: endif ########################################## # Python binding if ENABLE_PYTHON python_ltlib = _Hamlib.la #pythondir = @pythondir@ nodist__Hamlib_la_SOURCES = hamlibpy_wrap.c _Hamlib_la_LDFLAGS = -no-undefined -module -avoid-version _Hamlib_la_LIBADD = $(top_builddir)/src/libhamlib.la _Hamlib_ladir = $(pythondir) all-py: $(python_ltlib) check-py: all-py $(srcdir)/pytest.py || echo "Python test failed" 1>&2 python_PYTHON = Hamlib.py _Hamlib_la_LTLIBRARIES = $(python_ltlib) endif MOSTLYCLEANFILES+= hamlibpy_wrap.c Hamlib.py *.pyc BUILT_SOURCES += hamlibpy_wrap.c Hamlib.py Hamlib.py: hamlibpy_wrap.c hamlibpy_wrap.c: hamlib.swg $(SWGDEP) $(SWIG) -python @INCLUDES@ -I$(top_srcdir)/bindings -o $@ \ `test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg install-py: clean-py: distclean-py: uninstall-py: ########################################## lib_LTLIBRARIES = $(tcl_ltlib) # lib_LTLIBRARIES = @BINDING_LIB_TARGETS@ all-local: @BINDING_ALL@ check-local: @BINDING_CHECK@ clean-local: @BINDING_CLEAN@ distclean-local: @BINDING_DISTCLEAN@ distcheck-local: @BINDING_DISTCHECK@ install-exec-local: @BINDING_INSTALL_EXEC@ uninstall-local: @BINDING_UNINSTALL@ EXTRA_DIST = $(SWGFILES) \ Makefile.PL perltest.pl tcltest.tcl pytest.py BUILT_SOURCES += hamlibperl_wrap.c ## DISTCLEANFILES = Hamlib-pl.mk Hamlib-pl.mk.old DISTCLEANFILES = Hamlib-pl.mk.old MOSTLYCLEANFILES += hamlibperl_wrap.c Hamlib.pm Hamlib.bs noinst_SCRIPTS = perltest.pl tcltest.tcl pytest.py hamlibvb.bas hamlib-1.2.15.3/bindings/tcltest.tcl0000755000175000017500000000235012044564477014121 00000000000000#!/bin/sh # the next line restarts using tclsh \ exec tclsh "$0" "$@" load ".libs/hamlibtcl.so" Hamlib #package require Hamlib set tclver [info tclversion] puts "Tcl $tclver test, $hamlib_version\n" #rig_set_debug $RIG_DEBUG_TRACE rig_set_debug $RIG_DEBUG_NONE # Init RIG_MODEL_DUMMY Rig my_rig $RIG_MODEL_DUMMY my_rig open my_rig set_freq 145550000 puts status:[my_rig cget -error_status] # get_mode returns a tuple set moderes [my_rig get_mode] set mode [rig_strrmode [lindex $moderes 0]] puts "mode: $mode, bandwidth:[lindex $moderes 1]Hz" set state [my_rig cget -state] puts ITU_region:[$state cget -itu_region] # The following works well also # puts ITU_region:[[my_rig cget -state] cget -itu_region] puts getinfo:[my_rig get_info] my_rig set_level "VOX" 1 puts status:[my_rig cget -error_status] puts "VOX level:[my_rig get_level_i "VOX"]" puts status:[my_rig cget -error_status] my_rig set_level $RIG_LEVEL_VOX 5 puts status:[my_rig cget -error_status] puts "VOX level:[my_rig get_level_i $RIG_LEVEL_VOX]" puts status:[my_rig cget -error_status] puts strength:[my_rig get_level_i $RIG_LEVEL_STRENGTH] puts status:[my_rig cget -error_status] puts status(str):[rigerror [my_rig cget -error_status]] my_rig close #my_rig cleanup exit 0 hamlib-1.2.15.3/bindings/pytest.py0000755000175000017500000000573612044564477013650 00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- import sys sys.path.append ('.') sys.path.append ('.libs') sys.path.append ('/usr/local/hamlib/python') import Hamlib def StartUp (): print "Python",sys.version[:5],"test,", Hamlib.cvar.hamlib_version #Hamlib.rig_set_debug (Hamlib.RIG_DEBUG_TRACE) Hamlib.rig_set_debug (Hamlib.RIG_DEBUG_NONE) # Init RIG_MODEL_DUMMY my_rig = Hamlib.Rig (Hamlib.RIG_MODEL_DUMMY) my_rig.set_conf ("rig_pathname","/dev/Rig") my_rig.set_conf ("retry","5") my_rig.open () # 1073741944 is token value for "itu_region" # but using get_conf is much more convenient region = my_rig.get_conf(1073741944) rpath = my_rig.get_conf("rig_pathname") retry = my_rig.get_conf("retry") print "status(str):",Hamlib.rigerror(my_rig.error_status) print "get_conf: path=",rpath,", retry =",retry,", ITU region=",region my_rig.set_freq (5700000000,Hamlib.RIG_VFO_B) print "freq:",my_rig.get_freq() my_rig.set_freq (145550000) my_rig.set_vfo (Hamlib.RIG_VFO_B) #my_rig.set_vfo ("VFOA") (mode, width) = my_rig.get_mode() print "mode:",Hamlib.rig_strrmode(mode),", bandwidth:",width my_rig.set_mode(Hamlib.RIG_MODE_CW) (mode, width) = my_rig.get_mode() print "mode:",Hamlib.rig_strrmode(mode),", bandwidth:",width print "ITU_region: ",my_rig.state.itu_region print "Backend copyright: ",my_rig.caps.copyright print "Model:",my_rig.caps.model_name print "Manufacturer:",my_rig.caps.mfg_name print "Backend version:",my_rig.caps.version print "Backend license:",my_rig.caps.copyright print "Rig info:", my_rig.get_info() my_rig.set_level ("VOX", 1) print "VOX level: ",my_rig.get_level_i("VOX") my_rig.set_level (Hamlib.RIG_LEVEL_VOX, 5) print "VOX level: ", my_rig.get_level_i(Hamlib.RIG_LEVEL_VOX) print "strength: ", my_rig.get_level_i(Hamlib.RIG_LEVEL_STRENGTH) print "status: ",my_rig.error_status print "status(str):",Hamlib.rigerror(my_rig.error_status) chan = Hamlib.channel(Hamlib.RIG_VFO_B) my_rig.get_channel(chan) print "get_channel status: ",my_rig.error_status print "VFO: ",Hamlib.rig_strvfo(chan.vfo),", ",chan.freq my_rig.close () print "\nSome static functions:" err, long1, lat1 = Hamlib.locator2longlat("IN98EC") err, long2, lat2 = Hamlib.locator2longlat("DM33DX") err, loc1 = Hamlib.longlat2locator(long1, lat1, 3) err, loc2 = Hamlib.longlat2locator(long2, lat2, 3) print "Loc1: IN98EC -> ",loc1 print "Loc2: DM33DX -> ",loc2 # TODO: qrb should normalize? err, dist, az = Hamlib.qrb(long1, lat1, long2, lat2) if az > 180: az -= 360 longpath = Hamlib.distance_long_path(dist) print "Distance: ",dist," km, long path: ",longpath err, deg, min, sec, sw = Hamlib.dec2dms(az) az2 = Hamlib.dms2dec(deg, min, sec, sw) if sw: deg = -deg print "Bearing: ",az,", ",deg,"° ",min,"' ",sec,", recoded: ",az2 if __name__ == '__main__': StartUp () hamlib-1.2.15.3/yaesu/0000755000175000017500000000000012044565016011327 500000000000000hamlib-1.2.15.3/yaesu/vr5000.c0000644000175000017500000004050312044564477012363 00000000000000/* * vr5000.c - (C) Stephane Fillod and Jacob Heder 2005 * * This shared library provides an API for communicating * via serial interface to an VR-5000 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * Undocumented notes on the VR5000. * * There are some mishaps in the manual. The CAT serial delay times seems * not to be correct. More correct estimates are 70 mS write_delay ( * between bytes), 200 mS post_write_delay (between command), but when * reading s-meter, the delay must be over 500 mS. * * The read s-meter CAT command seems only to return 17 to 23 depending * on the strength of the signal. Setting the RF attenuator on with no * attenna on does not decrease the level below 17. If you wish to read * the s-meter on a specific frequency, set the frequency and wait a * 500-1000 mS before reading it. * The vr5000 has two vfo, but only 1 native. The second vfo is a following * vfo which only can tune into the frequency range of VFO_A (+,-) 20 Mhz. * * The vr5000 has no CAT commands for reading the frequency, ts nor mode. * These function are emulated, because the vr5000 thunkates the input * frequency. Secondly when changing the mode, ts will change, and since * ts it the one that desides how the frequency is thunkated, the frequency * will change. * * True reciever range was not specified correctly in manual. No all * mode allow to go down to 100 Khz. Therefore the minimum frequency * which will be allowed is 101.5 kKz. Maximum is 2599.99 Mhz. * * * Supported : VFO_A, 101.5 Khz to 2599.99 Mhz. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #define VR5000_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define VR5000_VFOS RIG_VFO_A #define VR5000_ANTS 0 #define MODE_LSB 0x00 #define MODE_USB 0x01 #define MODE_CW 0x02 #define MODE_AM 0x04 #define MODE_AMW 0x44 #define MODE_AMN 0x84 #define MODE_WFM 0x48 #define MODE_FMN 0x88 #define SAFETY_WRITE_DELAY 70 /* security value for beta version, ok to set lower later */ #define SAFETY_POST_DELAY 210 /* security value for beta version, */ /* TODO: get real measure numbers */ #define VR5000_STR_CAL { 2, { \ { 0, -60 }, /* S0 -6dB */ \ { 63, 60 } /* +60 */ \ } } /* Private helper function prototypes */ static int vr5000_init(RIG *rig); static int vr5000_cleanup(RIG *rig); static int vr5000_open(RIG *rig); static int vr5000_close(RIG *rig); static int vr5000_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int vr5000_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int vr5000_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int vr5000_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int vr5000_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int vr5000_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); static int vr5000_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts); static int vr5000_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts); /* * Private helper function prototypes. */ static int set_vr5000(RIG *rig, vfo_t vfo, freq_t freq ,rmode_t mode, pbwidth_t width,shortfreq_t ts); static int mode2rig(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static void correct_frequency(RIG *rig, vfo_t vfo, freq_t curr_freq, freq_t *freq); static int find_tuning_step(RIG *rig, vfo_t vfo, rmode_t mode, shortfreq_t *ts); static int check_tuning_step(RIG *rig, vfo_t vfo, rmode_t mode, shortfreq_t ts); /* * vr5000 rigs capabilities. */ const struct rig_caps vr5000_caps = { .rig_model = RIG_MODEL_VR5000, .model_name = "VR-5000", .mfg_name = "Yaesu", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 57600, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = SAFETY_WRITE_DELAY, .post_write_delay = SAFETY_POST_DELAY, .timeout = 1000, .retry = 0, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_RAWSTR, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .vfo_ops = RIG_OP_NONE, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_FREQ|RIG_TARGETABLE_MODE, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { }, .rx_range_list1 = { {kHz(101)+500, GHz(2.6)-1000, VR5000_MODES, -1, -1, RIG_VFO_A, VR5000_ANTS }, RIG_FRNG_END, }, /* api supported region 1 rx ranges */ .tx_range_list1 = { RIG_FRNG_END, }, /* region 1 TX ranges */ .rx_range_list2 = { {kHz(101)+500, GHz(2.6)-1000, VR5000_MODES, -1, -1, RIG_VFO_A, VR5000_ANTS }, RIG_FRNG_END, }, /* api supported region 2 rx ranges */ .tx_range_list2 = { RIG_FRNG_END, }, /* region 2 TX ranges */ .tuning_steps = { {RIG_MODE_SSB|RIG_MODE_CW, Hz(20)}, {RIG_MODE_SSB|RIG_MODE_CW, Hz(100)}, {RIG_MODE_SSB|RIG_MODE_CW, Hz(500)}, {RIG_MODE_AM|RIG_MODE_SSB|RIG_MODE_CW, kHz(1)}, {RIG_MODE_FM|RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_AM, kHz(5)}, {RIG_MODE_FM, kHz(6.25)}, {RIG_MODE_AM, kHz(9)}, {RIG_MODE_AM|RIG_MODE_WFM|RIG_MODE_FM, kHz(10)}, {RIG_MODE_FM, kHz(12.5)}, {RIG_MODE_AM|RIG_MODE_FM, kHz(20)}, {RIG_MODE_AM|RIG_MODE_FM, kHz(25)}, {RIG_MODE_AM|RIG_MODE_WFM|RIG_MODE_FM, kHz(50)}, {RIG_MODE_AM|RIG_MODE_WFM|RIG_MODE_FM, kHz(100)}, {RIG_MODE_AM|RIG_MODE_WFM|RIG_MODE_FM, kHz(500)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_AM, kHz(6)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_AM|RIG_MODE_FM, kHz(15)}, {RIG_MODE_WFM, kHz(230)}, RIG_FLT_END, }, .str_cal = VR5000_STR_CAL, .rig_init = vr5000_init, .rig_cleanup = vr5000_cleanup, .rig_open = vr5000_open, .rig_close = vr5000_close, .get_level = vr5000_get_level, .get_dcd = vr5000_get_dcd, .set_freq = vr5000_set_freq, .get_freq = vr5000_get_freq, .set_mode = vr5000_set_mode, .get_mode = vr5000_get_mode, .set_ts = vr5000_set_ts, .get_ts = vr5000_get_ts, }; /* * VR-5000 backend needs priv data to handle composite cmds */ struct vr5000_priv_data { vfo_t curr_vfo; shortfreq_t curr_ts; freq_t curr_freq; rmode_t curr_mode; pbwidth_t curr_width; }; int vr5000_init(RIG *rig) { struct vr5000_priv_data *priv; priv = (struct vr5000_priv_data*)malloc(sizeof(struct vr5000_priv_data)); if (!priv) return -RIG_ENOMEM; rig->state.priv = (void*)priv; return RIG_OK; } int vr5000_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * vr5000_open : Set CAT on and set tuner into known mode */ int vr5000_open(RIG *rig) { struct vr5000_priv_data *priv = rig->state.priv; unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x00}; unsigned char b_off[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x31}; int retval; /* CAT write command on */ retval = write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); if (retval != RIG_OK) return retval; /* disable RIG_VFO_B (only on display) */ retval = write_block(&rig->state.rigport, (char *) b_off, YAESU_CMD_LENGTH); if (retval != RIG_OK) return retval; /* set RIG_VFO_A to 10 Mhz normal AM, step 10 kHz */ priv->curr_vfo = RIG_VFO_A; priv->curr_mode = RIG_MODE_WFM; priv->curr_width= RIG_PASSBAND_NORMAL; priv->curr_ts = kHz(10); priv->curr_freq = kHz(10000); retval = set_vr5000(rig,priv->curr_vfo,priv->curr_freq,priv->curr_mode,priv->curr_width,priv->curr_ts); if (retval != RIG_OK) return retval; return RIG_OK; } int vr5000_close(RIG *rig) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x80}; return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int vr5000_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct vr5000_priv_data *priv = rig->state.priv; return set_vr5000(rig,vfo,freq,priv->curr_mode,priv->curr_width,priv->curr_ts); } int vr5000_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct vr5000_priv_data *priv = rig->state.priv; *freq = priv->curr_freq; return RIG_OK; } int vr5000_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct vr5000_priv_data *priv = rig->state.priv; if (check_tuning_step(rig,vfo,mode,priv->curr_ts)!=RIG_OK) find_tuning_step(rig,vfo,mode,&priv->curr_ts); priv->curr_mode = mode; return set_vr5000(rig,vfo,priv->curr_freq,mode,width,priv->curr_ts); } int vr5000_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct vr5000_priv_data *priv = rig->state.priv; *mode = priv->curr_mode; *width = priv->curr_width; return RIG_OK; } int vr5000_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) { struct vr5000_priv_data *priv = rig->state.priv; int retval; retval = check_tuning_step(rig,vfo,priv->curr_mode,ts); if (retval != RIG_OK) return retval; priv->curr_ts = ts; return set_vr5000(rig,vfo,priv->curr_freq,priv->curr_mode,priv->curr_width,ts); } int vr5000_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) { struct vr5000_priv_data *priv = rig->state.priv; *ts = priv->curr_ts; return RIG_OK; } int vr5000_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0xe7}; int retval; if (level != RIG_LEVEL_RAWSTR) return -RIG_EINVAL; serial_flush(&rig->state.rigport); /* send READ STATUS(Meter only) cmd to rig */ retval = write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); if (retval < 0) return retval; /* read back the 1 byte */ retval = read_block(&rig->state.rigport, (char *) cmd, 1); if (retval < 1) { rig_debug(RIG_DEBUG_ERR,"%s: read meter failed %d\n", __FUNCTION__,retval); return retval < 0 ? retval : -RIG_EIO; } val->i = cmd[0] & 0x3f; rig_debug(RIG_DEBUG_ERR,"Read(%x) RawValue(%x): \n",cmd[0],val->i); return RIG_OK; } int vr5000_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0xe7}; int retval; serial_flush(&rig->state.rigport); /* send READ STATUS(Meter only) cmd to rig */ retval = write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); if (retval < 0) return retval; /* read back the 1 byte */ retval = read_block(&rig->state.rigport, (char *) cmd, 1); if (retval < 1) { rig_debug(RIG_DEBUG_ERR,"%s: read meter failed %d\n", __FUNCTION__,retval); return retval < 0 ? retval : -RIG_EIO; } *dcd = (cmd[0] & 0x80) ? RIG_DCD_ON : RIG_DCD_OFF; return RIG_OK; } int mode2rig(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct vr5000_priv_data *priv = rig->state.priv; int md; if (priv->curr_vfo == RIG_VFO_CURR) vfo = priv->curr_vfo; /* * translate mode from generic to vr5000 specific */ switch(mode) { case RIG_MODE_USB: md = MODE_USB; break; case RIG_MODE_LSB: md = MODE_LSB; break; case RIG_MODE_CW: md = MODE_CW; break; case RIG_MODE_WFM: md = MODE_WFM; break; case RIG_MODE_FM: md = MODE_FMN; break; case RIG_MODE_AM: if (width != RIG_PASSBAND_NORMAL && width < rig_passband_normal(rig, mode)) md = MODE_AMN; else if (width != RIG_PASSBAND_NORMAL && width > rig_passband_normal(rig, mode)) md = MODE_AMW; else md = MODE_AM; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } return md; } /* * This function corrects the frequency */ void correct_frequency(RIG *rig, vfo_t vfo, freq_t curr_freq, freq_t *freq) { struct vr5000_priv_data *priv = rig->state.priv; shortfreq_t ts = priv->curr_ts; unsigned long long correct_freq = (unsigned long long)curr_freq; if (vfo == RIG_VFO_CURR) vfo = priv->curr_vfo; /* RIG_VFO_A frequency correction */ if (correct_freq%ts != 0) { if ((correct_freq%ts) > (ts>>1)) correct_freq += (ts-(correct_freq%ts)); else correct_freq -= (correct_freq%ts); } /* Check for frequencies out on true rx range */ if ((freq_t)correct_freq < rig->caps->rx_range_list1->start) { correct_freq = (unsigned long long)rig->caps->rx_range_list1->start; if (correct_freq%ts != 0) { correct_freq += (ts-(correct_freq%ts)); } } else if ((freq_t)correct_freq > rig->caps->rx_range_list1->end) { correct_freq = (unsigned long long)rig->caps->rx_range_list1->end; if (correct_freq%ts != 0) { correct_freq -= (correct_freq%ts); } } *freq = (freq_t) correct_freq; return; } /* * Set mode and ts, then frequency. Both mode/ts and frequency are set * everytime one of them changes. */ int set_vr5000(RIG *rig, vfo_t vfo,freq_t freq,rmode_t mode, pbwidth_t width,shortfreq_t ts) { struct vr5000_priv_data *priv = rig->state.priv; unsigned char cmd_mode_ts[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x07}; unsigned char cmd_freq[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x01}; static const unsigned char steps[] = { 0x21, 0x42, 0x02, 0x03, 0x43, 0x53, 0x63, 0x04, 0x14, 0x24, 0x35, 0x44, 0x05, 0x45 }; unsigned int frq; int retval; int i; if (vfo == RIG_VFO_CURR) vfo = priv->curr_vfo; retval = mode2rig(rig, vfo, mode, width); if (retval < 0) return retval; /* fill in m1 */ cmd_mode_ts[0] = retval; for (i=0; icaps->tuning_steps[i].ts == ts) break; } if (i >= TSLSTSIZ) { return -RIG_EINVAL; /* not found, unsupported */ } /* fill in m2 */ cmd_mode_ts[1] = steps[i]; retval = write_block(&rig->state.rigport, (char *) cmd_mode_ts, YAESU_CMD_LENGTH); if (retval != RIG_OK) return retval; /* Correct frequency */ correct_frequency(rig,vfo,freq,&freq); priv->curr_freq = freq; frq = (unsigned int)(freq/10); cmd_freq[0] = (frq >> 24) & 0xff; cmd_freq[1] = (frq >> 16) & 0xff; cmd_freq[2] = (frq >> 8) & 0xff; cmd_freq[3] = frq & 0xff; /* frequency set */ return write_block(&rig->state.rigport, (char *) cmd_freq, YAESU_CMD_LENGTH); } /* * find_tuning_step : return the lowest ts for a giving mode */ int find_tuning_step(RIG *rig, vfo_t vfo, rmode_t mode, shortfreq_t *ts) { int i; for (i=0; icaps->tuning_steps[i].modes & mode)!=0) { *ts = rig->caps->tuning_steps[i].ts; return RIG_OK; } } return -RIG_EINVAL; /* not found, unsupported */ } /* * check_tuning_step : return RIG_OK if this ts is supported by the mode */ int check_tuning_step(RIG *rig, vfo_t vfo, rmode_t mode, shortfreq_t ts) { int i; for (i=0; icaps->tuning_steps[i].ts == ts && ((rig->caps->tuning_steps[i].modes & mode)!=0)) return RIG_OK; } return -RIG_EINVAL; /* not found, unsupported */ } hamlib-1.2.15.3/yaesu/frg9600.c0000644000175000017500000001220212044564477012517 00000000000000/* * frg9600.c - (C) Stephane Fillod 2002-2004 * * This shared library provides an API for communicating * via serial interface to an FRG-9600 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "yaesu.h" /* Private helper function prototypes */ #define FRG9600_MODES (RIG_MODE_SSB|RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define FRG9600_VFOS (RIG_VFO_A) static int frg9600_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int frg9600_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); /* * frg9600 rigs capabilities. * Also this struct is READONLY! * */ const struct rig_caps frg9600_caps = { .rig_model = RIG_MODEL_FRG9600, .model_name = "FRG-9600", .mfg_name = "Yaesu", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 300, .timeout = 2000, .retry = 0, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .vfo_ops = RIG_OP_NONE, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, .rx_range_list1 = { {MHz(60), MHz(905), RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM, -1, -1, FRG9600_VFOS }, {MHz(60), MHz(460), RIG_MODE_SSB, -1, -1, FRG9600_VFOS }, RIG_FRNG_END, }, /* Region 1 rx ranges */ .tx_range_list1 = { RIG_FRNG_END, }, /* region 1 TX ranges */ .rx_range_list2 = { {MHz(60), MHz(905), RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM, -1, -1, FRG9600_VFOS }, {MHz(60), MHz(460), RIG_MODE_SSB, -1, -1, FRG9600_VFOS }, RIG_FRNG_END, }, /* Region 2 rx ranges */ .tx_range_list2 = { RIG_FRNG_END, }, /* region 2 TX ranges */ .tuning_steps = { {RIG_MODE_SSB|RIG_MODE_AM, Hz(100)}, {RIG_MODE_FM, kHz(5)}, {RIG_MODE_WFM, kHz(100)}, RIG_TS_END, }, /* mode/filter list, at -3dB ! */ .filters = { {RIG_MODE_AM, kHz(6)}, {RIG_MODE_SSB|RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_WFM, kHz(180)}, RIG_FLT_END, }, .set_freq = frg9600_set_freq, .set_mode = frg9600_set_mode, }; #define MODE_SET_LSB 0x10 #define MODE_SET_USB 0x11 #define MODE_SET_AMN 0x14 #define MODE_SET_AMW 0x15 #define MODE_SET_FMN 0x16 #define MODE_SET_WFM 0x17 int frg9600_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x0a, 0x00, 0x00, 0x00, 0x00}; /* store bcd format in cmd (MSB) */ to_bcd_be(cmd+1, freq/10, 8); /* Frequency set */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int frg9600_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x00}; unsigned char md; /* * translate mode from generic to frg9600 specific */ switch(mode) { case RIG_MODE_USB: md = MODE_SET_USB; break; case RIG_MODE_LSB: md = MODE_SET_LSB; break; case RIG_MODE_FM: md = MODE_SET_FMN; break; case RIG_MODE_WFM: md = MODE_SET_WFM; break; case RIG_MODE_AM: if (width != RIG_PASSBAND_NORMAL && width < rig_passband_normal(rig, mode)) md = MODE_SET_AMN; else md = MODE_SET_AMW; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } cmd[0] = md; /* Mode set */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } hamlib-1.2.15.3/yaesu/ft980.c0000644000175000017500000006123412044564477012305 00000000000000/* * ft980.c - (C) Stephane Fillod 2004-2010 * (C) Wolfgang Buesser 2010 * * This shared library provides an API for communicating * via serial interface to an FT-980 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "bandplan.h" #include "yaesu.h" #define FT980_MODES (RIG_MODE_LSB|RIG_MODE_USB|RIG_MODE_CW|RIG_MODE_AM|RIG_MODE_RTTY|RIG_MODE_FM) #define FT980_ANTS (RIG_ANT_1) /* TODO: RIG_VFO_HAM|RIG_VFO_GEN ? */ #define FT980_VFOS (RIG_VFO_MAIN) /* TODO: RIG_OP_TO_VFO|RIG_OP_FROM_VFO|RIG_OP_BAND_UP|RIG_OP_BAND_DOWN */ #define FT980_VFO_OPS (RIG_OP_NONE) typedef struct _ft980_memory_t { unsigned char mem_16[4];unsigned char vfo_16;unsigned char mode_16; unsigned char mem_15[4];unsigned char vfo_15;unsigned char mode_15; unsigned char mem_14[4];unsigned char vfo_14;unsigned char mode_14; unsigned char mem_13[4];unsigned char vfo_13;unsigned char mode_13; unsigned char mem_12[4];unsigned char vfo_12;unsigned char mode_12; unsigned char mem_11[4];unsigned char vfo_11;unsigned char mode_11; unsigned char mem_10[4];unsigned char vfo_10;unsigned char mode_10; unsigned char mem_9[4];unsigned char vfo_9;unsigned char mode_9; unsigned char mem_8[4];unsigned char vfo_8;unsigned char mode_8; unsigned char mem_7[4];unsigned char vfo_7;unsigned char mode_7; unsigned char mem_6[4];unsigned char vfo_6;unsigned char mode_6; unsigned char mem_5[4];unsigned char vfo_5;unsigned char mode_5; unsigned char mem_4[4];unsigned char vfo_4;unsigned char mode_4; unsigned char mem_3[4];unsigned char vfo_3;unsigned char mode_3; unsigned char mem_2[4];unsigned char vfo_2;unsigned char mode_2; unsigned char mem_1[4];unsigned char vfo_1;unsigned char mode_1; unsigned char CLAR[4]; unsigned char GEN[4];unsigned char HAM[4];unsigned char vfo;unsigned char mode; unsigned char ff_1[4]; unsigned char ff_2[4]; unsigned char vfo_mem; unsigned char mode_mem; unsigned char LDB; unsigned char EXT_CTL; unsigned char IF_SHIFT; unsigned char SPLIT_CODE; unsigned char FSK_SHIFT; unsigned char IF_WIDTH; unsigned char MEM_SHIFT; unsigned char CLAR_FLAG; unsigned char TAB_FLAG; unsigned char SELECT_SW; unsigned char OFFSET_SW; unsigned char MODE_SW; unsigned char MEM_CH_SW; unsigned char LOW_TAB[4]; unsigned char UP_TAB[4]; unsigned char VFO_STATUS; unsigned char OP_MODE; unsigned char OP_FREQ[4]; unsigned char STATUS_FLAG; } _ft980_memory_t; /* * Private data */ struct ft980_priv_data { _ft980_memory_t update_data; /* returned data */ struct timeval status_tv; /* update_data caching */ }; #define UPDATE_DATA_OFS(p, o) (((unsigned char*)((p)+1))-(o)) static const char cmd_OK[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0B}; static const char cmd_ON_OFF[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x00}; /* Private helper function prototypes */ static int ft980_transaction(RIG *rig, const unsigned char *cmd, unsigned char *data, int expected_len); static int ft980_get_status_data(RIG *rig); static int ft980_open(RIG *rig); static int ft980_close(RIG *rig); static int ft980_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft980_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ft980_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ft980_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int ft980_set_mem(RIG *rig, vfo_t vfo, int ch); static int ft980_get_mem(RIG *rig, vfo_t vfo, int *ch); #if 0 static int ft980_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int ft980_set_split_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft980_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ft980_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int ft980_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift); static int ft980_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs); #endif /* * ft980 rigs capabilities. */ #define FT980_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ } #define FT980_CACHE_TIMEOUT 500 /* ms */ /* * ft980 rigs capabilities. * * Protocol is documented in FT 980 Technical Supplement, page 13. * * TODO: */ const struct rig_caps ft980_caps = { .rig_model = RIG_MODEL_FT980, .model_name = "FT-980", .mfg_name = "Yaesu", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_SERIAL_RTS, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 80, .post_write_delay = 0, .timeout = 2000, .retry = 3, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .vfo_ops = FT980_VFO_OPS, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(10000), .max_xit = Hz(10000), .max_ifshift = Hz(1500), .targetable_vfo = RIG_TARGETABLE_NONE, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { {1, 16, RIG_MTYPE_MEM, FT980_MEM_CAP}, }, .rx_range_list1 = { {kHz(150), MHz(30)-100, FT980_MODES, -1, -1, FT980_VFOS, FT980_ANTS}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1, RIG_MODE_SSB|RIG_MODE_CW, W(5), W(100), FT980_VFOS, FT980_ANTS), FRQ_RNG_HF(1, RIG_MODE_FM|RIG_MODE_RTTY, W(2), W(50), FT980_VFOS, FT980_ANTS), FRQ_RNG_HF(1, RIG_MODE_AM, W(2), W(25), FT980_VFOS, FT980_ANTS), RIG_FRNG_END, }, .rx_range_list2 = { {kHz(150), MHz(30)-100, FT980_MODES, -1, -1, FT980_VFOS, FT980_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2, RIG_MODE_SSB|RIG_MODE_CW, W(5), W(100), FT980_VFOS, FT980_ANTS), FRQ_RNG_HF(2, RIG_MODE_FM|RIG_MODE_RTTY, W(2), W(50), FT980_VFOS, FT980_ANTS), FRQ_RNG_HF(2, RIG_MODE_AM, W(2), W(25), FT980_VFOS, FT980_ANTS), RIG_FRNG_END, }, .tuning_steps = { {FT980_MODES, Hz(10)}, {FT980_MODES, kHz(5)}, {FT980_MODES, kHz(500)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.5)}, {RIG_MODE_CW, Hz(300)}, {RIG_MODE_FM, kHz(12)}, {RIG_MODE_AM, kHz(5)}, {RIG_MODE_AM, kHz(3)}, RIG_FLT_END, }, .rig_open = ft980_open, .rig_close = ft980_close, .set_freq = ft980_set_freq, .get_freq = ft980_get_freq, .set_mode = ft980_set_mode, .get_mode = ft980_get_mode, .set_mem = ft980_set_mem, .get_mem = ft980_get_mem, #if 0 .get_level = ft980_get_level, .set_level = ft980_set_level, .set_split_vfo = ft980_set_split_vfo, .set_split_freq = ft980_set_split_freq, .set_split_mode = ft980_set_split_mode, .set_rptr_shift = ft980_set_rptr_shift, .set_rptr_offs = ft980_set_rptr_offs, #endif }; static void dump_freq(unsigned char* data) { rig_debug(RIG_DEBUG_VERBOSE, "%02x%02x%02x%02x ",data[3],data[2],data[1],data[0]); } static void dump_vfo(unsigned char data) { switch ((unsigned int)data) { case 0: rig_debug(RIG_DEBUG_VERBOSE, "GEN");break; case 128: rig_debug(RIG_DEBUG_VERBOSE, "HAM");break; } } static void dump_mode(unsigned char data) { switch ((unsigned int)data) { case 0: rig_debug(RIG_DEBUG_VERBOSE, " LSB\n");break; case 1: rig_debug(RIG_DEBUG_VERBOSE, " USB\n");break; case 2: rig_debug(RIG_DEBUG_VERBOSE, " CW-W\n");break; case 3: rig_debug(RIG_DEBUG_VERBOSE, " CW-N\n");break; case 4: rig_debug(RIG_DEBUG_VERBOSE, " AM-W\n");break; case 5: rig_debug(RIG_DEBUG_VERBOSE, " AM-N\n");break; case 6: rig_debug(RIG_DEBUG_VERBOSE, " FSK\n");break; case 7: rig_debug(RIG_DEBUG_VERBOSE, " FM\n");break; } } static void dump_switch(unsigned char data) { switch ((unsigned int)data) { case 0: rig_debug(RIG_DEBUG_VERBOSE, "OFF");break; case 1: rig_debug(RIG_DEBUG_VERBOSE, "ON ");break; } } static void dump_IF_SHIFT(unsigned char data) { rig_debug(RIG_DEBUG_VERBOSE, "IF_SHIFT :\%d\n",data-15); } static void dump_SPLIT_CODE(unsigned char data) { rig_debug(RIG_DEBUG_VERBOSE, "SPLIT_CODE :\%02x\n",data); } static void dump_FSK_SHIFT(unsigned char data) { rig_debug(RIG_DEBUG_VERBOSE, "FSK_SHIFT :\%02x\n",data); } static void dump_IF_WIDTH(unsigned char data) { rig_debug(RIG_DEBUG_VERBOSE, "IF_WIDTH :\%d\n",data); } static void dump_MEM_SHIFT(unsigned char data) { rig_debug(RIG_DEBUG_VERBOSE, "MEM_SHIFT :"); switch ((unsigned int)data) { case 0: rig_debug(RIG_DEBUG_VERBOSE, "OFF\n");break; case 16: rig_debug(RIG_DEBUG_VERBOSE, "ON\n");break; } } static void dump_CLAR_FLAG(unsigned char data) { unsigned char RX_CLAR =data & 0x20; unsigned char TX_CLAR =data & 0x40; rig_debug(RIG_DEBUG_VERBOSE, "CLAR_SHIFT RX/TX:"); switch ((unsigned int)RX_CLAR) { case 0: rig_debug(RIG_DEBUG_VERBOSE, "OFF ");break; case 0x20: rig_debug(RIG_DEBUG_VERBOSE, "ON ");break; } switch ((unsigned int)TX_CLAR) { case 0: rig_debug(RIG_DEBUG_VERBOSE, " OFF ");break; case 0x40: rig_debug(RIG_DEBUG_VERBOSE, " ON ");break; } rig_debug(RIG_DEBUG_VERBOSE, "\n"); } static void dump_TAB_FLAG(unsigned char data) { rig_debug(RIG_DEBUG_VERBOSE, "TAB FLAG :"); switch (data) { case 0: rig_debug(RIG_DEBUG_VERBOSE, "OFF\n");break; case 0x80: rig_debug(RIG_DEBUG_VERBOSE, "ON\n");break; } } static void dump_SELECT_SW(unsigned char data) { rig_debug(RIG_DEBUG_VERBOSE, "SELECT_SW :"); switch ((unsigned int)data) { case 0: rig_debug(RIG_DEBUG_VERBOSE, "VFO ");break; case 1: rig_debug(RIG_DEBUG_VERBOSE, "MR ");break; case 2: rig_debug(RIG_DEBUG_VERBOSE, "RX_M");break; case 3: rig_debug(RIG_DEBUG_VERBOSE, "RX_V");break; } rig_debug(RIG_DEBUG_VERBOSE, "\n"); } static void dump_MODE_SW(unsigned char data) { rig_debug(RIG_DEBUG_VERBOSE, "MODE_SW :"); switch ((unsigned int)data) { case 0: rig_debug(RIG_DEBUG_VERBOSE, "LSB ");break; case 1: rig_debug(RIG_DEBUG_VERBOSE, "USB ");break; case 2: rig_debug(RIG_DEBUG_VERBOSE, "CW-W");break; case 3: rig_debug(RIG_DEBUG_VERBOSE, "CW-N");break; case 4: rig_debug(RIG_DEBUG_VERBOSE, "AM-W");break; case 5: rig_debug(RIG_DEBUG_VERBOSE, "AM-N");break; case 6: rig_debug(RIG_DEBUG_VERBOSE, "FSK");break; case 7: rig_debug(RIG_DEBUG_VERBOSE, "FM");break; } rig_debug(RIG_DEBUG_VERBOSE, "\n"); } static void dump_MEM_CH_SW(unsigned char data) { rig_debug(RIG_DEBUG_VERBOSE, "MEM_CH_SW :%d\n",data+1); } static void dump_STATUS_FLAG(unsigned char data) { unsigned char TX =data & 0x01; unsigned char SPLIT =data & 0x08; unsigned char VFO =data & 0x20; unsigned char CLAR =data & 0x40; rig_debug(RIG_DEBUG_VERBOSE, "STATUS_FLAG :"); if(TX) { rig_debug(RIG_DEBUG_VERBOSE, "TX "); } else { rig_debug(RIG_DEBUG_VERBOSE, "RX "); } if(SPLIT) { rig_debug(RIG_DEBUG_VERBOSE, "SPLIT "); } else { rig_debug(RIG_DEBUG_VERBOSE, "SIMPLEX "); } if(VFO) { rig_debug(RIG_DEBUG_VERBOSE, "VFO "); } else { rig_debug(RIG_DEBUG_VERBOSE, "MEMORY "); } if(CLAR) { rig_debug(RIG_DEBUG_VERBOSE, "CLAR_ON "); } else { rig_debug(RIG_DEBUG_VERBOSE, "CLAR_OFF"); } rig_debug(RIG_DEBUG_VERBOSE, "\n"); } static void dump_memory(_ft980_memory_t *memory) { if (!rig_need_debug(RIG_DEBUG_VERBOSE)) return; rig_debug(RIG_DEBUG_VERBOSE, "mem_1 :"); dump_freq(memory->mem_1); dump_vfo(memory->vfo_1); dump_mode(memory->mode_1); rig_debug(RIG_DEBUG_VERBOSE, "mem_2 :"); dump_freq(memory->mem_2); dump_vfo(memory->vfo_2); dump_mode(memory->mode_2); rig_debug(RIG_DEBUG_VERBOSE, "mem_3 :"); dump_freq(memory->mem_3); dump_vfo(memory->vfo_3); dump_mode(memory->mode_3); rig_debug(RIG_DEBUG_VERBOSE, "mem_4 :"); dump_freq(memory->mem_4); dump_vfo(memory->vfo_4); dump_mode(memory->mode_4); rig_debug(RIG_DEBUG_VERBOSE, "mem_5 :"); dump_freq(memory->mem_5); dump_vfo(memory->vfo_5); dump_mode(memory->mode_5); rig_debug(RIG_DEBUG_VERBOSE, "mem_6 :"); dump_freq(memory->mem_6); dump_vfo(memory->vfo_6); dump_mode(memory->mode_6); rig_debug(RIG_DEBUG_VERBOSE, "mem_7 :"); dump_freq(memory->mem_7); dump_vfo(memory->vfo_7); dump_mode(memory->mode_7); rig_debug(RIG_DEBUG_VERBOSE, "mem_8 :"); dump_freq(memory->mem_8); dump_vfo(memory->vfo_8); dump_mode(memory->mode_8); rig_debug(RIG_DEBUG_VERBOSE, "mem_9 :"); dump_freq(memory->mem_9); dump_vfo(memory->vfo_9); dump_mode(memory->mode_9); rig_debug(RIG_DEBUG_VERBOSE, "mem_10 :"); dump_freq(memory->mem_10); dump_vfo(memory->vfo_10); dump_mode(memory->mode_10); rig_debug(RIG_DEBUG_VERBOSE, "mem_11 :"); dump_freq(memory->mem_11); dump_vfo(memory->vfo_11); dump_mode(memory->mode_11); rig_debug(RIG_DEBUG_VERBOSE, "mem_12 :"); dump_freq(memory->mem_12); dump_vfo(memory->vfo_12); dump_mode(memory->mode_12); rig_debug(RIG_DEBUG_VERBOSE, "mem_13 :"); dump_freq(memory->mem_13); dump_vfo(memory->vfo_13); dump_mode(memory->mode_13); rig_debug(RIG_DEBUG_VERBOSE, "mem_14 :"); dump_freq(memory->mem_14); dump_vfo(memory->vfo_14); dump_mode(memory->mode_14); rig_debug(RIG_DEBUG_VERBOSE, "mem_15 :"); dump_freq(memory->mem_15); dump_vfo(memory->vfo_15); dump_mode(memory->mode_15); rig_debug(RIG_DEBUG_VERBOSE, "mem_16 :"); dump_freq(memory->mem_16); dump_vfo(memory->vfo_16); dump_mode(memory->mode_16); rig_debug(RIG_DEBUG_VERBOSE, "GEN :"); dump_freq(memory->GEN); rig_debug(RIG_DEBUG_VERBOSE, "\nHAM :"); dump_freq(memory->HAM); rig_debug(RIG_DEBUG_VERBOSE, "\n "); dump_vfo(memory->vfo); dump_mode(memory->mode); rig_debug(RIG_DEBUG_VERBOSE, "CLAR :"); dump_freq(memory->CLAR); rig_debug(RIG_DEBUG_VERBOSE, "\n"); rig_debug(RIG_DEBUG_VERBOSE, "f_1 :"); dump_freq(memory->ff_1); rig_debug(RIG_DEBUG_VERBOSE, "\n"); rig_debug(RIG_DEBUG_VERBOSE, "f_2 :"); dump_freq(memory->ff_2); rig_debug(RIG_DEBUG_VERBOSE, "\n"); rig_debug(RIG_DEBUG_VERBOSE, " "); dump_vfo(memory->vfo); dump_mode(memory->mode); rig_debug(RIG_DEBUG_VERBOSE, "LDB :"); dump_switch(memory->LDB); rig_debug(RIG_DEBUG_VERBOSE, "\n"); rig_debug(RIG_DEBUG_VERBOSE, "EXT_CTL :"); dump_switch(memory->EXT_CTL); rig_debug(RIG_DEBUG_VERBOSE, "\n"); dump_IF_SHIFT(memory->IF_SHIFT); dump_SPLIT_CODE(memory->SPLIT_CODE); dump_FSK_SHIFT(memory->FSK_SHIFT); dump_IF_WIDTH(memory->IF_WIDTH); dump_MEM_SHIFT(memory->MEM_SHIFT); dump_CLAR_FLAG(memory->CLAR_FLAG); dump_TAB_FLAG(memory->TAB_FLAG); dump_SELECT_SW(memory->SELECT_SW); rig_debug(RIG_DEBUG_VERBOSE, "OFFSET_SW :"); dump_switch(memory->OFFSET_SW); rig_debug(RIG_DEBUG_VERBOSE, "\n"); dump_MODE_SW(memory->MODE_SW); dump_MEM_CH_SW(memory->MEM_CH_SW); rig_debug(RIG_DEBUG_VERBOSE, "LOW_TAB :"); dump_freq(memory->LOW_TAB); rig_debug(RIG_DEBUG_VERBOSE, "\n"); rig_debug(RIG_DEBUG_VERBOSE, "UP_TAB :"); dump_freq(memory->UP_TAB); rig_debug(RIG_DEBUG_VERBOSE, "\n"); rig_debug(RIG_DEBUG_VERBOSE, " "); dump_vfo(memory->VFO_STATUS); dump_mode(memory->OP_MODE); rig_debug(RIG_DEBUG_VERBOSE, "OP_FREQ :"); dump_freq(memory->OP_FREQ); rig_debug(RIG_DEBUG_VERBOSE, "\n"); dump_STATUS_FLAG(memory->STATUS_FLAG); } int ft980_transaction(RIG *rig, const unsigned char *cmd, unsigned char *data, int expected_len) { int retval; char echo_back[YAESU_CMD_LENGTH]; serial_flush(&rig->state.rigport); retval = write_block(&rig->state.rigport, (const char *)cmd, YAESU_CMD_LENGTH); if (retval < 0) return retval; retval = read_block(&rig->state.rigport, echo_back, YAESU_CMD_LENGTH); if (retval < 0) return retval; if (retval != YAESU_CMD_LENGTH || memcmp(echo_back, cmd, YAESU_CMD_LENGTH)) return -RIG_EPROTO; retval = write_block(&rig->state.rigport, cmd_OK, YAESU_CMD_LENGTH); if (retval < 0) return retval; retval = read_block(&rig->state.rigport, (char *)data, expected_len); if (retval < 0) return retval; if (retval != expected_len) return -RIG_EPROTO; return RIG_OK; } int ft980_get_status_data(RIG *rig) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x01 }; struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv; int retval; if (!rig_check_cache_timeout(&priv->status_tv, FT980_CACHE_TIMEOUT)) return RIG_OK; retval = ft980_transaction(rig, cmd, (unsigned char *)&priv->update_data, 148); if (retval != RIG_OK) return retval; /* update cache date */ gettimeofday(&priv->status_tv, NULL); dump_memory(&priv->update_data); return retval; } /* * ft980_open routine * */ int ft980_open(RIG *rig) { unsigned char echo_back[YAESU_CMD_LENGTH]; struct ft980_priv_data *priv; int retval, retry_count1=0; rig_debug(RIG_DEBUG_TRACE, "%s called\n",__FUNCTION__); rig->state.priv = malloc(sizeof (struct ft980_priv_data)); if (!rig->state.priv) return -RIG_ENOMEM; priv = (struct ft980_priv_data *)rig->state.priv; memset(priv, 0, sizeof(struct ft980_priv_data)); /* send Ext Cntl ON: Activate CAT */ do { int retry_count2=0; do { retval = write_block(&rig->state.rigport, (char *) cmd_ON_OFF, YAESU_CMD_LENGTH); retval = read_block(&rig->state.rigport, (char *) echo_back, YAESU_CMD_LENGTH); } while(retval != 5 && retry_count2++ < rig->state.rigport.retry); retval = write_block(&rig->state.rigport, (char *) cmd_OK, YAESU_CMD_LENGTH); retval = read_block(&rig->state.rigport, (char *) &priv->update_data, 148); } while(!priv->update_data.EXT_CTL && retry_count1++ < rig->state.rigport.retry); return RIG_OK; } int ft980_close(RIG *rig) { unsigned char echo_back[YAESU_CMD_LENGTH]; struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv; int retval, retry_count1=0; rig_debug(RIG_DEBUG_TRACE, "%s called\n",__FUNCTION__); do { int retry_count2=0; do { retval = write_block(&rig->state.rigport, (char *) cmd_ON_OFF, YAESU_CMD_LENGTH); retval = read_block(&rig->state.rigport, (char *) echo_back, YAESU_CMD_LENGTH); } while(retval != 5 && retry_count2++ < rig->state.rigport.retry); retval = write_block(&rig->state.rigport, (char *) cmd_OK, YAESU_CMD_LENGTH); retval = read_block(&rig->state.rigport, (char *) &priv->update_data, 148); } while(priv->update_data.EXT_CTL && retry_count1++ < rig->state.rigport.retry); free (priv); return RIG_OK; } int ft980_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x08}; struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv; /* store bcd format in cmd (MSB) */ to_bcd(cmd,freq/10,8); /* Frequency set */ return ft980_transaction(rig, cmd, UPDATE_DATA_OFS(&priv->update_data,5), 5); } int ft980_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv; int retval; freq_t f; /* Frequency get */ retval = ft980_get_status_data(rig); if (retval != RIG_OK) return retval; f = from_bcd(priv->update_data.OP_FREQ, 8); *freq = f*10; /* return displayed frequency */ return RIG_OK; } #define MD_LSB 0x10 #define MD_USB 0x11 #define MD_CW 0x12 #define MD_CWN 0x13 #define MD_AM 0x14 #define MD_AMN 0x15 #define MD_RTTY 0x16 #define MD_FM 0x17 int ft980_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0A}; struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv; unsigned char md; /* * translate mode from generic to ft980 specific */ switch(mode) { case RIG_MODE_CW : md = MD_CW; break; case RIG_MODE_USB: md = MD_USB; break; case RIG_MODE_LSB: md = MD_LSB; break; case RIG_MODE_FM: md = MD_FM; break; case RIG_MODE_AM: md = MD_AM; break; case RIG_MODE_RTTY: md = MD_RTTY; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } if (width != RIG_PASSBAND_NORMAL && width < rig_passband_normal(rig, mode)) { switch(md) { case MD_CW: md = MD_CWN; break; case MD_AM: md = MD_AMN; break; } } cmd[3] = md; /* Mode set */ return ft980_transaction(rig, cmd, UPDATE_DATA_OFS(&priv->update_data,22), 22); } /* * rig_get_mode * * get mode eg AM, CW etc * */ int ft980_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { unsigned char my_mode; /* ft890 mode, mode offset */ struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv; int retval,norm; retval = ft980_get_status_data(rig); if (retval != RIG_OK) return retval; my_mode = priv->update_data.OP_MODE; rig_debug(RIG_DEBUG_TRACE, "%s: mode = 0x%02x\n", __func__, mode); /* * translate mode from ft980 to generic. */ switch(my_mode) { case 0: *mode = RIG_MODE_LSB; norm = 1; break; case 1: *mode = RIG_MODE_USB; norm = 1; break; case 2: *mode = RIG_MODE_CW; norm = 1; break; case 3: *mode = RIG_MODE_CW; norm = 0; break; case 4: *mode = RIG_MODE_AM; norm = 1; break; case 5: *mode = RIG_MODE_AM; norm = 0; break; case 6: *mode = RIG_MODE_RTTY; norm = 1; break; case 7: *mode = RIG_MODE_FM; norm = 1; break; default: return -RIG_EPROTO; /* Oops! file bug report */ } if (norm) { *width = rig_passband_normal(rig, *mode); } else { *width = rig_passband_narrow(rig, *mode); } rig_debug(RIG_DEBUG_TRACE, "%s: set mode = %i\n", __func__, *mode); rig_debug(RIG_DEBUG_TRACE, "%s: set width = %li Hz\n", __func__, *width); return RIG_OK; } int ft980_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x8e}; return -RIG_ENIMPL; /* * this can be misleading as Yaesu call it "Full duplex" * or "sat mode", and split Yaesu terms is repeater shift. */ cmd[4] = split == RIG_SPLIT_ON ? 0x0e : 0x8e; return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int ft980_set_split_freq(RIG *rig, vfo_t vfo, freq_t freq) { return -RIG_ENIMPL; } int ft980_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { return -RIG_ENIMPL; } int ft980_set_mem(RIG *rig, vfo_t vfo, int ch) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0A }; struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv; if (ch >= 16 || ch < 1) return -RIG_EINVAL; cmd[3] = ch-1; return ft980_transaction(rig, cmd, UPDATE_DATA_OFS(&priv->update_data,22), 22); } int ft980_get_mem(RIG *rig, vfo_t vfo, int *ch) { struct ft980_priv_data *priv = (struct ft980_priv_data *)rig->state.priv; int retval; retval = ft980_get_status_data(rig); if (retval != RIG_OK) return retval; *ch = priv->update_data.MEM_CH_SW + 1; return RIG_OK; } hamlib-1.2.15.3/yaesu/ft757gx.h0000644000175000017500000000657312044564477012660 00000000000000/* * hamlib - (C) Frank Singleton 2000 (vk3fcs@@ix.netcom.com) * * ft757gx.h - (C) Frank Singleton 2000 (vk3fcs@@ix.netcom.com) * This shared library provides an API for communicating * via serial interface to an FT-757GX using the "CAT" interface * box (FIF-232C) or similar (max232 + some capacitors :-) * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT757GX_H #define _FT757GX_H 1 #define FT757GX_STATUS_UPDATE_DATA_LENGTH 75 #define FT757GX_PACING_INTERVAL 0 #define FT757GX_PACING_DEFAULT_VALUE 0 #define FT757GX_WRITE_DELAY 50 /* number of BCD digits--2 digits per octet */ #define BCD_LEN 8 /* Sequential fast writes confuse my FT757GX without this delay */ #define FT757GX_POST_WRITE_DELAY 5 /* Rough safe value for default timeout */ #define FT757GX_DEFAULT_READ_TIMEOUT FT757GX_STATUS_UPDATE_DATA_LENGTH * (5 + (FT757GX_PACING_INTERVAL * FT757GX_PACING_DEFAULT_VALUE)) /* * Some useful offsets in the status update map (offset = book byte value - 1) * * Status Update Chart, FT757GXII */ #define STATUS_CURR_FREQ 5 /* Operating Frequency */ #define STATUS_CURR_MODE 9 #define STATUS_VFOA_FREQ 10 #define STATUS_VFOA_MODE 14 #define STATUS_VFOB_FREQ 15 #define STATUS_VFOB_MODE 19 /* Mode values for both set and get */ #define MODE_LSB 0x00 #define MODE_USB 0x01 #define MODE_CWW 0x02 #define MODE_CWN 0x03 #define MODE_AM 0x04 #define MODE_FM 0x05 /* TODO: get better measure numbers */ #define FT757GXII_STR_CAL { 2, { \ { 0, -60 }, /* S0 -6dB */ \ { 15, 60 } /* +60 */ \ } } #define FT757_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1 \ } /* * Receiver caps */ #define FT757GX_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) /* * TX caps */ #define FT757GX_ALL_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) /* Backend fucntion prototypes. These map to frontend functions. */ static int ft757_init(RIG *rig); static int ft757_cleanup(RIG *rig); static int ft757_open(RIG *rig); static int ft757_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft757_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ft757_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); /* select mode */ static int ft757_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); /* get mode */ static int ft757_set_vfo(RIG *rig, vfo_t vfo); /* select vfo */ static int ft757_get_vfo(RIG *rig, vfo_t *vfo); /* get vfo */ static int ft757_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); static int ft757_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); #endif /* _FT757GX_H */ hamlib-1.2.15.3/yaesu/ft1000mp.h0000644000175000017500000001337412044564477012711 00000000000000/* * ft1000mp.h - (C) Stephane Fillod 2002 (fillods@users.sourceforge.net) * * This shared library provides an API for communicating * via serial interface to an FT-1000MP using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT1000MP_H #define _FT1000MP_H 1 #define FT1000MP_STATUS_FLAGS_LENGTH 6 /* 0xfa return size */ #define FT1000MP_STATUS_UPDATE_LENGTH 16 /* 0x10 U = 02 return size */ #define FT1000MP_PACING_INTERVAL 5 #define FT1000MP_PACING_DEFAULT_VALUE 0 #define FT1000MP_WRITE_DELAY 50 /* Delay sequential fast writes */ #define FT1000MP_POST_WRITE_DELAY 5 /* Rough safe value for default timeout */ #define FT1000MP_DEFAULT_READ_TIMEOUT 28 * ( 3 + (FT1000MP_PACING_INTERVAL * FT1000MP_PACING_DEFAULT_VALUE)) /* * 8N2 and 1 start bit = 11 bits at 4800 bps => effective byte rate = 1 byte in 2.2917 msec * => 28 bytes in 64 msec * * delay for 1 byte = 2.2917 + (pace_interval * 5) * * pace_interval time to read 345 bytes * ------------ ---------------------- * * 0 64 msec * 1 321 msec * 2 642 msec * 255 16.4 sec * */ /* * Native FT1000MP functions. More to come :-) * */ enum ft1000mp_native_cmd_e { FT1000MP_NATIVE_SPLIT_OFF = 0, FT1000MP_NATIVE_SPLIT_ON, FT1000MP_NATIVE_RECALL_MEM, FT1000MP_NATIVE_VFO_TO_MEM, FT1000MP_NATIVE_VFO_A, FT1000MP_NATIVE_VFO_B, FT1000MP_NATIVE_M_TO_VFO, FT1000MP_NATIVE_RIT_ON, FT1000MP_NATIVE_RIT_OFF, FT1000MP_NATIVE_XIT_ON, FT1000MP_NATIVE_XIT_OFF, FT1000MP_NATIVE_FREQA_SET, FT1000MP_NATIVE_FREQB_SET, FT1000MP_NATIVE_MODE_SET_LSB, FT1000MP_NATIVE_MODE_SET_USB, FT1000MP_NATIVE_MODE_SET_CW, FT1000MP_NATIVE_MODE_SET_CWR, FT1000MP_NATIVE_MODE_SET_AM, FT1000MP_NATIVE_MODE_SET_AMS, FT1000MP_NATIVE_MODE_SET_FM, FT1000MP_NATIVE_MODE_SET_FMW, FT1000MP_NATIVE_MODE_SET_RTTY_LSB, FT1000MP_NATIVE_MODE_SET_RTTY_USB, FT1000MP_NATIVE_MODE_SET_DATA_LSB, FT1000MP_NATIVE_MODE_SET_DATA_FM, FT1000MP_NATIVE_PACING, FT1000MP_NATIVE_PTT_OFF, FT1000MP_NATIVE_PTT_ON, FT1000MP_NATIVE_VFO_UPDATE, FT1000MP_NATIVE_CURR_VFO_UPDATE, FT1000MP_NATIVE_UPDATE, FT1000MP_NATIVE_SIZE /* end marker, value indicates number of */ /* native cmd entries */ }; typedef enum ft1000mp_native_cmd_e ft1000mp_native_cmd_t; /* * Internal MODES - when setting modes via cmd_mode_set() * */ #define MODE_SET_LSB 0x00 #define MODE_SET_USB 0x01 #define MODE_SET_CW 0x02 #define MODE_SET_CWR 0x03 #define MODE_SET_AM 0x04 #define MODE_SET_AMS 0x05 #define MODE_SET_FM 0x06 #define MODE_SET_FMW 0x07 /* what width is that? */ #define MODE_SET_RTTYL 0x08 #define MODE_SET_RTTYU 0x09 #define MODE_SET_PKTL 0x0a #define MODE_SET_PKTU 0x0b /* * Mode Bitmap. * When READING modes * */ #define MODE_LSB 0x00 #define MODE_USB 0x01 #define MODE_CW 0x02 #define MODE_AM 0x03 #define MODE_FM 0x04 #define MODE_RTTY 0x05 #define MODE_PKT 0x06 /* relevant bits: 5,6,7 */ #define MODE_MASK 0x07 /* * Status Flag Masks when reading * */ #define SF_DLOCK 0x01 #define SF_SPLITA 0x01 #define SF_SPLITB 0x02 #define SF_CLAR 0x04 #define SF_VFOAB 0x10 /* Status byte 0, bit 4, VFO A == 0, VFO B == 1 */ #define SF_VFOMR 0x10 #define SF_RXTX 0x20 #define SF_RESV 0x40 #define SF_PRI 0x80 /* * Local VFO CMD's, according to spec * */ #define FT1000MP_VFO_A 0x00 #define FT1000MP_VFO_B 0x01 /* * Some useful offsets in the status update map (offset) * */ #define FT1000MP_SUMO_DISPLAYED_STATUS 0x00 #define FT1000MP_SUMO_DISPLAYED_FREQ 0x01 #define FT1000MP_SUMO_VFO_A_FREQ 0x01 #define FT1000MP_SUMO_VFO_B_FREQ 0x11 #define FT1000MP_SUMO_VFO_A_CLAR 0x05 #define FT1000MP_SUMO_VFO_B_CLAR 0x15 #define FT1000MP_SUMO_VFO_A_MODE 0x07 #define FT1000MP_SUMO_VFO_B_MODE 0x17 /* * API local implementation * */ int ft1000mp_init(RIG *rig); int ft1000mp_cleanup(RIG *rig); int ft1000mp_open(RIG *rig); int ft1000mp_close(RIG *rig); int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int ft1000mp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int ft1000mp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); /* select mode */ int ft1000mp_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); /* get mode */ int ft1000mp_set_vfo(RIG *rig, vfo_t vfo); /* select vfo */ int ft1000mp_get_vfo(RIG *rig, vfo_t *vfo); /* get vfo */ int ft1000mp_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); int ft1000mp_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit); int ft1000mp_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit); int ft1000mp_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit); int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int ft1000mp_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); #endif /* _FT1000MP_H */ hamlib-1.2.15.3/yaesu/ft450.c0000644000175000017500000001723312044564477012275 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft450.c - (C) Nate Bargmann 2007 (n0nb at arrl.net) * (C) Stephane Fillod 2008 * (C) Terry Embry 2008-2009 * * This shared library provides an API for communicating * via serial interface to an FT-450 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "hamlib/rig.h" #include "bandplan.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "newcat.h" #include "ft450.h" #include "idx_builtin.h" /* * ft450 rigs capabilities. * Also this struct is READONLY! * */ const struct rig_caps ft450_caps = { .rig_model = RIG_MODEL_FT450, .model_name = "FT-450", .mfg_name = "Yaesu", .version = NEWCAT_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, /* Default rate per manual */ .serial_rate_max = 38400, .serial_data_bits = 8, .serial_stop_bits = 1, /* Assumed since manual makes no mention */ .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = FT450_WRITE_DELAY, .post_write_delay = FT450_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = FT450_FUNCS, .has_set_func = FT450_FUNCS, .has_get_level = FT450_LEVELS, .has_set_level = RIG_LEVEL_SET(FT450_LEVELS), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, [LVL_CWPITCH] = { .min = { .i = 400 }, .max = { .i = 800 }, .step = { .i = 100 } }, }, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, RIG_DBLST_END, }, /* TBC */ .attenuator = { 18, RIG_DBLST_END, }, /* TBC */ .max_rit = Hz(9999), .max_xit = Hz(0), .max_ifshift = Hz(1000), .vfo_ops = FT450_VFO_OPS, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_OFF, /* May enable later as the 450 has an Auto Info command */ .bank_qty = 0, .chan_desc_sz = 0, .str_cal = FT450_STR_CAL, .chan_list = { { 1, 500, RIG_MTYPE_MEM, NEWCAT_MEM_CAP }, { 501, 504, RIG_MTYPE_EDGE, NEWCAT_MEM_CAP }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30), MHz(60), FT450_ALL_RX_MODES, -1, -1, FT450_VFO_ALL, FT450_ANTS}, /* General coverage + ham */ RIG_FRNG_END, }, /* FIXME: Are these the correct Region 1 values? */ .tx_range_list1 = { FRQ_RNG_HF(1, FT450_OTHER_TX_MODES, W(5), W(100), FT450_VFO_ALL, FT450_ANTS), FRQ_RNG_HF(1, FT450_AM_TX_MODES, W(2), W(25), FT450_VFO_ALL, FT450_ANTS), /* AM class */ FRQ_RNG_6m(1, FT450_OTHER_TX_MODES, W(5), W(100), FT450_VFO_ALL, FT450_ANTS), FRQ_RNG_6m(1, FT450_AM_TX_MODES, W(2), W(25), FT450_VFO_ALL, FT450_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30), MHz(56), FT450_ALL_RX_MODES, -1, -1, FT450_VFO_ALL, FT450_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2, FT450_OTHER_TX_MODES, W(5), W(100), FT450_VFO_ALL, FT450_ANTS), FRQ_RNG_HF(2, FT450_AM_TX_MODES, W(2), W(25), FT450_VFO_ALL, FT450_ANTS), /* AM class */ FRQ_RNG_6m(2, FT450_OTHER_TX_MODES, W(5), W(100), FT450_VFO_ALL, FT450_ANTS), FRQ_RNG_6m(2, FT450_AM_TX_MODES, W(2), W(25), FT450_VFO_ALL, FT450_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {FT450_SSB_CW_RX_MODES, Hz(10)}, /* Normal */ {FT450_SSB_CW_RX_MODES, Hz(100)}, /* Fast */ {FT450_AM_RX_MODES, Hz(100)}, /* Normal */ {FT450_AM_RX_MODES, kHz(1)}, /* Fast */ {FT450_FM_RX_MODES, Hz(100)}, /* Normal */ {FT450_FM_RX_MODES, kHz(1)}, /* Fast */ RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {FT450_CW_RTTY_PKT_RX_MODES, Hz(1800)}, /* Normal CW, RTTY, PKT/USER */ {FT450_CW_RTTY_PKT_RX_MODES, Hz(500)}, /* Narrow CW, RTTY, PKT/USER */ {FT450_CW_RTTY_PKT_RX_MODES, Hz(2400)}, /* Wide CW, RTTY, PKT/USER */ {RIG_MODE_SSB, Hz(2400)}, /* Normal SSB */ {RIG_MODE_SSB, Hz(1800)}, /* Narrow SSB */ {RIG_MODE_SSB, Hz(3000)}, /* Wide SSB */ {RIG_MODE_AM, Hz(6000)}, /* Normal AM */ {RIG_MODE_AM, Hz(3000)}, /* Narrow AM */ {FT450_FM_RX_MODES, Hz(12000)}, /* Normal FM */ {FT450_FM_RX_MODES, Hz(8000)}, /* Narrow FM */ RIG_FLT_END, }, .priv = NULL, /* private data FIXME: */ .rig_init = newcat_init, .rig_cleanup = newcat_cleanup, .rig_open = newcat_open, /* port opened */ .rig_close = newcat_close, /* port closed */ .set_freq = newcat_set_freq, .get_freq = newcat_get_freq, .set_mode = newcat_set_mode, .get_mode = newcat_get_mode, .set_vfo = newcat_set_vfo, .get_vfo = newcat_get_vfo, .set_ptt = newcat_set_ptt, .get_ptt = newcat_get_ptt, .set_split_vfo = newcat_set_split_vfo, .get_split_vfo = newcat_get_split_vfo, .set_rit = newcat_set_rit, .get_rit = newcat_get_rit, .get_func = newcat_get_func, .set_func = newcat_set_func, .get_level = newcat_get_level, .set_level = newcat_set_level, .get_mem = newcat_get_mem, .set_mem = newcat_set_mem, .vfo_op = newcat_vfo_op, .get_info = newcat_get_info, .power2mW = newcat_power2mW, .mW2power = newcat_mW2power, .set_rptr_shift = newcat_set_rptr_shift, .get_rptr_shift = newcat_get_rptr_shift, .set_ctcss_tone = newcat_set_ctcss_tone, .get_ctcss_tone = newcat_get_ctcss_tone, .set_ctcss_sql = newcat_set_ctcss_sql, .get_ctcss_sql = newcat_get_ctcss_sql, .set_powerstat = newcat_set_powerstat, .get_powerstat = newcat_get_powerstat, .get_ts = newcat_get_ts, .set_ts = newcat_set_ts, .set_trn = newcat_set_trn, .get_trn = newcat_get_trn, .set_channel = newcat_set_channel, .get_channel = newcat_get_channel, }; hamlib-1.2.15.3/yaesu/ft890.h0000644000175000017500000002643712044564477012320 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft890.h - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * (C) Stephane Fillod 2002, 2003 (fillods at users.sourceforge.net) * (C) Nate Bargmann 2002, 2003 (n0nb at arrl.net) * * This shared library provides an API for communicating * via serial interface to an FT-890 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT890_H #define _FT890_H 1 #define TRUE 1 #define FALSE 0 #define ON TRUE #define OFF FALSE #define FT890_VFO_ALL (RIG_VFO_A|RIG_VFO_B) /* Receiver caps */ #define FT890_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB) #define FT890_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB) #define FT890_AM_RX_MODES (RIG_MODE_AM) #define FT890_FM_RX_MODES (RIG_MODE_FM) /* TX caps */ #define FT890_OTHER_TX_MODES (RIG_MODE_CW| RIG_MODE_USB| RIG_MODE_LSB ) /* 100 W class */ #define FT890_AM_TX_MODES (RIG_MODE_AM ) /* set 25W max */ #define FT890_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN) /* fix */ /* * Other features (used by rig_caps) * */ #define FT890_ANTS 0 /* Returned data length in bytes */ #define FT890_MEM_CHNL_LENGTH 1 /* 0x10 P1 = 01 return size */ #define FT890_OP_DATA_LENGTH 19 /* 0x10 P1 = 03 return size */ #define FT890_VFO_DATA_LENGTH 18 /* 0x10 P1 = 03 return size -- A & B returned */ #define FT890_MEM_CHNL_DATA_LENGTH 19 /* 0x10 P1 = 04, P4 = 0x01-0x20 return size */ #define FT890_STATUS_FLAGS_LENGTH 5 /* 0xf7, 0xfa return size */ #define FT890_ALL_DATA_LENGTH 649 /* 0x10 P1 = 00 return size */ /* Timing values in mS */ #define FT890_PACING_INTERVAL 5 #define FT890_PACING_DEFAULT_VALUE 0 #define FT890_WRITE_DELAY 50 /* Delay sequential fast writes */ #define FT890_POST_WRITE_DELAY 5 /* Rough safe value for default timeout */ #define FT890_DEFAULT_READ_TIMEOUT 649 * ( 5 + (FT890_PACING_INTERVAL * FT890_PACING_DEFAULT_VALUE)) /* BCD coded frequency length */ #define FT890_BCD_DIAL 8 #define FT890_BCD_RIT 3 /* * 8N2 and 1 start bit = 11 bits at 4800 bps => effective byte * rate = 1 byte in 2.2917 msec => 649 bytes in 1487 msec * * delay for 28 bytes = (2.2917 + pace_interval) * 28 * * pace_interval time to read 28 bytes * ------------ ---------------------- * * 0 1487 msec * 1 2136 msec (backend default) * 2 2785 msec * 5 4732 msec * 255 167 sec * */ /* * Native FT890 functions. More to come :-) * */ enum ft890_native_cmd_e { FT890_NATIVE_SPLIT_OFF = 0, FT890_NATIVE_SPLIT_ON, FT890_NATIVE_RECALL_MEM, FT890_NATIVE_VFO_TO_MEM, FT890_NATIVE_VFO_A, FT890_NATIVE_VFO_B, FT890_NATIVE_MEM_TO_VFO, FT890_NATIVE_CLARIFIER_OPS, FT890_NATIVE_FREQ_SET, FT890_NATIVE_MODE_SET, FT890_NATIVE_PACING, FT890_NATIVE_PTT_OFF, FT890_NATIVE_PTT_ON, FT890_NATIVE_MEM_CHNL, FT890_NATIVE_OP_DATA, FT890_NATIVE_VFO_DATA, FT890_NATIVE_MEM_CHNL_DATA, FT890_NATIVE_TUNER_OFF, FT890_NATIVE_TUNER_ON, FT890_NATIVE_TUNER_START, FT890_NATIVE_READ_METER, FT890_NATIVE_READ_FLAGS, FT890_NATIVE_SIZE /* end marker, value indicates number of */ /* native cmd entries */ }; typedef enum ft890_native_cmd_e ft890_native_cmd_t; /* * Internal MODES - when setting modes via FT890_NATIVE_MODE_SET * */ #define MODE_SET_LSB 0x00 #define MODE_SET_USB 0x01 #define MODE_SET_CW_W 0x02 #define MODE_SET_CW_N 0x03 #define MODE_SET_AM_W 0x04 #define MODE_SET_AM_N 0x05 #define MODE_SET_FM 0x06 /* * Internal Clarifier parms - when setting clarifier via * FT890_NATIVE_CLARIFIER_OPS * * The manual seems to be incorrect with regard to P1 and P2 values * P1 = 0x00 clarifier off * P1 = 0x01 clarifier on * P1 = 0xff clarifier set * P2 = 0x00 clarifier up * P2 = 0xff clarifier down */ /* P1 values */ #define CLAR_RX_OFF 0x00 #define CLAR_RX_ON 0x01 #define CLAR_SET_FREQ 0xff /* P2 values */ #define CLAR_OFFSET_PLUS 0x00 #define CLAR_OFFSET_MINUS 0xff /* * Some useful offsets in the status update flags (offset) * SUMO--Status Update Memory Offset? * * SF_ bit tests are now grouped with flag bytes for ease of reference * * FIXME: complete flags and bits * * CAT command 0xFA requests the FT-890 to return its status flags. * These flags consist of 3 bytes (plus 2 filler bytes) and are documented * in the FT-890 manual on page 33. * */ #define FT890_SUMO_DISPLAYED_STATUS_0 0x00 /* Status flag byte 0 */ #define SF_GC (1<<1) /* General Coverage Reception selected */ #define SF_SPLIT (1<<2) /* Split active */ #define SF_MCK (1<<3) /* memory Checking in progress */ #define SF_MT (1<<4) /* Memory Tuning in progress */ #define SF_MR (1<<5) /* Memory Mode selected */ #define SF_A (0<<6) /* bit 6 clear, VFO A */ #define SF_B (1<<6) /* bit 6 set, VFO B */ #define SF_VFO (1<<7) /* bit 7 set, VFO A or B active */ #define SF_VFOA (SF_VFO|SF_A) /* bit 7 set, bit 6 clear, VFO A */ #define SF_VFOB (SF_VFO|SF_B) /* bit 7 set, bit 6 set, VFO B */ #define SF_VFO_MASK (SF_VFOB) /* bits 6 and 7 */ #define SF_MEM_MASK (SF_MCK|SF_MT|SF_MR) /* bits 3, 4 and 5 */ #define FT890_SUMO_DISPLAYED_STATUS_1 0x01 /* Status flag byte 1 */ #define FT890_SUMO_DISPLAYED_STATUS_2 0x02 /* Status flag byte 1 */ #define SF_PTT_OFF (0<<7) /* bit 7 set, PTT open */ #define SF_PTT_ON (1<<7) /* bit 7 set, PTT closed */ #define SF_PTT_MASK (SF_PTT_ON) /* * Offsets for VFO record retrieved via 0x10 P1 = 02, 03, 04 * * The FT-890 returns frequency and mode data via three seperate commands. * CAT command 0x10, P1 = 02 returns the current main and sub displays' data (19 bytes) * CAT command 0x10, P1 = 03 returns VFO A & B data (18 bytes) * CAT command 0x10, P1 = 04, P4 = 0x01-0x20 returns memory channel data (19 bytes) * In all cases the format is (from the FT-890 manual page 32): * * Offset Value * 0x00 Band Selection (BPF selection: 0x00 - 0x30 (bit 7 =1 on a blanked memory)) * 0x01 Operating Frequency (Hex value of display--Not BCD!) * 0x04 Clarifier Offset (signed value between -999d (0xfc19) and +999d (0x03e7)) * 0x06 Mode Data * 0x07 CTCSS tone code (0x00 - 0x20) * 0x08 Flags (Operating flags -- manual page 33) * * Memory Channel data has the same layout and offsets as the operating * data record. * When either of the 19 byte records is read (P1 = 02, 04), the offset is * +1 as the leading byte is the memory channel number. * The VFO data command (P1 = 03) returns 18 bytes and the VFO B data has * the same layout, but the offset starts at 0x09 and continues through 0x12 * */ #define FT890_SUMO_MEM_CHANNEL 0x00 /* Memory Channel from 0xfa, P1 = 1 */ #define FT890_SUMO_DISPLAYED_FREQ 0x02 /* Current main display, can be VFO A, Memory data, Memory tune (3 bytes) */ #define FT890_SUMO_DISPLAYED_CLAR 0x05 /* RIT offset -- current display */ #define FT890_SUMO_DISPLAYED_MODE 0x07 /* Current main display mode */ #define FT890_SUMO_DISPLAYED_FLAG 0x09 #define FT890_SUMO_VFO_A_FREQ 0x01 /* VFO A frequency, not necessarily currently displayed! */ #define FT890_SUMO_VFO_A_CLAR 0x04 /* RIT offset -- VFO A */ #define FT890_SUMO_VFO_A_MODE 0x06 /* VFO A mode, not necessarily currently displayed! */ #define FT890_SUMO_VFO_A_FLAG 0x08 #define FT890_SUMO_VFO_B_FREQ 0x0a /* Current sub display && VFO B */ #define FT890_SUMO_VFO_B_CLAR 0x0d /* RIT offset -- VFO B */ #define FT890_SUMO_VFO_B_MODE 0x0f /* Current sub display && VFO B */ #define FT890_SUMO_VFO_B_FLAG 0x11 /* * Read meter offset * * FT-890 returns the level of the S meter when in RX and ALC or PO or SWR * when in TX. The level is replicated in the first four bytes sent by the * rig with the final byte being a constant 0xf7 * * The manual states that the returned value will range between 0x00 and 0xff * while "in practice the highest value returned will be around 0xf0". The * manual is silent when this value is returned as my rig returns 0x00 for * S0, 0x44 for S9 and 0x9D for S9 +60. * */ #define FT890_SUMO_METER 0x00 /* Meter level */ /* * Narrow filter selection flag from offset 0x08 or 0x11 * in VFO/Memory Record * * used when READING modes from FT-890 * */ #define FLAG_AM_N (1<<6) #define FLAG_CW_N (1<<7) #define FLAG_MASK (FLAG_AM_N|FLAG_CW_N) /* * Mode Bitmap from offset 0x06 or 0x0f in VFO/Memory Record. * * used when READING modes from FT-890 * */ #define MODE_LSB 0x00 #define MODE_USB 0x01 #define MODE_CW 0x02 #define MODE_AM 0x03 #define MODE_FM 0x04 /* All relevant bits */ #define MODE_MASK (MODE_LSB|MODE_USB|MODE_CW|MODE_AM|MODE_FM) /* * Command string parameter offsets */ #define P1 3 #define P2 2 #define P3 1 #define P4 0 /* * API local implementation * */ static int ft890_init(RIG *rig); static int ft890_cleanup(RIG *rig); static int ft890_open(RIG *rig); static int ft890_close(RIG *rig); static int ft890_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft890_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ft890_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ft890_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int ft890_set_vfo(RIG *rig, vfo_t vfo); static int ft890_get_vfo(RIG *rig, vfo_t *vfo); static int ft890_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); static int ft890_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); static int ft890_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int ft890_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); static int ft890_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); static int ft890_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit); static int ft890_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static int ft890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int ft890_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); #endif /* _FT890_H */ hamlib-1.2.15.3/yaesu/ft5000.h0000644000175000017500000001075112044564477012354 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft5000.h - (C) Nate Bargmann 2007 (n0nb at arrl.net) * (C) Stephane Fillod 2008-2010 * * This shared library provides an API for communicating * via serial interface to an FT-DX5000 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT5000_H #define _FT5000_H 1 #if 0 #define TRUE 1 #define FALSE 0 #define ON TRUE #define OFF FALSE #endif #define FTDX5000_VFO_ALL (RIG_VFO_A|RIG_VFO_B) /* Receiver caps */ #define FTDX5000_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|\ RIG_MODE_RTTY|RIG_MODE_RTTYR|\ RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM) #define FTDX5000_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|\ RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB) #define FTDX5000_AM_RX_MODES (RIG_MODE_AM) #define FTDX5000_FM_RX_MODES (RIG_MODE_FM|RIG_MODE_PKTFM) #define FTDX5000_CW_RTTY_PKT_RX_MODES (RIG_MODE_RTTY|RIG_MODE_RTTYR|\ RIG_MODE_PKTUSB|RIG_MODE_PKTLSB|RIG_MODE_CW|RIG_MODE_CWR) /* TRX caps */ #define FTDX5000_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY| \ RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM) /* 100 W class */ #define FTDX5000_AM_TX_MODES (RIG_MODE_AM) /* set 25W max */ /* TBC */ #define FTDX5000_LEVELS (RIG_LEVEL_ATT|RIG_LEVEL_PREAMP|\ RIG_LEVEL_ALC|RIG_LEVEL_RAWSTR|RIG_LEVEL_SWR|\ RIG_LEVEL_RFPOWER|RIG_LEVEL_RF|RIG_LEVEL_SQL|\ RIG_LEVEL_MICGAIN|RIG_LEVEL_IF|RIG_LEVEL_CWPITCH|\ RIG_LEVEL_KEYSPD|RIG_LEVEL_AF|RIG_LEVEL_AGC|\ RIG_LEVEL_METER|RIG_LEVEL_BKINDL|RIG_LEVEL_SQL|\ RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY|RIG_LEVEL_COMP|\ RIG_LEVEL_ANTIVOX|RIG_LEVEL_NR|RIG_LEVEL_NOTCHF) /* TBC */ #define FTDX5000_FUNCS (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_LOCK|\ RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\ RIG_FUNC_FBKIN|RIG_FUNC_COMP|RIG_FUNC_ANF|RIG_FUNC_MN) /* TBC */ #define FTDX5000_VFO_OPS (RIG_OP_TUNE|RIG_OP_CPY|RIG_OP_XCHG|\ RIG_OP_UP|RIG_OP_DOWN|RIG_OP_BAND_UP|RIG_OP_BAND_DOWN|\ RIG_OP_TO_VFO|RIG_OP_FROM_VFO|RIG_OP_TOGGLE) /* TBC */ #define FTDX5000_STR_CAL { 16, \ { \ { 0, -54 }, /* S0 */ \ { 12, -48 }, /* S1 */ \ { 27, -42 }, /* S2 */ \ { 40, -36 }, /* S3 */ \ { 55, -30 }, /* S4 */ \ { 65, -24 }, /* S5 */ \ { 80, -18 }, /* S6 */ \ { 95, -12 }, /* S7 */ \ { 112, -6 }, /* S8 */ \ { 130, 0 }, /* S9 */ \ { 150, 10 }, /* +10 */ \ { 172, 20 }, /* +20 */ \ { 190, 30 }, /* +30 */ \ { 220, 40 }, /* +40 */ \ { 240, 50 }, /* +50 */ \ { 255, 60 }, /* +60 */ \ } } /* * Other features (used by rig_caps) * */ #define FTDX5000_TX_ANTS (RIG_ANT_1|RIG_ANT_2) #define FTDX5000_MEM_CHNL_LENGTH 1 /* 0x10 P1 = 01 return size */ #define FTDX5000_OP_DATA_LENGTH 19 /* 0x10 P1 = 03 return size */ #define FTDX5000_VFO_DATA_LENGTH 18 /* 0x10 P1 = 03 return size -- A & B returned */ #define FTDX5000_MEM_CHNL_DATA_LENGTH 19 /* 0x10 P1 = 04, P4 = 0x01-0x20 return size */ #define FTDX5000_STATUS_FLAGS_LENGTH 5 /* 0xf7, 0xfa return size */ #define FTDX5000_ALL_DATA_LENGTH 649 /* 0x10 P1 = 00 return size */ /* Timing values in mS */ // #define FTDX5000_PACING_INTERVAL 5 // #define FTDX5000_PACING_DEFAULT_VALUE 0 /* Delay between bytes sent to FT-5000 * Should not exceed value set in CAT TOT menu (rig default is 10 mSec) */ #define FTDX5000_WRITE_DELAY 0 /* Delay sequential fast writes */ #define FTDX5000_POST_WRITE_DELAY 5 #endif /* _FT5000_H */ hamlib-1.2.15.3/yaesu/vx1700.h0000644000175000017500000001624512044564477012407 00000000000000/* * Copyright (c) 2010-2011 by Mikhail Kshevetskiy (mikhail.kshevetskiy@gmail.com) * * Code based on VX-1700 CAT manual: * http://www.vertexstandard.com/downloadFile.cfm?FileID=3397&FileCatID=135&FileName=VX-1700_CAT_MANUAL_10_14_2008.pdf&FileContentType=application%2Fpdf * * WARNING: this manual have two errors * 1) Status Update Command (10h), U=01 returns 0..199 for channels 1..200 * 2) Frequency Data (bytes 1--4 of 9-Byte VFO Data Assignment, Status Update * Command (10h), U=02 and U=03) uses bytes 1--3 for frequency, byte 4 is * not used and always zero. Thus bytes 0x15,0xBE,0x68,0x00 means * frequency = 10 * 0x15BE68 = 10 * 1425000 = 14.25 MHz * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _VX1700_H #define _VX1700_H 1 #include #include #define VX1700_MIN_CHANNEL 1 #define VX1700_MAX_CHANNEL 200 #define VX1700_MODES (RIG_MODE_SSB | RIG_MODE_CW | RIG_MODE_AM | RIG_MODE_SAL | RIG_MODE_SAH) #define VX1700_VFO_ALL (RIG_VFO_A|RIG_VFO_MEM) #define VX1700_ANTS RIG_ANT_1 #define VX1700_VFO_OPS (RIG_OP_UP|RIG_OP_DOWN|RIG_OP_TO_VFO|RIG_OP_FROM_VFO) #define VX1700_FILTER_WIDTH_NARROW kHz(0.5) #define VX1700_FILTER_WIDTH_WIDE kHz(2.2) #define VX1700_FILTER_WIDTH_SSB kHz(2.2) #define VX1700_FILTER_WIDTH_AM kHz(6.0) /* Returned data length in bytes */ #define VX1700_MEM_CHNL_LENGTH 1 /* 0x10 p1=01 return size */ #define VX1700_OP_DATA_LENGTH 19 /* 0x10 p1=02 return size */ #define VX1700_VFO_DATA_LENGTH 18 /* 0x10 p1=03 return size */ #define VX1700_READ_METER_LENGTH 5 /* 0xf7 return size */ #define VX1700_STATUS_FLAGS_LENGTH 5 /* 0xfa return size */ /* BCD coded frequency length */ #define VX1700_BCD_DIAL 8 // VX-1700 native commands typedef enum vx1700_native_cmd_e { VX1700_NATIVE_RECALL_MEM = 0, /* 0x02, p1=ch */ VX1700_NATIVE_VFO_TO_MEM, /* 0x03, p1=ch, p2=0 */ VX1700_NATIVE_MEM_HIDE, /* 0x03, p1=ch, p2=1 */ VX1700_NATIVE_VFO_A, /* 0x05 */ VX1700_NATIVE_FREQ_SET, /* 0x0a, p1:4=freq */ VX1700_NATIVE_MODE_SET_LSB, /* 0x0c, p1=0x00 */ VX1700_NATIVE_MODE_SET_USB, /* 0x0c, p1=0x01 */ VX1700_NATIVE_MODE_SET_CW_W, /* 0x0c, p1=0x02 */ VX1700_NATIVE_MODE_SET_CW_N, /* 0x0c, p1=0x03 */ VX1700_NATIVE_MODE_SET_AM, /* 0x0c, p1=0x04 */ VX1700_NATIVE_MODE_SET_RTTY_LSB_W, /* 0x0c, p1=0x08 */ VX1700_NATIVE_MODE_SET_RTTY_USB_W, /* 0x0c, p1=0x09 */ VX1700_NATIVE_MODE_SET_H3E, /* 0x0c, p1=0x0d */ VX1700_NATIVE_MODE_SET_RTTY_LSB_N, /* 0x0c, p1=0x0e */ VX1700_NATIVE_MODE_SET_RTTY_USB_N, /* 0x0c, p1=0x0f */ VX1700_NATIVE_PTT_OFF, /* 0x0f, p1=0 */ VX1700_NATIVE_PTT_ON, /* 0x0f, p1=1 */ VX1700_NATIVE_UPDATE_MEM_CHNL, /* 0x10, p1=1 */ VX1700_NATIVE_UPDATE_OP_DATA, /* 0x10, p1=2 */ VX1700_NATIVE_UPDATE_VFO_DATA, /* 0x10, p1=3 */ VX1700_NATIVE_TX_POWER_LOW, /* 0x18 */ VX1700_NATIVE_TX_POWER_MID, /* 0x28 */ VX1700_NATIVE_TX_POWER_HI, /* 0x48 */ VX1700_NATIVE_CPY_RX_TO_TX, /* 0x85 */ VX1700_NATIVE_TX_FREQ_SET, /* 0x8a, p1:4=freq */ VX1700_NATIVE_OP_FREQ_STEP_UP, /* 0x8e, p1=0 */ VX1700_NATIVE_OP_FREQ_STEP_DOWN, /* 0x8e, p1=1 */ VX1700_NATIVE_READ_METER, /* 0xf7 */ VX1700_NATIVE_READ_FLAGS, /* 0xfa */ VX1700_NATIVE_SIZE } vx1700_native_cmd_t; // OpCode Declarations #define VX1700_CMD_RECALLMEM 0x02 #define VX1700_CMD_VFO2MEM 0x03 #define VX1700_CMD_SEL_VFOA 0x05 #define VX1700_CMD_SET_VFOA 0x0a #define VX1700_CMD_SEL_OP_MODE 0x0c #define VX1700_CMD_PTT 0x0f #define VX1700_CMD_UPDATE 0x10 #define VX1700_CMD_RX2TX 0x85 #define VX1700_CMD_STEP_VFO 0x8e #define VX1700_CMD_RD_METER 0xf7 #define VX1700_CMD_RD_FLAGS 0xfa // Return codes #define VX1700_CMD_RETCODE_OK 0x00 #define VX1700_CMD_RETCODE_ERROR 0xF0 // Operating Mode Status #define VX1700_MODE_LSB 0x00 #define VX1700_MODE_USB 0x01 #define VX1700_MODE_CW_W 0x02 #define VX1700_MODE_CW_N 0x03 #define VX1700_MODE_AM 0x04 #define VX1700_MODE_RTTY 0x05 // Operation Mode Selection #define VX1700_OP_MODE_LSB 0x00 #define VX1700_OP_MODE_USB 0x01 #define VX1700_OP_MODE_CW_W 0x02 #define VX1700_OP_MODE_CW_N 0x03 #define VX1700_OP_MODE_AM 0x04 #define VX1700_OP_MODE_RTTY_LSB_W 0x08 #define VX1700_OP_MODE_RTTY_USB_W 0x09 #define VX1700_OP_MODE_H3E 0x0d #define VX1700_OP_MODE_RTTY_LSB_N 0x0e #define VX1700_OP_MODE_RTTY_USB_N 0x0f // Status Flag 1 Masks #define VX1700_SF_LOCKED 0x01 /* LOCK is activated */ #define VX1700_SF_MEM 0x20 /* Memory Mode */ #define VX1700_SF_VFO 0x80 /* VFO Mode */ // Status Flag 2 Masks #define VX1700_SF_PTT_BY_CAT 0x01 /* PTT closed by CAT */ #define VX1700_SF_MEM_SCAN_PAUSE 0x02 /* Scanning paused */ #define VX1700_SF_MEM_SCAN 0x04 /* Scanning enabled */ #define VX1700_SF_RTTY_FILTER_NARROW 0x08 /* Narrow RTTY filter selected */ #define VX1700_SF_CW_FILTER_NARROW 0x10 /* Narrow CW filter selected */ #define VX1700_SF_RTTY_USB 0x20 /* USB selected for RTTY */ // Status Flag 3 Masks #define VX1700_SF_10W_TX 0x20 /* 10 Watt TX output selected */ #define VX1700_SF_TUNER_ON 0x20 /* Antenna Tuner working */ #define VX1700_SF_TRANSMISSION_ON 0x80 /* Transmission in progress */ /* HAMLIB API implementation */ static int vx1700_init(RIG *rig); static int vx1700_open(RIG *rig); static int vx1700_cleanup(RIG *rig); static const char * vx1700_get_info(RIG *rig); static int vx1700_set_vfo(RIG *rig, vfo_t vfo); static int vx1700_get_vfo(RIG *rig, vfo_t *vfo); static int vx1700_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int vx1700_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int vx1700_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq); static int vx1700_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq); static int vx1700_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int vx1700_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int vx1700_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); static int vx1700_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); static int vx1700_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static int vx1700_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); static int vx1700_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int vx1700_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int vx1700_set_mem(RIG *rig, vfo_t vfo, int ch); static int vx1700_get_mem(RIG *rig, vfo_t vfo, int *ch); static int vx1700_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); #endif /* _VX1700_H */ hamlib-1.2.15.3/yaesu/ft990.c0000644000175000017500000024455612044564477012320 00000000000000/* * hamlib - (C) Stephane Fillod 2002-2010 (fillods at users.sourceforge.net) * (C) Terry Embry 2009 * * ft990.c - (C) Berndt Josef Wulf (wulf at ping.net.au) * * This shared library provides an API for communicating * via serial interface to an FT-990 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "bandplan.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "ft990.h" /* FT1000D */ #define FT1000D_OP_DATA_LENGTH 16 /* Private helper function prototypes */ static int ft990_get_update_data(RIG *rig, unsigned char ci, unsigned short ch); static int ft990_send_static_cmd(RIG *rig, unsigned char ci); static int ft990_send_dynamic_cmd(RIG *rig, unsigned char ci, unsigned char p1, unsigned char p2, unsigned char p3, unsigned char p4); static int ft990_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq); static int ft990_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit); static const yaesu_cmd_set_t ncmd[] = { { 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* Split (OFF) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* Split (On) */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* Recall Memory */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* Memory Operations */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x04 } }, /* Lock (OFF) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x04 } }, /* Lock (ON) */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* Select VFO (A) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* Select VFO (B) */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x06 } }, /* Copy Memory Data to VFO A */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* OP Freq Up 0.1MHz */ { 1, { 0x00, 0x00, 0x01, 0x00, 0x07 } }, /* OP Freq Up 1MHz */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* OP Freq Down 0.1MHz */ { 1, { 0x00, 0x00, 0x01, 0x00, 0x08 } }, /* OP Freq Down 1MHz */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, /* RX Clarifier (OFF) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x09 } }, /* RX Clarifier (ON) */ { 1, { 0x00, 0x00, 0x00, 0x80, 0x09 } }, /* TX Clarifier (OFF) */ { 1, { 0x00, 0x00, 0x00, 0x81, 0x09 } }, /* TX Clarifier (ON) */ { 1, { 0x00, 0x00, 0x00, 0xff, 0x09 } }, /* Clear Clarifier Offset */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, /* Clarifier */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* Set Op Freq */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* OP Mode Set LSB */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0c } }, /* OP Mode Set USB */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x0c } }, /* OP Mode Set CW 2.4KHz */ { 1, { 0x00, 0x00, 0x00, 0x03, 0x0c } }, /* OP Mode Set CW 500Hz */ { 1, { 0x00, 0x00, 0x00, 0x04, 0x0c } }, /* OP Mode Set AM 6KHz */ { 1, { 0x00, 0x00, 0x00, 0x05, 0x0c } }, /* OP Mode Set AM 2.4KHz */ { 1, { 0x00, 0x00, 0x00, 0x06, 0x0c } }, /* OP Mode Set FM */ { 1, { 0x00, 0x00, 0x00, 0x08, 0x0c } }, /* OP Mode Set RTTY LSB */ { 1, { 0x00, 0x00, 0x00, 0x09, 0x0c } }, /* OP Mode Set RTTY USB */ { 1, { 0x00, 0x00, 0x00, 0x0a, 0x0c } }, /* OP Mode Set PKT LSB */ { 1, { 0x00, 0x00, 0x00, 0x0b, 0x0c } }, /* OP Mode Set PKT FM */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0e } }, /* Pacing */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0f } }, /* PTT (OFF) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0f } }, /* PTT (ON) */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x10 } }, /* Update All Data (1508 bytes) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x10 } }, /* Update Memory Ch Number */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x10 } }, /* Update Op Data */ { 1, { 0x00, 0x00, 0x00, 0x03, 0x10 } }, /* Update VFO Data */ { 0, { 0x00, 0x00, 0x00, 0x04, 0x10 } }, /* Update Memory Ch Data */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x81 } }, /* Tuner (OFF) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x81 } }, /* Tuner (ON) */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x82 } }, /* Tuner (Start) */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x84 } }, /* Repeater Mode (OFF) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x84 } }, /* Repeater Mode (Minus) */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x84 } }, /* Repeater Mode (Plus) */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x85 } }, /* Copy displayed VFO (A=B || B=A) */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x8C } }, /* Select Bandwidth */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x8E } }, /* Step Operating Frequency Up */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x8E } }, /* Step Operating Frequency Down */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xf7 } }, /* Read Meter */ { 0, { 0x00, 0x00, 0x00, 0x00, 0xf8 } }, /* DIM Level */ { 0, { 0x00, 0x00, 0x00, 0x00, 0xf9 } }, /* Set Offset for Repeater Shift */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xfa } }, /* Read Status Flags */ }; /* * Private data */ struct ft990_priv_data { unsigned char pacing; /* pacing value */ unsigned int read_update_delay; /* depends on pacing value */ vfo_t current_vfo; /* active VFO from last cmd */ unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of CAT cmd */ yaesu_cmd_set_t pcs[FT990_NATIVE_SIZE]; /* private cmd set */ ft990_update_data_t update_data; /* returned data */ }; /* * ft990 rigs capabilities. */ #define FT990_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .rit = 1, \ .xit = 1, \ .rptr_shift = 1, \ .flags = 1, \ } const struct rig_caps ft990_caps = { .rig_model = RIG_MODEL_FT990, .model_name = "FT-990", .mfg_name = "Yaesu", .version = "0.2.1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT990_WRITE_DELAY, .post_write_delay = FT990_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = RIG_FUNC_LOCK | RIG_FUNC_TUNER | RIG_FUNC_MON, .has_set_func = RIG_FUNC_LOCK | RIG_FUNC_TUNER, .has_get_level = RIG_LEVEL_STRENGTH | RIG_LEVEL_SWR | RIG_LEVEL_ALC | \ RIG_LEVEL_RFPOWER | RIG_LEVEL_COMP, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_BACKLIGHT, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(1200), .vfo_ops = RIG_OP_CPY | RIG_OP_FROM_VFO | RIG_OP_TO_VFO | RIG_OP_UP | RIG_OP_DOWN | RIG_OP_TUNE | RIG_OP_TOGGLE, .targetable_vfo = RIG_TARGETABLE_ALL, .transceive = RIG_TRN_OFF, /* Yaesus have to be polled, sigh */ .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { {1, 90, RIG_MTYPE_MEM, FT990_MEM_CAP}, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100), MHz(30), FT990_ALL_RX_MODES, -1, -1, FT990_VFO_ALL, FT990_ANTS}, /* General coverage + ham */ RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1, FT990_OTHER_TX_MODES, W(5), W(100), FT990_VFO_ALL, FT990_ANTS), FRQ_RNG_HF(1, FT990_AM_TX_MODES, W(2), W(25), FT990_VFO_ALL, FT990_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100), MHz(30), FT990_ALL_RX_MODES, -1, -1, FT990_VFO_ALL, FT990_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2, FT990_OTHER_TX_MODES, W(5), W(100), FT990_VFO_ALL, FT990_ANTS), FRQ_RNG_HF(2, FT990_AM_TX_MODES, W(2), W(25), FT990_VFO_ALL, FT990_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {FT990_SSB_CW_RX_MODES, Hz(10)}, /* Normal */ {FT990_SSB_CW_RX_MODES, Hz(100)}, /* Fast */ {FT990_AM_RX_MODES, Hz(100)}, /* Normal */ {FT990_AM_RX_MODES, kHz(1)}, /* Fast */ {FT990_FM_RX_MODES, Hz(100)}, /* Normal */ {FT990_FM_RX_MODES, kHz(1)}, /* Fast */ {FT990_RTTY_RX_MODES, Hz(10)}, /* Normal */ {FT990_RTTY_RX_MODES, Hz(100)}, /* Fast */ RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_SSB, RIG_FLT_ANY}, /* Enable all filters for SSB */ {RIG_MODE_CW, RIG_FLT_ANY}, /* Enable all filters for CW */ {RIG_MODE_RTTY, RIG_FLT_ANY}, /* Enable all filters for RTTY */ {RIG_MODE_RTTYR,RIG_FLT_ANY}, /* Enable all filters for Reverse RTTY */ {RIG_MODE_PKTLSB,RIG_FLT_ANY},/* Enable all filters for Packet Radio LSB */ {RIG_MODE_AM, kHz(6)}, /* normal AM filter */ {RIG_MODE_AM, kHz(2.4)}, /* narrow AM filter */ {RIG_MODE_FM, kHz(8)}, /* FM standard filter */ {RIG_MODE_PKTFM,kHz(8)}, /* FM standard filter for Packet Radio FM */ RIG_FLT_END, }, .priv = NULL, /* private data FIXME: */ .rig_init = ft990_init, .rig_cleanup = ft990_cleanup, .rig_open = ft990_open, /* port opened */ .rig_close = ft990_close, /* port closed */ .set_freq = ft990_set_freq, .get_freq = ft990_get_freq, .set_mode = ft990_set_mode, .get_mode = ft990_get_mode, .set_vfo = ft990_set_vfo, .get_vfo = ft990_get_vfo, .set_ptt = ft990_set_ptt, .get_ptt = ft990_get_ptt, .set_rptr_shift = ft990_set_rptr_shift, .get_rptr_shift = ft990_get_rptr_shift, .set_rptr_offs = ft990_set_rptr_offs, .set_split_vfo = ft990_set_split_vfo, .get_split_vfo = ft990_get_split_vfo, .set_rit = ft990_set_rit, .get_rit = ft990_get_rit, .set_xit = ft990_set_xit, .get_xit = ft990_get_xit, .set_func = ft990_set_func, .get_func = ft990_get_func, .set_parm = ft990_set_parm, .get_level = ft990_get_level, .set_mem = ft990_set_mem, .get_mem = ft990_get_mem, .vfo_op = ft990_vfo_op, .set_channel = ft990_set_channel, .get_channel = ft990_get_channel, }; /* * ************************************ * * Hamlib API functions * * ************************************ */ /* * rig_init */ int ft990_init(RIG *rig) { struct ft990_priv_data *priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft990_priv_data *)malloc(sizeof(struct ft990_priv_data)); if (!priv) return -RIG_ENOMEM; // Copy native cmd set to private cmd storage area memcpy(priv->pcs, ncmd, sizeof(ncmd)); // Set default pacing value priv->pacing = FT990_PACING_DEFAULT_VALUE; // Set update timeout priv->read_update_delay = FT990_DEFAULT_READ_TIMEOUT; // Set operating vfo mode to current VFO priv->current_vfo = RIG_VFO_MAIN; rig->state.priv = (void *)priv; return RIG_OK; } /* * rig_cleanup */ int ft990_cleanup(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * rig_open */ int ft990_open(RIG *rig) { struct rig_state *rig_s; struct ft990_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft990_priv_data *)rig->state.priv; rig_s = &rig->state; rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n", __func__, rig_s->rigport.write_delay); rig_debug(RIG_DEBUG_TRACE, "%s: post_write_delay = %i msec\n", __func__, rig_s->rigport.post_write_delay); rig_debug(RIG_DEBUG_TRACE, "%s: read pacing = %i\n", __func__, priv->pacing); err = ft990_send_dynamic_cmd(rig, FT990_NATIVE_PACING, priv->pacing, 0, 0, 0); if (err != RIG_OK) return err; // Get current rig settings and status err = ft990_get_update_data(rig, FT990_NATIVE_UPDATE_OP_DATA, 0); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_close */ int ft990_close(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; return RIG_OK; } /* * rig_set_freq* * * Set frequency for a given VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * freq | input | 100000 - 30000000 * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing currVFO to vfo will use the currently selected VFO * obtained from the priv->current_vfo data structure. * In all other cases the passed vfo is selected if it differs * from the currently selected VFO. */ int ft990_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct ft990_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq); // Frequency range sanity check if (freq < 100000 || freq > 30000000) return -RIG_EINVAL; priv = (struct ft990_priv_data *)rig->state.priv; // Set to selected VFO if(vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE,"%s: priv->current.vfo = 0x%02x\n", __func__, vfo); } else { if (vfo != priv->current_vfo) { err = ft990_set_vfo(rig, vfo); if (err != RIG_OK) return err; } } err = ft990_send_dial_freq(rig, FT990_NATIVE_FREQ_SET, freq); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_freq* * * Get frequency for a given VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, Main, VFO, VFOA, VFOB, MEM * freq * | output | 100000 - 30000000 * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing currVFO to vfo will use the currently selected VFO * obtained from the priv->current_vfo data structure. * In all other cases the passed vfo is selected if it differs * from the currently selected VFO. */ int ft990_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft990_priv_data *priv; unsigned char *p; freq_t f; int err; int ci; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); if (!rig) return -RIG_EINVAL; priv = (struct ft990_priv_data *)rig->state.priv; if(vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE,"%s: priv->current.vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: p = priv->update_data.vfoa.basefreq; ci = FT990_NATIVE_UPDATE_VFO_DATA; break; case RIG_VFO_B: p = priv->update_data.vfob.basefreq; ci = FT990_NATIVE_UPDATE_VFO_DATA; break; case RIG_VFO_MEM: case RIG_VFO_MAIN: p = priv->update_data.current_front.basefreq; ci = FT990_NATIVE_UPDATE_OP_DATA; break; default: return -RIG_EINVAL; } // Get update data structure to obtain get frequency err = ft990_get_update_data(rig, ci, 0); if (err != RIG_OK) return err; /* big endian integer */ f = ((((p[0]<<8) + p[1])<<8) + p[2]) * 10; rig_debug(RIG_DEBUG_TRACE, "%s: p0=0x%02x p1=0x%02x p2=0x%02x\n", __func__, p[0], p[1], p[2]); rig_debug(RIG_DEBUG_TRACE, "%s: freq = %"PRIfreq" Hz for vfo 0x%02x\n", __func__, f, vfo); // Frequency sanity check if (f<100000 || f>30000000) return -RIG_EINVAL; *freq = f; return RIG_OK; } /* * rig_set_ptt* * * Control PTT for a given VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * ptt | input | 0 = off, 1 = off * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing currVFO to vfo will use the currently selected VFO * obtained from the priv->current_vfo data structure. * In all other cases the passed vfo is selected if it differs * from the currently selected VFO. */ int ft990_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { struct ft990_priv_data *priv; int err; unsigned char ci; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt); priv = (struct ft990_priv_data *) rig->state.priv; // Set to selected VFO if(vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE,"%s: priv->current.vfo = 0x%02x\n", __func__, vfo); } else { if (vfo != priv->current_vfo) { err = ft990_set_vfo(rig, vfo); if (err != RIG_OK) return err; } } switch(ptt) { case RIG_PTT_ON: ci = FT990_NATIVE_PTT_ON; break; case RIG_PTT_OFF: ci = FT990_NATIVE_PTT_OFF; break; default: return -RIG_EINVAL; } err = ft990_send_static_cmd(rig, ci); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_ptt* * * Get PTT line status * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, Main, VFO, VFOA, VFOB, MEM * ptt * | output | 0 = off, 1 = on * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: The passed value for the vfo is ignored since the PTT status * is independent from the VFO selection. */ int ft990_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct ft990_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft990_priv_data *) rig->state.priv; err = ft990_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0); if(err != RIG_OK) return err; *ptt = ((priv->update_data.flag1 & FT990_SF_XMIT) != 0); rig_debug(RIG_DEBUG_TRACE, "%s: set ptt = 0x%02x\n", __func__, *ptt); return RIG_OK; } /* * rig_set_rptr_shift* * * Set repeater shift for a given VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * freq | input | - = negative repeater shift, * | | + = positive repeater shift, * | | any other character = simplex (is this a bug?) * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing currVFO to vfo will use the currently selected VFO * obtained from the priv->current_vfo data structure. * In all other cases the passed vfo is selected if it differs * from the currently selected VFO. * Repeater shift can only be set when in FM mode. */ int ft990_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift) { struct ft990_priv_data *priv; unsigned char ci; char *p; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed rptr_shift = 0x%02x\n", __func__, rptr_shift); priv = (struct ft990_priv_data *) rig->state.priv; // Set to selected VFO if(vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE,"%s: priv->current.vfo = 0x%02x\n", __func__, vfo); } else { if (vfo != priv->current_vfo) { err = ft990_set_vfo(rig, vfo); if (err != RIG_OK) return err; } } // Construct update query switch(vfo) { case RIG_VFO_A: p = (char *) &priv->update_data.vfoa.mode; ci = FT990_NATIVE_UPDATE_VFO_DATA; break; case RIG_VFO_B: p = (char *) &priv->update_data.vfob.mode; ci = FT990_NATIVE_UPDATE_VFO_DATA; break; case RIG_VFO_MEM: p = (char *) &priv->update_data.current_front.mode; ci = FT990_NATIVE_UPDATE_OP_DATA; break; default: return -RIG_EINVAL; } // Get update for selected VFO err = ft990_get_update_data(rig, ci, 0); if (err != RIG_OK) return err; rig_debug(RIG_DEBUG_TRACE, "%s: set mode = 0x%02x\n", __func__, *p); // Shift mode settings are only valid in FM mode if ((*p & FT990_MODE_FM) == 0) return -RIG_EINVAL; // Construct repeater shift command switch(rptr_shift) { case RIG_RPT_SHIFT_NONE: ci = FT990_NATIVE_RPTR_SHIFT_NONE; break; case RIG_RPT_SHIFT_MINUS: ci = FT990_NATIVE_RPTR_SHIFT_MINUS; break; case RIG_RPT_SHIFT_PLUS: ci = FT990_NATIVE_RPTR_SHIFT_PLUS; break; default: return -RIG_EINVAL; } // Set repeater shift err = ft990_send_static_cmd(rig, ci); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_rptr_shift* * * Get repeater shift setting for a given VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, Main, VFO, VFOA, VFOB, MEM * shift * | output | 0 = simplex * | | 1 = negative repeater shift * | | 2 = positive repeater shift * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing currVFO to vfo will use the currently selected VFO * obtained from the priv->current_vfo data structure. * In all other cases the passed vfo is selected if it differs * from the currently selected VFO. * Repeater shift can only be obtained when in FM mode. */ int ft990_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift) { struct ft990_priv_data *priv; ft990_op_data_t *p; unsigned char ci; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft990_priv_data *) rig->state.priv; if(vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE,"%s: priv->current.vfo = 0x%02x\n", __func__, vfo); } // Construct update query switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: p = &priv->update_data.vfoa; ci = FT990_NATIVE_UPDATE_VFO_DATA; break; case RIG_VFO_B: p = &priv->update_data.vfob; ci = FT990_NATIVE_UPDATE_VFO_DATA; break; case RIG_VFO_MEM: case RIG_VFO_MAIN: p = &priv->update_data.current_front; ci = FT990_NATIVE_UPDATE_OP_DATA; break; default: return -RIG_EINVAL; } // Get update for selected VFO err = ft990_get_update_data(rig, ci, 0); if (err != RIG_OK) return err; rig_debug(RIG_DEBUG_TRACE, "%s: set mode = 0x%02x\n", __func__, p->mode); // Shift mode settings are only valid in FM mode if (p->mode & FT990_MODE_FM) *rptr_shift = (p->status & FT990_RPT_MASK) >> 2; else return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: set rptr shift = 0x%02x\n", __func__, *rptr_shift); return RIG_OK; } /* * rig_set_rptr_offs* * * Set repeater frequency offset for a given VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * off | input | 0 - 199999 * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: The passed value for the vfo is ignored since the * repeater frequency offset is independent from the VFO selection. */ int ft990_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs) { unsigned char bcd[(int) FT990_BCD_RPTR_OFFSET/2]; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed offs = 0x%02x\n", __func__, offs); // Check for valid offset if (offs < 0 || offs > 199999) return -RIG_EINVAL; to_bcd(bcd, offs/10, FT990_BCD_RPTR_OFFSET); rig_debug(RIG_DEBUG_TRACE, "%s: set bcd[0] = 0x%02x, bcd[1] = 0x%02x, bcd[2] = 0x%02x\n", __func__, bcd[0], bcd[1], bcd[2]); err = ft990_send_dynamic_cmd(rig, FT990_NATIVE_RPTR_OFFSET, 0, bcd[2], bcd[1], bcd[0]); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_set_split_vfo* * * Set split operation for a given VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * split | input | 0 = off, 1 = on * tx_vfo | input | currVFO, VFOA, VFOB * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing currVFO to vfo or tx_vfo will use the currently * selected VFO obtained from the priv->current_vfo data structure. * Only VFOA and VFOB are valid assignments for the tx_vfo. * The tx_vfo is loaded first when assigning MEM to vfo to ensure * the correct TX VFO is selected by the rig in split mode. * An error is returned if vfo and tx_vfo are the same. */ int ft990_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { struct ft990_priv_data *priv; unsigned char ci; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed split = 0x%02x\n", __func__, split); rig_debug(RIG_DEBUG_TRACE, "%s: passed tx_vfo = 0x%02x\n", __func__, tx_vfo); priv = (struct ft990_priv_data *) rig->state.priv; if(vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE,"%s: vfo = priv->current.vfo = 0x%02x\n", __func__, vfo); } if (tx_vfo == RIG_VFO_CURR) { tx_vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE,"%s: tx_vfo = priv->current.vfo = 0x%02x\n", __func__, tx_vfo); } // RX VFO and TX VFO cannot be the same, no support for MEM as TX VFO if (vfo == tx_vfo || tx_vfo == RIG_VFO_MEM) return -RIG_ENTARGET; // Set TX VFO first if RIG_VFO_MEM selected for RX VFO if (vfo == RIG_VFO_MEM) { err = ft990_set_vfo(rig, tx_vfo); if (err != RIG_OK) return err; } // Set RX VFO err = ft990_set_vfo(rig, vfo); if (err != RIG_OK) return err; switch(split) { case RIG_SPLIT_ON: ci = FT990_NATIVE_SPLIT_ON; break; case RIG_SPLIT_OFF: ci = FT990_NATIVE_SPLIT_OFF; break; default: return -RIG_EINVAL; } err = ft990_send_static_cmd(rig, ci); if (err != RIG_OK); return err; return RIG_OK; } /* * rig_get_split_vfo* * * Get split mode status for a given VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, Main, VFO, VFOA, VFOB, MEM * split * | output | 0 = on, 1 = off * tx_vfo * | output | VFOA, VFOB * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: The passed value for the vfo is ignored in order to * preserve the current split vfo system settings. */ int ft990_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { struct ft990_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft990_priv_data *) rig->state.priv; // Read status flags err = ft990_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0); if (err != RIG_OK) return err; // Get split mode status *split = priv->update_data.flag1 & FT990_SF_SPLIT; rig_debug(RIG_DEBUG_TRACE, "%s: set split = 0x%02x\n", __func__, priv->update_data.flag1); rig_debug(RIG_DEBUG_TRACE, "%s: set split = 0x%02x\n", __func__, *split); // Get transmit vfo switch(priv->current_vfo) { case RIG_VFO_A: *tx_vfo = RIG_VFO_B; break; case RIG_VFO_B: *tx_vfo = RIG_VFO_A; break; case RIG_VFO_MEM: if (priv->update_data.flag1 & FT990_SF_VFOB) *tx_vfo = RIG_VFO_B; else *tx_vfo = RIG_VFO_A; break; default: return -RIG_EINVAL; } rig_debug(RIG_DEBUG_TRACE, "%s: set tx_vfo = 0x%02x\n", __func__, *tx_vfo); return RIG_OK; } /* * rig_set_rit* * * Set receiver clarifier offset for a given VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * rit | input | -9999 - 9999 * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing currVFO to vfo will use the currently selected VFO * obtained from the priv->current_vfo data structure. * In all other cases the passed vfo is selected if it differs * from the currently selected VFO. * * The following conditions are checked: * * rit = 0 && xit enabled -> disable rit * rit = 0 && xit disabled -> disable rit and set frequency = 0 */ int ft990_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { struct ft990_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %i\n", __func__, rit); // Check for valid clarifier offset frequency if (rit < -9999 || rit > 9999) return -RIG_EINVAL; priv = (struct ft990_priv_data *) rig->state.priv; // Set to selected VFO if(vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE,"%s: priv->current.vfo = 0x%02x\n", __func__, vfo); } else { if (vfo != priv->current_vfo) { err = ft990_set_vfo(rig, vfo); if (err != RIG_OK) return err; } } // If rit = 0 disable RX clarifier if (rit == 0) { err = ft990_get_update_data(rig, FT990_NATIVE_UPDATE_OP_DATA, 0); if (err != RIG_OK) return err; if ((priv->update_data.current_front.status & FT990_CLAR_TX_EN) == 0) { err = ft990_send_static_cmd(rig, FT990_NATIVE_CLEAR_CLARIFIER_OFFSET); if (err != RIG_OK) return err; } // Disable RX Clarifier err = ft990_send_static_cmd(rig, FT990_NATIVE_RX_CLARIFIER_OFF); if (err != RIG_OK) return err; } else { // Enable RX Clarifier err = ft990_send_static_cmd(rig, FT990_NATIVE_RX_CLARIFIER_ON); if(err != RIG_OK) return err; // Set RX clarifier offset err = ft990_send_rit_freq(rig, FT990_NATIVE_CLARIFIER_OPS, rit); if (err != RIG_OK) return err; } return RIG_OK; } /* * rig_get_rit* * * Get receiver clarifier offset for a given VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * rit * | output | -9999 - 9999 * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing currVFO to vfo will use the currently selected VFO * obtained from the priv->current_vfo data structure. * In all other cases the passed vfo is selected if it differs * from the currently selected VFO. */ int ft990_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { struct ft990_priv_data *priv; unsigned char ci; ft990_op_data_t *p; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft990_priv_data *) rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } // Construct update query switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: ci = FT990_NATIVE_UPDATE_VFO_DATA; p = (ft990_op_data_t *) &priv->update_data.vfoa; break; case RIG_VFO_B: ci = FT990_NATIVE_UPDATE_VFO_DATA; p = (ft990_op_data_t *) &priv->update_data.vfob; break; case RIG_VFO_MEM: case RIG_VFO_MAIN: ci = FT990_NATIVE_UPDATE_OP_DATA; p = (ft990_op_data_t *) &priv->update_data.current_front; break; default: return -RIG_EINVAL; } // Get update for selected VFO/MEM err = ft990_get_update_data(rig, ci, 0); if (err != RIG_OK) return err; // Clarifier offset is only returned when enabled if (p->status & FT990_CLAR_RX_EN) *rit = (short) ((p->coffset[0]<<8) | p->coffset[1]) * 10; else *rit = 0; rig_debug(RIG_DEBUG_TRACE, "%s: rit freq = %li Hz\n", __func__, *rit); return RIG_OK; } /* * rig_set_xit* * * Set transmitter clarifier offset for a given VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * xit | input | -9999 - 9999 * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing currVFO to vfo will use the currently selected VFO * obtained from the priv->current_vfo data structure. * In all other cases the passed vfo is selected if it differs * from the currently selected VFO. * * The following conditions are checked: * * xit = 0 && rit enabled -> disable xit * xit = 0 && rit disabled -> disable xit and set frequency = 0 */ int ft990_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit) { struct ft990_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %i\n", __func__, xit); if (xit < -9999 || xit > 9999) return -RIG_EINVAL; priv = (struct ft990_priv_data *) rig->state.priv; // Set to selected VFO if(vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE,"%s: priv->current.vfo = 0x%02x\n", __func__, vfo); } else { if (vfo != priv->current_vfo) { err = ft990_set_vfo(rig, vfo); if (err != RIG_OK) return err; } } // Disable TX clarifier and return if xit = 0 if (xit == 0) { err = ft990_get_update_data(rig, FT990_NATIVE_UPDATE_OP_DATA, 0); if (err != RIG_OK) return err; if ((priv->update_data.current_front.status & FT990_CLAR_RX_EN) == 0) { err = ft990_send_static_cmd(rig, FT990_NATIVE_CLEAR_CLARIFIER_OFFSET); if (err != RIG_OK) return err; } err = ft990_send_static_cmd(rig, FT990_NATIVE_TX_CLARIFIER_OFF); if (err != RIG_OK) return err; } else { // Enable TX Clarifier err = ft990_send_static_cmd(rig, FT990_NATIVE_TX_CLARIFIER_ON); if(err != RIG_OK) return err; // Set TX clarifier offset err = ft990_send_rit_freq(rig, FT990_NATIVE_CLARIFIER_OPS, xit); if (err != RIG_OK) return err; } return RIG_OK; } /* * rig_get_xit* * * Get transmitter clarifier offset for a given VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * xit * | output | -9999 - 9999 * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing currVFO to vfo will use the currently selected VFO * obtained from the priv->current_vfo data structure. * In all other cases the passed vfo is selected if it differs * from the currently selected VFO. */ int ft990_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit) { struct ft990_priv_data *priv; unsigned char ci; ft990_op_data_t *p; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft990_priv_data *) rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: ci = FT990_NATIVE_UPDATE_VFO_DATA; p = (ft990_op_data_t *) &priv->update_data.vfoa; break; case RIG_VFO_B: ci = FT990_NATIVE_UPDATE_VFO_DATA; p = (ft990_op_data_t *) &priv->update_data.vfob; break; case RIG_VFO_MEM: case RIG_VFO_MAIN: ci = FT990_NATIVE_UPDATE_OP_DATA; p = (ft990_op_data_t *) &priv->update_data.current_front; break; default: return -RIG_EINVAL; } err = ft990_get_update_data(rig, ci, 0); if (err != RIG_OK) return err; // Clarifier offset is only returned when enabled if (p->status & FT990_CLAR_TX_EN) *xit = (short) ((p->coffset[0]<<8) | p->coffset[1]) * 10; else *xit = 0; rig_debug(RIG_DEBUG_TRACE, "%s: read freq = %li Hz\n", __func__, *xit); return RIG_OK; } /* * rig_set_func* * * Set rig function * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * func | input | LOCK, TUNER * status | input | 0 = off, 1 = off * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: The passed value for the vfo is ignored since the * the status of rig functions are vfo independent. */ int ft990_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { unsigned char ci; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed func = %i\n", __func__, func); rig_debug(RIG_DEBUG_TRACE, "%s: passed status = %i\n", __func__, status); switch(func) { case RIG_FUNC_LOCK: if(status) ci = FT990_NATIVE_LOCK_ON; else ci = FT990_NATIVE_LOCK_OFF; break; case RIG_FUNC_TUNER: if(status) ci = FT990_NATIVE_TUNER_ON; else ci = FT990_NATIVE_TUNER_OFF; break; default: return -RIG_EINVAL; } err = ft990_send_static_cmd(rig, ci); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_func* * * Get status of a rig function * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, Main, VFO, VFOA, VFOB, MEM * func | input | LOCK, TUNER, MON * status * | output | 0 = off, 1 = on * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: The passed value for the vfo is ignored since the * the status of rig function are vfo independent. */ int ft990_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { struct ft990_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed func = %i\n", __func__, func); priv = (struct ft990_priv_data *)rig->state.priv; err = ft990_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0); if (err != RIG_OK) return err; switch(func) { case RIG_FUNC_LOCK: *status = ((priv->update_data.flag2 & FT990_SF_LOCKED) != 0); break; case RIG_FUNC_TUNER: *status = ((priv->update_data.flag3 & FT990_SF_TUNER_ON) != 0); break; case RIG_FUNC_MON: *status = ((priv->update_data.flag3 & FT990_SF_XMIT_MON) != 0); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * rig_set_parm* * * Set rig parameters that are not VFO specific * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * parm | input | BACKLIGHT * val | input | 0.0..1.0 * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: */ int ft990_set_parm(RIG *rig, setting_t parm, value_t val) { int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed parm = %i\n", __func__, parm); rig_debug(RIG_DEBUG_TRACE, "%s: passed val = %f\n", __func__, val.f); switch(parm) { case RIG_PARM_BACKLIGHT: err = ft990_send_dynamic_cmd(rig, FT990_NATIVE_DIM_LEVEL, (unsigned char) (0x0d * val.f), 0, 0, 0); break; default: return -RIG_EINVAL; } if (err != RIG_OK) return err; return RIG_OK; } /* * rig_set_mode* * * Set operating mode and passband for a given VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * mode | input | USB, LSB, CW, AM, FM, RTTY, RTTYR, PKTLSB, PKTFM * width | input | 2400, 2000, 500, 250 (USB) * | | 2400, 2000, 500, 250 (LSB) * | | 2400, 2000, 500, 250 (CW) * | | 2400, 2000, 500, 250 (RTTY) * | | 2400, 2000, 500, 250 (RTTYR) * | | 2400, 2000, 500, 250 (PKTLSB) * | | 6000, 2400 (AM) * | | 8000 (FM) * | | 8000 (PKTFM) * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing currVFO to vfo will use the currently selected VFO * obtained from the priv->current_vfo data structure. * In all other cases the passed vfo is selected if it differs * from the currently selected VFO. */ int ft990_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct ft990_priv_data *priv; unsigned char bw; unsigned char ci; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed mode = 0x%02x\n", __func__, mode); rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %li Hz\n", __func__, width); priv = (struct ft990_priv_data *)rig->state.priv; // Set to selected VFO if(vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE,"%s: priv->current.vfo = 0x%02x\n", __func__, vfo); } else { if (vfo != priv->current_vfo) { err = ft990_set_vfo(rig, vfo); if (err != RIG_OK) return err; } } switch(mode) { case RIG_MODE_AM: if (width == rig_passband_narrow(rig, mode)) ci = FT990_NATIVE_MODE_SET_AM_N; else if (width == rig_passband_normal(rig, mode)) ci = FT990_NATIVE_MODE_SET_AM_W; else return -RIG_EINVAL; break; case RIG_MODE_CW: ci = FT990_NATIVE_MODE_SET_CW_W; break; case RIG_MODE_USB: ci = FT990_NATIVE_MODE_SET_USB; break; case RIG_MODE_LSB: ci = FT990_NATIVE_MODE_SET_LSB; break; case RIG_MODE_RTTY: ci = FT990_NATIVE_MODE_SET_RTTY_LSB; break; case RIG_MODE_RTTYR: ci = FT990_NATIVE_MODE_SET_RTTY_USB; break; case RIG_MODE_FM: ci = FT990_NATIVE_MODE_SET_FM; break; case RIG_MODE_PKTLSB: ci = FT990_NATIVE_MODE_SET_PKT_LSB; break; case RIG_MODE_PKTFM: ci = FT990_NATIVE_MODE_SET_PKT_FM; break; default: return -RIG_EINVAL; } err = ft990_send_static_cmd(rig, ci); if (err != RIG_OK) return err; if (ci == FT990_NATIVE_MODE_SET_AM_N || ci == FT990_NATIVE_MODE_SET_AM_W || ci == FT990_NATIVE_MODE_SET_FM || ci == FT990_NATIVE_MODE_SET_PKT_FM) return RIG_OK; switch(width) { case 250: bw = FT990_BW_F250; break; case 500: bw = FT990_BW_F500; break; case 2000: bw = FT990_BW_F2000; break; case 2400: bw = FT990_BW_F2400; break; default: return -RIG_EINVAL; } rig_debug(RIG_DEBUG_TRACE, "%s: set bw = 0x%02x\n",__func__, bw); err = ft990_send_dynamic_cmd(rig, FT990_NATIVE_BANDWIDTH, bw, 0, 0, 0); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_mode* * * Get operating mode and passband for a given VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * mode | input | USB, LSB, CW, AM, FM, RTTY, RTTYR, PKTLSB, PKTFM * width * | output | 2400, 2000, 500, 250 (USB) * | | 2400, 2000, 500, 250 (LSB) * | | 2400, 2000, 500, 250 (CW) * | | 2400, 2000, 500, 250 (RTTY) * | | 2400, 2000, 500, 250 (RTTYR) * | | 2400, 2000, 500, 250 (PKTLSB) * | | 6000, 2400 (AM) * | | 8000 (FM) * | | 8000 (PKTFM) * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing currVFO to vfo will use the currently selected VFO * obtained from the priv->current_vfo data structure. * In all other cases the passed vfo is selected if it differs * from the currently selected VFO. */ int ft990_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct ft990_priv_data *priv; unsigned char *p; unsigned char *fl; unsigned char ci; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft990_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: p = &priv->update_data.vfoa.mode; ci = FT990_NATIVE_UPDATE_VFO_DATA; fl = &priv->update_data.vfoa.filter; break; case RIG_VFO_B: p = &priv->update_data.vfob.mode; ci = FT990_NATIVE_UPDATE_VFO_DATA; fl = &priv->update_data.vfob.filter; break; case RIG_VFO_MEM: case RIG_VFO_MAIN: p = &priv->update_data.current_front.mode; ci = FT990_NATIVE_UPDATE_OP_DATA; fl = &priv->update_data.current_front.filter; break; default: return -RIG_EINVAL; } // Get update for selected VFO err = ft990_get_update_data(rig, ci, 0); if (err != RIG_OK) return err; rig_debug(RIG_DEBUG_TRACE, "%s: fl = 0x%02x\n", __func__, *fl); rig_debug(RIG_DEBUG_TRACE, "%s: current mode = 0x%02x\n", __func__, *p); switch(*p) { case FT990_MODE_LSB: *mode = RIG_MODE_LSB; break; case FT990_MODE_USB: *mode = RIG_MODE_USB; break; case FT990_MODE_CW: *mode = RIG_MODE_CW; break; case FT990_MODE_AM: *mode = RIG_MODE_AM; break; case FT990_MODE_FM: *mode = RIG_MODE_FM; break; case FT990_MODE_RTTY: if (*fl & FT990_BW_FMPKTRTTY) *mode = RIG_MODE_RTTYR; else *mode = RIG_MODE_RTTY; break; case FT990_MODE_PKT: if (*fl & FT990_BW_FMPKTRTTY) *mode = RIG_MODE_PKTFM; else *mode = RIG_MODE_PKTLSB; break; default: return -RIG_EINVAL; } rig_debug(RIG_DEBUG_TRACE, "%s: get mode = 0x%02x\n", __func__, *mode); // The FT990 firmware appears to have a bug since the // AM bandwidth for 2400Hz and 6000Hz are interchanged. switch(*fl & (~FT990_BW_FMPKTRTTY)) { case FT990_BW_F2400: if (*mode == RIG_MODE_FM || *mode == RIG_MODE_PKTFM) *width = 8000; else if (*mode == RIG_MODE_AM) // <- FT990 firmware bug? *width = 6000; else *width = 2400; break; case FT990_BW_F2000: *width = 2000; break; case FT990_BW_F500: *width = 500; break; case FT990_BW_F250: *width = 250; break; case FT990_BW_F6000: *width = 2400; // <- FT990 firmware bug? break; default: return -RIG_EINVAL; } rig_debug(RIG_DEBUG_TRACE, "%s: get width = %li Hz\n", __func__, *width); return RIG_OK; } /* * rig_set_vfo* * * Set operational VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing currVFO to vfo will use the currently selected VFO * obtained from the priv->current_vfo data structure. * In all other cases the passed vfo is selected if it differs * from the currently selected VFO. */ int ft990_set_vfo(RIG *rig, vfo_t vfo) { struct ft990_priv_data *priv; unsigned char ci; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft990_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_A: ci = FT990_NATIVE_VFO_A; break; case RIG_VFO_B: ci = FT990_NATIVE_VFO_B; break; case RIG_VFO_MEM: ci = FT990_NATIVE_RECALL_MEM; break; default: return -RIG_EINVAL; } rig_debug(RIG_DEBUG_TRACE, "%s: set ci = %i\n", __func__, ci); if (vfo == RIG_VFO_MEM) { err = ft990_send_dynamic_cmd(rig, ci, priv->update_data.channelnumber + 1, 0, 0, 0); rig_debug(RIG_DEBUG_TRACE, "%s: set mem channel = 0x%02x\n", __func__, priv->update_data.channelnumber + 1); } else { err = ft990_send_static_cmd(rig, ci); } if (err != RIG_OK) return err; priv->current_vfo = vfo; return RIG_OK; } /* * rig_get_vfo* * * Get operational VFO * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo * | output | VFOA, VFOB, MEM * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing currVFO to vfo will use the currently selected VFO * obtained from the priv->current_vfo data structure. * In all other cases the passed vfo is selected if it differs * from the currently selected VFO. * The result is stored in the priv->current_vfo data structure * for later retrieval. */ int ft990_get_vfo(RIG *rig, vfo_t *vfo) { struct ft990_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft990_priv_data *)rig->state.priv; /* Get flags for VFO status */ err = ft990_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0); if (err != RIG_OK) return err; if(priv->update_data.flag2 & FT990_SF_MEM || priv->update_data.flag2 & FT990_SF_MTUNE) priv->current_vfo = RIG_VFO_MEM; else if (priv->update_data.flag1 & FT990_SF_VFOB) priv->current_vfo = RIG_VFO_B; else priv->current_vfo = RIG_VFO_A; rig_debug(RIG_DEBUG_TRACE, "%s: vfo status_1 = 0x%02x\n", __func__, priv->update_data.flag1); rig_debug(RIG_DEBUG_TRACE, "%s: vfo status_2 = 0x%02x\n", __func__, priv->update_data.flag2); rig_debug(RIG_DEBUG_TRACE, "%s: stat_vfo = 0x%02x\n", __func__, priv->current_vfo); *vfo = priv->current_vfo; return RIG_OK; } /* * rig_get_level * * This function will read the meter level.The data * is processed depending upon selection of the level * parameter. The following are the currently supported * levels and returned value range: * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, Main, VFO, VFOA, VFOB, MEM * level | input | STRENGTH, ALC, COMP, RFPOWER, SWR * value * | output | see table below * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * ---------------------------------------------------------- * level | Description | Returned Value | Units | * ---------------------------------------------------------- * STRENGTH | Signal Strength | -54 .. +60 | db | * COMP | Compression | 0.0 .. 1.0 | %/100 | * RFPOWER | RF Power Output | 0.0 .. 1.0 | %/100 | * SWR | Standing Wave Ratio | 0.0 .. 1.0 | %/100 | * ---------------------------------------------------------- * * Comments: Passing currVFO to vfo will use the currently selected VFO * obtained from the priv->current_vfo data structure. * In all other cases the passed vfo is selected if it differs * from the currently selected VFO. */ int ft990_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *value) { struct ft990_priv_data *priv; struct rig_state *rig_s; unsigned char mdata[YAESU_CMD_LENGTH]; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed level %li\n", __func__, level); priv = (struct ft990_priv_data *) rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo 0x%02x\n", __func__, vfo); } else { if (vfo != priv->current_vfo) { err = ft990_set_vfo(rig, vfo); if (err != RIG_OK) return err; } } err = ft990_send_static_cmd(rig, FT990_NATIVE_READ_METER); if (err != RIG_OK) return err; rig_s = &rig->state; err = read_block(&rig_s->rigport, (char *) mdata, FT990_READ_METER_LENGTH); if (err < 0) return err; rig_debug(RIG_DEBUG_TRACE, "%s: meter data %d\n", __func__, mdata[0]); switch(level) { case RIG_LEVEL_STRENGTH: value->i = mdata[0]/2.246 - 54; rig_debug(RIG_DEBUG_TRACE, "%s: meter level %d\n", __func__, value->i); break; case RIG_LEVEL_ALC: case RIG_LEVEL_COMP: case RIG_LEVEL_RFPOWER: case RIG_LEVEL_SWR: value->f = (float) mdata[0]/255; rig_debug(RIG_DEBUG_TRACE, "%s: meter level %d\n", __func__, value->f); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * rig_vfo_op* * * Perform vfo operations * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | VFOA, VFOB, MEM * op | input | CPY = copy from VFO to VFO * | | FROM_VFO = copy from VFO to MEM * | | TO_VFO = copy from MEM to VFO * | | UP = step dial frequency up * | | DOWN = step dial frequency down * | | TUNE = start antenna tuner * | | TOGGLE = toggle between VFOA and VFOB * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing currVFO to vfo will use the currently selected VFO * obtained from the priv->current_vfo data structure. * In all other cases the passed vfo is selected if it differs * from the currently selected VFO. */ int ft990_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { struct ft990_priv_data *priv; unsigned char ci; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed op %li\n", __func__, op); priv = (struct ft990_priv_data *) rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo 0x%02x\n", __func__, vfo); } else { if (vfo != priv->current_vfo) { err = ft990_set_vfo(rig, vfo); if (err != RIG_OK) return err; } } switch(op) { case RIG_OP_CPY: ci = FT990_NATIVE_VFO_TO_VFO; break; case RIG_OP_FROM_VFO: ci = FT990_NATIVE_VFO_TO_MEM; break; case RIG_OP_TO_VFO: ci = FT990_NATIVE_MEM_TO_VFO; break; case RIG_OP_UP: ci = FT990_NATIVE_OP_FREQ_STEP_UP; break; case RIG_OP_DOWN: ci = FT990_NATIVE_OP_FREQ_STEP_DOWN; break; case RIG_OP_TUNE: ci = FT990_NATIVE_TUNER_START; break; case RIG_OP_TOGGLE: switch(vfo) { case RIG_VFO_A: ci = FT990_NATIVE_VFO_B; vfo = RIG_VFO_B; break; case RIG_VFO_B: ci = FT990_NATIVE_VFO_A; vfo = RIG_VFO_A; break; default: return -RIG_EINVAL; } break; default: return -RIG_EINVAL; } if (op == RIG_OP_TO_VFO || op == RIG_OP_FROM_VFO) err = ft990_send_dynamic_cmd(rig, ci, priv->update_data.channelnumber + 1, 0, 0, 0); else err = ft990_send_static_cmd(rig, ci); if (err != RIG_OK) return err; if (op == RIG_OP_TOGGLE) priv->current_vfo = vfo; return RIG_OK; } /* * rig_set_mem* * * Set main vfo to selected memory channel number * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * ch | input | 1 - 90 * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: The passed value for the vfo is ignored since the * the channel selection is vfo independent. */ int ft990_set_mem(RIG *rig, vfo_t vfo, int ch) { struct ft990_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ch = %i\n", __func__, ch); priv = (struct ft990_priv_data *) rig->state.priv; // Check for valid channel number if (ch < 1 || ch > 90) return -RIG_EINVAL; // Recall selected memory channel err = ft990_send_dynamic_cmd(rig, FT990_NATIVE_RECALL_MEM, ch, 0, 0, 0); if (err != RIG_OK) return err; priv->current_vfo = RIG_VFO_MEM; priv->update_data.channelnumber = ch - 1; return RIG_OK; } /* * rig_get_mem* * * Get memory channel number used by main vfo * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * ch * | output | 1 - 90 * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: The passed value for the vfo is ignored since * the channel selection is vfo independent. */ int ft990_get_mem(RIG *rig, vfo_t vfo, int *ch) { struct ft990_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft990_priv_data *) rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } err = ft990_get_update_data(rig, FT990_NATIVE_UPDATE_MEM_CHNL, 0); if (err != RIG_OK) return err; rig_debug(RIG_DEBUG_TRACE, "%s: channel number %i\n", __func__, priv->update_data.channelnumber + 1); *ch = priv->update_data.channelnumber + 1; // Check for valid channel number if (*ch < 1 || *ch > 90) return -RIG_EINVAL; return RIG_OK; } /* * rig_set_channel* * * Set memory channel parameters and attributes * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * chan * | input | channel attribute data structure * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure */ int ft990_set_channel (RIG *rig, const channel_t *chan) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; return -RIG_ENIMPL; } /* * rig_get_channel* * * Get memory channel parameters and attributes * * Parameter | Type | Accepted/Expected Values * ------------------------------------------------------------------------- * RIG * | input | pointer to private data * chan * | input | (chan->vfo) currVFO, VFOA, VFOB, MEM * | | (chan->channel_num) 0 - 90 * chan * | output | channel attributes data structure * ------------------------------------------------------------------------- * Returns RIG_OK on success or an error code on failure * * Comments: Passing a memory channel number of 0 returns information on * the current channel or channel last in use. * * Status for split operation, active rig functions and tuning steps * are only relevant for currVFO */ int ft990_get_channel (RIG *rig, channel_t *chan) { struct ft990_priv_data *priv; ft990_op_data_t *p; char ci; int err; channel_t _chan; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed chan->vfo = %i\n", __func__, chan->vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed chan->channel_num = %i\n", __func__, chan->channel_num); priv = (struct ft990_priv_data *) rig->state.priv; if(chan->channel_num < 0 && chan->channel_num > 90) return -RIG_EINVAL; /* * Get a clean slate so we don't have to assign value to * variables that are not relevant to this equipment */ _chan.channel_num = chan->channel_num; _chan.vfo = chan->vfo; memset(chan,0,sizeof(channel_t)); chan->channel_num = _chan.channel_num; chan->vfo = _chan.vfo; if(chan->channel_num == 0) { switch(chan->vfo) { // Current or last selected memory channel case RIG_VFO_MEM: err = ft990_get_update_data(rig, FT990_NATIVE_UPDATE_MEM_CHNL, 0); if(err != RIG_OK) return err; chan->channel_num = priv->update_data.channelnumber + 1; p = (ft990_op_data_t *) &priv->update_data.channel[chan->channel_num]; ci = FT990_NATIVE_UPDATE_MEM_CHNL_DATA; break; case RIG_VFO_A: p = (ft990_op_data_t *) &priv->update_data.vfoa; ci = FT990_NATIVE_UPDATE_VFO_DATA; break; case RIG_VFO_B: p = (ft990_op_data_t *) &priv->update_data.vfob; ci = FT990_NATIVE_UPDATE_VFO_DATA; break; case RIG_VFO_CURR: p = (ft990_op_data_t *) &priv->update_data.current_front; ci = FT990_NATIVE_UPDATE_OP_DATA; break; default: return -RIG_EINVAL; } } else { p = (ft990_op_data_t *) &priv->update_data.channel[chan->channel_num]; ci = FT990_NATIVE_UPDATE_MEM_CHNL_DATA; chan->vfo = RIG_VFO_MEM; } /* * Get data for selected VFO/MEM */ err = ft990_get_update_data(rig, ci, chan->channel_num); if (err != RIG_OK) return err; // Blanked memory, nothing to report if (p->bpf & FT990_EMPTY_MEM) return RIG_OK; /* * Get RX frequency */ chan->freq = ((((p->basefreq[0] << 8) + p->basefreq[1]) << 8) + p->basefreq[2]) * 10; /* * Get RX operating mode */ switch(p->mode) { case FT990_MODE_LSB: chan->mode = RIG_MODE_LSB; break; case FT990_MODE_USB: chan->mode = RIG_MODE_USB; break; case FT990_MODE_CW: chan->mode = RIG_MODE_CW; break; case FT990_MODE_AM: chan->mode = RIG_MODE_AM; break; case FT990_MODE_FM: chan->mode = RIG_MODE_FM; break; case FT990_MODE_RTTY: if(p->filter & FT990_BW_FMPKTRTTY) chan->mode = RIG_MODE_RTTYR; else chan->mode = RIG_MODE_RTTY; break; case FT990_MODE_PKT: if(p->filter & FT990_BW_FMPKTRTTY) chan->mode = RIG_MODE_PKTFM; else chan->mode = RIG_MODE_PKTLSB; break; default: return -RIG_EINVAL; } rig_debug(RIG_DEBUG_TRACE, "%s: mode = 0x%02x\n", __func__, p->mode); rig_debug(RIG_DEBUG_TRACE, "%s: filter = 0x%02x\n", __func__, p->filter); /* * Get RX bandwidth selection * * The FT990 firmware appears to have a bug since the * AM bandwidth for 2400Hz and 6000Hz are interchanged. */ switch(p->filter & (~FT990_BW_FMPKTRTTY)) { case FT990_BW_F2400: if (chan->mode == RIG_MODE_FM || chan->mode == RIG_MODE_PKTFM) chan->width = 8000; else if (chan->mode == RIG_MODE_AM) // <- FT990 firmware bug? chan->width = 6000; else chan->width = 2400; break; case FT990_BW_F2000: chan->width = 2000; break; case FT990_BW_F500: chan->width = 500; break; case FT990_BW_F250: chan->width = 250; break; case FT990_BW_F6000: chan->width = 2400; // <- FT990 firmware bug? break; default: return -RIG_EINVAL; } err = ft990_get_update_data(rig, FT990_NATIVE_READ_FLAGS, 0); if (err != RIG_OK) return err; rig_debug(RIG_DEBUG_TRACE, "%s: set status = %i\n", __func__, priv->update_data.flag1); /* * Status for split operation, active rig functions and tuning steps * are only relevant for currVFO */ if(chan->vfo & RIG_VFO_CURR) { chan->split = (priv->update_data.flag1 & FT990_SF_SPLIT); if(priv->update_data.flag1 & FT990_SF_XMIT_MON) chan->funcs |= RIG_FUNC_MON; if(priv->update_data.flag1 & FT990_SF_TUNER_ON) chan->funcs |= RIG_FUNC_TUNER; if(priv->update_data.flag1 & FT990_SF_FAST) { if(chan->mode & (FT990_AM_RX_MODES | FT990_FM_RX_MODES)) chan->tuning_step = 1000; else chan->tuning_step = 100; } else { if(chan->mode & (FT990_AM_RX_MODES | FT990_FM_RX_MODES)) chan->tuning_step = 100; else chan->tuning_step = 10; } } /* * Get RIT frequencies */ if (p->status & FT990_CLAR_RX_EN) chan->rit = (short) ((p->coffset[0]<<8) | p->coffset[1]) * 10; if(chan->split & RIG_SPLIT_ON) { // Get data for the transmit VFO p = (ft990_op_data_t *) &priv->update_data.current_rear; /* FT1000D */ if (RIG_MODEL_FT1000D == rig->caps->rig_model) p = (ft990_op_data_t *) &priv->update_data.vfob; chan->tx_freq = ((((p->basefreq[0] << 8) + p->basefreq[1]) << 8) + p->basefreq[2]) * 10; /* * Get RX operating mode */ switch(p->mode) { case FT990_MODE_LSB: chan->tx_mode = RIG_MODE_LSB; break; case FT990_MODE_USB: chan->tx_mode = RIG_MODE_USB; break; case FT990_MODE_CW: chan->tx_mode = RIG_MODE_CW; break; case FT990_MODE_AM: chan->tx_mode = RIG_MODE_AM; break; case FT990_MODE_FM: chan->tx_mode = RIG_MODE_FM; break; case FT990_MODE_RTTY: if (p->filter & FT990_BW_FMPKTRTTY) chan->tx_mode = RIG_MODE_RTTYR; else chan->tx_mode = RIG_MODE_RTTY; break; case FT990_MODE_PKT: if (p->filter & FT990_BW_FMPKTRTTY) chan->tx_mode = RIG_MODE_PKTFM; else chan->tx_mode = RIG_MODE_PKTLSB; break; default: return -RIG_EINVAL; } rig_debug(RIG_DEBUG_TRACE, "%s: set tx mode = 0x%02x\n", __func__, chan->mode); rig_debug(RIG_DEBUG_TRACE, "%s: tx filter = 0x%02x\n", __func__, p->filter); /* * Get RX bandwidth selection * * The FT990 firmware appears to have a bug since the * AM bandwidth for 2400Hz and 6000Hz are interchanged. */ switch(p->filter & (~FT990_BW_FMPKTRTTY)) { case FT990_BW_F2400: if (chan->tx_mode == RIG_MODE_FM || chan->mode == RIG_MODE_PKTFM) chan->tx_width = 8000; else if (chan->tx_mode == RIG_MODE_AM) // <- FT990 firmware bug? chan->tx_width = 6000; else chan->tx_width = 2400; break; case FT990_BW_F2000: chan->tx_width = 2000; break; case FT990_BW_F500: chan->tx_width = 500; break; case FT990_BW_F250: chan->tx_width = 250; break; case FT990_BW_F6000: chan->tx_width = 2400; // <- FT990 firmware bug? break; default: return -RIG_EINVAL; } if(priv->update_data.flag1 & FT990_SF_VFOB) { if(chan->tx_vfo & (RIG_VFO_A | RIG_VFO_MEM)) chan->tx_vfo = RIG_VFO_B; else if(chan->vfo & RIG_VFO_MEM) chan->tx_vfo = RIG_VFO_A; else chan->tx_vfo = RIG_VFO_MEM; } else { if(chan->vfo & RIG_VFO_A) chan->tx_vfo = RIG_VFO_MEM; else chan->tx_vfo = RIG_VFO_A; } /* * Get XIT frequencies */ if (p->status & FT990_CLAR_TX_EN) chan->xit = (short) ((p->coffset[0]<<8) | p->coffset[1]) * 10; } else { /* * RX/TX frequency, mode, bandwidth and vfo are identical in simplex mode */ chan->tx_freq = chan->freq; chan->tx_mode = chan->mode; chan->tx_width = chan->width; chan->tx_vfo = chan->vfo; /* * Get XIT frequencies */ if (p->status & FT990_CLAR_TX_EN) chan->xit = (short) ((p->coffset[0]<<8) | p->coffset[1]) * 10; } rig_debug(RIG_DEBUG_TRACE, "%s: set status = %i\n", __func__, p->status); /* * Repeater shift only possible if transmit mode is FM */ if (chan->tx_mode & RIG_MODE_FM) chan->rptr_shift= (p->status & FT990_RPT_MASK) >> 2; /* * Check for skip channel for memory channels */ if(chan->vfo & RIG_VFO_MEM) chan->flags |= RIG_CHFLAG_SKIP; return RIG_OK; } /* * Private helper function. Retrieves update data from rig. * using pacing value and buffer indicated in *priv struct. * Extended to be command agnostic as 990 has several ways to * get data and several ways to return it. * * Need to use this when doing ft990_get_* stuff * * Arguments: *rig Valid RIG instance * ci command index * rl expected length of returned data in octets * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ int ft990_get_update_data(RIG *rig, unsigned char ci, unsigned short ch) { struct rig_state *rig_s; struct ft990_priv_data *priv; int n; int err; int rl; char temp[5]; char *p; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: passed ci 0x%02x\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed ch 0x%02x\n", __func__, ch); if (!rig) return -RIG_EINVAL; priv = (struct ft990_priv_data *)rig->state.priv; rig_s = &rig->state; if (ci == FT990_NATIVE_UPDATE_MEM_CHNL_DATA) // P4 = 0x01 to 0x5a for channel 1 - 90 err = ft990_send_dynamic_cmd(rig, ci, 4, 0, 0, ch); else err = ft990_send_static_cmd(rig, ci); if (err != RIG_OK) return err; switch(ci) { case FT990_NATIVE_UPDATE_ALL_DATA: p = (char *) &priv->update_data; rl = FT990_ALL_DATA_LENGTH; /* FT1000D */ if (RIG_MODEL_FT1000D == rig->caps->rig_model) return RIG_OK; break; case FT990_NATIVE_UPDATE_MEM_CHNL: p = (char *) &priv->update_data.channelnumber; rl = FT990_MEM_CHNL_LENGTH; break; case FT990_NATIVE_UPDATE_OP_DATA: p = (char *) &priv->update_data.current_front; rl = FT990_OP_DATA_LENGTH; /* FT1000D */ if (RIG_MODEL_FT1000D == rig->caps->rig_model) rl = FT1000D_OP_DATA_LENGTH; break; case FT990_NATIVE_UPDATE_VFO_DATA: p = (char *) &priv->update_data.vfoa; rl = FT990_VFO_DATA_LENGTH; break; case FT990_NATIVE_UPDATE_MEM_CHNL_DATA: p = (char *) &priv->update_data.channel[ch]; rl = FT990_MEM_CHNL_DATA_LENGTH; break; case FT990_NATIVE_READ_FLAGS: p = temp; rl = FT990_STATUS_FLAGS_LENGTH; break; default: return -RIG_EINVAL; } n = read_block(&rig_s->rigport, p, rl); if (n < 0) return n; /* die returning read_block error */ rig_debug(RIG_DEBUG_TRACE, "%s: read %i bytes\n", __func__, n); if (ci == FT990_NATIVE_READ_FLAGS) memcpy(&priv->update_data, p, FT990_STATUS_FLAGS_LENGTH - 2); return RIG_OK; } /* * Private helper function to send a complete command sequence. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ int ft990_send_static_cmd(RIG *rig, unsigned char ci) { struct rig_state *rig_s; struct ft990_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft990_priv_data *)rig->state.priv; rig_s = &rig->state; if (!priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to send incomplete sequence\n", __func__); return -RIG_EINVAL; } err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } /* * Private helper function to build and then send a complete command * sequence. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * p1-p4 Command parameters * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ int ft990_send_dynamic_cmd(RIG *rig, unsigned char ci, unsigned char p1, unsigned char p2, unsigned char p3, unsigned char p4) { struct rig_state *rig_s; struct ft990_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = 0x%02x\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n", __func__, p1, p2, p3, p4); priv = (struct ft990_priv_data *)rig->state.priv; if (priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n", __func__); return -RIG_EINVAL; } rig_s = &rig->state; memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); priv->p_cmd[3] = p1; priv->p_cmd[2] = p2; priv->p_cmd[1] = p3; priv->p_cmd[0] = p4; err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } /* * Private helper function to build and send a complete command to * change the display frequency. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * freq freq_t frequency value * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ int ft990_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq) { struct rig_state *rig_s; struct ft990_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = 0x%02x\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq); priv = (struct ft990_priv_data *)rig->state.priv; if (priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n", __func__); return -RIG_EINVAL; } rig_s = &rig->state; /* Copy native cmd freq_set to private cmd storage area */ memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); /* store bcd format in in p_cmd */ to_bcd(priv->p_cmd, freq/10, FT990_BCD_DIAL); rig_debug(RIG_DEBUG_TRACE, "%s: requested freq after conversion = %"PRIll" Hz\n", __func__, from_bcd(priv->p_cmd, FT990_BCD_DIAL) * 10); err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } /* * Private helper function to build and send a complete command to * change the rit frequency. * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * rit shortfreq_t frequency value * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ int ft990_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit) { struct ft990_priv_data *priv; struct rig_state *rig_s; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if(!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = 0x%02x\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit); priv = (struct ft990_priv_data *) rig->state.priv; rig_s = &rig->state; if (priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n", __func__); return -RIG_EINVAL; } // Copy native command into privat command storage area memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); // Reset current clarifier offset priv->p_cmd[3] = FT990_CLAR_CLEAR; // Check and set tuning direction - up or down if (rit < 0) priv->p_cmd[2] = FT990_CLAR_TUNE_DOWN; else priv->p_cmd[2] = FT990_CLAR_TUNE_UP; // Store bcd format into privat command storage area to_bcd(priv->p_cmd, labs(rit)/10, FT990_BCD_RIT); err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH); if(err != RIG_OK) return err; return RIG_OK; } hamlib-1.2.15.3/yaesu/ft950.c0000644000175000017500000002361612044564477012304 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft950.c - (C) Nate Bargmann 2007 (n0nb at arrl.net) * (C) Stephane Fillod 2008 * (C) Terry Embry 2008-2009 * * This shared library provides an API for communicating * via serial interface to an FT-950 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "hamlib/rig.h" #include "bandplan.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "newcat.h" #include "ft950.h" #include "idx_builtin.h" /* * ft950 rigs capabilities. * Also this struct is READONLY! * */ const struct rig_caps ft950_caps = { .rig_model = RIG_MODEL_FT950, .model_name = "FT-950", .mfg_name = "Yaesu", .version = NEWCAT_VER ".2", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, /* Default rate per manual */ .serial_rate_max = 38400, .serial_data_bits = 8, .serial_stop_bits = 1, /* Assumed since manual makes no mention */ .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = FT950_WRITE_DELAY, .post_write_delay = FT950_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = FT950_FUNCS, .has_set_func = FT950_FUNCS, .has_get_level = FT950_LEVELS, .has_set_level = RIG_LEVEL_SET(FT950_LEVELS), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, [LVL_CWPITCH] = { .min = { .i = 300 }, .max = { .i = 1050 }, .step = { .i = 50 } }, }, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, 20, RIG_DBLST_END, }, /* TBC */ .attenuator = { 6, 12, 18, RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(1000), .vfo_ops = FT950_VFO_OPS, .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_RIG, /* May enable later as the 950 has an Auto Info command */ .bank_qty = 0, .chan_desc_sz = 0, .str_cal = FT950_STR_CAL, .chan_list = { { 1, 99, RIG_MTYPE_MEM, NEWCAT_MEM_CAP }, { 100, 117, RIG_MTYPE_EDGE, NEWCAT_MEM_CAP }, /* two by two */ { 125, 128, RIG_MTYPE_BAND, NEWCAT_MEM_CAP }, /* 60M Channels U51-U54 or US1-US4, if available */ { 130, 130, RIG_MTYPE_BAND, NEWCAT_MEM_CAP }, /* 60M Channel U55 or US5, if available */ { 131, 131, RIG_MTYPE_BAND, NEWCAT_MEM_CAP }, /* EU5, 5167.5 KHz Alaska Emergency Freq, if available */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(30), MHz(56), FT950_ALL_RX_MODES, -1, -1, FT950_VFO_ALL, FT950_ANTS}, /* General coverage + ham */ RIG_FRNG_END, }, /* FIXME: Are these the correct Region 1 values? */ .tx_range_list1 = { FRQ_RNG_HF(1, FT950_OTHER_TX_MODES, W(5), W(100), FT950_VFO_ALL, FT950_ANTS), FRQ_RNG_HF(1, FT950_AM_TX_MODES, W(2), W(25), FT950_VFO_ALL, FT950_ANTS), /* AM class */ FRQ_RNG_6m(1, FT950_OTHER_TX_MODES, W(5), W(100), FT950_VFO_ALL, FT950_ANTS), FRQ_RNG_6m(1, FT950_AM_TX_MODES, W(2), W(25), FT950_VFO_ALL, FT950_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30), MHz(56), FT950_ALL_RX_MODES, -1, -1, FT950_VFO_ALL, FT950_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2, FT950_OTHER_TX_MODES, W(5), W(100), FT950_VFO_ALL, FT950_ANTS), FRQ_RNG_HF(2, FT950_AM_TX_MODES, W(2), W(25), FT950_VFO_ALL, FT950_ANTS), /* AM class */ FRQ_RNG_6m(2, FT950_OTHER_TX_MODES, W(5), W(100), FT950_VFO_ALL, FT950_ANTS), FRQ_RNG_6m(2, FT950_AM_TX_MODES, W(2), W(25), FT950_VFO_ALL, FT950_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {FT950_SSB_CW_RX_MODES, Hz(10)}, /* Normal */ {FT950_SSB_CW_RX_MODES, Hz(100)}, /* Fast */ {FT950_AM_RX_MODES, Hz(100)}, /* Normal */ {FT950_AM_RX_MODES, kHz(1)}, /* Fast */ {FT950_FM_RX_MODES, Hz(100)}, /* Normal */ {FT950_FM_RX_MODES, kHz(1)}, /* Fast */ RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {FT950_CW_RTTY_PKT_RX_MODES, Hz(1700)}, /* Normal CW, RTTY, PKT */ {FT950_CW_RTTY_PKT_RX_MODES, Hz(500)}, /* Narrow CW, RTTY, PKT */ {FT950_CW_RTTY_PKT_RX_MODES, Hz(2400)}, /* Wide CW, RTTY, PKT */ {FT950_CW_RTTY_PKT_RX_MODES, Hz(2000)}, /* CW, RTTY, PKT */ {FT950_CW_RTTY_PKT_RX_MODES, Hz(1400)}, /* CW, RTTY, PKT */ {FT950_CW_RTTY_PKT_RX_MODES, Hz(1200)}, /* CW, RTTY, PKT */ {FT950_CW_RTTY_PKT_RX_MODES, Hz(800)}, /* CW, RTTY, PKT */ {FT950_CW_RTTY_PKT_RX_MODES, Hz(400)}, /* CW, RTTY, PKT */ {FT950_CW_RTTY_PKT_RX_MODES, Hz(300)}, /* CW, RTTY, PKT */ {FT950_CW_RTTY_PKT_RX_MODES, Hz(200)}, /* CW, RTTY, PKT */ {FT950_CW_RTTY_PKT_RX_MODES, Hz(100)}, /* CW, RTTY, PKT */ {RIG_MODE_SSB, Hz(2400)}, /* Normal SSB */ {RIG_MODE_SSB, Hz(1800)}, /* Narrow SSB */ {RIG_MODE_SSB, Hz(3000)}, /* Wide SSB */ {RIG_MODE_SSB, Hz(2900)}, /* SSB */ {RIG_MODE_SSB, Hz(2800)}, /* SSB */ {RIG_MODE_SSB, Hz(2700)}, /* SSB */ {RIG_MODE_SSB, Hz(2600)}, /* SSB */ {RIG_MODE_SSB, Hz(2500)}, /* SSB */ {RIG_MODE_SSB, Hz(2250)}, /* SSB */ {RIG_MODE_SSB, Hz(2100)}, /* SSB */ {RIG_MODE_SSB, Hz(1950)}, /* SSB */ {RIG_MODE_SSB, Hz(1650)}, /* SSB */ {RIG_MODE_SSB, Hz(1500)}, /* SSB */ {RIG_MODE_SSB, Hz(1350)}, /* SSB */ {RIG_MODE_SSB, Hz(1100)}, /* SSB */ {RIG_MODE_SSB, Hz(850)}, /* SSB */ {RIG_MODE_SSB, Hz(600)}, /* SSB */ {RIG_MODE_SSB, Hz(400)}, /* SSB */ {RIG_MODE_SSB, Hz(200)}, /* SSB */ {RIG_MODE_AM, Hz(9000)}, /* Normal AM */ {RIG_MODE_AM, Hz(6000)}, /* Narrow AM */ {FT950_FM_RX_MODES, Hz(16000)}, /* Normal FM */ {FT950_FM_RX_MODES, Hz(9000)}, /* Narrow FM */ RIG_FLT_END, }, .priv = NULL, /* private data FIXME: */ .rig_init = newcat_init, .rig_cleanup = newcat_cleanup, .rig_open = newcat_open, /* port opened */ .rig_close = newcat_close, /* port closed */ .set_freq = newcat_set_freq, .get_freq = newcat_get_freq, .set_mode = newcat_set_mode, .get_mode = newcat_get_mode, .set_vfo = newcat_set_vfo, .get_vfo = newcat_get_vfo, .set_ptt = newcat_set_ptt, .get_ptt = newcat_get_ptt, .set_split_vfo = newcat_set_split_vfo, .get_split_vfo = newcat_get_split_vfo, .set_rit = newcat_set_rit, .get_rit = newcat_get_rit, .set_xit = newcat_set_xit, .get_xit = newcat_get_xit, .set_ant = newcat_set_ant, .get_ant = newcat_get_ant, .get_func = newcat_get_func, .set_func = newcat_set_func, .get_level = newcat_get_level, .set_level = newcat_set_level, .get_mem = newcat_get_mem, .set_mem = newcat_set_mem, .vfo_op = newcat_vfo_op, .get_info = newcat_get_info, .power2mW = newcat_power2mW, .mW2power = newcat_mW2power, .set_rptr_shift = newcat_set_rptr_shift, .get_rptr_shift = newcat_get_rptr_shift, .set_ctcss_tone = newcat_set_ctcss_tone, .get_ctcss_tone = newcat_get_ctcss_tone, .set_ctcss_sql = newcat_set_ctcss_sql, .get_ctcss_sql = newcat_get_ctcss_sql, .set_powerstat = newcat_set_powerstat, .get_powerstat = newcat_get_powerstat, .set_ts = newcat_set_ts, .get_ts = newcat_get_ts, .set_trn = newcat_set_trn, .get_trn = newcat_get_trn, .set_channel = newcat_set_channel, .get_channel = newcat_get_channel, }; hamlib-1.2.15.3/yaesu/ft920.h0000644000175000017500000002762112044564477012306 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft920.h - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * (C) Nate Bargmann 2002, 2003, 2007 (n0nb at arrl.net) * (C) Stephane Fillod 2002 (fillods at users.sourceforge.net) * * This shared library provides an API for communicating * via serial interface to an FT-920 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT920_H #define _FT920_H 1 #define TRUE 1 #define FALSE 0 #define FT920_VFO_ALL (RIG_VFO_A|RIG_VFO_B) /* Receiver caps */ #define FT920_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM|RIG_MODE_FM|RIG_MODE_WFM) #define FT920_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB) #define FT920_AM_RX_MODES (RIG_MODE_AM) #define FT920_FM_RX_MODES (RIG_MODE_FM|RIG_MODE_WFM) /* TX caps */ #define FT920_OTHER_TX_MODES (RIG_MODE_CW| RIG_MODE_USB| RIG_MODE_LSB|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM ) /* 100 W class */ #define FT920_AM_TX_MODES (RIG_MODE_AM ) /* set 25W max */ /* Other features */ #define FT920_ANTS 0 /* FIXME: declare Ant A & B and RX input */ #define FT920_FUNC_ALL (RIG_FUNC_TUNER | RIG_FUNC_LOCK) /* fix */ /* Returned data length in bytes */ #define FT920_MEM_CHNL_LENGTH 1 /* 0x10 P1 = 01 return size */ #define FT920_STATUS_FLAGS_LENGTH 8 /* 0xfa return size */ #define FT920_VFO_DATA_LENGTH 28 /* 0x10 P1 = 02, 03 return size */ #define FT920_MEM_CHNL_DATA_LENGTH 14 /* 0x10 P1 = 04, P4 = 0x00-0x89 return size */ /* Delay sequential fast writes * * It is thought that it takes the rig about 60 mS to process a command * so a default of 80 mS should be long enough to prevent commands from * stacking up. */ #define FT920_POST_WRITE_DELAY 80 /* * 8N2 and 1 start bit = 11 bits at 4800 bps => effective byte rate = 1 byte * in 2.2917 msec => 28 bytes in 64 msec * * delay for 28 bytes = (2.2917 + pace_interval) * 28 * * pace_interval time to read 28 bytes * ------------- --------------------- * * 0 64 msec * 1 92 msec * 2 120 msec * 5 204 msec * 255 7.2 sec * */ /* Timing values in mS */ #define FT920_PACING_DEFAULT_VALUE 0 /* time between characters from 920 */ #define FT920_WRITE_DELAY 0 /* time between characters to 920 */ /* Rough safe value for default timeout */ #define FT920_DEFAULT_READ_TIMEOUT 28 * ( 5 + FT920_PACING_DEFAULT_VALUE) /* BCD coded frequency length */ #define FT920_BCD_DIAL 8 #define FT920_BCD_RIT 3 /* * Native FT920 functions. More to come :-) * */ enum ft920_native_cmd_e { FT920_NATIVE_SPLIT_OFF = 0, FT920_NATIVE_SPLIT_ON, FT920_NATIVE_RECALL_MEM, FT920_NATIVE_VFO_TO_MEM, FT920_NATIVE_VFO_A, FT920_NATIVE_VFO_B, FT920_NATIVE_MEM_TO_VFO, FT920_NATIVE_CLARIFIER_OPS, FT920_NATIVE_VFO_A_FREQ_SET, FT920_NATIVE_MODE_SET, FT920_NATIVE_PACING, FT920_NATIVE_PTT_OFF, FT920_NATIVE_PTT_ON, FT920_NATIVE_MEM_CHNL, FT920_NATIVE_OP_DATA, FT920_NATIVE_VFO_DATA, FT920_NATIVE_MEM_CHNL_DATA, FT920_NATIVE_TUNER_BYPASS, FT920_NATIVE_TUNER_INLINE, FT920_NATIVE_TUNER_START, FT920_NATIVE_VFO_B_FREQ_SET, FT920_NATIVE_VFO_A_PASSBAND_WIDE, FT920_NATIVE_VFO_A_PASSBAND_NAR, FT920_NATIVE_VFO_B_PASSBAND_WIDE, FT920_NATIVE_VFO_B_PASSBAND_NAR, FT920_NATIVE_STATUS_FLAGS, FT920_NATIVE_SIZE /* end marker, value indicates number of */ /* native cmd entries */ }; typedef enum ft920_native_cmd_e ft920_native_cmd_t; /* * Internal MODES - when setting modes via FT920_NATIVE_MODE_SET * */ /* VFO A */ #define MODE_SET_A_LSB 0x00 #define MODE_SET_A_USB 0x01 #define MODE_SET_A_CW_U 0x02 #define MODE_SET_A_CW_L 0x03 #define MODE_SET_A_AM_W 0x04 #define MODE_SET_A_AM_N 0x05 #define MODE_SET_A_FM_W 0x06 #define MODE_SET_A_FM_N 0x07 #define MODE_SET_A_DATA_L 0x08 #define MODE_SET_A_DATA_U 0x0a #define MODE_SET_A_DATA_F 0x0b /* VFO B */ #define MODE_SET_B_LSB 0x80 #define MODE_SET_B_USB 0x81 #define MODE_SET_B_CW_U 0x82 #define MODE_SET_B_CW_L 0x83 #define MODE_SET_B_AM_W 0x84 #define MODE_SET_B_AM_N 0x85 #define MODE_SET_B_FM_W 0x86 #define MODE_SET_B_FM_N 0x87 #define MODE_SET_B_DATA_L 0x88 #define MODE_SET_B_DATA_U 0x8a #define MODE_SET_B_DATA_F 0x8b /* * Internal Clarifier parms - when setting clarifier via * FT920_NATIVE_CLARIFIER_OPS * */ /* P1 values */ #define CLAR_RX_OFF 0x00 #define CLAR_RX_ON 0x01 #define CLAR_TX_OFF 0x80 #define CLAR_TX_ON 0x81 #define CLAR_SET_FREQ 0xff /* P2 values */ #define CLAR_OFFSET_PLUS 0x00 #define CLAR_OFFSET_MINUS 0xff /* Tuner status values used to set the * tuner state and indicate tuner status. */ #define TUNER_BYPASS 0 #define TUNER_INLINE 1 #define TUNER_TUNING 2 /* * Local VFO CMD's, according to spec * */ //#define FT920_VFO_A 0x00 //#define FT920_VFO_B 0x01 /* * Some useful offsets in the status update flags (offset) * SUMO--Status Update Memory Offset? * * SF_ bit tests are now grouped with flag bytes for ease of reference * * FIXME: complete flags and bits * * CAT command 0xFA, P1 = 01 requests the FT-920 to return its status flags. * These flags consist of 8 bytes and are documented in the FT-920 manual * on page 89. * */ #define FT920_SUMO_DISPLAYED_STATUS_0 0x00 /* Status flag byte 0 */ #define SF_VFOA 0x00 /* bits 0 & 1, VFO A TX/RX == 0 */ #define SF_SPLITA (1<<0) /* Split operation with VFO-B on TX */ #define SF_SPLITB (1<<1) /* Split operation with VFO-B on RX */ #define SF_VFOB (SF_SPLITA|SF_SPLITB) /* bits 0 & 1, VFO B TX/RX == 3 */ #define SF_TUNER_TUNE (1<<2) /* Antenna tuner On and Tuning for match*/ #define SF_PTT_OFF (0<<7) /* Receive mode (PTT line open) */ #define SF_PTT_ON (1<<7) /* Transmission in progress (PTT line grounded) */ #define SF_PTT_MASK (SF_PTT_ON) #define FT920_SUMO_DISPLAYED_STATUS_1 0x01 /* Status flag byte 1 */ #define SF_QMB (1<<3) /* Quick Memory Bank (QMB) selected */ #define SF_MT (1<<4) /* Memory Tuning in progress */ #define SF_VFO (1<<5) /* VFO operation selected */ #define SF_MR (1<<6) /* Memory Mode selected */ #define SF_GC (1<<7) /* General Coverage Reception selected */ #define SF_VFO_MASK (SF_QMB|SF_MT|SF_VFO|SF_MR) #define FT920_SUMO_DISPLAYED_STATUS_2 0x02 /* Status flag byte 2 */ #define SF_TUNER_INLINE (1<<1) /* Antenna tuner is inline or bypass */ #define SF_VFOB_LOCK (1<<2) /* VFO B tuning lock status */ #define SF_VFOA_LOCK (1<<3) /* VFO A tuning lock status */ /* * Offsets for VFO record retrieved via 0x10 P1 = 02, 03 * * The FT-920 returns frequency and mode data via three seperate commands. * CAT command 0x10, P1 = 02 returns the current main and sub displays' data (28 bytes) * CAT command 0x10, P1 = 03 returns VFO A data and the sub display data (sub display is always VFO B) (28 bytes) * CAT command 0x10, P1 = 04, P4 = 0x00-0x89 returns memory channel data (14 bytes) * In all cases the format is (from the FT-920 manual page 90): * * Offset Value * 0x00 Band Selection (not documented!) * 0x01 Operating Frequency (Hex value of display--Not BCD!) * 0x05 Clarifier Offset (Hex value) * 0x07 Mode Data * 0x08 Flag * 0x09 Filter Data 1 * 0x0a Filter Data 2 * 0x0b CTCSS Encoder Data * 0x0c CTCSS Decoder Data * 0x0d Memory recall Flag * * Memory Channel data has the same layout and offsets * VFO B data has the same layout, but the offset starts at 0x0e and * continues through 0x1b * */ #define FT920_SUMO_DISPLAYED_FREQ 0x01 /* Current main display, can be VFO A, Memory data, Memory tune */ #define FT920_SUMO_VFO_A_FREQ 0x01 /* VFO A frequency, not necessarily currently displayed! */ #define FT920_SUMO_DISPLAYED_CLAR 0x05 /* RIT/XIT offset -- current display */ #define FT920_SUMO_VFO_A_CLAR 0x05 /* RIT/XIT offset -- VFO A */ #define FT920_SUMO_DISPLAYED_MODE 0x07 /* Current main display mode */ #define FT920_SUMO_VFO_A_MODE 0x07 /* VFO A mode, not necessarily currently displayed! */ #define FT920_SUMO_VFO_B_FREQ 0x0f /* Current sub display && VFO B */ #define FT920_SUMO_VFO_B_CLAR 0x13 /* RIT/XIT offset -- VFO B */ #define FT920_SUMO_VFO_B_MODE 0x15 /* Current sub display && VFO B */ /* * Mode Bitmap from offset 0x07 or 0x16 in VFO Record. * Bits 5 and 6 ignored * used when READING modes from FT-920 * */ #define MODE_LSB 0x00 #define MODE_CW_L 0x01 /* CW listening on LSB */ #define MODE_AM 0x02 #define MODE_FM 0x03 #define MODE_DATA_L 0x04 /* DATA on LSB */ #define MODE_DATA_U 0x05 /* DATA on USB (who does that? :) */ #define MODE_DATA_F 0x06 /* DATA on FM */ #define MODE_USB 0x40 #define MODE_CW_U 0x41 /* CW listening on USB */ /* Narrow filter selected */ #define MODE_LSBN 0x80 /* Not sure this actually exists */ #define MODE_CW_LN 0x81 #define MODE_AMN 0x82 #define MODE_FMN 0x83 #define MODE_DATA_LN 0x84 #define MODE_DATA_UN 0x85 #define MODE_DATA_FN 0x86 #define MODE_USBN 0xc0 /* Not sure this actually exists */ #define MODE_CW_UN 0xc1 /* All relevent bits */ #define MODE_MASK 0xc7 /* * Command string parameter offsets */ #define P1 3 #define P2 2 #define P3 1 #define P4 0 /* * API local implementation * */ static int ft920_init(RIG *rig); static int ft920_cleanup(RIG *rig); static int ft920_open(RIG *rig); static int ft920_close(RIG *rig); static int ft920_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft920_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ft920_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int ft920_set_vfo(RIG *rig, vfo_t vfo); static int ft920_get_vfo(RIG *rig, vfo_t *vfo); static int ft920_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int ft920_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); static int ft920_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq); static int ft920_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq); static int ft920_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width); static int ft920_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width); static int ft920_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); static int ft920_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit); static int ft920_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit); static int ft920_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit); /* not documented in my FT-920 manual, but it works! - N0NB */ static int ft920_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); static int ft920_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); static int ft920_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static int ft920_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); #endif /* _FT920_H */ hamlib-1.2.15.3/yaesu/ft9000.h0000644000175000017500000001101712044564477012354 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft9000.h - (C) Nate Bargmann 2007 (n0nb at arrl.net) * (C) Stephane Fillod 2008 * (C) Terry Embry 2009 * * This shared library provides an API for communicating * via serial interface to an FT-9000 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT9000_H #define _FT9000_H 1 #if 0 #define TRUE 1 #define FALSE 0 #define ON TRUE #define OFF FALSE #endif #define FT9000_VFO_ALL (RIG_VFO_A|RIG_VFO_B) /* Receiver caps */ #define FT9000_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|\ RIG_MODE_RTTY|RIG_MODE_RTTYR|\ RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM) #define FT9000_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|\ RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB) #define FT9000_AM_RX_MODES (RIG_MODE_AM) #define FT9000_FM_RX_MODES (RIG_MODE_FM|RIG_MODE_PKTFM) /* TRX caps */ #define FT9000_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY| \ RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM) #define FT9000_AM_TX_MODES (RIG_MODE_AM) #define FT9000_FM_RX_MODES (RIG_MODE_FM|RIG_MODE_PKTFM) #define FT9000_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR) #define FT9000_CW_RTTY_PKT_RX_MODES (RIG_MODE_RTTY|RIG_MODE_RTTYR|\ RIG_MODE_PKTUSB|RIG_MODE_PKTLSB|RIG_MODE_CW|RIG_MODE_CWR) /* TBC */ #define FT9000_LEVELS (RIG_LEVEL_ATT|RIG_LEVEL_PREAMP|\ RIG_LEVEL_ALC|RIG_LEVEL_RAWSTR|RIG_LEVEL_SWR|\ RIG_LEVEL_RFPOWER|RIG_LEVEL_RF|RIG_LEVEL_SQL|\ RIG_LEVEL_MICGAIN|RIG_LEVEL_IF|RIG_LEVEL_CWPITCH|\ RIG_LEVEL_KEYSPD|RIG_LEVEL_AF|RIG_LEVEL_AGC|\ RIG_LEVEL_METER|RIG_LEVEL_BKINDL|RIG_LEVEL_SQL|\ RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY|RIG_LEVEL_COMP|\ RIG_LEVEL_ANTIVOX|RIG_LEVEL_NR|RIG_LEVEL_NOTCHF) /* TBC */ #define FT9000_FUNCS (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_LOCK|\ RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\ RIG_FUNC_FBKIN|RIG_FUNC_COMP|RIG_FUNC_ANF|RIG_FUNC_MN) /* TBC */ #define FT9000_VFO_OPS (RIG_OP_TUNE|RIG_OP_CPY|RIG_OP_XCHG|\ RIG_OP_UP|RIG_OP_DOWN|RIG_OP_BAND_UP|RIG_OP_BAND_DOWN|\ RIG_OP_TO_VFO|RIG_OP_FROM_VFO|RIG_OP_TOGGLE) /* TBC */ #define FT9000_STR_CAL { 16, \ { \ { 0, -54 }, /* S0 */ \ { 12, -48 }, /* S1 */ \ { 27, -42 }, /* S2 */ \ { 40, -36 }, /* S3 */ \ { 55, -30 }, /* S4 */ \ { 65, -24 }, /* S5 */ \ { 80, -18 }, /* S6 */ \ { 95, -12 }, /* S7 */ \ { 112, -6 }, /* S8 */ \ { 130, 0 }, /* S9 */ \ { 150, 10 }, /* +10 */ \ { 172, 20 }, /* +20 */ \ { 190, 30 }, /* +30 */ \ { 220, 40 }, /* +40 */ \ { 240, 50 }, /* +50 */ \ { 255, 60 }, /* +60 */ \ } } /* * Other features (used by rig_caps) * */ #define FT9000_TX_ANTS (RIG_ANT_1|RIG_ANT_2|RIG_ANT_3|RIG_ANT_4) #define FT9000_MEM_CHNL_LENGTH 1 /* 0x10 P1 = 01 return size */ #define FT9000_OP_DATA_LENGTH 19 /* 0x10 P1 = 03 return size */ #define FT9000_VFO_DATA_LENGTH 18 /* 0x10 P1 = 03 return size -- A & B returned */ #define FT9000_MEM_CHNL_DATA_LENGTH 19 /* 0x10 P1 = 04, P4 = 0x01-0x20 return size */ #define FT9000_STATUS_FLAGS_LENGTH 5 /* 0xf7, 0xfa return size */ #define FT9000_ALL_DATA_LENGTH 649 /* 0x10 P1 = 00 return size */ /* Timing values in mS */ // #define FT9000_PACING_INTERVAL 5 // #define FT9000_PACING_DEFAULT_VALUE 0 /* Delay between bytes sent to FT-9000 * Should not exceed value set in CAT TOT menu (rig default is 10 mSec) */ #define FT9000_WRITE_DELAY 0 /* Delay sequential fast writes */ #define FT9000_POST_WRITE_DELAY 5 #endif /* _FT9000_H */ hamlib-1.2.15.3/yaesu/ft747.h0000644000175000017500000001340112044564477012304 00000000000000/* * hamlib - (C) Frank Singleton 2000 (vk3fcs@@ix.netcom.com) * (C) Stephane Fillod 2000-2010 * * ft747.h - (C) Frank Singleton 2000 (vk3fcs@@ix.netcom.com) * This shared library provides an API for communicating * via serial interface to an FT-747GX using the "CAT" interface * box (FIF-232C) or similar (max232 + some capacitors :-) * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT747_H #define _FT747_H 1 /* * According to manual, the UPDATE data length should be 345 * but some rigs are short by one byte. */ #define FT747_STATUS_UPDATE_DATA_LENGTH 344 #define FT747_PACING_DEFAULT_VALUE 0 #define FT747_WRITE_DELAY 5 /* manual say 50 ms, but it doesn't work though */ /* Sequential fast writes confuse my FT747 without this delay */ #define FT747_POST_WRITE_DELAY 5 /* * 8N2 and 1 start bit = 11 bits at 4800 bps => effective byte rate = 1 byte in 2.2917 msec * => 345 bytes in 790 msec * * delay for 1 byte = 2.2917 + (pace_interval * 5) * * pace_interval time to read 345 bytes * ------------ ---------------------- * * 0 790 msec * 1 2515 msec * 2 4240 msec * 255 441 sec => 7 min 21 seconds * */ /* * Native FT747 functions. This is what I have to work with :-) * */ enum ft747_native_cmd_e { FT_747_NATIVE_SPLIT_OFF = 0, FT_747_NATIVE_SPLIT_ON, FT_747_NATIVE_RECALL_MEM, FT_747_NATIVE_VFO_TO_MEM, FT_747_NATIVE_DLOCK_OFF, FT_747_NATIVE_DLOCK_ON, FT_747_NATIVE_VFO_A, FT_747_NATIVE_VFO_B, FT_747_NATIVE_M_TO_VFO, FT_747_NATIVE_UP_500K, FT_747_NATIVE_DOWN_500K, FT_747_NATIVE_CLARIFY_OFF, FT_747_NATIVE_CLARIFY_ON, FT_747_NATIVE_FREQ_SET, FT_747_NATIVE_MODE_SET_LSB, FT_747_NATIVE_MODE_SET_USB, FT_747_NATIVE_MODE_SET_CWW, FT_747_NATIVE_MODE_SET_CWN, FT_747_NATIVE_MODE_SET_AMW, FT_747_NATIVE_MODE_SET_AMN, FT_747_NATIVE_MODE_SET_FMW, FT_747_NATIVE_MODE_SET_FMN, FT_747_NATIVE_PACING, FT_747_NATIVE_PTT_OFF, FT_747_NATIVE_PTT_ON, FT_747_NATIVE_UPDATE, FT_747_NATIVE_SIZE /* end marker, value indicates number of */ /* native cmd entries */ }; typedef enum ft747_native_cmd_e ft747_native_cmd_t; /* Internal MODES - when setting modes via cmd_mode_set() */ #define MODE_SET_LSB 0x00 #define MODE_SET_USB 0x01 #define MODE_SET_CWW 0x02 #define MODE_SET_CWN 0x03 #define MODE_SET_AMW 0x04 #define MODE_SET_AMN 0x05 #define MODE_SET_FMW 0x06 #define MODE_SET_FMN 0x07 /* * Mode Bitmap. Bits 5 and 6 unused * When READING modes */ #define MODE_FM 0x01 #define MODE_AM 0x02 #define MODE_CW 0x04 #define MODE_FMN 0x81 #define MODE_AMN 0x82 #define MODE_CWN 0x84 #define MODE_USB 0x08 #define MODE_LSB 0x10 #define MODE_NAR 0x80 /* All relevent bits */ #define MODE_MASK 0x9f /* * Status Flag Masks when reading */ #define SF_DLOCK 0x01 #define SF_SPLIT 0x02 #define SF_CLAR 0x04 #define SF_VFOAB 0x08 #define SF_VFOMR 0x10 #define SF_RXTX 0x20 #define SF_RESV 0x40 #define SF_PRI 0x80 /* * Local VFO CMD's, according to spec */ #define FT747_VFO_A 0x00 #define FT747_VFO_B 0x01 /* * Some useful offsets in the status update map (offset) * * Manual appears to be full of mistakes regarding offsets etc.. -- FS * */ #define FT747_SUMO_DISPLAYED_MEM 0x17 #define FT747_SUMO_DISPLAYED_MODE 0x18 #define FT747_SUMO_DISPLAYED_STATUS 0x00 #define FT747_SUMO_DISPLAYED_FREQ 0x01 #define FT747_SUMO_VFO_A_FREQ 0x09 #define FT747_SUMO_VFO_B_FREQ 0x11 /* * API local implementation */ static int ft747_init(RIG *rig); static int ft747_cleanup(RIG *rig); static int ft747_open(RIG *rig); static int ft747_close(RIG *rig); static int ft747_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft747_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ft747_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); /* select mode */ static int ft747_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); /* get mode */ static int ft747_set_vfo(RIG *rig, vfo_t vfo); /* select vfo */ static int ft747_get_vfo(RIG *rig, vfo_t *vfo); /* get vfo */ static int ft747_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); static int ft747_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); static int ft747_set_split(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int ft747_get_split(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); static int ft747_set_mem(RIG *rig, vfo_t vfo, int ch); static int ft747_get_mem(RIG *rig, vfo_t vfo, int *ch); /* * The time the status block is cached (in millisec). * This optimises the common case of doing eg. rig_get_freq() and * rig_get_mode() in a row. * * The timeout is set to at least the time to transfer the block (790ms) * plus post write delay, plus some margin, but less than 1 second, * which may be typical polling period. */ #define FT747_CACHE_TIMEOUT 900 #endif /* _FT747_H */ hamlib-1.2.15.3/yaesu/README.ft8900000644000175000017500000000144312044564477013014 00000000000000Quirks, known bugs, and other notes. ==================================== In this document I'll try to describe the behavior of the Yaesu FT-890 transceiver with Hamlib. Some of these are limitations of the radio while others are programming trade-offs with Hamlib. This document is organized by Hamlib function calls and documents observed behavior with each call. rig_set_rit * RIG_VFO_* value is respected so the rig VFO may be changed with this call. * To "zero" the RIT pass a value > 0 or < 10 with this call. The digit will be dropped as resolution is 10 Hz minimum and the clarifier offset set to 0 Hz. General notes. As with most all Yaesu radios the radio must be polled by the application for status updates, i.e. no transceive mode in CAT. hamlib-1.2.15.3/yaesu/newcat.c0000644000175000017500000043226712044564477012724 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * and the Hamlib Group (hamlib-developer at lists.sourceforge.net) * * newcat.c - (C) Nate Bargmann 2007 (n0nb at arrl.net) * (C) Stephane Fillod 2008-2010 * (C) Terry Embry 2008-2010 * * This shared library provides an API for communicating * via serial interface to any newer Yaesu radio using the * "new" text CAT interface. * * Models this code aims to support are FTDX-9000*, FT-2000, FT-DX5000, * FT-950, FT-450. Much testing remains. -N0NB * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "iofunc.h" #include "newcat.h" /* global variables */ static const char cat_term = ';'; /* Yaesu command terminator */ static const char cat_unknown_cmd[] = "?;"; /* Yaesu ? */ /* Internal Backup and Restore VFO Memory Channels */ #define NC_MEM_CHANNEL_NONE 2012 #define NC_MEM_CHANNEL_VFO_A 2013 #define NC_MEM_CHANNEL_VFO_B 2014 /* ID 0310 == 310, Must drop leading zero */ typedef enum nc_rigid_e { NC_RIGID_NONE = 0, NC_RIGID_FT450 = 241, NC_RIGID_FT950 = 310, NC_RIGID_FT2000 = 251, NC_RIGID_FT2000D = 252, NC_RIGID_FTDX9000D = 101, NC_RIGID_FTDX9000Contest = 102, NC_RIGID_FTDX9000MP = 103, NC_RIGID_FTDX5000 = 362 } nc_rigid_t; /* * The following table defines which commands are valid for any given * rig supporting the "new" CAT interface. */ typedef struct _yaesu_newcat_commands { char *command; ncboolean ft450; ncboolean ft950; ncboolean ft2000; ncboolean ft9000; ncboolean ft5000; } yaesu_newcat_commands_t; /* * Even thought this table does make a handy reference, it could be depreciated as it is not really needed. * All of the CAT commands used in the newcat interface are available on the FT-950, FT-2000, FT-5000, and FT-9000. * There are 5 CAT commands used in the newcat interface that are not available on the FT-450. * Thesec CAT commands are XT -TX Clarifier ON/OFF, AN - Antenna select, PL - Speech Proc Level, * PR - Speech Proc ON/OFF, and BC - Auto Notch filter ON/OFF. * The FT-450 returns -RIG_ENVAIL for these unavailable CAT commands. * * NOTE: The following table must be in alphabetical order by the * command. This is because it is searched using a binary search * to determine whether or not a command is valid for a given rig. * * The list of supported commands is obtained from the rig's operator's * or CAT programming manual. * */ static const yaesu_newcat_commands_t valid_commands[] = { /* Command FT-450 FT-950 FT-2000 FT-9000 FT-5000 */ {"AB", FALSE, TRUE, TRUE, TRUE, TRUE }, {"AC", TRUE, TRUE, TRUE, TRUE, TRUE }, {"AG", TRUE, TRUE, TRUE, TRUE, TRUE }, {"AI", TRUE, TRUE, TRUE, TRUE, TRUE }, {"AM", FALSE, TRUE, TRUE, TRUE, TRUE }, {"AN", FALSE, TRUE, TRUE, TRUE, TRUE }, {"BC", FALSE, TRUE, TRUE, TRUE, TRUE }, {"BD", TRUE, TRUE, TRUE, TRUE, TRUE }, {"BI", TRUE, TRUE, TRUE, TRUE, TRUE }, {"BP", TRUE, TRUE, TRUE, TRUE, TRUE }, {"BS", TRUE, TRUE, TRUE, TRUE, TRUE }, {"BU", TRUE, TRUE, TRUE, TRUE, TRUE }, {"BY", TRUE, TRUE, TRUE, TRUE, TRUE }, {"CH", TRUE, TRUE, TRUE, TRUE, TRUE }, {"CN", TRUE, TRUE, TRUE, TRUE, TRUE }, {"CO", TRUE, TRUE, TRUE, TRUE, TRUE }, {"CS", TRUE, TRUE, TRUE, TRUE, TRUE }, {"CT", TRUE, TRUE, TRUE, TRUE, TRUE }, {"DA", TRUE, TRUE, TRUE, TRUE, TRUE }, {"DN", TRUE, TRUE, TRUE, TRUE, TRUE }, {"DP", FALSE, TRUE, TRUE, TRUE, TRUE }, {"DS", TRUE, FALSE, TRUE, TRUE, TRUE }, {"ED", TRUE, TRUE, TRUE, TRUE, TRUE }, {"EK", FALSE, TRUE, TRUE, TRUE, FALSE }, {"EU", TRUE, TRUE, TRUE, TRUE, TRUE }, {"EX", TRUE, TRUE, TRUE, TRUE, TRUE }, {"FA", TRUE, TRUE, TRUE, TRUE, TRUE }, {"FB", TRUE, TRUE, TRUE, TRUE, TRUE }, {"FK", FALSE, TRUE, TRUE, TRUE, FALSE }, {"FR", FALSE, TRUE, TRUE, TRUE, TRUE }, {"FS", TRUE, TRUE, TRUE, TRUE, TRUE }, {"FT", TRUE, TRUE, TRUE, TRUE, TRUE }, {"GT", TRUE, TRUE, TRUE, TRUE, TRUE }, {"ID", TRUE, TRUE, TRUE, TRUE, TRUE }, {"IF", TRUE, TRUE, TRUE, TRUE, TRUE }, {"IS", TRUE, TRUE, TRUE, TRUE, TRUE }, {"KM", TRUE, TRUE, TRUE, TRUE, TRUE }, {"KP", TRUE, TRUE, TRUE, TRUE, TRUE }, {"KR", TRUE, TRUE, TRUE, TRUE, TRUE }, {"KS", TRUE, TRUE, TRUE, TRUE, TRUE }, {"KY", TRUE, TRUE, TRUE, TRUE, TRUE }, {"LK", TRUE, TRUE, TRUE, TRUE, TRUE }, {"LM", TRUE, TRUE, TRUE, TRUE, TRUE }, {"MA", FALSE, TRUE, TRUE, TRUE, TRUE }, {"MC", TRUE, TRUE, TRUE, TRUE, TRUE }, {"MD", TRUE, TRUE, TRUE, TRUE, TRUE }, {"MG", TRUE, TRUE, TRUE, TRUE, TRUE }, {"MK", TRUE, TRUE, TRUE, TRUE, TRUE }, {"ML", TRUE, TRUE, TRUE, TRUE, TRUE }, {"MR", TRUE, TRUE, TRUE, TRUE, TRUE }, {"MS", TRUE, TRUE, TRUE, TRUE, TRUE }, {"MW", TRUE, TRUE, TRUE, TRUE, TRUE }, {"MX", FALSE, TRUE, TRUE, TRUE, TRUE }, {"NA", TRUE, TRUE, TRUE, TRUE, TRUE }, {"NB", TRUE, TRUE, TRUE, TRUE, TRUE }, {"NL", FALSE, TRUE, TRUE, TRUE, TRUE }, {"NR", TRUE, TRUE, TRUE, TRUE, TRUE }, {"OI", TRUE, TRUE, TRUE, TRUE, TRUE }, {"OS", TRUE, TRUE, TRUE, TRUE, TRUE }, {"PA", TRUE, TRUE, TRUE, TRUE, TRUE }, {"PB", TRUE, TRUE, TRUE, TRUE, TRUE }, {"PC", TRUE, TRUE, TRUE, TRUE, TRUE }, {"PL", FALSE, TRUE, TRUE, TRUE, TRUE }, {"PR", FALSE, TRUE, TRUE, TRUE, TRUE }, {"PS", TRUE, TRUE, TRUE, TRUE, TRUE }, {"QI", TRUE, TRUE, TRUE, TRUE, TRUE }, {"QR", TRUE, TRUE, TRUE, TRUE, TRUE }, {"QS", TRUE, TRUE, TRUE, TRUE, TRUE }, {"RA", TRUE, TRUE, TRUE, TRUE, TRUE }, {"RC", TRUE, TRUE, TRUE, TRUE, TRUE }, {"RD", TRUE, TRUE, TRUE, TRUE, TRUE }, {"RF", FALSE, TRUE, TRUE, TRUE, TRUE }, {"RG", TRUE, TRUE, TRUE, TRUE, TRUE }, {"RI", TRUE, TRUE, TRUE, TRUE, TRUE }, {"RL", TRUE, TRUE, TRUE, TRUE, TRUE }, {"RM", TRUE, TRUE, TRUE, TRUE, TRUE }, {"RO", FALSE, TRUE, TRUE, TRUE, TRUE }, {"RP", TRUE, FALSE, FALSE, FALSE, FALSE }, {"RS", TRUE, TRUE, TRUE, TRUE, TRUE }, {"RT", TRUE, TRUE, TRUE, TRUE, TRUE }, {"RU", TRUE, TRUE, TRUE, TRUE, TRUE }, {"SC", TRUE, TRUE, TRUE, TRUE, TRUE }, {"SD", TRUE, TRUE, TRUE, TRUE, TRUE }, {"SF", FALSE, TRUE, TRUE, TRUE, TRUE }, {"SH", TRUE, TRUE, TRUE, TRUE, TRUE }, {"SM", TRUE, TRUE, TRUE, TRUE, TRUE }, {"SQ", TRUE, TRUE, TRUE, TRUE, TRUE }, {"ST", TRUE, FALSE, FALSE, FALSE, FALSE }, {"SV", TRUE, TRUE, TRUE, TRUE, TRUE }, {"TS", TRUE, TRUE, TRUE, TRUE, TRUE }, {"TX", TRUE, TRUE, TRUE, TRUE, TRUE }, {"UL", TRUE, TRUE, TRUE, TRUE, TRUE }, {"UP", TRUE, TRUE, TRUE, TRUE, TRUE }, {"VD", TRUE, TRUE, TRUE, TRUE, TRUE }, {"VF", FALSE, TRUE, TRUE, TRUE, TRUE }, {"VG", TRUE, TRUE, TRUE, TRUE, TRUE }, {"VM", TRUE, TRUE, TRUE, TRUE, TRUE }, {"VR", TRUE, FALSE, FALSE, FALSE, FALSE }, {"VS", TRUE, TRUE, TRUE, TRUE, TRUE }, {"VV", TRUE, FALSE, FALSE, FALSE, FALSE }, {"VX", TRUE, TRUE, TRUE, TRUE, TRUE }, {"XT", FALSE, TRUE, TRUE, TRUE, TRUE }, }; int valid_commands_count = sizeof(valid_commands) / sizeof(yaesu_newcat_commands_t); /* * future - private data * * FIXME: Does this need to be exposed to the application/frontend through * rig_caps.priv? I'm guessing not since it's private to the backend. -N0NB */ struct newcat_priv_data { unsigned int read_update_delay; /* depends on pacing value */ // vfo_t current_vfo; /* active VFO from last cmd */ char cmd_str[NEWCAT_DATA_LEN]; /* command string buffer */ char ret_data[NEWCAT_DATA_LEN]; /* returned data--max value, most are less */ int current_mem; /* private memory channel number */ int rig_id; /* rig id from CAT Command ID; */ }; typedef struct newcat_cmd_data { char cmd_str[NEWCAT_DATA_LEN]; /* command string buffer */ char ret_data[NEWCAT_DATA_LEN]; /* returned data--max value, most are less */ } newcat_cmd_data_t; /* NewCAT Internal Functions */ static ncboolean newcat_is_rig(RIG * rig, rig_model_t model); static int newcat_get_tx_vfo(RIG * rig, vfo_t * tx_vfo); static int newcat_set_tx_vfo(RIG * rig, vfo_t tx_vfo); static int newcat_set_vfo_from_alias(RIG * rig, vfo_t * vfo); static int newcat_scale_float(int scale, float fval); static int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width); static int newcat_set_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int newcat_set_narrow(RIG * rig, vfo_t vfo, ncboolean narrow); static int newcat_get_narrow(RIG * rig, vfo_t vfo, ncboolean * narrow); static int newcat_set_faststep(RIG * rig, ncboolean fast_step); static int newcat_get_faststep(RIG * rig, ncboolean * fast_step); static int newcat_get_rigid(RIG * rig); static int newcat_get_vfo_mode(RIG * rig, vfo_t * vfo_mode); static int newcat_set_cmd(RIG * rig, newcat_cmd_data_t * cmd); static int newcat_get_cmd(RIG * rig, newcat_cmd_data_t * cmd); static int newcat_vfomem_toggle(RIG * rig); static ncboolean newcat_valid_command(RIG *rig, char *command); /* * ************************************ * * Hamlib API functions * * ************************************ */ /* * rig_init * */ int newcat_init(RIG *rig) { struct newcat_priv_data *priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct newcat_priv_data *)malloc(sizeof(struct newcat_priv_data)); if (!priv) /* whoops! memory shortage! */ return -RIG_ENOMEM; /* TODO: read pacing from preferences */ // priv->pacing = NEWCAT_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */ priv->read_update_delay = NEWCAT_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */ // priv->current_vfo = RIG_VFO_MAIN; /* default to whatever */ // priv->current_vfo = RIG_VFO_A; rig->state.priv = (void *)priv; priv->rig_id = NC_RIGID_NONE; priv->current_mem = NC_MEM_CHANNEL_NONE; return RIG_OK; } /* * rig_cleanup * * the serial port is closed by the frontend * */ int newcat_cleanup(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * rig_open * * New CAT does not support pacing * */ int newcat_open(RIG *rig) { struct rig_state *rig_s; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; // priv = (struct newcat_priv_data *)rig->state.priv; rig_s = &rig->state; rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n", __func__, rig_s->rigport.write_delay); rig_debug(RIG_DEBUG_TRACE, "%s: post_write_delay = %i msec\n", __func__, rig_s->rigport.post_write_delay); return RIG_OK; } /* * rig_close * */ int newcat_close(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; return RIG_OK; } /* * rig_set_freq * * Set frequency for a given VFO * RIG_TARGETABLE_VFO * Does not SET priv->current_vfo * */ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { const struct rig_caps *caps; struct newcat_priv_data *priv; struct rig_state *state; char c; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "FA")) return -RIG_ENAVAIL; priv = (struct newcat_priv_data *)rig->state.priv; caps = rig->caps; state = &rig->state; // vfo_t tvfo; // tvfo = (vfo == RIG_VFO_CURR || vfo == RIG_VFO_VFO) ? state->current_vfo : vfo; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); // rig_debug(RIG_DEBUG_TRACE, "%s: translated vfo = 0x%02x\n", __func__, tvfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq); /* additional debugging */ rig_debug(RIG_DEBUG_TRACE, "%s: R2 minimum freq = %"PRIfreq" Hz\n", __func__, caps->rx_range_list2[0].start); rig_debug(RIG_DEBUG_TRACE, "%s: R2 maximum freq = %"PRIfreq" Hz\n", __func__, caps->rx_range_list2[0].end); if (freq < caps->rx_range_list1[0].start || freq > caps->rx_range_list1[0].end || freq < caps->rx_range_list2[0].start || freq > caps->rx_range_list2[0].end) return -RIG_EINVAL; err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; /* vfo should now be modified to a valid VFO constant. */ switch (vfo) { case RIG_VFO_A: c = 'A'; break; case RIG_VFO_B: c = 'B'; break; case RIG_VFO_MEM: c = 'A'; break; default: return -RIG_ENIMPL; /* Only VFO_A or VFO_B are valid */ } // W1HKJ // creation of the priv structure guarantees that the string can be NEWCAT_DATA_LEN // bytes in length. the snprintf will only allow (NEWCAT_DATA_LEN - 1) chars // followed by the NULL terminator. // CAT command string for setting frequency requires that 8 digits be sent // including leading fill zeros snprintf(priv->cmd_str, sizeof(priv->cmd_str), "F%c%08d%c", c, (int)freq, cat_term); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); return err; } /* * rig_get_freq * * Return Freq for a given VFO * RIG_TARGETABLE_FREQ * Does not SET priv->current_vfo * */ int newcat_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { char command[3]; struct newcat_priv_data *priv; struct rig_state *state; char c; int err; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); if (!newcat_valid_command(rig, "FA")) return -RIG_ENAVAIL; err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; switch(vfo) { case RIG_VFO_A: c = 'A'; break; case RIG_VFO_B: c = 'B'; break; case RIG_VFO_MEM: c = 'A'; break; default: return -RIG_EINVAL; /* sorry, unsupported VFO */ } /* Build the command string */ snprintf(command, sizeof(command), "F%c", c); if (!newcat_valid_command(rig, command)) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c", command, cat_term); rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", priv->cmd_str); /* get freq */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s\n", __func__, err, priv->ret_data); /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get FREQ\n", __func__); return -RIG_EPROTO; } /* convert the read frequency string into freq_t and store in *freq */ sscanf(priv->ret_data+2, "%"SCNfreq, freq); rig_debug(RIG_DEBUG_TRACE, "%s: freq = %"PRIfreq" Hz for vfo 0x%02x\n", __func__, freq, vfo); return RIG_OK; } int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct newcat_priv_data *priv; struct rig_state *state; int err; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "MD")) return -RIG_ENAVAIL; err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MD0x%c", cat_term); /* FT9000 RIG_TARGETABLE_MODE (mode and width) */ /* FT2000 mode only */ if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) priv->cmd_str[2] = (RIG_VFO_B == vfo) ? '1' : '0'; rig_debug(RIG_DEBUG_VERBOSE,"%s: generic mode = %x \n", __func__, mode); if (RIG_PASSBAND_NORMAL == width) width = rig_passband_normal(rig, mode); switch(mode) { case RIG_MODE_LSB: priv->cmd_str[3] = '1'; break; case RIG_MODE_USB: priv->cmd_str[3] = '2'; break; case RIG_MODE_CW: priv->cmd_str[3] = '3'; break; case RIG_MODE_AM: priv->cmd_str[3] = '5'; break; case RIG_MODE_RTTY: priv->cmd_str[3] = '6'; break; case RIG_MODE_CWR: priv->cmd_str[3] = '7'; break; case RIG_MODE_PKTLSB: /* FT450 USER-L */ priv->cmd_str[3] = '8'; break; case RIG_MODE_RTTYR: priv->cmd_str[3] = '9'; break; case RIG_MODE_PKTFM: priv->cmd_str[3] = 'A'; break; case RIG_MODE_FM: priv->cmd_str[3] = '4'; break; case RIG_MODE_PKTUSB: /* FT450 USER-U */ priv->cmd_str[3] = 'C'; break; default: return -RIG_EINVAL; } err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; if (RIG_PASSBAND_NORMAL == width) width = rig_passband_normal(rig, mode); /* Set width after mode has been set */ err = newcat_set_rx_bandwidth(rig, vfo, mode, width); return err; } int newcat_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct newcat_priv_data *priv; struct rig_state *state; char c; int err; ncboolean narrow; char main_sub_vfo = '0'; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "MD")) return -RIG_ENAVAIL; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) main_sub_vfo = RIG_VFO_B == vfo ? '1' : '0'; /* Build the command string */ snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MD%c%c", main_sub_vfo, cat_term); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); /* Get MODE */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s\n", __func__, err, priv->ret_data); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get MODE\n", __func__); return -RIG_EPROTO; } /* * The current mode value is a digit '0' ... 'C' * embedded at ret_data[3] in the read string. */ c = priv->ret_data[3]; /* default, unless set otherwise */ *width = RIG_PASSBAND_NORMAL; switch (c) { case '1': *mode = RIG_MODE_LSB; break; case '2': *mode = RIG_MODE_USB; break; case '3': *mode = RIG_MODE_CW; break; case '4': *mode = RIG_MODE_FM; err = newcat_get_narrow(rig, vfo, &narrow); if (narrow == TRUE) *width = rig_passband_narrow(rig, *mode); else *width = rig_passband_normal(rig, *mode); return err; case '5': *mode = RIG_MODE_AM; err = newcat_get_narrow(rig, vfo, &narrow); if (narrow == TRUE) *width = rig_passband_narrow(rig, *mode); else *width = rig_passband_normal(rig, *mode); return err; case '6': *mode = RIG_MODE_RTTY; break; case '7': *mode = RIG_MODE_CWR; break; case '8': *mode = RIG_MODE_PKTLSB; /* FT450 USER-L */ break; case '9': *mode = RIG_MODE_RTTYR; break; case 'A': *mode = RIG_MODE_PKTFM; err = newcat_get_narrow(rig, vfo, &narrow); if (narrow == TRUE) *width = rig_passband_narrow(rig, *mode); else *width = rig_passband_normal(rig, *mode); return err; case 'B': *mode = RIG_MODE_FM; /* narrow */ *width = rig_passband_narrow(rig, *mode); return RIG_OK; case 'C': *mode = RIG_MODE_PKTUSB; /* FT450 USER-U */ break; case 'D': *mode = RIG_MODE_AM; /* narrow, FT950 */ *width = rig_passband_narrow(rig, *mode); return RIG_OK; default: return -RIG_EPROTO; } if (RIG_PASSBAND_NORMAL == *width) *width = rig_passband_normal(rig, *mode); err = newcat_get_rx_bandwidth(rig, vfo, *mode, width); if (err < 0) return err; return RIG_OK; } /* * rig_set_vfo * * set vfo and store requested vfo for later RIG_VFO_CURR * requests. * */ int newcat_set_vfo(RIG *rig, vfo_t vfo) { struct newcat_priv_data *priv; struct rig_state *state; char c; int err, mem; vfo_t vfo_mode; char command[] = "VS"; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_TRACE, "%s: called, passed vfo = 0x%02x\n", __func__, vfo); if (!newcat_valid_command(rig, command)) return -RIG_ENAVAIL; err = newcat_set_vfo_from_alias(rig, &vfo); /* passes RIG_VFO_MEM, RIG_VFO_A, RIG_VFO_B */ if (err < 0) return err; switch(vfo) { case RIG_VFO_A: case RIG_VFO_B: if (vfo == RIG_VFO_B) c = '1'; else c = '0'; err = newcat_get_vfo_mode(rig, &vfo_mode); if (vfo_mode == RIG_VFO_MEM) { priv->current_mem = NC_MEM_CHANNEL_NONE; state->current_vfo = RIG_VFO_A; err = newcat_vfomem_toggle(rig); return err; } break; case RIG_VFO_MEM: if (priv->current_mem == NC_MEM_CHANNEL_NONE) { /* Only works correctly for VFO A */ if (state->current_vfo == RIG_VFO_B) return -RIG_ENTARGET; /* get current memory channel */ err = newcat_get_mem(rig, vfo, &mem); if (err != RIG_OK) return err; /* turn on memory channel */ err = newcat_set_mem(rig, vfo, mem); if (err != RIG_OK) return err; /* Set current_mem now */ priv->current_mem = mem; } /* Set current_vfo now */ state->current_vfo = vfo; return RIG_OK; default: return -RIG_ENIMPL; /* sorry, VFO not implemented */ } /* Build the command string */ snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c", command, c, cat_term); rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", priv->cmd_str); err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; state->current_vfo = vfo; /* if set_vfo worked, set current_vfo */ rig_debug(RIG_DEBUG_TRACE, "%s: rig->state.current_vfo = 0x%02x\n", __func__, vfo); return RIG_OK; } /* * rig_get_vfo * * get current RX vfo/mem and store requested vfo for * later RIG_VFO_CURR requests plus pass the tested vfo/mem * back to the frontend. * */ int newcat_get_vfo(RIG *rig, vfo_t *vfo) { struct newcat_priv_data *priv; struct rig_state *state; char c; int err; vfo_t vfo_mode; char command[] = "VS"; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; if (!rig || !vfo) return -RIG_EINVAL; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, command)) return -RIG_ENAVAIL; /* Build the command string */ snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s;", command); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); /* Get VFO */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s, VFO value = %c\n", __func__, err, priv->ret_data, priv->ret_data[2]); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get VFO\n", __func__); *vfo = RIG_VFO_A; state->current_vfo = RIG_VFO_A; return -RIG_EPROTO; } /* * The current VFO value is a digit ('0' or '1' ('A' or 'B' respectively)) * embedded at ret_data[2] in the read string. */ c = priv->ret_data[2]; switch (c) { case '0': *vfo = RIG_VFO_A; break; case '1': *vfo = RIG_VFO_B; break; default: return -RIG_EPROTO; /* sorry, wrong current VFO */ } /* Check to see if RIG is in MEM mode */ err = newcat_get_vfo_mode(rig, &vfo_mode); if (vfo_mode == RIG_VFO_MEM) *vfo = RIG_VFO_MEM; state->current_vfo = *vfo; /* set now */ rig_debug(RIG_DEBUG_TRACE, "%s: rig->state.current_vfo = 0x%02x\n", __func__, state->current_vfo); return RIG_OK; } int newcat_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { // struct newcat_priv_data *priv; struct rig_state *state; int err; char txon[] = "TX1;"; char txoff[] = "TX0;"; // priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; if (!newcat_valid_command(rig, "TX")) return -RIG_ENAVAIL; switch(ptt) { case RIG_PTT_ON: err = write_block(&state->rigport, txon, strlen(txon)); break; case RIG_PTT_OFF: err = write_block(&state->rigport, txoff, strlen(txoff)); break; default: return -RIG_EINVAL; } return err; } int newcat_get_ptt(RIG * rig, vfo_t vfo, ptt_t * ptt) { char c; struct newcat_priv_data *priv; struct rig_state *state; int err; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; if (!newcat_valid_command(rig, "TX")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c", "TX", cat_term); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); /* Get PTT */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s, PTT value = %c\n", __func__, err, priv->ret_data, priv->ret_data[2]); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get PTT\n", __func__); return -RIG_EPROTO; } c = priv->ret_data[2]; switch (c) { case '0': /* FT-950 "TX OFF", Original Release Firmware */ *ptt = RIG_PTT_OFF; break; case '1' : /* Just because,    what the CAT Manual Shows */ case '2' : /* FT-950 Radio:    Mic, Dataport, CW "TX ON" */ case '3' : /* FT-950 CAT port: Radio in "TX ON" mode     [Not what the CAT Manual Shows] */ *ptt = RIG_PTT_ON; break; default: return -RIG_EPROTO; } return RIG_OK; } int newcat_get_dcd(RIG * rig, vfo_t vfo, dcd_t * dcd) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_rptr_shift(RIG * rig, vfo_t vfo, rptr_shift_t rptr_shift) { struct newcat_priv_data *priv; struct rig_state *state; int err; char c; char command[] = "OS"; char main_sub_vfo = '0'; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; if (!newcat_valid_command(rig, command)) return -RIG_ENAVAIL; /* Main or SUB vfo */ err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) main_sub_vfo = RIG_VFO_B == vfo ? '1' : '0'; switch (rptr_shift) { case RIG_RPT_SHIFT_NONE: c = '0'; break; case RIG_RPT_SHIFT_PLUS: c = '1'; break; case RIG_RPT_SHIFT_MINUS: c = '2'; break; default: return -RIG_EINVAL; } snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c%c", command, main_sub_vfo, c, cat_term); err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); return err; } int newcat_get_rptr_shift(RIG * rig, vfo_t vfo, rptr_shift_t * rptr_shift) { struct newcat_priv_data *priv; struct rig_state *state; int err; char c; char command[] = "OS"; char main_sub_vfo = '0'; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, command)) return -RIG_ENAVAIL; /* Set Main or SUB vfo */ err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c", command, main_sub_vfo, cat_term); /* Get Rptr Shift */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s, Rptr Shift value = %c\n", __func__, err, priv->ret_data, priv->ret_data[3]); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get RPTR_SHIFT\n", __func__); return -RIG_EPROTO; } c = priv->ret_data[3]; switch (c) { case '0': *rptr_shift = RIG_RPT_SHIFT_NONE; break; case '1': *rptr_shift = RIG_RPT_SHIFT_PLUS; break; case '2': *rptr_shift = RIG_RPT_SHIFT_MINUS; break; default: return -RIG_EINVAL; } return RIG_OK; } int newcat_set_rptr_offs(RIG * rig, vfo_t vfo, shortfreq_t offs) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_get_rptr_offs(RIG * rig, vfo_t vfo, shortfreq_t * offs) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_split_freq(RIG * rig, vfo_t vfo, freq_t tx_freq) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_get_split_freq(RIG * rig, vfo_t vfo, freq_t * tx_freq) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_split_mode(RIG * rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_get_split_mode(RIG * rig, vfo_t vfo, rmode_t * tx_mode, pbwidth_t * tx_width) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_split_vfo(RIG * rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { int err; vfo_t rx_vfo; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; err = newcat_get_vfo(rig, &rx_vfo); /* sync to rig current vfo */ if (err != RIG_OK) return err; switch (split) { case RIG_SPLIT_OFF: err = newcat_set_tx_vfo(rig, vfo); if (err != RIG_OK) return err; if (rx_vfo != vfo) { err = newcat_set_vfo(rig, vfo); if (err != RIG_OK) return err; } break; case RIG_SPLIT_ON: err = newcat_set_tx_vfo(rig, tx_vfo); if (err != RIG_OK) return err; if (rx_vfo != vfo) { err = newcat_set_vfo(rig, vfo); if (err != RIG_OK) return err; } break; default: return -RIG_EINVAL; } return RIG_OK; } int newcat_get_split_vfo(RIG * rig, vfo_t vfo, split_t * split, vfo_t *tx_vfo) { int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); err = newcat_set_vfo_from_alias(rig, &vfo); if (err != RIG_OK) return err; err = newcat_get_tx_vfo(rig, tx_vfo); if (err != RIG_OK) return err; if (*tx_vfo != vfo) *split = RIG_SPLIT_ON; else *split = RIG_SPLIT_OFF; rig_debug(RIG_DEBUG_TRACE, "SPLIT = %d, vfo = %d, TX_vfo = %d\n", *split, vfo, *tx_vfo); return RIG_OK; } int newcat_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit) { struct newcat_priv_data *priv; struct rig_state *state; int err; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; if (!newcat_valid_command(rig, "RT")) return -RIG_ENAVAIL; if (rit > rig->caps->max_rit) rit = rig->caps->max_rit; /* + */ else if (abs(rit) > rig->caps->max_rit) rit = - rig->caps->max_rit; /* - */ if (rit == 0) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cRT0%c", cat_term, cat_term); else if (rit < 0) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cRD%04d%cRT1%c", cat_term, abs(rit), cat_term, cat_term); else snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cRU%04d%cRT1%c", cat_term, abs(rit), cat_term, cat_term); err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); return err; } int newcat_get_rit(RIG * rig, vfo_t vfo, shortfreq_t * rit) { struct newcat_priv_data *priv; struct rig_state *state; char *retval; char rit_on; int err; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; if (!newcat_valid_command(rig, "IF")) return -RIG_ENAVAIL; *rit = 0; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c", "IF", cat_term); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); /* Get RIT */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s, RIT value = %c\n", __func__, err, priv->ret_data, priv->ret_data[18]); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get RIT\n", __func__); return -RIG_EPROTO; } retval = priv->ret_data + 13; rit_on = retval[5]; retval[5] = '\0'; if (rit_on == '1') *rit = (shortfreq_t) atoi(retval); return RIG_OK; } int newcat_set_xit(RIG * rig, vfo_t vfo, shortfreq_t xit) { struct newcat_priv_data *priv; struct rig_state *state; int err; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; if (!newcat_valid_command(rig, "XT")) return -RIG_ENAVAIL; if (xit > rig->caps->max_xit) xit = rig->caps->max_xit; /* + */ else if (abs(xit) > rig->caps->max_xit) xit = - rig->caps->max_xit; /* - */ if (xit == 0) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cXT0%c", cat_term, cat_term); else if (xit < 0) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cRD%04d%cXT1%c", cat_term, abs(xit), cat_term, cat_term); else snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RC%cRU%04d%cXT1%c", cat_term, abs(xit), cat_term, cat_term); err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); return err; } int newcat_get_xit(RIG * rig, vfo_t vfo, shortfreq_t * xit) { struct newcat_priv_data *priv; struct rig_state *state; char *retval; char xit_on; int err; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; if (!newcat_valid_command(rig, "IF")) return -RIG_ENAVAIL; *xit = 0; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c", "IF", cat_term); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); /* Get XIT */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s, XIT value = %c\n", __func__, err, priv->ret_data, priv->ret_data[19]); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get XIT\n", __func__); return -RIG_EPROTO; } retval = priv->ret_data + 13; xit_on = retval[6]; retval[5] = '\0'; if (xit_on == '1') *xit = (shortfreq_t) atoi(retval); return RIG_OK; } int newcat_set_ts(RIG * rig, vfo_t vfo, shortfreq_t ts) { int err, i; pbwidth_t width; rmode_t mode; ncboolean ts_match; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); err = newcat_get_mode(rig, vfo, &mode, &width); if (err < 0) return err; /* assume 2 tuning steps per mode */ for (i = 0, ts_match = FALSE; i < TSLSTSIZ && rig->caps->tuning_steps[i].ts; i++) if (rig->caps->tuning_steps[i].modes & mode) { if (ts <= rig->caps->tuning_steps[i].ts) err = newcat_set_faststep(rig, FALSE); else err = newcat_set_faststep(rig, TRUE); if (err != RIG_OK) return err; ts_match = TRUE; break; } /* if mode */ rig_debug(RIG_DEBUG_TRACE, "ts_match = %d, i = %d, ts = %d\n", ts_match, i, ts); if (ts_match) return RIG_OK; else return -RIG_ENAVAIL; } int newcat_get_ts(RIG * rig, vfo_t vfo, shortfreq_t * ts) { pbwidth_t width; rmode_t mode; int err, i; ncboolean ts_match; ncboolean fast_step = FALSE; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); err = newcat_get_mode(rig, vfo, &mode, &width); if (err < 0) return err; err = newcat_get_faststep(rig, &fast_step); if (err < 0) return err; /* assume 2 tuning steps per mode */ for (i = 0, ts_match = FALSE; i < TSLSTSIZ && rig->caps->tuning_steps[i].ts; i++) if (rig->caps->tuning_steps[i].modes & mode) { if (fast_step == FALSE) *ts = rig->caps->tuning_steps[i].ts; else *ts = rig->caps->tuning_steps[i+1].ts; ts_match = TRUE; break; } rig_debug(RIG_DEBUG_TRACE, "ts_match = %d, i = %d, i+1 = %d, *ts = %d\n", ts_match, i, i+1, *ts); if (ts_match) return RIG_OK; else return -RIG_ENAVAIL; } int newcat_set_dcs_code(RIG * rig, vfo_t vfo, tone_t code) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_get_dcs_code(RIG * rig, vfo_t vfo, tone_t * code) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_tone(RIG * rig, vfo_t vfo, tone_t tone) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_get_tone(RIG * rig, vfo_t vfo, tone_t * tone) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_ctcss_tone(RIG * rig, vfo_t vfo, tone_t tone) { struct newcat_priv_data *priv; struct rig_state *state; int err; int i; ncboolean tone_match; char main_sub_vfo = '0'; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "CN")) return -RIG_ENAVAIL; if (!newcat_valid_command(rig, "CT")) return -RIG_ENAVAIL; err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; for (i = 0, tone_match = FALSE; rig->caps->ctcss_list[i] != 0; i++) if (tone == rig->caps->ctcss_list[i]) { tone_match = TRUE; break; } rig_debug(RIG_DEBUG_TRACE, "%s: tone = %d, tone_match = %d, i = %d", __func__, tone, tone_match, i); if (tone_match == FALSE && tone != 0) return -RIG_ENAVAIL; if (tone == 0) /* turn off ctcss */ snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CT%c0%c", main_sub_vfo, cat_term); else { snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CN%c%02d%cCT%c2%c", main_sub_vfo, i, cat_term, main_sub_vfo, cat_term); } err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); return err; } int newcat_get_ctcss_tone(RIG * rig, vfo_t vfo, tone_t * tone) { struct newcat_priv_data *priv; struct rig_state *state; int err; int t; int ret_data_len; char *retlvl; char cmd[] = "CN"; char main_sub_vfo = '0'; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, cmd)) return -RIG_ENAVAIL; err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c", cmd, main_sub_vfo, cat_term); /* Get CTCSS TONE */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s\n", __func__, err, priv->ret_data); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get CTCSS_TONE\n", __func__); return -RIG_EPROTO; } ret_data_len = strlen(priv->ret_data); /* skip command */ retlvl = priv->ret_data + strlen(priv->cmd_str)-1; /* chop term */ priv->ret_data[ret_data_len-1] = '\0'; t = atoi(retlvl); /* tone index */ if (t < 0 || t > 49) return -RIG_ENAVAIL; *tone = rig->caps->ctcss_list[t]; return RIG_OK; } int newcat_set_dcs_sql(RIG * rig, vfo_t vfo, tone_t code) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_get_dcs_sql(RIG * rig, vfo_t vfo, tone_t * code) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_tone_sql(RIG * rig, vfo_t vfo, tone_t tone) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_get_tone_sql(RIG * rig, vfo_t vfo, tone_t * tone) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_ctcss_sql(RIG * rig, vfo_t vfo, tone_t tone) { int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); err = newcat_set_ctcss_tone(rig, vfo, tone); if (err != RIG_OK) return err; /* Change to sql */ if (tone) { err = newcat_set_func(rig, vfo, RIG_FUNC_TSQL, TRUE); if (err != RIG_OK) return err; } return RIG_OK; } int newcat_get_ctcss_sql(RIG * rig, vfo_t vfo, tone_t * tone) { int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); err = newcat_get_ctcss_tone(rig, vfo, tone); return err; } int newcat_power2mW(RIG * rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode) { int rig_id; rig_id = newcat_get_rigid(rig); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); switch (rig_id) { case NC_RIGID_FT450: /* 100 Watts */ *mwpower = power * 100000; rig_debug(RIG_DEBUG_TRACE, "case FT450 - rig_id = %d, *mwpower = %d\n", rig_id, *mwpower); break; case NC_RIGID_FT950: /* 100 Watts */ *mwpower = power * 100000; /* 0..100 Linear scale */ rig_debug(RIG_DEBUG_TRACE, "case FT950 - rig_id = %d, power = %f, *mwpower = %d\n", rig_id, power, *mwpower); break; case NC_RIGID_FT2000: /* 100 Watts */ *mwpower = power * 100000; rig_debug(RIG_DEBUG_TRACE, "case FT2000 - rig_id = %d, *mwpower = %d\n", rig_id, *mwpower); break; case NC_RIGID_FT2000D: /* 200 Watts */ *mwpower = power * 200000; rig_debug(RIG_DEBUG_TRACE, "case FT2000D - rig_id = %d, *mwpower = %d\n", rig_id, *mwpower); break; case NC_RIGID_FTDX5000: /* 200 Watts */ *mwpower = power * 200000; rig_debug(RIG_DEBUG_TRACE, "case FTDX5000 - rig_id = %d, *mwpower = %d\n", rig_id, *mwpower); break; case NC_RIGID_FTDX9000D: /* 200 Watts */ *mwpower = power * 200000; rig_debug(RIG_DEBUG_TRACE, "case FTDX9000D - rig_id = %d, *mwpower = %d\n", rig_id, *mwpower); break; case NC_RIGID_FTDX9000Contest: /* 200 Watts */ *mwpower = power * 200000; rig_debug(RIG_DEBUG_TRACE, "case FTDX9000Contest - rig_id = %d, *mwpower = %d\n", rig_id, *mwpower); break; case NC_RIGID_FTDX9000MP: /* 400 Watts */ *mwpower = power * 400000; rig_debug(RIG_DEBUG_TRACE, "case FTDX9000MP - rig_id = %d, *mwpower = %d\n", rig_id, *mwpower); break; default: /* 100 Watts */ *mwpower = power * 100000; rig_debug(RIG_DEBUG_TRACE, "default - rig_id = %d, *mwpower = %d\n", rig_id, *mwpower); } return RIG_OK; } int newcat_mW2power(RIG * rig, float *power, unsigned int mwpower, freq_t freq, rmode_t mode) { int rig_id; rig_id = newcat_get_rigid(rig); rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); switch (rig_id) { case NC_RIGID_FT450: /* 100 Watts */ *power = mwpower / 100000.0; rig_debug(RIG_DEBUG_TRACE, "case FT450 - rig_id = %d, *power = %f\n", rig_id, *power); break; case NC_RIGID_FT950: /* 100 Watts */ *power = mwpower / 100000.0; /* 0..100 Linear scale */ rig_debug(RIG_DEBUG_TRACE, "case FT950 - rig_id = %d, mwpower = %d, *power = %f\n", rig_id, mwpower, *power); break; case NC_RIGID_FT2000: /* 100 Watts */ *power = mwpower / 100000.0; rig_debug(RIG_DEBUG_TRACE, "case FT2000 - rig_id = %d, *power = %f\n", rig_id, *power); break; case NC_RIGID_FT2000D: /* 200 Watts */ *power = mwpower / 200000.0; rig_debug(RIG_DEBUG_TRACE, "case FT2000D - rig_id = %d, *power = %f\n", rig_id, *power); break; case NC_RIGID_FTDX5000: /* 200 Watts */ *power = mwpower / 200000.0; rig_debug(RIG_DEBUG_TRACE, "case FTDX5000 - rig_id = %d, *power = %f\n", rig_id, *power); break; case NC_RIGID_FTDX9000D: /* 200 Watts */ *power = mwpower / 200000.0; rig_debug(RIG_DEBUG_TRACE, "case FTDX9000D - rig_id = %d, *power = %f\n", rig_id, *power); break; case NC_RIGID_FTDX9000Contest: /* 200 Watts */ *power = mwpower / 200000.0; rig_debug(RIG_DEBUG_TRACE, "case FTDX9000Contest - rig_id = %d, *power = %f\n", rig_id, *power); break; case NC_RIGID_FTDX9000MP: /* 400 Watts */ *power = mwpower / 400000.0; rig_debug(RIG_DEBUG_TRACE, "case FTDX9000MP - rig_id = %d, *power = %f\n", rig_id, *power); break; default: /* 100 Watts */ *power = mwpower / 100000.0; rig_debug(RIG_DEBUG_TRACE, "default - rig_id = %d, *power = %f\n", rig_id, *power); } return RIG_OK; } int newcat_set_powerstat(RIG * rig, powerstat_t status) { struct newcat_priv_data *priv; struct rig_state *state; int err; char ps; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "PS")) return -RIG_ENAVAIL; switch (status) { case RIG_POWER_ON: ps = '1'; break; case RIG_POWER_OFF: case RIG_POWER_STANDBY: ps = '0'; break; default: return -RIG_ENAVAIL; } snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PS%c%c", ps, cat_term); err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); // delay 1.5 seconds usleep(1500000); err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); return err; } /* * This functions returns an error if the rig is off, dah */ int newcat_get_powerstat(RIG * rig, powerstat_t * status) { struct newcat_priv_data *priv; struct rig_state *state; int err; char ps; char command[] = "PS"; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); *status = RIG_POWER_OFF; if (!newcat_valid_command(rig, command)) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c", command, cat_term); /* Get Power status */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s, PS value = %c\n", __func__, err, priv->ret_data, priv->ret_data[2]); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get PS\n", __func__); return -RIG_EPROTO; } ps = priv->ret_data[2]; switch (ps) { case '1': *status = RIG_POWER_ON; break; case '0': *status = RIG_POWER_OFF; break; default: return -RIG_ENAVAIL; } return RIG_OK; } int newcat_reset(RIG * rig, reset_t reset) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_ant(RIG * rig, vfo_t vfo, ant_t ant) { struct newcat_priv_data *priv; struct rig_state *state; int err; char which_ant; char command[] = "AN"; char main_sub_vfo = '0'; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; if (!newcat_valid_command(rig, command)) return -RIG_ENAVAIL; /* Main or SUB vfo */ err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; if (newcat_is_rig(rig, RIG_MODEL_FT9000)) main_sub_vfo = RIG_VFO_B == vfo ? '1' : '0'; switch (ant) { case RIG_ANT_1: which_ant = '1'; break; case RIG_ANT_2: which_ant = '2'; break; case RIG_ANT_3: if (newcat_is_rig(rig, RIG_MODEL_FT950)) /* FT2000 also */ return -RIG_EINVAL; which_ant = '3'; break; case RIG_ANT_4: if (newcat_is_rig(rig, RIG_MODEL_FT950)) return -RIG_EINVAL; which_ant = '4'; break; case RIG_ANT_5: if (newcat_is_rig(rig, RIG_MODEL_FT950)) return -RIG_EINVAL; /* RX only, on FT-2000/FT-5000/FT-9000 */ which_ant = '5'; break; default: return -RIG_EINVAL; } snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c%c", command, main_sub_vfo, which_ant, cat_term); err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); return err; } int newcat_get_ant(RIG * rig, vfo_t vfo, ant_t * ant) { struct newcat_priv_data *priv; struct rig_state *state; int err; char c; char command[] = "AN"; char main_sub_vfo = '0'; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, command)) return -RIG_ENAVAIL; /* Set Main or SUB vfo */ err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; if (newcat_is_rig(rig, RIG_MODEL_FT9000)) main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c", command, main_sub_vfo, cat_term); /* Get ANT */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s, ANT value = %c\n", __func__, err, priv->ret_data, priv->ret_data[3]); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get ANT\n", __func__); return -RIG_EPROTO; } c = priv->ret_data[3]; switch (c) { case '1': *ant = RIG_ANT_1; break; case '2' : *ant = RIG_ANT_2; break; case '3' : *ant = RIG_ANT_3; break; case '4' : *ant = RIG_ANT_4; break; case '5' : *ant = RIG_ANT_5; break; default: return -RIG_EPROTO; } return RIG_OK; } int newcat_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val) { struct newcat_priv_data *priv; struct rig_state *state; int err; int i; int scale; int fpf; char main_sub_vfo = '0'; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; /* Set Main or SUB vfo */ err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; /* Start with both but mostly FT9000 */ if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; switch (level) { case RIG_LEVEL_RFPOWER: if (!newcat_valid_command(rig, "PC")) return -RIG_ENAVAIL; scale = (newcat_is_rig(rig, RIG_MODEL_FT950)) ? 100 : 255; fpf = newcat_scale_float(scale, val.f); snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PC%03d%c", fpf, cat_term); break; case RIG_LEVEL_AF: if (!newcat_valid_command(rig, "AG")) return -RIG_ENAVAIL; fpf = newcat_scale_float(255, val.f); snprintf(priv->cmd_str, sizeof(priv->cmd_str), "AG%c%03d%c", main_sub_vfo, fpf, cat_term); break; case RIG_LEVEL_AGC: if (!newcat_valid_command(rig, "GT")) return -RIG_ENAVAIL; switch (val.i) { case RIG_AGC_OFF: snprintf(priv->cmd_str, sizeof(priv->cmd_str), "GT00;"); break; case RIG_AGC_FAST: snprintf(priv->cmd_str, sizeof(priv->cmd_str), "GT01;"); break; case RIG_AGC_MEDIUM: snprintf(priv->cmd_str, sizeof(priv->cmd_str), "GT02;"); break; case RIG_AGC_SLOW: snprintf(priv->cmd_str, sizeof(priv->cmd_str), "GT03;"); break; case RIG_AGC_AUTO: snprintf(priv->cmd_str, sizeof(priv->cmd_str), "GT04;"); break; default: return -RIG_EINVAL; } priv->cmd_str[2] = main_sub_vfo; break; case RIG_LEVEL_IF: if (!newcat_valid_command(rig, "IS")) return -RIG_ENAVAIL; if (abs(val.i) > rig->caps->max_ifshift) { if (val.i > 0) val.i = rig->caps->max_ifshift; else val.i = rig->caps->max_ifshift * -1; } snprintf(priv->cmd_str, sizeof(priv->cmd_str), "IS0%+.4d%c", val.i, cat_term); /* problem with %+04d */ if (newcat_is_rig(rig, RIG_MODEL_FT9000)) priv->cmd_str[2] = main_sub_vfo; break; case RIG_LEVEL_CWPITCH: if (!newcat_valid_command(rig, "KP")) return -RIG_ENAVAIL; if (val.i < 300) i = 300; else if (val.i > 1050) i = 1050; else i = val.i; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "KP%02d%c", 2*((i+50-300)/100), cat_term); break; case RIG_LEVEL_KEYSPD: if (!newcat_valid_command(rig, "KS")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "KS%03d%c", val.i, cat_term); break; case RIG_LEVEL_MICGAIN: if (!newcat_valid_command(rig, "MG")) return -RIG_ENAVAIL; fpf = newcat_scale_float(255, val.f); snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MG%03d%c", fpf, cat_term); break; case RIG_LEVEL_METER: if (!newcat_valid_command(rig, "MS")) return -RIG_ENAVAIL; switch (val.i) { case RIG_METER_ALC: snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MS1;"); break; case RIG_METER_PO: if (newcat_is_rig(rig, RIG_MODEL_FT950)) return RIG_OK; else snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MS2;"); break; case RIG_METER_SWR: snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MS3;"); break; case RIG_METER_COMP: snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MS0;"); break; case RIG_METER_IC: snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MS4;"); break; case RIG_METER_VDD: snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MS5;"); break; default: return -RIG_EINVAL; } break; case RIG_LEVEL_PREAMP: if (!newcat_valid_command(rig, "PA")) return -RIG_ENAVAIL; if (val.i == 0) { snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PA00%c", cat_term); if (newcat_is_rig(rig, RIG_MODEL_FT9000)) priv->cmd_str[2] = main_sub_vfo; break; } priv->cmd_str[0] = '\0'; for (i=0; state->preamp[i] != RIG_DBLST_END; i++) if (state->preamp[i] == val.i) { snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PA0%d%c", i+1, cat_term); break; } if (strlen(priv->cmd_str) != 0) { if (newcat_is_rig(rig, RIG_MODEL_FT9000)) priv->cmd_str[2] = main_sub_vfo; break; } return -RIG_EINVAL; case RIG_LEVEL_ATT: if (!newcat_valid_command(rig, "RA")) return -RIG_ENAVAIL; if (val.i == 0) { snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RA00%c", cat_term); if (newcat_is_rig(rig, RIG_MODEL_FT9000)) priv->cmd_str[2] = main_sub_vfo; break; } priv->cmd_str[0] = '\0'; for (i=0; state->attenuator[i] != RIG_DBLST_END; i++) if (state->attenuator[i] == val.i) { snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RA0%d%c", i+1, cat_term); break; /* for loop */ } if (strlen(priv->cmd_str) != 0) { if (newcat_is_rig(rig, RIG_MODEL_FT9000)) priv->cmd_str[2] = main_sub_vfo; break; } return -RIG_EINVAL; case RIG_LEVEL_RF: if (!newcat_valid_command(rig, "RG")) return -RIG_ENAVAIL; fpf = newcat_scale_float(255, val.f); snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RG%c%03d%c", main_sub_vfo, fpf, cat_term); break; case RIG_LEVEL_NR: if (!newcat_valid_command(rig, "RL")) return -RIG_ENAVAIL; if (newcat_is_rig(rig, RIG_MODEL_FT450)) { fpf = newcat_scale_float(11, val.f); if (fpf < 1) fpf = 1; if (fpf > 11) fpf = 11; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RL0%02d%c", fpf, cat_term); } else { fpf = newcat_scale_float(15, val.f); if (fpf < 1) fpf = 1; if (fpf > 15) fpf = 15; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RL0%02d%c", fpf, cat_term); if (newcat_is_rig(rig, RIG_MODEL_FT9000)) priv->cmd_str[2] = main_sub_vfo; } break; case RIG_LEVEL_COMP: if (!newcat_valid_command(rig, "PL")) return -RIG_ENAVAIL; scale = (newcat_is_rig(rig, RIG_MODEL_FT950)) ? 100 : 255; fpf = newcat_scale_float(scale, val.f); snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PL%03d%c", fpf, cat_term); break; case RIG_LEVEL_BKINDL: /* Standard: word "PARIS" == 50 Unit Intervals, UIs */ /* 1 dot == 2 UIs */ /* tenth_dots-per-second -to- milliseconds */ if (!newcat_valid_command(rig, "SD")) return -RIG_ENAVAIL; if (val.i < 1) val.i = 1; val.i = 5000 / val.i; if (newcat_is_rig(rig, RIG_MODEL_FT950) || newcat_is_rig(rig, RIG_MODEL_FT450)) { if (val.i < 30) val.i = 30; if (val.i > 3000) val.i = 3000; } else if (newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) { if (val.i < 1) val.i = 1; if (val.i > 5000) val.i = 5000; } snprintf(priv->cmd_str, sizeof(priv->cmd_str), "SD%04d%c", val.i, cat_term); break; case RIG_LEVEL_SQL: if (!newcat_valid_command(rig, "SQ")) return -RIG_ENAVAIL; fpf = newcat_scale_float(255, val.f); snprintf(priv->cmd_str, sizeof(priv->cmd_str), "SQ%c%03d%c", main_sub_vfo, fpf, cat_term); break; case RIG_LEVEL_VOX: if (!newcat_valid_command(rig, "VD")) return -RIG_ENAVAIL; /* VOX delay, arg int (tenth of seconds), 100ms UI */ val.i = val.i * 100; if (newcat_is_rig(rig, RIG_MODEL_FT950) || newcat_is_rig(rig, RIG_MODEL_FT450)) { if (val.i < 100) /* min is 30ms but spec is 100ms Unit Intervals */ val.i = 30; if (val.i > 3000) val.i =3000; } else if (newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) { if (val.i < 0) val.i = 0; if (val.i > 5000) val.i = 5000; } snprintf(priv->cmd_str, sizeof(priv->cmd_str), "VD%04d%c", val.i, cat_term); break; case RIG_LEVEL_VOXGAIN: if (!newcat_valid_command(rig, "VG")) return -RIG_ENAVAIL; scale = (newcat_is_rig(rig, RIG_MODEL_FT950)) ? 100 : 255; fpf = newcat_scale_float(scale, val.f); snprintf(priv->cmd_str, sizeof(priv->cmd_str), "VG%03d%c", fpf, cat_term); break; case RIG_LEVEL_ANTIVOX: if (newcat_is_rig(rig, RIG_MODEL_FT950)) { fpf = newcat_scale_float(100, val.f); snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX117%03d%c", fpf, cat_term); } else return -RIG_EINVAL; break; case RIG_LEVEL_NOTCHF: if (!newcat_valid_command(rig, "BP")) return -RIG_ENAVAIL; val.i = val.i / 10; if (val.i < 1) /* fix lower bounds limit */ val.i = 1; if (newcat_is_rig(rig, RIG_MODEL_FT950)) { if (val.i > 300) val.i = 300; } else { if (val.i > 400) val.i = 400; } snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BP01%03d%c", val.i, cat_term); if (newcat_is_rig(rig, RIG_MODEL_FT9000)) /* The old CAT Man. shows VFO */ priv->cmd_str[2] = main_sub_vfo; break; default: return -RIG_EINVAL; } err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); return err; } int newcat_get_level(RIG * rig, vfo_t vfo, setting_t level, value_t * val) { struct newcat_priv_data *priv; struct rig_state *state; int err; int ret_data_len; char *retlvl; float scale; char main_sub_vfo = '0'; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; /* Set Main or SUB vfo */ err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; switch (level) { case RIG_LEVEL_RFPOWER: if (!newcat_valid_command(rig, "PC")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PC%c", cat_term); break; case RIG_LEVEL_PREAMP: if (!newcat_valid_command(rig, "PA")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PA0%c", cat_term); if (newcat_is_rig(rig, RIG_MODEL_FT9000)) priv->cmd_str[2] = main_sub_vfo; break; case RIG_LEVEL_AF: if (!newcat_valid_command(rig, "AG")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "AG%c%c", main_sub_vfo, cat_term); break; case RIG_LEVEL_AGC: if (!newcat_valid_command(rig, "GT")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "GT%c%c", main_sub_vfo, cat_term); break; case RIG_LEVEL_IF: if (!newcat_valid_command(rig, "IS")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "IS0%c", cat_term); if (newcat_is_rig(rig, RIG_MODEL_FT9000)) priv->cmd_str[2] = main_sub_vfo; break; case RIG_LEVEL_CWPITCH: if (!newcat_valid_command(rig, "KP")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "KP%c", cat_term); break; case RIG_LEVEL_KEYSPD: if (!newcat_valid_command(rig, "KS")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "KS%c", cat_term); break; case RIG_LEVEL_MICGAIN: if (!newcat_valid_command(rig, "MG")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MG%c", cat_term); break; case RIG_LEVEL_METER: if (!newcat_valid_command(rig, "MS")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MS%c", cat_term); break; case RIG_LEVEL_ATT: if (!newcat_valid_command(rig, "RA")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RA0%c", cat_term); if (newcat_is_rig(rig, RIG_MODEL_FT9000)) priv->cmd_str[2] = main_sub_vfo; break; case RIG_LEVEL_RF: if (!newcat_valid_command(rig, "RG")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RG%c%c", main_sub_vfo, cat_term); break; case RIG_LEVEL_COMP: if (!newcat_valid_command(rig, "PL")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PL%c", cat_term); break; case RIG_LEVEL_NR: if (!newcat_valid_command(rig, "RL")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RL0%c", cat_term); if (newcat_is_rig(rig, RIG_MODEL_FT9000)) priv->cmd_str[2] = main_sub_vfo; break; case RIG_LEVEL_BKINDL: if (!newcat_valid_command(rig, "SD")) return -RIG_ENAVAIL; /* should be tenth of dots */ snprintf(priv->cmd_str, sizeof(priv->cmd_str), "SD%c", cat_term); break; case RIG_LEVEL_SQL: if (!newcat_valid_command(rig, "SQ")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "SQ%c%c", main_sub_vfo, cat_term); break; case RIG_LEVEL_VOX: /* VOX delay, arg int (tenth of seconds) */ if (!newcat_valid_command(rig, "VD")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "VD%c", cat_term); break; case RIG_LEVEL_VOXGAIN: if (!newcat_valid_command(rig, "VG")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "VG%c", cat_term); break; /* * Read only levels */ case RIG_LEVEL_RAWSTR: if (!newcat_valid_command(rig, "SM")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "SM%c%c", main_sub_vfo, cat_term); break; case RIG_LEVEL_SWR: if (!newcat_valid_command(rig, "RM")) return -RIG_ENAVAIL; if (newcat_is_rig(rig, RIG_MODEL_FT9000)) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM09%c", cat_term); else snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM6%c", cat_term); break; case RIG_LEVEL_ALC: if (!newcat_valid_command(rig, "RM")) return -RIG_ENAVAIL; if (newcat_is_rig(rig, RIG_MODEL_FT9000)) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM07%c", cat_term); else snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM4%c", cat_term); break; case RIG_LEVEL_ANTIVOX: if (newcat_is_rig(rig, RIG_MODEL_FT950)) { snprintf(priv->cmd_str, sizeof(priv->cmd_str), "EX117%c", cat_term); } else return -RIG_EINVAL; break; case RIG_LEVEL_NOTCHF: if (!newcat_valid_command(rig, "BP")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BP01%c", cat_term); if (newcat_is_rig(rig, RIG_MODEL_FT9000)) priv->cmd_str[2] = main_sub_vfo; break; default: return -RIG_EINVAL; } err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s\n", __func__, err, priv->ret_data); ret_data_len = strlen(priv->ret_data); if (ret_data_len <= strlen(priv->cmd_str) || priv->ret_data[ret_data_len-1] != cat_term) return -RIG_EPROTO; /* skip command */ retlvl = priv->ret_data + strlen(priv->cmd_str)-1; /* chop term */ priv->ret_data[ret_data_len-1] = '\0'; switch (level) { case RIG_LEVEL_RFPOWER: case RIG_LEVEL_VOXGAIN: case RIG_LEVEL_COMP: case RIG_LEVEL_ANTIVOX: scale = (newcat_is_rig(rig, RIG_MODEL_FT950)) ? 100. : 255.; val->f = (float)atoi(retlvl)/scale; break; case RIG_LEVEL_AF: case RIG_LEVEL_MICGAIN: case RIG_LEVEL_RF: case RIG_LEVEL_SQL: case RIG_LEVEL_SWR: case RIG_LEVEL_ALC: val->f = (float)atoi(retlvl)/255.; break; case RIG_LEVEL_BKINDL: val->i = atoi(retlvl); /* milliseconds */ if (val->i < 1) val->i = 1; val->i = 5000 / val->i; /* ms -to- tenth_dots-per-second */ if (val->i < 1) val->i = 1; break; case RIG_LEVEL_RAWSTR: case RIG_LEVEL_KEYSPD: case RIG_LEVEL_IF: val->i = atoi(retlvl); break; case RIG_LEVEL_NR: /* ratio 0 - 1.0 */ if (newcat_is_rig(rig, RIG_MODEL_FT450)) val->f = (float) (atoi(retlvl) / 11. ); else val->f = (float) (atoi(retlvl) / 15. ); break; case RIG_LEVEL_VOX: /* VOX delay, arg int (tenth of seconds), 100ms intervals */ val->i = atoi(retlvl)/100; break; case RIG_LEVEL_PREAMP: if (retlvl[0] < '0' || retlvl[0] > '9') return -RIG_EPROTO; val->i = (retlvl[0] == '0') ? 0 : state->preamp[retlvl[0]-'1']; break; case RIG_LEVEL_ATT: if (retlvl[0] < '0' || retlvl[0] > '9') return -RIG_EPROTO; val->i = (retlvl[0] == '0') ? 0 : state->attenuator[retlvl[0]-'1']; break; case RIG_LEVEL_AGC: switch (retlvl[0]) { case '0': val->i = RIG_AGC_OFF; break; case '1': val->i = RIG_AGC_FAST; break; case '2': val->i = RIG_AGC_MEDIUM; break; case '3': val->i = RIG_AGC_SLOW; break; case '4': case '5': case '6': val->i = RIG_AGC_AUTO; break; default: return -RIG_EPROTO; } break; case RIG_LEVEL_CWPITCH: val->i = (atoi(retlvl)/2)*100+300; break; case RIG_LEVEL_METER: switch (retlvl[0]) { case '0': val->i = RIG_METER_COMP; break; case '1': val->i = RIG_METER_ALC; break; case '2': val->i = RIG_METER_PO; break; case '3': val->i = RIG_METER_SWR; break; case '4': val->i = RIG_METER_IC; break; /* ID CURRENT */ case '5': val->i = RIG_METER_VDD; break; /* Final Amp Voltage */ default: return -RIG_EPROTO; } break; case RIG_LEVEL_NOTCHF: val->i = atoi(retlvl) * 10; break; default: return -RIG_EINVAL; } return RIG_OK; } int newcat_set_func(RIG * rig, vfo_t vfo, setting_t func, int status) { struct newcat_priv_data *priv; struct rig_state *state; int err; char main_sub_vfo = '0'; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; /* Set Main or SUB vfo */ err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; switch (func) { case RIG_FUNC_ANF: if (!newcat_valid_command(rig, "BC")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BC0%d%c", status ? 1 : 0, cat_term); if (newcat_is_rig(rig, RIG_MODEL_FT9000)) priv->cmd_str[2] = main_sub_vfo; break; case RIG_FUNC_MN: if (!newcat_valid_command(rig, "BP")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BP00%03d%c", status ? 1 : 0, cat_term); if (newcat_is_rig(rig, RIG_MODEL_FT9000)) priv->cmd_str[2] = main_sub_vfo; break; case RIG_FUNC_FBKIN: if (!newcat_valid_command(rig, "BI")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BI%d%c", status ? 1 : 0, cat_term); break; case RIG_FUNC_TONE: if (!newcat_valid_command(rig, "CT")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CT0%d%c", status ? 2 : 0, cat_term); priv->cmd_str[2] = main_sub_vfo; break; case RIG_FUNC_TSQL: if (!newcat_valid_command(rig, "CT")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CT0%d%c", status ? 1 : 0, cat_term); priv->cmd_str[2] = main_sub_vfo; break; case RIG_FUNC_LOCK: if (!newcat_valid_command(rig, "LK")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "LK%d%c", status ? 1 : 0, cat_term); break; case RIG_FUNC_MON: if (!newcat_valid_command(rig, "ML")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "ML0%03d%c", status ? 1 : 0, cat_term); break; case RIG_FUNC_NB: if (!newcat_valid_command(rig, "NB")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "NB0%d%c", status ? 1 : 0, cat_term); priv->cmd_str[2] = main_sub_vfo; break; case RIG_FUNC_NR: if (!newcat_valid_command(rig, "NR")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "NR0%d%c", status ? 1 : 0, cat_term); priv->cmd_str[2] = main_sub_vfo; break; case RIG_FUNC_COMP: if (!newcat_valid_command(rig, "PR")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PR%d%c", status ? 1 : 0, cat_term); break; case RIG_FUNC_VOX: if (!newcat_valid_command(rig, "VX")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "VX%d%c", status ? 1 : 0, cat_term); break; default: return -RIG_EINVAL; } err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); return err; } int newcat_get_func(RIG * rig, vfo_t vfo, setting_t func, int *status) { struct newcat_priv_data *priv; struct rig_state *state; int err; int ret_data_len; char *retfunc; char main_sub_vfo = '0'; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; switch (func) { case RIG_FUNC_ANF: if (!newcat_valid_command(rig, "BC")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BC0%c", cat_term); if (newcat_is_rig(rig, RIG_MODEL_FT9000)) priv->cmd_str[2] = main_sub_vfo; break; case RIG_FUNC_MN: if (!newcat_valid_command(rig, "BP")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BP00%c", cat_term); if (newcat_is_rig(rig, RIG_MODEL_FT9000)) priv->cmd_str[2] = main_sub_vfo; break; case RIG_FUNC_FBKIN: if (!newcat_valid_command(rig, "BI")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BI%c", cat_term); break; case RIG_FUNC_TONE: if (!newcat_valid_command(rig, "CT")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CT0%c", cat_term); priv->cmd_str[2] = main_sub_vfo; break; case RIG_FUNC_TSQL: if (!newcat_valid_command(rig, "CT")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "CT0%c", cat_term); priv->cmd_str[2] = main_sub_vfo; break; case RIG_FUNC_LOCK: if (!newcat_valid_command(rig, "LK")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "LK%c", cat_term); break; case RIG_FUNC_MON: if (!newcat_valid_command(rig, "ML")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "ML0%c", cat_term); break; case RIG_FUNC_NB: if (!newcat_valid_command(rig, "NB")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "NB0%c", cat_term); priv->cmd_str[2] = main_sub_vfo; break; case RIG_FUNC_NR: if (!newcat_valid_command(rig, "NR")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "NR0%c", cat_term); priv->cmd_str[2] = main_sub_vfo; break; case RIG_FUNC_COMP: if (!newcat_valid_command(rig, "PR")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "PR%c", cat_term); break; case RIG_FUNC_VOX: if (!newcat_valid_command(rig, "VX")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "VX%c", cat_term); break; default: return -RIG_EINVAL; } err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s\n", __func__, err, priv->ret_data); ret_data_len = strlen(priv->ret_data); if (ret_data_len <= strlen(priv->cmd_str) || priv->ret_data[ret_data_len-1] != cat_term) return -RIG_EPROTO; /* skip command */ retfunc = priv->ret_data + strlen(priv->cmd_str)-1; /* chop term */ priv->ret_data[ret_data_len-1] = '\0'; switch (func) { case RIG_FUNC_MN: *status = (retfunc[2] == '0') ? 0 : 1; break; case RIG_FUNC_ANF: case RIG_FUNC_FBKIN: case RIG_FUNC_LOCK: case RIG_FUNC_MON: case RIG_FUNC_NB: case RIG_FUNC_NR: case RIG_FUNC_COMP: case RIG_FUNC_VOX: *status = (retfunc[0] == '0') ? 0 : 1; break; case RIG_FUNC_TONE: *status = (retfunc[0] == '2') ? 1 : 0; break; case RIG_FUNC_TSQL: *status = (retfunc[0] == '1') ? 1 : 0; break; default: return -RIG_EINVAL; } return RIG_OK; } int newcat_set_parm(RIG * rig, setting_t parm, value_t val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_get_parm(RIG * rig, setting_t parm, value_t * val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_get_ext_level(RIG *rig, vfo_t vfo, token_t token, value_t *val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_ext_parm(RIG *rig, token_t token, value_t val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_get_ext_parm(RIG *rig, token_t token, value_t *val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_conf(RIG * rig, token_t token, const char *val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_get_conf(RIG * rig, token_t token, char *val) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_send_dtmf(RIG * rig, vfo_t vfo, const char *digits) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_recv_dtmf(RIG * rig, vfo_t vfo, char *digits, int *length) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_send_morse(RIG * rig, vfo_t vfo, const char *msg) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_bank(RIG * rig, vfo_t vfo, int bank) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_mem(RIG * rig, vfo_t vfo, int ch) { struct newcat_priv_data *priv; struct rig_state *state; int err, i; ncboolean restore_vfo; chan_t *chan_list; channel_t valid_chan; channel_cap_t *mem_caps = NULL; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "MC")) return -RIG_ENAVAIL; chan_list = rig->caps->chan_list; for (i=0; i= chan_list[i].start && ch <= chan_list[i].end) { mem_caps = &chan_list[i].mem_caps; break; } } /* Test for valid usable channel, skip if empty */ memset(&valid_chan, 0, sizeof(channel_t)); valid_chan.channel_num = ch; err = newcat_get_channel(rig, &valid_chan); if (valid_chan.freq <= 1.0) mem_caps = NULL; rig_debug(RIG_DEBUG_TRACE, "ValChan Freq = %d, pMemCaps = %d\n", valid_chan.freq, mem_caps); /* Out of Range, or empty */ if (!mem_caps) return -RIG_ENAVAIL; /* set to usable vfo if needed */ err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; /* Restore to VFO mode or leave in Memory Mode */ switch (vfo) { case RIG_VFO_A: /* Jump back from memory channel */ restore_vfo = TRUE; break; case RIG_VFO_MEM: /* Jump from channel to channel in memmory mode */ restore_vfo = FALSE; break; case RIG_VFO_B: default: /* Only works with VFO A */ return -RIG_ENTARGET; } /* Set Memory Channel Number ************** */ rig_debug(RIG_DEBUG_TRACE, "channel_num = %d, vfo = %d\n", ch, vfo); snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MC%03d%c", ch, cat_term); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; /* Restore VFO even if setting to blank memory channel */ if (restore_vfo) { err = newcat_vfomem_toggle(rig); if (err != RIG_OK) return err; } return RIG_OK; } int newcat_get_mem(RIG * rig, vfo_t vfo, int *ch) { struct newcat_priv_data *priv; struct rig_state *state; int err; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "MC")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MC%c", cat_term); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); /* Get Memory Channel Number */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s\n", __func__, err, priv->ret_data); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get MEM\n", __func__); /* Invalid channel should never see this from radio */ return -RIG_EPROTO; } *ch = atoi(priv->ret_data + 2); return RIG_OK; } int newcat_vfo_op(RIG * rig, vfo_t vfo, vfo_op_t op) { struct newcat_priv_data *priv; struct rig_state *state; int err; char main_sub_vfo = '0'; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; /* Set Main or SUB vfo */ err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; switch (op) { case RIG_OP_TUNE: snprintf(priv->cmd_str, sizeof(priv->cmd_str), "AC002%c", cat_term); break; case RIG_OP_CPY: if (newcat_is_rig(rig, RIG_MODEL_FT450)) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "VV%c", cat_term); else snprintf(priv->cmd_str, sizeof(priv->cmd_str), "AB%c", cat_term); break; case RIG_OP_XCHG: case RIG_OP_TOGGLE: snprintf(priv->cmd_str, sizeof(priv->cmd_str), "SV%c", cat_term); break; case RIG_OP_UP: snprintf(priv->cmd_str, sizeof(priv->cmd_str), "UP%c", cat_term); break; case RIG_OP_DOWN: snprintf(priv->cmd_str, sizeof(priv->cmd_str), "DN%c", cat_term); break; case RIG_OP_BAND_UP: if (main_sub_vfo == 1) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BU1%c", cat_term); else snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BU0%c", cat_term); break; case RIG_OP_BAND_DOWN: if (main_sub_vfo == 1) snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BD1%c", cat_term); else snprintf(priv->cmd_str, sizeof(priv->cmd_str), "BD0%c", cat_term); break; case RIG_OP_FROM_VFO: /* VFOA ! */ snprintf(priv->cmd_str, sizeof(priv->cmd_str), "AM%c", cat_term); break; case RIG_OP_TO_VFO: /* VFOA ! */ snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MA%c", cat_term); break; default: return -RIG_EINVAL; } err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); return err; } int newcat_scan(RIG * rig, vfo_t vfo, scan_t scan, int ch) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_trn(RIG * rig, int trn) { struct newcat_priv_data *priv; struct rig_state *state; int err; char c; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "AI")) return -RIG_ENAVAIL; if (trn == RIG_TRN_OFF) c = '0'; else c = '1'; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "AI%c%c", c, cat_term); rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", priv->cmd_str); err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); return err; } int newcat_get_trn(RIG * rig, int *trn) { struct newcat_priv_data *priv; struct rig_state *state; int err; char c; char command[] = "AI"; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, command)) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c", command, cat_term); /* Get Auto Information */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s, TRN value = %c\n", __func__, err, priv->ret_data, priv->ret_data[2]); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get TRN\n", __func__); return -RIG_EPROTO; } c = priv->ret_data[2]; if (c == '0') *trn = RIG_TRN_OFF; else *trn = RIG_TRN_RIG; return RIG_OK; } int newcat_decode_event(RIG * rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); return -RIG_ENAVAIL; } int newcat_set_channel(RIG * rig, const channel_t * chan) { struct newcat_priv_data *priv; struct rig_state *state; int err, i; int rxit; char c_rit, c_xit, c_mode, c_vfo, c_tone, c_rptr_shift; tone_t tone; ncboolean restore_vfo; chan_t *chan_list; channel_cap_t *mem_caps = NULL; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "MW")) return -RIG_ENAVAIL; chan_list = rig->caps->chan_list; for (i=0; ichannel_num >= chan_list[i].start && chan->channel_num <= chan_list[i].end && // writable memory types... NOT 60-METERS or READ-ONLY channels (chan_list[i].type == RIG_MTYPE_MEM || chan_list[i].type == RIG_MTYPE_EDGE) ) { mem_caps = &chan_list[i].mem_caps; break; } } /* Out of Range */ if (!mem_caps) return -RIG_ENAVAIL; /* Set Restore to VFO or leave in memory mode */ switch (state->current_vfo) { case RIG_VFO_A: /* Jump back from memory channel */ restore_vfo = TRUE; break; case RIG_VFO_MEM: /* Jump from channel to channel in memmory mode */ restore_vfo = FALSE; break; case RIG_VFO_B: default: /* Only works with VFO A */ return -RIG_ENTARGET; } /* Write Memory Channel ************************* */ /* Clarifier TX, RX */ if (chan->rit) { rxit = chan->rit; c_rit = '1'; c_xit = '0'; } else if (chan->xit) { rxit= chan->xit; c_rit = '0'; c_xit = '1'; } else { rxit = 0; c_rit = '0'; c_xit = '0'; } /* MODE */ switch(chan->mode) { case RIG_MODE_LSB: c_mode = '1'; break; case RIG_MODE_USB: c_mode = '2'; break; case RIG_MODE_CW: c_mode = '3'; break; case RIG_MODE_FM: c_mode = '4'; break; case RIG_MODE_AM: c_mode = '5'; break; case RIG_MODE_RTTY: c_mode = '6'; break; case RIG_MODE_CWR: c_mode = '7'; break; case RIG_MODE_PKTLSB: c_mode = '8'; break; case RIG_MODE_RTTYR: c_mode = '9'; break; case RIG_MODE_PKTFM: c_mode = 'A'; break; case RIG_MODE_PKTUSB: c_mode = 'C'; break; default: c_mode = '1'; break; } /* VFO Fixed */ c_vfo = '0'; /* CTCSS Tone / Sql */ if (chan->ctcss_tone) { c_tone = '2'; tone = chan->ctcss_tone; } else if (chan->ctcss_sql) { c_tone = '1'; tone = chan->ctcss_sql; } else { c_tone = '0'; tone = 0; } for (i = 0; rig->caps->ctcss_list[i] != 0; i++) if (tone == rig->caps->ctcss_list[i]) { tone = i; if (tone > 49) tone = 0; break; } /* Repeater Shift */ switch (chan->rptr_shift) { case RIG_RPT_SHIFT_NONE: c_rptr_shift = '0'; break; case RIG_RPT_SHIFT_PLUS: c_rptr_shift = '1'; break; case RIG_RPT_SHIFT_MINUS: c_rptr_shift = '2'; break; default: c_rptr_shift = '0'; } snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MW%03d%08d%+.4d%c%c%c%c%c%02d%c%c", chan->channel_num, (int)chan->freq, rxit, c_rit, c_xit, c_mode, c_vfo, c_tone, tone, c_rptr_shift, cat_term); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); /* Set Memory Channel */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; /* Restore VFO ********************************** */ if (restore_vfo) { err = newcat_vfomem_toggle(rig); return err; } return RIG_OK; } int newcat_get_channel(RIG * rig, channel_t * chan) { struct newcat_priv_data *priv; struct rig_state *state; char *retval; char c, c2; int err, i; chan_t *chan_list; channel_cap_t *mem_caps = NULL; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "MR")) return -RIG_ENAVAIL; chan_list = rig->caps->chan_list; for (i=0; ichannel_num >= chan_list[i].start && chan->channel_num <= chan_list[i].end) { mem_caps = &chan_list[i].mem_caps; break; } } /* Out of Range */ if (!mem_caps) return -RIG_ENAVAIL; rig_debug(RIG_DEBUG_TRACE, "sizeof(channel_t) = %d\n", sizeof(channel_t) ); rig_debug(RIG_DEBUG_TRACE, "sizeof(priv->cmd_str) = %d\n", sizeof(priv->cmd_str) ); snprintf(priv->cmd_str, sizeof(priv->cmd_str), "MR%03d%c", chan->channel_num, cat_term); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); /* Get Memory Channel */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s, ret_data length = %d\n", __func__, err, priv->ret_data, strlen(priv->ret_data)); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "Unrecognized command, get_channel, Invalid empty channel (freq == 0.0)...\n"); /* Invalid channel, has not been set up, make sure freq is 0 to indicate empty channel */ chan->freq = 0.0; return RIG_OK; } /* ret_data string to channel_t struct :: this will destroy ret_data */ /* rptr_shift P10 ************************ */ retval = priv->ret_data + 25; switch (*retval) { case '0': chan->rptr_shift = RIG_RPT_SHIFT_NONE; break; case '1': chan->rptr_shift = RIG_RPT_SHIFT_PLUS; break; case '2': chan->rptr_shift = RIG_RPT_SHIFT_MINUS; break; default: chan->rptr_shift = RIG_RPT_SHIFT_NONE; } *retval = '\0'; /* CTCSS Encoding P8 ********************* */ retval = priv->ret_data + 22; c = *retval; /* CTCSS Tone P9 ************************* */ chan->ctcss_tone = 0; chan->ctcss_sql = 0; retval = priv->ret_data + 23; i = atoi(retval); if (c == '1') chan->ctcss_sql = rig->caps->ctcss_list[i]; else if (c == '2') chan->ctcss_tone = rig->caps->ctcss_list[i]; /* vfo, mem, P7 ************************** */ retval = priv->ret_data + 21; if (*retval == '1') chan->vfo = RIG_VFO_MEM; else chan->vfo = RIG_VFO_CURR; /* MODE P6 ******************************* */ chan->width = 0; retval = priv->ret_data + 20; switch (*retval) { case '1': chan->mode = RIG_MODE_LSB; break; case '2': chan->mode = RIG_MODE_USB; break; case '3': chan->mode = RIG_MODE_CW; break; case '4': chan->mode = RIG_MODE_FM; break; case '5': chan->mode = RIG_MODE_AM; break; case '6': chan->mode = RIG_MODE_RTTY; break; case '7': chan->mode = RIG_MODE_CWR; break; case '8': chan->mode = RIG_MODE_PKTLSB; break; case '9': chan->mode = RIG_MODE_RTTYR; break; case 'A': chan->mode = RIG_MODE_PKTFM; break; case 'B': chan->mode = RIG_MODE_FM; break; case 'C': chan->mode = RIG_MODE_PKTUSB; break; case 'D': chan->mode = RIG_MODE_AM; break; default: chan->mode = RIG_MODE_LSB; } /* Clarifier TX P5 *********************** */ retval = priv->ret_data + 19; c2 = *retval; /* Clarifier RX P4 *********************** */ retval = priv->ret_data + 18; c = *retval; *retval = '\0'; /* Clarifier Offset P3 ******************* */ chan->rit = 0; chan->xit = 0; retval = priv->ret_data + 13; if (c == '1') chan->rit = atoi(retval); else if (c2 == '1') chan->xit = atoi(retval); *retval = '\0'; /* Frequency P2 ************************** */ retval = priv->ret_data + 5; chan->freq = atof(retval); return RIG_OK; } const char *newcat_get_info(RIG * rig) { struct newcat_priv_data *priv; struct rig_state *state; int err; static char idbuf[12]; /* extra large static string array */ priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return NULL; /* Build the command string */ snprintf(priv->cmd_str, sizeof(priv->cmd_str), "ID;"); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, priv->cmd_str); /* Get Identification Channel */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return NULL; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return NULL; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return NULL; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s\n", __func__, err, priv->ret_data); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "Unrecognized command, get INFO\n"); return NULL; } priv->ret_data[6] = '\0'; snprintf(idbuf, sizeof(idbuf), "%s", priv->ret_data); return idbuf; } /* * newcat_valid_command * * Determine whether or not the command is valid for the specified * rig. This function should be called before sending the command * to the rig to make it easier to differentiate invalid and illegal * commands (for a rig). */ ncboolean newcat_valid_command(RIG *rig, char *command) { const struct rig_caps *caps; ncboolean is_ft450; ncboolean is_ft950; ncboolean is_ft2000; ncboolean is_ft9000; ncboolean is_ft5000; int search_high; int search_index; int search_low; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) { rig_debug(RIG_DEBUG_ERR, "%s: Rig argument is invalid\n", __func__); return FALSE; } caps = rig->caps; if (!caps) { rig_debug(RIG_DEBUG_ERR, "%s: Rig capabilities not valid\n", __func__); return FALSE; } /* * Determine the type of rig from the model number. Note it is * possible for several model variants to exist; i.e., all the * FT-9000 variants. */ is_ft450 = newcat_is_rig(rig, RIG_MODEL_FT450); is_ft950 = newcat_is_rig(rig, RIG_MODEL_FT950); is_ft2000 = newcat_is_rig(rig, RIG_MODEL_FT2000); is_ft9000 = newcat_is_rig(rig, RIG_MODEL_FT9000); is_ft5000 = newcat_is_rig(rig, RIG_MODEL_FTDX5000); if (!is_ft450 && !is_ft950 && !is_ft2000 && !is_ft5000 && !is_ft9000) { rig_debug(RIG_DEBUG_ERR, "%s: '%s' is unknown\n", __func__, caps->model_name); return FALSE; } /* * Make sure the command is known, and then check to make sure * is it valud for the rig. */ search_low = 0; search_high = valid_commands_count; while (search_low <= search_high) { int search_test; search_index = (search_low + search_high) / 2; search_test = strcmp (valid_commands[search_index].command, command); if (search_test > 0) search_high = search_index - 1; else if (search_test < 0) search_low = search_index + 1; else { /* * The command is valid. Now make sure it is supported by the rig. */ if (is_ft450 && valid_commands[search_index].ft450) return TRUE; else if (is_ft950 && valid_commands[search_index].ft950) return TRUE; else if (is_ft2000 && valid_commands[search_index].ft2000) return TRUE; else if (is_ft5000 && valid_commands[search_index].ft5000) return TRUE; else if (is_ft9000 && valid_commands[search_index].ft9000) return TRUE; else { rig_debug(RIG_DEBUG_TRACE, "%s: '%s' command '%s' not supported\n", __func__, caps->model_name, command); return FALSE; } } } rig_debug(RIG_DEBUG_TRACE, "%s: '%s' command '%s' not valid\n", __func__, caps->model_name, command); return FALSE; } ncboolean newcat_is_rig(RIG * rig, rig_model_t model) { ncboolean is_rig; is_rig = (model == rig->caps->rig_model) ? TRUE : FALSE; return is_rig; } /* * newcat_set_tx_vfo does not set priv->curr_vfo */ int newcat_set_tx_vfo(RIG * rig, vfo_t tx_vfo) { struct newcat_priv_data *priv; struct rig_state *state; int err; char p1; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "FT")) return -RIG_ENAVAIL; err = newcat_set_vfo_from_alias(rig, &tx_vfo); if (err < 0) return err; switch (tx_vfo) { case RIG_VFO_A: p1 = '0'; break; case RIG_VFO_B: p1 = '1'; break; case RIG_VFO_MEM: /* VFO A */ if (priv->current_mem == NC_MEM_CHANNEL_NONE) return RIG_OK; else /* Memory Channel mode */ p1 = '0'; break; default: return -RIG_EINVAL; } if (newcat_is_rig(rig, RIG_MODEL_FT950)) p1 = p1 + 2; /* FT950 non-Toggle */ snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c", "FT", p1, cat_term); rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", priv->cmd_str); /* Set TX VFO */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); return err; } /* * newcat_get_tx_vfo does not set priv->curr_vfo */ int newcat_get_tx_vfo(RIG * rig, vfo_t * tx_vfo) { struct newcat_priv_data *priv; struct rig_state *state; int err; char c; vfo_t vfo_mode; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "FT")) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c", "FT", cat_term); rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", priv->cmd_str); /* Get TX VFO */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s, TX_VFO value = %c\n", __func__, err, priv->ret_data, priv->ret_data[2]); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get TX_VFO\n", __func__); return -RIG_EPROTO; } c = priv->ret_data[2]; switch (c) { case '0': *tx_vfo = RIG_VFO_A; break; case '1' : *tx_vfo = RIG_VFO_B; break; default: return -RIG_EPROTO; } /* Check to see if RIG is in MEM mode */ err = newcat_get_vfo_mode(rig, &vfo_mode); if (vfo_mode == RIG_VFO_MEM && *tx_vfo == RIG_VFO_A) *tx_vfo = RIG_VFO_MEM; rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo = 0x%02x\n", __func__, *tx_vfo); return RIG_OK; } int newcat_set_vfo_from_alias(RIG * rig, vfo_t * vfo) { // struct newcat_priv_data *priv; // priv = (struct newcat_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: alias vfo = 0x%02x\n", __func__, *vfo); switch (*vfo) { case RIG_VFO_A: case RIG_VFO_B: case RIG_VFO_MEM: /* passes through */ break; case RIG_VFO_CURR: /* RIG_VFO_RX == RIG_VFO_CURR */ case RIG_VFO_VFO: *vfo = rig->state.current_vfo; break; case RIG_VFO_TX: /* set to another vfo for split or uplink */ *vfo = (rig->state.current_vfo == RIG_VFO_B) ? RIG_VFO_A : RIG_VFO_B; break; case RIG_VFO_MAIN: *vfo = RIG_VFO_A; break; case RIG_VFO_SUB: *vfo = RIG_VFO_B; break; default: rig_debug(RIG_DEBUG_TRACE, "Unrecognized. vfo= %d\n", *vfo); return -RIG_EINVAL; } return RIG_OK; } /* * Found newcat_set_level() floating point math problem * Using rigctl on FT950 I was trying to set RIG_LEVEL_COMP to 12 * I kept setting it to 11. I wrote some test software and * found out that 0.12 * 100 = 11 with my setup. * Compilier is gcc 4.2.4, CPU is AMD X2 * This works somewhat but Find a better way. * The newcat_get_level() seems to work correctly. * Terry KJ4EED * */ int newcat_scale_float(int scale, float fval) { float f; float fudge = 0.003; if ((fval + fudge) > 1.0) f = scale * fval; else f = scale * (fval + fudge); return (int) f; } int newcat_set_narrow(RIG * rig, vfo_t vfo, ncboolean narrow) { struct newcat_priv_data *priv; struct rig_state *state; int err; char c; char main_sub_vfo = '0'; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "NA")) return -RIG_ENAVAIL; err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; if (narrow == TRUE) c = '1'; else c = '0'; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "NA%c%c%c", main_sub_vfo, c, cat_term); rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", priv->cmd_str); err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); return err; } int newcat_get_narrow(RIG * rig, vfo_t vfo, ncboolean * narrow) { struct newcat_priv_data *priv; struct rig_state *state; int err; char c; char command[] = "NA"; char main_sub_vfo = '0'; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, command)) return -RIG_ENAVAIL; err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c", command, main_sub_vfo, cat_term); /* Get NAR */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s, NARROW value = %c\n", __func__, err, priv->ret_data, priv->ret_data[3]); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get NARROW\n", __func__); return -RIG_EPROTO; } c = priv->ret_data[3]; if (c == '1') *narrow = TRUE; else *narrow = FALSE; return RIG_OK; } int newcat_set_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { struct newcat_priv_data *priv; struct rig_state *state; int err; char width_str[6]; /* extra larger buffer */ char main_sub_vfo = '0'; char narrow = '0'; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "SH")) return -RIG_ENAVAIL; err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; if (newcat_is_rig(rig, RIG_MODEL_FT950)) { switch (mode) { case RIG_MODE_PKTUSB: case RIG_MODE_PKTLSB: case RIG_MODE_RTTY: case RIG_MODE_RTTYR: case RIG_MODE_CW: case RIG_MODE_CWR: switch (width) { case 1700: snprintf(width_str, sizeof(width_str), "11"); narrow = '0'; break; /* normal */ case 500: snprintf(width_str, sizeof(width_str), "07"); narrow = '0'; break; /* narrow */ case 2400: snprintf(width_str, sizeof(width_str), "13"); narrow = '0'; break; /* wide */ case 2000: snprintf(width_str, sizeof(width_str), "12"); narrow = '0'; break; case 1400: snprintf(width_str, sizeof(width_str), "10"); narrow = '0'; break; case 1200: snprintf(width_str, sizeof(width_str), "09"); narrow = '0'; break; case 800: snprintf(width_str, sizeof(width_str), "08"); narrow = '0'; break; case 400: snprintf(width_str, sizeof(width_str), "06"); narrow = '1'; break; case 300: snprintf(width_str, sizeof(width_str), "05"); narrow = '1'; break; case 200: snprintf(width_str, sizeof(width_str), "04"); narrow = '1'; break; case 100: snprintf(width_str, sizeof(width_str), "03"); narrow = '1'; break; default: return -RIG_EINVAL; } break; case RIG_MODE_LSB: case RIG_MODE_USB: switch (width) { case 2400: snprintf(width_str, sizeof(width_str), "13"); narrow = '0'; break; /* normal */ case 1800: snprintf(width_str, sizeof(width_str), "09"); narrow = '0'; break; /* narrow */ case 3000: snprintf(width_str, sizeof(width_str), "20"); narrow = '0'; break; /* wide */ case 2900: snprintf(width_str, sizeof(width_str), "19"); narrow = '0'; break; case 2800: snprintf(width_str, sizeof(width_str), "18"); narrow = '0'; break; case 2700: snprintf(width_str, sizeof(width_str), "17"); narrow = '0'; break; case 2600: snprintf(width_str, sizeof(width_str), "16"); narrow = '0'; break; case 2500: snprintf(width_str, sizeof(width_str), "15"); narrow = '0'; break; case 2450: snprintf(width_str, sizeof(width_str), "14"); narrow = '0'; break; case 2250: snprintf(width_str, sizeof(width_str), "12"); narrow = '0'; break; case 2100: snprintf(width_str, sizeof(width_str), "11"); narrow = '0'; break; case 1950: snprintf(width_str, sizeof(width_str), "10"); narrow = '0'; break; case 1650: snprintf(width_str, sizeof(width_str), "08"); narrow = '1'; break; case 1500: snprintf(width_str, sizeof(width_str), "07"); narrow = '1'; break; case 1350: snprintf(width_str, sizeof(width_str), "06"); narrow = '1'; break; case 1100: snprintf(width_str, sizeof(width_str), "05"); narrow = '1'; break; case 850: snprintf(width_str, sizeof(width_str), "04"); narrow = '1'; break; case 600: snprintf(width_str, sizeof(width_str), "03"); narrow = '1'; break; case 400: snprintf(width_str, sizeof(width_str), "02"); narrow = '1'; break; case 200: snprintf(width_str, sizeof(width_str), "01"); narrow = '1'; break; default: return -RIG_EINVAL; } break; case RIG_MODE_AM: case RIG_MODE_FM: case RIG_MODE_PKTFM: if (width < rig_passband_normal(rig, mode)) err = newcat_set_narrow(rig, vfo, TRUE); else err = newcat_set_narrow(rig, vfo, FALSE); return err; default: return -RIG_EINVAL; } /* end switch(mode) */ } /* end if FT950 */ else { /* FT450, FT2000, FT5000, FT9000 */ switch (mode) { case RIG_MODE_PKTUSB: case RIG_MODE_PKTLSB: case RIG_MODE_RTTY: case RIG_MODE_RTTYR: case RIG_MODE_CW: case RIG_MODE_CWR: switch (width) { case 1800: snprintf(width_str, sizeof(width_str), "16"); narrow = '0'; break; /* normal */ case 500: snprintf(width_str, sizeof(width_str), "06"); narrow = '0'; break; /* narrow */ case 2400: snprintf(width_str, sizeof(width_str), "24"); narrow = '0'; break; /* wide */ default: return -RIG_EINVAL; } break; case RIG_MODE_LSB: case RIG_MODE_USB: switch (width) { case 2400: snprintf(width_str, sizeof(width_str), "16"); narrow = '0'; break; /* normal */ case 1800: snprintf(width_str, sizeof(width_str), "08"); narrow = '0'; break; /* narrow */ case 3000: snprintf(width_str, sizeof(width_str), "25"); narrow = '0'; break; /* wide */ default: return -RIG_EINVAL; } break; case RIG_MODE_AM: case RIG_MODE_FM: case RIG_MODE_PKTFM: if (width < rig_passband_normal(rig, mode)) err = newcat_set_narrow(rig, vfo, TRUE); else err = newcat_set_narrow(rig, vfo, FALSE); return err; default: return -RIG_EINVAL; } /* end switch(mode) */ } /* end else */ rig_debug(RIG_DEBUG_TRACE, "sizeof(width_str) = %d\n", sizeof(width_str) ); snprintf(priv->cmd_str, sizeof(priv->cmd_str), "NA%c%c%cSH%c%s%c", main_sub_vfo, narrow, cat_term, main_sub_vfo, width_str, cat_term); rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", priv->cmd_str); /* Set RX Bandwidth */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); return err; } int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t *width) { struct newcat_priv_data *priv; struct rig_state *state; int err; int ret_data_len; char *retlvl; int w; char cmd[] = "SH"; char main_sub_vfo = '0'; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, cmd)) return -RIG_ENAVAIL; err = newcat_set_vfo_from_alias(rig, &vfo); if (err < 0) return err; if (newcat_is_rig(rig, RIG_MODEL_FT9000) || newcat_is_rig(rig, RIG_MODEL_FT2000) || newcat_is_rig(rig, RIG_MODEL_FTDX5000)) main_sub_vfo = (RIG_VFO_B == vfo) ? '1' : '0'; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c%c", cmd, main_sub_vfo, cat_term); /* Get RX BANDWIDTH */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s\n", __func__, err, priv->ret_data); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get RX_BANDWIDTH\n", __func__); return -RIG_EPROTO; } ret_data_len = strlen(priv->ret_data); /* skip command */ retlvl = priv->ret_data + strlen(priv->cmd_str)-1; /* chop term */ priv->ret_data[ret_data_len-1] = '\0'; w = atoi(retlvl); /* width */ if (newcat_is_rig(rig, RIG_MODEL_FT950)) { switch (mode) { case RIG_MODE_PKTUSB: case RIG_MODE_PKTLSB: case RIG_MODE_RTTY: case RIG_MODE_RTTYR: case RIG_MODE_CW: case RIG_MODE_CWR: switch (w) { case 11: *width = 1700; break; /* normal */ case 0: case 7: *width = 500; break; /* narrow */ case 13: *width = 2400; break; /* wide */ case 12: *width = 2000; break; case 10: *width = 1400; break; case 9: *width = 1200; break; case 8: *width = 800; break; case 6: *width = 400; break; case 5: *width = 300; break; case 3: *width = 100; break; case 4: *width = 200; break; default: return -RIG_EINVAL; } break; case RIG_MODE_LSB: case RIG_MODE_USB: switch (w) { case 0: case 13: *width = 2400; break; /* normal */ case 9: *width = 1800; break; /* narrow */ case 20: *width = 3000; break; /* wide */ case 19: *width = 2900; break; case 18: *width = 2800; break; case 17: *width = 2700; break; case 16: *width = 2600; break; case 15: *width = 2500; break; case 14: *width = 2450; break; case 12: *width = 2250; break; case 11: *width = 2100; break; case 10: *width = 1950; break; case 8: *width = 1650; break; case 7: *width = 1500; break; case 6: *width = 1350; break; case 5: *width = 1100; break; case 4: *width = 850; break; case 3: *width = 600; break; case 2: *width = 400; break; case 1: *width = 200; break; default: return -RIG_EINVAL; } break; case RIG_MODE_AM: case RIG_MODE_PKTFM: case RIG_MODE_FM: return RIG_OK; default: return -RIG_EINVAL; } /* end switch(mode) */ } /* end if FT950 */ else { /* FT450, FT2000, FT5000, FT9000 */ switch (mode) { case RIG_MODE_PKTUSB: case RIG_MODE_PKTLSB: case RIG_MODE_RTTY: case RIG_MODE_RTTYR: case RIG_MODE_CW: case RIG_MODE_CWR: case RIG_MODE_LSB: case RIG_MODE_USB: if (w < 16) *width = rig_passband_narrow(rig, mode); else if (w > 16) *width = rig_passband_wide(rig, mode); else *width = rig_passband_normal(rig, mode); break; case RIG_MODE_AM: case RIG_MODE_PKTFM: case RIG_MODE_FM: return RIG_OK; default: return -RIG_EINVAL; } /* end switch (mode) */ } /* end else */ return RIG_OK; } int newcat_set_faststep(RIG * rig, ncboolean fast_step) { struct newcat_priv_data *priv; struct rig_state *state; int err; char c; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "FS")) return -RIG_ENAVAIL; if (fast_step == TRUE) c = '1'; else c = '0'; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "FS%c%c", c, cat_term); rig_debug(RIG_DEBUG_TRACE, "cmd_str = %s\n", priv->cmd_str); err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); return err; } int newcat_get_faststep(RIG * rig, ncboolean * fast_step) { struct newcat_priv_data *priv; struct rig_state *state; int err; char c; char command[] = "FS"; priv = (struct newcat_priv_data *)rig->state.priv; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, command)) return -RIG_ENAVAIL; snprintf(priv->cmd_str, sizeof(priv->cmd_str), "%s%c", command, cat_term); /* Get Fast Step */ err = write_block(&state->rigport, priv->cmd_str, strlen(priv->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, priv->ret_data[strlen(priv->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, priv->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s, FASTSTEP value = %c\n", __func__, err, priv->ret_data, priv->ret_data[2]); /* Check for I don't know this command? */ if (strcmp(priv->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get FASTSTEP\n", __func__); return -RIG_EPROTO; } c = priv->ret_data[2]; if (c == '1') *fast_step = TRUE; else *fast_step = FALSE; return RIG_OK; } int newcat_get_rigid(RIG * rig) { struct newcat_priv_data *priv; const char * s; priv = (struct newcat_priv_data *)rig->state.priv; s = NULL; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); /* if first valid get */ if (priv->rig_id == NC_RIGID_NONE) { s = newcat_get_info(rig); if (s != NULL) { s +=2; /* ID0310, jump past ID */ priv->rig_id = atoi(s); } } rig_debug(RIG_DEBUG_TRACE, "rig_id = %d, *s = %s\n", priv->rig_id, s); return priv->rig_id; } /* * input: RIG *, vfo_t * * output: VFO mode: RIG_VFO_VFO for VFO A and B * RIG_VFO_MEM for VFO MEM * return: RIG_OK or error */ int newcat_get_vfo_mode(RIG * rig, vfo_t * vfo_mode) { // struct rig_state *state; char * retval; int err; newcat_cmd_data_t cmd; // state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "IF")) return -RIG_ENAVAIL; snprintf(cmd.cmd_str, sizeof(cmd.cmd_str), "IF%c", cat_term); /* Get VFO A Information ****************** */ rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, cmd.cmd_str); err = newcat_get_cmd(rig, &cmd); if (err != RIG_OK) return err; /* vfo, mem, P7 ************************** */ retval = cmd.ret_data + 21; switch (*retval) { case '0': *vfo_mode = RIG_VFO_VFO; break; case '1': /* Memory */ case '2': /* Memory Tune */ case '3': /* Quick Memory Bank */ case '4': /* Quick Memory Bank Tune */ default: *vfo_mode = RIG_VFO_MEM; } rig_debug(RIG_DEBUG_TRACE, "%s: vfo mode = %d\n", __func__, *vfo_mode); return RIG_OK; } /* * Writes cmd and does not wait for reply, no reply expected * input: complete CAT command string including termination in cmd_str * return: RIG_OK or error */ int newcat_set_cmd(RIG * rig, newcat_cmd_data_t * cmd) { struct rig_state *state; int err; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, cmd->cmd_str); err = write_block(&state->rigport, cmd->cmd_str, strlen(cmd->cmd_str)); if (err != RIG_OK) return err; return RIG_OK; } /* * Writed data and waits for responce * input: complete CAT command string including termination in cmd_str * output: complete CAT command answer string in ret_data * return: RIG_OK or error */ int newcat_get_cmd(RIG * rig, newcat_cmd_data_t * cmd) { struct rig_state *state; int err; state = &rig->state; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: cmd_str = %s\n", __func__, cmd->cmd_str); err = write_block(&state->rigport, cmd->cmd_str, strlen(cmd->cmd_str)); if (err != RIG_OK) return err; err = read_string(&state->rigport, cmd->ret_data, sizeof(cmd->ret_data), &cat_term, sizeof(cat_term)); if (err < 0) return err; /* Check that command termination is correct */ if (strchr(&cat_term, cmd->ret_data[strlen(cmd->ret_data) - 1]) == NULL) { rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", __func__, cmd->ret_data); return -RIG_EPROTO; } rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s, ret_data length = %d\n", __func__, err, cmd->ret_data, strlen(cmd->ret_data)); /* Check for I don't know this command? */ if (strcmp(cmd->ret_data, cat_unknown_cmd) == 0) { rig_debug(RIG_DEBUG_TRACE, "%s: Unrecognized command, get cmd = %s\n", __func__, cmd->cmd_str); return -RIG_EPROTO; } return RIG_OK; } int newcat_vfomem_toggle(RIG * rig) { int err; newcat_cmd_data_t cmd; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!newcat_valid_command(rig, "VM")) return -RIG_ENAVAIL; /* copy set command */ snprintf(cmd.cmd_str, sizeof(cmd.cmd_str), "%s", "VM;"); err = newcat_set_cmd(rig, &cmd); return err; } hamlib-1.2.15.3/yaesu/yaesu.h0000644000175000017500000000522212044564477012561 00000000000000/* * hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com) * * yaesu.h - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com) * (C) Stephane Fillod 2001-2010 * * Common yaesu declarations for hamlib * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _YAESU_H #define _YAESU_H 1 /* * Length (in bytes) of yaesu command sequences */ #define YAESU_CMD_LENGTH 5 /* * Basic Data structure for yaesu native cmd set */ struct yaesu_cmd_set { unsigned char ncomp; /* 1 = complete, 0 = incomplete, needs extra info */ unsigned char nseq[YAESU_CMD_LENGTH]; /* native cmd sequence */ }; typedef struct yaesu_cmd_set yaesu_cmd_set_t; extern const struct rig_caps ft100_caps; extern const struct rig_caps ft450_caps; extern const struct rig_caps ft736_caps; extern const struct rig_caps ft747_caps; extern const struct rig_caps ft757gx_caps; extern const struct rig_caps ft757gx2_caps; extern const struct rig_caps ft767gx_caps; extern const struct rig_caps ft817_caps; extern const struct rig_caps ft857_caps; extern const struct rig_caps ft897_caps; extern const struct rig_caps ft847_caps; extern const struct rig_caps ft840_caps; extern const struct rig_caps ft890_caps; extern const struct rig_caps ft900_caps; extern const struct rig_caps ft920_caps; extern const struct rig_caps ft950_caps; extern const struct rig_caps ft980_caps; extern const struct rig_caps ft990_caps; extern const struct rig_caps ft1000mp_caps; extern const struct rig_caps ft1000mpmkv_caps; extern const struct rig_caps ft1000mpmkvfld_caps; extern const struct rig_caps ft1000d_caps; extern const struct rig_caps ft2000_caps; extern const struct rig_caps ftdx5000_caps; extern const struct rig_caps ft9000_caps; extern const struct rig_caps frg100_caps; extern const struct rig_caps frg8800_caps; extern const struct rig_caps frg9600_caps; extern const struct rig_caps vr5000_caps; extern const struct rig_caps vx1700_caps; #endif /* _YAESU_H */ hamlib-1.2.15.3/yaesu/ft100.h0000644000175000017500000001270112044564477012265 00000000000000/* * hamlib - (C) Frank Singleton 2000-2003 (vk3fcs@ix.netcom.com) * (C) Stephane Fillod 2000-2009 * * ft100.h - (C) Chris Karpinsky 2001 (aa1vl@arrl.net) * This shared library provides an API for communicating * via serial interface to an FT-100 using the "CAT" interface. * The starting point for this code was Frank's ft847 implementation. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT100_H #define _FT100_H 1 #define FT100_WRITE_DELAY 0 #define FT100_POST_WRITE_DELAY 100 /* max is 200ms */ #define FT100_DEFAULT_READ_TIMEOUT 2000 enum ft100_native_cmd_e { FT100_NATIVE_CAT_LOCK_ON = 0, FT100_NATIVE_CAT_LOCK_OFF, FT100_NATIVE_CAT_PTT_ON, FT100_NATIVE_CAT_PTT_OFF, FT100_NATIVE_CAT_SET_FREQ, FT100_NATIVE_CAT_SET_MODE_LSB, FT100_NATIVE_CAT_SET_MODE_USB, FT100_NATIVE_CAT_SET_MODE_CW, FT100_NATIVE_CAT_SET_MODE_CWR, FT100_NATIVE_CAT_SET_MODE_AM, FT100_NATIVE_CAT_SET_MODE_FM, FT100_NATIVE_CAT_SET_MODE_DIG, FT100_NATIVE_CAT_SET_MODE_WFM, FT100_NATIVE_CAT_CLAR_ON, FT100_NATIVE_CAT_CLAR_OFF, FT100_NATIVE_CAT_SET_CLAR_FREQ, FT100_NATIVE_CAT_SET_VFOAB, FT100_NATIVE_CAT_SET_VFOA, FT100_NATIVE_CAT_SET_VFOB, FT100_NATIVE_CAT_SPLIT_ON, FT100_NATIVE_CAT_SPLIT_OFF, FT100_NATIVE_CAT_SET_RPT_SHIFT_MINUS, FT100_NATIVE_CAT_SET_RPT_SHIFT_PLUS, FT100_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX, FT100_NATIVE_CAT_SET_RPT_OFFSET, /* fix me */ FT100_NATIVE_CAT_SET_DCS_ON, FT100_NATIVE_CAT_SET_CTCSS_ENC_ON, FT100_NATIVE_CAT_SET_CTCSS_ENC_DEC_ON, FT100_NATIVE_CAT_SET_CTCSS_DCS_OFF, /* em xif */ FT100_NATIVE_CAT_SET_CTCSS_FREQ, FT100_NATIVE_CAT_SET_DCS_CODE, FT100_NATIVE_CAT_GET_RX_STATUS, FT100_NATIVE_CAT_GET_TX_STATUS, FT100_NATIVE_CAT_GET_FREQ_MODE_STATUS, FT100_NATIVE_CAT_PWR_WAKE, FT100_NATIVE_CAT_PWR_ON, FT100_NATIVE_CAT_PWR_OFF, FT100_NATIVE_CAT_READ_STATUS, FT100_NATIVE_CAT_READ_METERS, FT100_NATIVE_CAT_READ_FLAGS, FT100_NATIVE_SIZE /* end marker */ }; typedef enum ft100_native_cmd_e ft100_native_cmd_t; /* * we are able to get way more info * than we can set * */ typedef struct { unsigned char band_no; unsigned char freq[4]; unsigned char mode; unsigned char ctcss; unsigned char dcs; unsigned char flag1; unsigned char flag2; unsigned char clarifier[2]; unsigned char not_used; unsigned char step1; unsigned char step2; unsigned char filter; unsigned char stuffing[16]; } FT100_STATUS_INFO; typedef struct { unsigned char mic_switch_1; unsigned char tx_fwd_power; unsigned char tx_rev_power; unsigned char s_meter; unsigned char mic_level; unsigned char squelch_level; unsigned char mic_switch_2; unsigned char final_temp; unsigned char alc_level; } FT100_METER_INFO; typedef struct { unsigned char byte[8]; } FT100_FLAG_INFO; struct ft100_priv_data { /* TODO: make use of cached data */ FT100_STATUS_INFO status; FT100_FLAG_INFO flags; }; static int ft100_init(RIG *rig); static int ft100_open(RIG *rig); static int ft100_cleanup(RIG *rig); static int ft100_close(RIG *rig); static int ft100_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ft100_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ft100_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int ft100_set_vfo(RIG *rig, vfo_t vfo); static int ft100_get_vfo(RIG *rig, vfo_t *vfo); static int ft100_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); static int ft100_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); static int ft100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); #if 0 static int ft100_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int ft100_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static int ft100_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); static int ft100_set_parm(RIG *rig, setting_t parm, value_t val); static int ft100_get_parm(RIG *rig, setting_t parm, value_t *val); #endif static int ft100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int ft100_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); static int ft100_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift); //static int ft100_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *shift); static int ft100_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code); //static int ft100_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code); static int ft100_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone); //static int ft100_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone); //static int ft100_get_info(RIG *rig, FT100_STATUS_INFO *ft100_status, FT100_METER_INFO *ft100_meter, FT100_FLAG_INFO *ft100_flags); #endif /* _FT100_H */ hamlib-1.2.15.3/yaesu/ft2000.c0000644000175000017500000001771012044564477012346 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft2000.c - (C) Nate Bargmann 2007 (n0nb at arrl.net) * (C) Stephane Fillod 2008 * (C) Terry Embry 2008-2009 * * This shared library provides an API for communicating * via serial interface to an FT-2000 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "hamlib/rig.h" #include "bandplan.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "newcat.h" #include "ft2000.h" #include "idx_builtin.h" #include "tones.h" /* * ft2000 rigs capabilities. * Also this struct is READONLY! * */ const struct rig_caps ft2000_caps = { .rig_model = RIG_MODEL_FT2000, .model_name = "FT-2000", .mfg_name = "Yaesu", .version = NEWCAT_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, /* Default rate per manual */ .serial_rate_max = 38400, .serial_data_bits = 8, .serial_stop_bits = 1, /* Assumed since manual makes no mention */ .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = FT2000_WRITE_DELAY, .post_write_delay = FT2000_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = FT2000_FUNCS, .has_set_func = FT2000_FUNCS, .has_get_level = FT2000_LEVELS, .has_set_level = RIG_LEVEL_SET(FT2000_LEVELS), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, [LVL_CWPITCH] = { .min = { .i = 300 }, .max = { .i = 1050 }, .step = { .i = 50 } }, }, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, 20, RIG_DBLST_END, }, /* TBC */ .attenuator = { 6, 12, 18, RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(1000), .vfo_ops = FT2000_VFO_OPS, .targetable_vfo = RIG_TARGETABLE_FREQ|RIG_TARGETABLE_MODE, .transceive = RIG_TRN_OFF, /* May enable later as the 2000 has an Auto Info command */ .bank_qty = 0, .chan_desc_sz = 0, .str_cal = FT2000_STR_CAL, .chan_list = { { 1, 99, RIG_MTYPE_MEM, NEWCAT_MEM_CAP }, { 100, 117, RIG_MTYPE_EDGE, NEWCAT_MEM_CAP }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { /* General coverage + ham, ANT_5 is RX only antenna */ {kHz(30), MHz(60), FT2000_ALL_RX_MODES, -1, -1, FT2000_VFO_ALL, FT2000_TX_ANTS|RIG_ANT_5}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1, FT2000_OTHER_TX_MODES, W(5), W(100), FT2000_VFO_ALL, FT2000_TX_ANTS), FRQ_RNG_HF(1, FT2000_AM_TX_MODES, W(2), W(25), FT2000_VFO_ALL, FT2000_TX_ANTS), /* AM class */ FRQ_RNG_6m(1, FT2000_OTHER_TX_MODES, W(5), W(100), FT2000_VFO_ALL, FT2000_TX_ANTS), FRQ_RNG_6m(1, FT2000_AM_TX_MODES, W(2), W(25), FT2000_VFO_ALL, FT2000_TX_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30), MHz(60), FT2000_ALL_RX_MODES, -1, -1, FT2000_VFO_ALL, FT2000_TX_ANTS|RIG_ANT_5}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2, FT2000_OTHER_TX_MODES, W(5), W(100), FT2000_VFO_ALL, FT2000_TX_ANTS), FRQ_RNG_HF(2, FT2000_AM_TX_MODES, W(2), W(25), FT2000_VFO_ALL, FT2000_TX_ANTS), /* AM class */ FRQ_RNG_6m(2, FT2000_OTHER_TX_MODES, W(5), W(100), FT2000_VFO_ALL, FT2000_TX_ANTS), FRQ_RNG_6m(2, FT2000_AM_TX_MODES, W(2), W(25), FT2000_VFO_ALL, FT2000_TX_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {FT2000_SSB_CW_RX_MODES, Hz(10)}, /* Normal */ {FT2000_SSB_CW_RX_MODES, Hz(100)}, /* Fast */ {FT2000_AM_RX_MODES, Hz(100)}, /* Normal */ {FT2000_AM_RX_MODES, kHz(1)}, /* Fast */ {FT2000_FM_RX_MODES, Hz(100)}, /* Normal */ {FT2000_FM_RX_MODES, kHz(1)}, /* Fast */ RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {FT2000_CW_RTTY_PKT_RX_MODES, Hz(1800)}, /* Normal CW, RTTY, PKT/USER */ {FT2000_CW_RTTY_PKT_RX_MODES, Hz(500)}, /* Narrow CW, RTTY, PKT/USER */ {FT2000_CW_RTTY_PKT_RX_MODES, Hz(2400)}, /* Wide CW, RTTY, PKT/USER */ {RIG_MODE_SSB, Hz(2400)}, /* Normal SSB */ {RIG_MODE_SSB, Hz(1800)}, /* Narrow SSB */ {RIG_MODE_SSB, Hz(3000)}, /* Wide SSB */ {RIG_MODE_AM, Hz(9000)}, /* Normal AM */ {RIG_MODE_AM, Hz(6000)}, /* Narrow AM */ {FT2000_FM_RX_MODES, Hz(12000)}, /* Normal FM */ {FT2000_FM_RX_MODES, Hz(8000)}, /* Narrow FM */ RIG_FLT_END, }, .priv = NULL, .rig_init = newcat_init, .rig_cleanup = newcat_cleanup, .rig_open = newcat_open, /* port opened */ .rig_close = newcat_close, /* port closed */ .set_freq = newcat_set_freq, .get_freq = newcat_get_freq, .set_mode = newcat_set_mode, .get_mode = newcat_get_mode, .set_vfo = newcat_set_vfo, .get_vfo = newcat_get_vfo, .set_ptt = newcat_set_ptt, .get_ptt = newcat_get_ptt, .set_split_vfo = newcat_set_split_vfo, .get_split_vfo = newcat_get_split_vfo, .set_rit = newcat_set_rit, .get_rit = newcat_get_rit, .set_xit = newcat_set_xit, .get_xit = newcat_get_xit, .set_ant = newcat_set_ant, .get_ant = newcat_get_ant, .get_func = newcat_get_func, .set_func = newcat_set_func, .get_level = newcat_get_level, .set_level = newcat_set_level, .get_mem = newcat_get_mem, .set_mem = newcat_set_mem, .vfo_op = newcat_vfo_op, .get_info = newcat_get_info, .power2mW = newcat_power2mW, .mW2power = newcat_mW2power, .set_rptr_shift = newcat_set_rptr_shift, .get_rptr_shift = newcat_get_rptr_shift, .set_ctcss_tone = newcat_set_ctcss_tone, .get_ctcss_tone = newcat_get_ctcss_tone, .set_ctcss_sql = newcat_set_ctcss_sql, .get_ctcss_sql = newcat_get_ctcss_sql, .set_powerstat = newcat_set_powerstat, .get_powerstat = newcat_get_powerstat, .get_ts = newcat_get_ts, .set_ts = newcat_set_ts, .set_trn = newcat_set_trn, .get_trn = newcat_get_trn, .set_channel = newcat_set_channel, .get_channel = newcat_get_channel, }; hamlib-1.2.15.3/yaesu/ft897.c0000644000175000017500000007404712044564477012322 00000000000000/* -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*- * * ft897.c - (C) Tomi Manninen 2003 (oh2bns@sral.fi) * (C) Stephane Fillod 2009 * * ...derived but heavily modified from: * * ft817.c - (C) Chris Karpinsky 2001 (aa1vl@arrl.net) * * This shared library provides an API for communicating * via serial interface to an FT-897 using the "CAT" interface. * The starting point for this code was Frank's ft847 implementation. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * Unimplemented features supported by the FT-897: * * - RIT ON/OFF without touching the RIT offset. This would * need frontend support (eg. a new RIG_FUNC_xxx) * * - DCS encoder/squelch ON/OFF, similar to RIG_FUNC_TONE/TSQL. * Needs frontend support. * * - RX status command returns info that is not used: * * - discriminator centered (yes/no flag) * - received ctcss/dcs matched (yes/no flag) * * The manual also indicates that CTCSS and DCS codes can be set * separately for tx and rx, but this doesn't seem to work. It * doesn't work from front panel either. * * DONE (--sf): * * - VFO A/B toggle. Needs frontend support (RIG_OP_TOGGLE) * * - Split ON/OFF. Maybe some sort of split operation could * be supported with this and the above??? * * - TX status command returns info that is not used: * * - split on/off flag * - high swr flag */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #ifdef HAVE_SYS_TIME_H #include #endif #include "hamlib/rig.h" #include "serial.h" #include "yaesu.h" #include "ft897.h" #include "misc.h" #include "tones.h" #include "bandplan.h" static int ft897_init(RIG *rig); static int ft897_open(RIG *rig); static int ft897_cleanup(RIG *rig); static int ft897_close(RIG *rig); static int ft897_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft897_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ft897_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ft897_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); // static int ft897_set_vfo(RIG *rig, vfo_t vfo); // static int ft897_get_vfo(RIG *rig, vfo_t *vfo); static int ft897_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int ft897_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); static int ft897_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); static int ft897_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); static int ft897_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); // static int ft897_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int ft897_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int ft897_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); // static int ft897_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); // static int ft897_set_parm(RIG *rig, setting_t parm, value_t val); // static int ft897_get_parm(RIG *rig, setting_t parm, value_t *val); static int ft897_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code); static int ft897_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t code); static int ft897_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code); static int ft897_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone); static int ft897_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift); static int ft897_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs); static int ft897_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); static int ft897_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); // static int ft897_set_powerstat(RIG *rig, powerstat_t status); /* Native ft897 cmd set prototypes. These are READ ONLY as each */ /* rig instance will copy from these and modify if required . */ /* Complete sequences (1) can be read and used directly as a cmd sequence . */ /* Incomplete sequences (0) must be completed with extra parameters */ /* eg: mem number, or freq etc.. */ static const yaesu_cmd_set_t ncmd[] = { { 1, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* lock on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x80 } }, /* lock off */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* ptt on */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x88 } }, /* ptt off */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* set freq */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main LSB */ { 1, { 0x01, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main USB */ { 1, { 0x02, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main CW */ { 1, { 0x03, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main CWR */ { 1, { 0x04, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main AM */ { 1, { 0x08, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main FM */ { 1, { 0x88, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main FM-N */ { 1, { 0x0a, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main DIG */ { 1, { 0x0c, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main PKT */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* clar on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x85 } }, /* clar off */ { 0, { 0x00, 0x00, 0x00, 0x00, 0xf5 } }, /* set clar freq */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x81 } }, /* toggle vfo a/b */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* split on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x82 } }, /* split off */ { 1, { 0x09, 0x00, 0x00, 0x00, 0x09 } }, /* set RPT shift MINUS */ { 1, { 0x49, 0x00, 0x00, 0x00, 0x09 } }, /* set RPT shift PLUS */ { 1, { 0x89, 0x00, 0x00, 0x00, 0x09 } }, /* set RPT shift SIMPLEX */ { 0, { 0x00, 0x00, 0x00, 0x00, 0xf9 } }, /* set RPT offset freq */ { 1, { 0x0a, 0x00, 0x00, 0x00, 0x0a } }, /* set DCS on */ { 1, { 0x0b, 0x00, 0x00, 0x00, 0x0a } }, /* set DCS decoder on */ { 1, { 0x0c, 0x00, 0x00, 0x00, 0x0a } }, /* set DCS encoder on */ { 1, { 0x2a, 0x00, 0x00, 0x00, 0x0a } }, /* set CTCSS on */ { 1, { 0x3a, 0x00, 0x00, 0x00, 0x0a } }, /* set CTCSS decoder on */ { 1, { 0x4a, 0x00, 0x00, 0x00, 0x0a } }, /* set CTCSS encoder on */ { 1, { 0x8a, 0x00, 0x00, 0x00, 0x0a } }, /* set CTCSS/DCS off */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0b } }, /* set CTCSS tone */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* set DCS code */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xe7 } }, /* get RX status */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xf7 } }, /* get TX status */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* get FREQ and MODE status */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* pwr wakeup sequence */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0f } }, /* pwr on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x8f } }, /* pwr off */ }; #define FT897_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_USB|\ RIG_MODE_LSB|RIG_MODE_RTTY|RIG_MODE_FM) #define FT897_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_USB|RIG_MODE_LSB) #define FT897_AM_FM_RX_MODES (RIG_MODE_AM|RIG_MODE_FM) #define FT897_OTHER_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_USB|\ RIG_MODE_LSB|RIG_MODE_RTTY|RIG_MODE_FM) #define FT897_AM_TX_MODES (RIG_MODE_AM) #define FT897_VFO_ALL (RIG_VFO_A|RIG_VFO_B) #define FT897_ANTS 0 const struct rig_caps ft897_caps = { .rig_model = RIG_MODEL_FT897, .model_name = "FT-897", .mfg_name = "Yaesu", .version = "0.3.3", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 38400, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT897_WRITE_DELAY, .post_write_delay = FT897_POST_WRITE_DELAY, .timeout = FT897_TIMEOUT, .retry = 0, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_LOCK | RIG_FUNC_TONE | RIG_FUNC_TSQL, .has_get_level = RIG_LEVEL_STRENGTH | RIG_LEVEL_RFPOWER | RIG_LEVEL_SWR | RIG_LEVEL_RAWSTR, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, /* granularity */ .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = common_dcs_list, /* only 104 supported */ .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9990), .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, }, .vfo_ops = RIG_OP_TOGGLE, .rx_range_list1 = { {kHz(100),MHz(56), FT897_ALL_RX_MODES,-1,-1}, {MHz(76), MHz(108),RIG_MODE_WFM, -1,-1}, {MHz(118),MHz(164),FT897_ALL_RX_MODES,-1,-1}, {MHz(420),MHz(470),FT897_ALL_RX_MODES,-1,-1}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,FT897_OTHER_TX_MODES, W(10),W(100),FT897_VFO_ALL,FT897_ANTS), /* AM class */ FRQ_RNG_HF(1,FT897_AM_TX_MODES, W(2.5),W(25),FT897_VFO_ALL,FT897_ANTS), FRQ_RNG_2m(1,FT897_OTHER_TX_MODES, W(5),W(50),FT897_VFO_ALL,FT897_ANTS), /* AM class */ FRQ_RNG_2m(1,FT897_AM_TX_MODES, W(2.5),W(25),FT897_VFO_ALL,FT897_ANTS), FRQ_RNG_70cm(1,FT897_OTHER_TX_MODES, W(2),W(20),FT897_VFO_ALL,FT897_ANTS), /* AM class */ FRQ_RNG_70cm(1,FT897_AM_TX_MODES, W(0.5),W(5),FT897_VFO_ALL,FT897_ANTS), RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(56), FT897_ALL_RX_MODES,-1,-1}, {MHz(76), MHz(108),RIG_MODE_WFM, -1,-1}, {MHz(118),MHz(164),FT897_ALL_RX_MODES,-1,-1}, {MHz(420),MHz(470),FT897_ALL_RX_MODES,-1,-1}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,FT897_OTHER_TX_MODES, W(10),W(100),FT897_VFO_ALL,FT897_ANTS), /* AM class */ FRQ_RNG_HF(2,FT897_AM_TX_MODES, W(2.5),W(25),FT897_VFO_ALL,FT897_ANTS), FRQ_RNG_2m(2,FT897_OTHER_TX_MODES, W(5),W(50),FT897_VFO_ALL,FT897_ANTS), /* AM class */ FRQ_RNG_2m(2,FT897_AM_TX_MODES, W(2.5),W(25),FT897_VFO_ALL,FT897_ANTS), FRQ_RNG_70cm(2,FT897_OTHER_TX_MODES, W(2),W(20),FT897_VFO_ALL,FT897_ANTS), /* AM class */ FRQ_RNG_70cm(2,FT897_AM_TX_MODES, W(0.5),W(5),FT897_VFO_ALL,FT897_ANTS), RIG_FRNG_END, }, .tuning_steps = { {FT897_SSB_CW_RX_MODES,10}, {FT897_SSB_CW_RX_MODES,100}, {FT897_AM_FM_RX_MODES,10}, {FT897_AM_FM_RX_MODES,100}, RIG_TS_END, }, /* filter selection is not supported by CAT functions * per testing by Rich Newsom, WA4SXZ */ .filters = { // {RIG_MODE_SSB, kHz(2.2)}, // {RIG_MODE_CW, kHz(2.2)}, // {RIG_MODE_CWR, kHz(2.2)}, // {RIG_MODE_RTTY, kHz(2.2)}, // {RIG_MODE_AM, kHz(6)}, // {RIG_MODE_FM, kHz(15)}, // {RIG_MODE_PKTFM, kHz(15)}, // {RIG_MODE_FM, kHz(9)}, // {RIG_MODE_PKTFM, kHz(9)}, // {RIG_MODE_WFM, kHz(230)}, /* ?? */ RIG_FLT_END, }, .priv = NULL, .rig_init = ft897_init, .rig_cleanup = ft897_cleanup, .rig_open = ft897_open, .rig_close = ft897_close, .set_freq = ft897_set_freq, .get_freq = ft897_get_freq, .set_mode = ft897_set_mode, .get_mode = ft897_get_mode, .set_vfo = NULL, .get_vfo = NULL, .set_ptt = ft897_set_ptt, .get_ptt = ft897_get_ptt, .get_dcd = ft897_get_dcd, .set_rptr_shift = ft897_set_rptr_shift, .get_rptr_shift = NULL, .set_rptr_offs = ft897_set_rptr_offs, .get_rptr_offs = NULL, .set_split_freq = NULL, .get_split_freq = NULL, .set_split_mode = NULL, .get_split_mode = NULL, .set_split_vfo = ft897_set_split_vfo, .get_split_vfo = ft897_get_split_vfo, .set_rit = ft897_set_rit, .get_rit = NULL, .set_xit = NULL, .get_xit = NULL, .set_ts = NULL, .get_ts = NULL, .set_dcs_code = ft897_set_dcs_code, .get_dcs_code = NULL, .set_ctcss_tone = ft897_set_ctcss_tone, .get_ctcss_tone = NULL, .set_dcs_sql = ft897_set_dcs_sql, .get_dcs_sql = NULL, .set_ctcss_sql = ft897_set_ctcss_sql, .get_ctcss_sql = NULL, .set_powerstat = NULL, .get_powerstat = NULL, .reset = NULL, .set_ant = NULL, .get_ant = NULL, .set_level = NULL, .get_level = ft897_get_level, .set_func = ft897_set_func, .get_func = NULL, .set_parm = NULL, .get_parm = NULL, .vfo_op = ft897_vfo_op, }; /* ---------------------------------------------------------------------- */ int ft897_init(RIG *rig) { struct ft897_priv_data *p; rig_debug(RIG_DEBUG_VERBOSE,"ft897:ft897_init called \n"); if ((p = calloc(1, sizeof(struct ft897_priv_data))) == NULL) return -RIG_ENOMEM; /* Copy complete native cmd set to private cmd storage area */ memcpy(p->pcs, ncmd, sizeof(ncmd)); rig->state.priv = (void*) p; return RIG_OK; } int ft897_cleanup(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"ft897:ft897_cleanup called \n"); if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } int ft897_open(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"ft897:ft897_open called \n"); return RIG_OK; } int ft897_close(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"ft897:ft897_close called \n"); return RIG_OK; } /* ---------------------------------------------------------------------- */ static inline long timediff(struct timeval *tv1, struct timeval *tv2) { struct timeval tv; tv.tv_usec = tv1->tv_usec - tv2->tv_usec; tv.tv_sec = tv1->tv_sec - tv2->tv_sec; return ((tv.tv_sec * 1000L) + (tv.tv_usec / 1000L)); } static int check_cache_timeout(struct timeval *tv) { struct timeval curr; long t; if (tv->tv_sec == 0 && tv->tv_usec == 0) { rig_debug(RIG_DEBUG_VERBOSE, "ft897: cache invalid\n"); return 1; } gettimeofday(&curr, NULL); if ((t = timediff(&curr, tv)) < FT897_CACHE_TIMEOUT) { rig_debug(RIG_DEBUG_VERBOSE, "ft897: using cache (%ld ms)\n", t); return 0; } else { rig_debug(RIG_DEBUG_VERBOSE, "ft897: cache timed out (%ld ms)\n", t); return 1; } } static int ft897_get_status(RIG *rig, int status) { struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv; struct timeval *tv; unsigned char *data; int len; int n; switch (status) { case FT897_NATIVE_CAT_GET_FREQ_MODE_STATUS: data = p->fm_status; len = YAESU_CMD_LENGTH; tv = &p->fm_status_tv; break; case FT897_NATIVE_CAT_GET_RX_STATUS: data = &p->rx_status; len = 1; tv = &p->rx_status_tv; break; case FT897_NATIVE_CAT_GET_TX_STATUS: data = &p->tx_status; len = 1; tv = &p->tx_status_tv; break; default: rig_debug(RIG_DEBUG_ERR, "ft897_get_status: Internal error!\n"); return -RIG_EINTERNAL; } serial_flush(&rig->state.rigport); write_block(&rig->state.rigport, (char *) p->pcs[status].nseq, YAESU_CMD_LENGTH); if ((n = read_block(&rig->state.rigport, (char *) data, len)) < 0) return n; if (n != len) return -RIG_EIO; gettimeofday(tv, NULL); return RIG_OK; } /* ---------------------------------------------------------------------- */ int ft897_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; if (check_cache_timeout(&p->fm_status_tv)) if ((n = ft897_get_status(rig, FT897_NATIVE_CAT_GET_FREQ_MODE_STATUS)) < 0) return n; *freq = from_bcd_be(p->fm_status, 8) * 10; return -RIG_OK; } int ft897_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; if (check_cache_timeout(&p->fm_status_tv)) if ((n = ft897_get_status(rig, FT897_NATIVE_CAT_GET_FREQ_MODE_STATUS)) < 0) return n; switch (p->fm_status[4]) { case 0x00: *mode = RIG_MODE_LSB; break; case 0x01: *mode = RIG_MODE_USB; break; case 0x02: case 0x82: *mode = RIG_MODE_CW; break; case 0x03: case 0x83: *mode = RIG_MODE_CWR; break; case 0x04: *mode = RIG_MODE_AM; break; case 0x06: *mode = RIG_MODE_WFM; break; case 0x08: case 0x88: *mode = RIG_MODE_FM; break; case 0x0a: case 0x8a: *mode = RIG_MODE_RTTY; break; case 0x0c: case 0x8c: *mode = RIG_MODE_PKTFM; break; default: *mode = RIG_MODE_NONE; } *width = RIG_PASSBAND_NORMAL; return RIG_OK; } int ft897_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; if (check_cache_timeout(&p->tx_status_tv)) if ((n = ft897_get_status(rig, FT897_NATIVE_CAT_GET_TX_STATUS)) < 0) return n; *ptt = ((p->tx_status & 0x80) == 0); return RIG_OK; } static int ft897_get_pometer_level(RIG *rig, value_t *val) { struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv; int n; if (check_cache_timeout(&p->tx_status_tv)) if ((n = ft897_get_status(rig, FT897_NATIVE_CAT_GET_TX_STATUS)) < 0) return n; /* Valid only if PTT is on */ if ((p->tx_status & 0x80) == 0) val->f = ((p->tx_status & 0x0F) / 15.0); else val->f = 0.0; return RIG_OK; } static int ft897_get_swr_level(RIG *rig, value_t *val) { struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv; int n; if (check_cache_timeout(&p->tx_status_tv)) if ((n = ft897_get_status(rig, FT897_NATIVE_CAT_GET_TX_STATUS)) < 0) return n; /* Valid only if PTT is on */ if ((p->tx_status & 0x80) == 0) val->f = p->tx_status & 0x40 ? 30.0 : 1.0; /* or infinity? */ else val->f = 0.0; return RIG_OK; } static int ft897_get_smeter_level(RIG *rig, value_t *val) { struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv; int n; if (check_cache_timeout(&p->rx_status_tv)) if ((n = ft897_get_status(rig, FT897_NATIVE_CAT_GET_RX_STATUS)) < 0) return n; n = (p->rx_status & 0x0F) - 9; val->i = n * ((n > 0) ? 10 : 6); return RIG_OK; } static int ft897_get_rawstr_level(RIG *rig, value_t *val) { struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv; int n; if (check_cache_timeout(&p->rx_status_tv)) if ((n = ft897_get_status(rig, FT897_NATIVE_CAT_GET_RX_STATUS)) < 0) return n; val->i = p->rx_status & 0x0F; return RIG_OK; } int ft897_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; switch (level) { case RIG_LEVEL_STRENGTH: return ft897_get_smeter_level(rig, val); case RIG_LEVEL_RAWSTR: return ft897_get_rawstr_level(rig, val); case RIG_LEVEL_RFPOWER: return ft897_get_pometer_level(rig, val); case RIG_LEVEL_SWR: return ft897_get_swr_level(rig, val); default: return -RIG_EINVAL; } return RIG_OK; } int ft897_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; if (check_cache_timeout(&p->rx_status_tv)) if ((n = ft897_get_status(rig, FT897_NATIVE_CAT_GET_RX_STATUS)) < 0) return n; /* TODO: consider bit 6 too ??? (CTCSS/DCS code match) */ if (p->rx_status & 0x80) *dcd = RIG_DCD_OFF; else *dcd = RIG_DCD_ON; return RIG_OK; } /* ---------------------------------------------------------------------- */ static int ft897_read_ack(RIG *rig) { #if (FT897_POST_WRITE_DELAY == 0) char dummy; int n; if ((n = read_block(&rig->state.rigport, &dummy, 1)) < 0) { rig_debug(RIG_DEBUG_ERR, "ft897: error reading ack\n"); return n; } rig_debug(RIG_DEBUG_TRACE,"ft897: ack received (%d)\n", dummy); if (dummy != 0) return -RIG_ERJCTED; #endif return RIG_OK; } /* * private helper function to send a private command sequence. * Must only be complete sequences. */ static int ft897_send_cmd(RIG *rig, int index) { struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv; if (p->pcs[index].ncomp == 0) { rig_debug(RIG_DEBUG_VERBOSE, "ft897: Incomplete sequence\n"); return -RIG_EINTERNAL; } write_block(&rig->state.rigport, (char *) p->pcs[index].nseq, YAESU_CMD_LENGTH); return ft897_read_ack(rig); } /* * The same for incomplete commands. */ static int ft897_send_icmd(RIG *rig, int index, unsigned char *data) { struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv; unsigned char cmd[YAESU_CMD_LENGTH]; if (p->pcs[index].ncomp == 1) { rig_debug(RIG_DEBUG_VERBOSE, "ft897: Complete sequence\n"); return -RIG_EINTERNAL; } cmd[YAESU_CMD_LENGTH - 1] = p->pcs[index].nseq[YAESU_CMD_LENGTH - 1]; memcpy(cmd, data, YAESU_CMD_LENGTH - 1); write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); return ft897_read_ack(rig); } /* ---------------------------------------------------------------------- */ int ft897_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned char data[YAESU_CMD_LENGTH - 1]; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE,"ft897: requested freq = %"PRIfreq" Hz\n", freq); /* fill in the frequency */ to_bcd_be(data, (freq + 5) / 10, 8); return ft897_send_icmd(rig, FT897_NATIVE_CAT_SET_FREQ, data); } int ft897_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { int index; /* index of sequence to send */ if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE,"ft897: generic mode = %x \n", mode); switch(mode) { case RIG_MODE_AM: index = FT897_NATIVE_CAT_SET_MODE_AM; break; case RIG_MODE_CW: index = FT897_NATIVE_CAT_SET_MODE_CW; break; case RIG_MODE_USB: index = FT897_NATIVE_CAT_SET_MODE_USB; break; case RIG_MODE_LSB: index = FT897_NATIVE_CAT_SET_MODE_LSB; break; case RIG_MODE_RTTY: index = FT897_NATIVE_CAT_SET_MODE_DIG; break; case RIG_MODE_FM: index = FT897_NATIVE_CAT_SET_MODE_FM; break; case RIG_MODE_WFM: index = FT897_NATIVE_CAT_SET_MODE_FM; break; case RIG_MODE_CWR: index = FT897_NATIVE_CAT_SET_MODE_CWR; break; case RIG_MODE_PKTFM: index = FT897_NATIVE_CAT_SET_MODE_PKT; break; default: return -RIG_EINVAL; } if (width != RIG_PASSBAND_NORMAL) return -RIG_EINVAL; return ft897_send_cmd(rig, index); } int ft897_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { int index, n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft897: ft897_set_ptt called\n"); switch(ptt) { case RIG_PTT_ON: index = FT897_NATIVE_CAT_PTT_ON; break; case RIG_PTT_OFF: index = FT897_NATIVE_CAT_PTT_OFF; break; default: return -RIG_EINVAL; } n = ft897_send_cmd(rig, index); if (n < 0 && n != -RIG_ERJCTED) return n; return RIG_OK; } int ft897_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { int index, n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft897: ft897_vfo_op called\n"); switch (op) { case RIG_OP_TOGGLE: index = FT897_NATIVE_CAT_SET_VFOAB; break; default: return -RIG_EINVAL; } n = ft897_send_cmd(rig, index); if (n < 0 && n != -RIG_ERJCTED) return n; return RIG_OK; } int ft897_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { int index, n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft897: ft897_set_split_vfo called\n"); switch(split) { case RIG_SPLIT_OFF: index = FT897_NATIVE_CAT_SPLIT_OFF; break; case RIG_SPLIT_ON: index = FT897_NATIVE_CAT_SPLIT_ON; break; default: return -RIG_EINVAL; } n = ft897_send_cmd(rig, index); if (n < 0 && n != -RIG_ERJCTED) return n; return RIG_OK; } int ft897_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { struct ft897_priv_data *p = (struct ft897_priv_data *) rig->state.priv; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; if (check_cache_timeout(&p->tx_status_tv)) if ((n = ft897_get_status(rig, FT897_NATIVE_CAT_GET_TX_STATUS)) < 0) return n; *split = ((p->tx_status & 0x20) == 0) ? RIG_SPLIT_ON : RIG_SPLIT_OFF; return RIG_OK; } int ft897_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; switch (func) { case RIG_FUNC_LOCK: if (status) return ft897_send_cmd(rig, FT897_NATIVE_CAT_LOCK_ON); else return ft897_send_cmd(rig, FT897_NATIVE_CAT_LOCK_OFF); case RIG_FUNC_TONE: if (status) return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_ENC_ON); else return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_DCS_OFF); case RIG_FUNC_TSQL: if (status) return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_ON); else return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_DCS_OFF); #if 0 case RIG_FUNC_CODE: /* this doesn't exist */ if (status) return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_DCS_ENC_ON); else return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_DCS_OFF); case RIG_FUNC_DSQL: /* this doesn't exist */ if (status) return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_DCS_ON); else return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_DCS_OFF); #endif default: return -RIG_EINVAL; } } int ft897_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code) { unsigned char data[YAESU_CMD_LENGTH - 1]; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft897: set DCS code (%d)\n", code); if (code == 0) return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_DCS_OFF); /* fill in the DCS code - the rig doesn't support separate codes... */ to_bcd_be(data, code, 4); to_bcd_be(data + 2, code, 4); if ((n = ft897_send_icmd(rig, FT897_NATIVE_CAT_SET_DCS_CODE, data)) < 0) return n; return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_DCS_ENC_ON); } int ft897_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone) { unsigned char data[YAESU_CMD_LENGTH - 1]; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft897: set CTCSS tone (%.1f)\n", tone / 10.0); if (tone == 0) return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_DCS_OFF); /* fill in the CTCSS freq - the rig doesn't support separate tones... */ to_bcd_be(data, tone, 4); to_bcd_be(data + 2, tone, 4); if ((n = ft897_send_icmd(rig, FT897_NATIVE_CAT_SET_CTCSS_FREQ, data)) < 0) return n; return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_ENC_ON); } int ft897_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code) { unsigned char data[YAESU_CMD_LENGTH - 1]; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft897: set DCS sql (%d)\n", code); if (code == 0) return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_DCS_OFF); /* fill in the DCS code - the rig doesn't support separate codes... */ to_bcd_be(data, code, 4); to_bcd_be(data + 2, code, 4); if ((n = ft897_send_icmd(rig, FT897_NATIVE_CAT_SET_DCS_CODE, data)) < 0) return n; return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_DCS_ON); } int ft897_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone) { unsigned char data[YAESU_CMD_LENGTH - 1]; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft897: set CTCSS sql (%.1f)\n", tone / 10.0); if (tone == 0) return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_DCS_OFF); /* fill in the CTCSS freq - the rig doesn't support separate tones... */ to_bcd_be(data, tone, 4); to_bcd_be(data + 2, tone, 4); if ((n = ft897_send_icmd(rig, FT897_NATIVE_CAT_SET_CTCSS_FREQ, data)) < 0) return n; return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_CTCSS_ON); } int ft897_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift) { if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft897: set repeter shift = %i\n", shift); switch (shift) { case RIG_RPT_SHIFT_NONE: return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX); case RIG_RPT_SHIFT_MINUS: return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_RPT_SHIFT_MINUS); case RIG_RPT_SHIFT_PLUS: return ft897_send_cmd(rig, FT897_NATIVE_CAT_SET_RPT_SHIFT_PLUS); } return -RIG_EINVAL; } int ft897_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs) { unsigned char data[YAESU_CMD_LENGTH - 1]; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft897: set repeter offs = %li\n", offs); /* fill in the offset freq */ to_bcd_be(data, offs / 10, 8); return ft897_send_icmd(rig, FT897_NATIVE_CAT_SET_RPT_OFFSET, data); } int ft897_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { unsigned char data[YAESU_CMD_LENGTH - 1]; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft897: set rit = %li)\n", rit); /* fill in the RIT freq */ data[0] = (rit < 0) ? 255 : 0; data[1] = 0; to_bcd_be(data + 2, labs(rit) / 10, 4); if ((n = ft897_send_icmd(rig, FT897_NATIVE_CAT_SET_CLAR_FREQ, data)) < 0) return n; /* the rig rejects if these are repeated - don't confuse user with retcode */ if (rit == 0) ft897_send_cmd(rig, FT897_NATIVE_CAT_CLAR_OFF); else ft897_send_cmd(rig, FT897_NATIVE_CAT_CLAR_ON); return RIG_OK; } #if 0 /* * This doesn't seem to work on FT897. It might work with FT817 though. */ int ft897_set_powerstat(RIG *rig, powerstat_t status) { switch (status) { case RIG_POWER_OFF: return ft897_send_cmd(rig, FT897_NATIVE_CAT_PWR_OFF); case RIG_POWER_ON: return ft897_send_cmd(rig, FT897_NATIVE_CAT_PWR_ON); case RIG_POWER_STANDBY: default: return -RIG_EINVAL; } } #endif /* ---------------------------------------------------------------------- */ hamlib-1.2.15.3/yaesu/ft990.h0000644000175000017500000003064612044564477012316 00000000000000/* * hamlib - (C) Stephane Fillod 2002, 2003 (fillods at users.sourceforge.net) * * ft990.h - (C) Berndt Josef Wulf (wulf at ping.net.au) * * This shared library provides an API for communicating * via serial interface to an FT-990 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT990_H #define _FT990_H 1 // Global Definitions #define TRUE 1 #define FALSE 0 #define ON TRUE #define OFF FALSE /* RX caps */ #define FT990_ALL_RX_MODES (RIG_MODE_LSB|RIG_MODE_USB|RIG_MODE_CW|RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTFM|RIG_MODE_PKTLSB) #define FT990_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB|RIG_MODE_PKTLSB) #define FT990_RTTY_RX_MODES (RIG_MODE_RTTY|RIG_MODE_RTTYR) #define FT990_AM_RX_MODES (RIG_MODE_AM) #define FT990_FM_RX_MODES (RIG_MODE_FM|RIG_MODE_PKTFM) /* TX caps */ #define FT990_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM|RIG_MODE_PKTFM|RIG_MODE_PKTLSB) /* 100 W class */ #define FT990_AM_TX_MODES (RIG_MODE_AM ) /* set 25W max */ #define FT990_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_LOCK|RIG_FUNC_TUNER) /* fix */ /* Other features */ #define FT990_VFO_ALL (RIG_VFO_A|RIG_VFO_B) #define FT990_ANTS 0 #define FT990_VFO_OPS (RIG_OP_TO_VFO|RIG_OP_FROM_VFO|RIG_OP_CPY|RIG_OP_UP|RIG_OP_DOWN) /* Returned data length in bytes */ #define FT990_ALL_DATA_LENGTH 1508 /* 0x10 P1 = 00 return size */ #define FT990_MEM_CHNL_LENGTH 1 /* 0x10 P1 = 01 return size */ #define FT990_OP_DATA_LENGTH 32 /* 0x10 P1 = 02 return size */ #define FT990_VFO_DATA_LENGTH 32 /* 0x10 P1 = 03 return size -- A & B returned */ #define FT990_MEM_CHNL_DATA_LENGTH 16 /* 0x10 P1 = 04, P4 = 0x00-0x59 return size */ #define FT990_READ_METER_LENGTH 5 /* 0xf7 return size */ #define FT990_STATUS_FLAGS_LENGTH 5 /* 0xfa return size */ /* BCD coded frequency length */ #define FT990_BCD_DIAL 8 #define FT990_BCD_RIT 3 #define FT990_BCD_RPTR_OFFSET 6 /* Timing values in mS */ #define FT990_PACING_INTERVAL 5 #define FT990_PACING_DEFAULT_VALUE 0 #define FT990_WRITE_DELAY 50 /* Delay sequential fast writes */ #define FT990_POST_WRITE_DELAY 5 /* Rough safe value for default timeout */ #define FT990_DEFAULT_READ_TIMEOUT FT990_ALL_DATA_LENGTH * ( 5 + (FT990_PACING_INTERVAL * FT990_PACING_DEFAULT_VALUE)) // FT990 native commands typedef enum ft990_native_cmd_e { FT990_NATIVE_SPLIT_OFF = 0, FT990_NATIVE_SPLIT_ON, FT990_NATIVE_RECALL_MEM, FT990_NATIVE_VFO_TO_MEM, FT990_NATIVE_LOCK_OFF, FT990_NATIVE_LOCK_ON, FT990_NATIVE_VFO_A, FT990_NATIVE_VFO_B, FT990_NATIVE_MEM_TO_VFO, FT990_NATIVE_VFO_STEP_UP, FT990_NATIVE_VFO_STEP_UP_FAST, FT990_NATIVE_VFO_STEP_DOWN, FT990_NATIVE_VFO_STEP_DOWN_FAST, FT990_NATIVE_RX_CLARIFIER_OFF, FT990_NATIVE_RX_CLARIFIER_ON, FT990_NATIVE_TX_CLARIFIER_OFF, FT990_NATIVE_TX_CLARIFIER_ON, FT990_NATIVE_CLEAR_CLARIFIER_OFFSET, FT990_NATIVE_CLARIFIER_OPS, FT990_NATIVE_FREQ_SET, FT990_NATIVE_MODE_SET_LSB, FT990_NATIVE_MODE_SET_USB, FT990_NATIVE_MODE_SET_CW_W, FT990_NATIVE_MODE_SET_CW_N, FT990_NATIVE_MODE_SET_AM_W, FT990_NATIVE_MODE_SET_AM_N, FT990_NATIVE_MODE_SET_FM, FT990_NATIVE_MODE_SET_RTTY_LSB, FT990_NATIVE_MODE_SET_RTTY_USB, FT990_NATIVE_MODE_SET_PKT_LSB, FT990_NATIVE_MODE_SET_PKT_FM, FT990_NATIVE_PACING, FT990_NATIVE_PTT_OFF, FT990_NATIVE_PTT_ON, FT990_NATIVE_UPDATE_ALL_DATA, FT990_NATIVE_UPDATE_MEM_CHNL, FT990_NATIVE_UPDATE_OP_DATA, FT990_NATIVE_UPDATE_VFO_DATA, FT990_NATIVE_UPDATE_MEM_CHNL_DATA, FT990_NATIVE_TUNER_OFF, FT990_NATIVE_TUNER_ON, FT990_NATIVE_TUNER_START, FT990_NATIVE_RPTR_SHIFT_NONE, FT990_NATIVE_RPTR_SHIFT_MINUS, FT990_NATIVE_RPTR_SHIFT_PLUS, FT990_NATIVE_VFO_TO_VFO, FT990_NATIVE_BANDWIDTH, FT990_NATIVE_OP_FREQ_STEP_UP, FT990_NATIVE_OP_FREQ_STEP_DOWN, FT990_NATIVE_READ_METER, FT990_NATIVE_DIM_LEVEL, FT990_NATIVE_RPTR_OFFSET, FT990_NATIVE_READ_FLAGS, FT990_NATIVE_SIZE } ft990_native_cmd_t; /* HAMLIB API implementation */ int ft990_init(RIG *rig); int ft990_cleanup(RIG *rig); int ft990_open(RIG *rig); int ft990_close(RIG *rig); int ft990_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int ft990_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int ft990_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int ft990_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int ft990_set_vfo(RIG *rig, vfo_t vfo); int ft990_get_vfo(RIG *rig, vfo_t *vfo); int ft990_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); int ft990_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); int ft990_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift); int ft990_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift); int ft990_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs); int ft990_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); int ft990_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); int ft990_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); int ft990_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit); int ft990_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); int ft990_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); int ft990_set_parm(RIG *rig, setting_t parm, value_t val); int ft990_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit); int ft990_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit); int ft990_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); int ft990_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); int ft990_set_mem(RIG *rig, vfo_t vfo, int ch); int ft990_get_mem(RIG *rig, vfo_t vfo, int *ch); int ft990_set_channel (RIG *rig, const channel_t *chan); int ft990_get_channel (RIG *rig, channel_t *chan); /* * The definitions below are copied from the kft990 * project and are hereby made available to the * hamlib project. [BJW] */ // OpCode Declarations #define FT990_CMD_SPLIT 0x01 #define FT990_CMD_RECALLMEM 0x02 #define FT990_CMD_VFO2MEM 0x03 #define FT990_CMD_LOCK 0x04 #define FT990_CMD_SELVFOAB 0x05 #define FT990_CMD_MEM2VFO 0x06 #define FT990_CMD_UP 0x07 #define FT990_CMD_DOWN 0x08 #define FT990_CMD_CLARIFIER 0x09 #define FT990_CMD_SETVFOA 0x0a #define FT990_CMD_SELOPMODE 0x0c #define FT990_CMD_PACING 0x0e #define FT990_CMD_PTT 0x0f #define FT990_CMD_UPDATE 0x10 #define FT990_CMD_TUNER 0x81 #define FT990_CMD_START 0x82 #define FT990_CMD_RPT 0x84 #define FT990_CMD_VFOA2B 0x85 #define FT990_CMD_BW 0x8c #define FT990_CMD_MEMSCANSKIP 0x8d #define FT990_CMD_STEPVFO 0x8e #define FT990_CMD_RDMETER 0xf7 #define FT990_CMD_DIMLEVEL 0xf8 #define FT990_CMD_RPTROFFSET 0xf9 #define FT990_CMD_RDFLAGS 0xfa // Bandwidth Filter #define FT990_BW_F2400 0x00 #define FT990_BW_F2000 0x01 #define FT990_BW_F500 0x02 #define FT990_BW_F250 0x03 #define FT990_BW_F6000 0x04 #define FT990_BW_FMPKTRTTY 0x80 // Operating Mode Status #define FT990_MODE_LSB 0x00 #define FT990_MODE_USB 0x01 #define FT990_MODE_CW 0x02 #define FT990_MODE_AM 0x03 #define FT990_MODE_FM 0x04 #define FT990_MODE_RTTY 0x05 #define FT990_MODE_PKT 0x06 // Operation Mode Selection #define FT990_OP_MODE_LSB 0x00 #define FT990_OP_MODE_USB 0x01 #define FT990_OP_MODE_CW2400 0x02 #define FT990_OP_MODE_CW500 0x03 #define FT990_OP_MODE_AM6000 0x04 #define FT990_OP_MODE_AM2400 0x05 #define FT990_OP_MODE_FM 0x06 #define FT990_OP_MODE_RTTYLSB 0x08 #define FT990_OP_MODE_RTTYUSB 0x09 #define FT990_OP_MODE_PKTLSB 0x0a #define FT990_OP_MODE_PKTFM 0x0b // Clarifier Operation #define FT990_CLAR_TX_EN 0x01 #define FT990_CLAR_RX_EN 0x02 #define FT990_CLAR_RX_OFF 0x00 #define FT990_CLAR_RX_ON 0x01 #define FT990_CLAR_TX_OFF 0x80 #define FT990_CLAR_TX_ON 0x81 #define FT990_CLAR_CLEAR 0xff #define FT990_CLAR_TUNE_UP 0x00 #define FT990_CLAR_TUNE_DOWN 0xff // Repeater Shift Enable #define FT990_RPT_POS_EN 0x04 #define FT990_RPT_NEG_EN 0x08 #define FT990_RPT_MASK 0x0C // Status Flag 1 Masks #define FT990_SF_SPLIT 0x01 #define FT990_SF_VFOB 0x02 #define FT990_SF_FAST 0x04 #define FT990_SF_CAT 0x08 #define FT990_SF_TUNING 0x10 #define FT990_SF_KEY_ENTRY 0x20 #define FT990_SF_MEM_EMPTY 0x40 #define FT990_SF_XMIT 0x80 // Status Flag 2 Masks #define FT990_SF_MEM_SCAN_PAUSE 0x01 #define FT990_SF_MEM_CHECK 0x02 #define FT990_SF_MEM_SCAN 0x04 #define FT990_SF_LOCKED 0x08 #define FT990_SF_MTUNE 0x10 #define FT990_SF_VFO 0x20 #define FT990_SF_MEM 0x40 #define FT990_SF_GEN 0x80 // Status Flag 3 Masks #define FT990_SF_PTT 0x01 #define FT990_SF_TX_INHIBIT 0x02 #define FT990_SF_KEY_TIMER 0x04 #define FT990_SF_MEM_TIMER 0x08 #define FT990_SF_PTT_INHIBIT 0x10 #define FT990_SF_XMIT_MON 0x20 #define FT990_SF_TUNER_ON 0x40 #define FT990_SF_SIDETONE 0x80 #define FT990_EMPTY_MEM 0x80 #define FT990_AMFILTER2400 0x80 // Flags Byte 1 typedef struct _ft990_flags1_t { unsigned split: 1; unsigned vfob: 1; unsigned fast: 1; unsigned cat: 1; unsigned tuning: 1; unsigned keyentry: 1; unsigned memempty: 1; unsigned xmit: 1; } ft990_flags1_t; // Flags Byte 2 typedef struct _ft990_flags2_t { unsigned memscanpause:1; unsigned memcheck: 1; unsigned memscan: 1; unsigned locked: 1; unsigned mtune: 1; unsigned vfo: 1; unsigned mem: 1; unsigned gen: 1; } ft990_flags2_t; // Flags Byte 3 typedef struct _ft990_status3_t { unsigned ptt: 1; unsigned txinhibit: 1; unsigned keytimer: 1; unsigned memtimer: 1; unsigned pttinhibit: 1; unsigned xmitmon: 1; unsigned tuneron: 1; unsigned sidetone: 1; } ft990_flags3_t; typedef union _ft990_flags1_u { ft990_flags1_t bits; unsigned char byte; } ft990_flags1_u; typedef union _ft990_flags2_u { ft990_flags2_t bits; unsigned char byte; } ft990_flags2_u; typedef union _ft990_flags3_u { ft990_flags3_t bits; unsigned char byte; } ft990_flags3_u; typedef struct _ft990_status_data_t { ft990_flags1_u flags1; ft990_flags2_u flags2; ft990_flags3_u flags3; unsigned char id1; unsigned char id2; } ft990_status_data_t; typedef struct _ft990_meter_data_t { unsigned char mdata1; unsigned char mdata2; unsigned char mdata3; unsigned char mdata4; unsigned char id1; } ft990_meter_data_t; typedef struct _ft990_op_data_t { unsigned char bpf; unsigned char basefreq[3]; unsigned char status; unsigned char coffset[2]; unsigned char mode; unsigned char filter; unsigned char lastssbfilter; unsigned char lastcwfilter; unsigned char lastrttyfilter; unsigned char lastpktfilter; unsigned char lastclariferstate; unsigned char skipscanamfilter; unsigned char amfm100; } ft990_op_data_t; // Update Data Structure typedef struct _ft990_update_data_t { unsigned char flag1; unsigned char flag2; unsigned char flag3; unsigned char channelnumber; ft990_op_data_t current_front; ft990_op_data_t current_rear; ft990_op_data_t vfoa; ft990_op_data_t vfob; ft990_op_data_t channel[90]; } ft990_update_data_t; // Command Structure typedef struct _ft990_command_t { unsigned char data[4]; unsigned char opcode; } ft990_command_t; #endif /* _FT990_H */ hamlib-1.2.15.3/yaesu/frg100.c0000644000175000017500000002166312044564477012434 00000000000000/* * frg100.c - (C) Stephane Fillod 2002-2005 * * This shared library provides an API for communicating * via serial interface to an FRG-100 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #define FRG100_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM|RIG_MODE_FM) #define FRG100_VFOS (RIG_VFO_A) #define FRG100_ANTS 0 /* TODO: get real measure numbers */ #define FRG100_STR_CAL { 2, { \ { 0, -60 }, /* S0 -6dB */ \ { 60, 60 } /* +60 */ \ } } #define FRG100_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1 \ } /* Private helper function prototypes */ static int frg100_open(RIG *rig); static int frg100_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int frg100_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int frg100_set_vfo(RIG *rig, vfo_t vfo); static int frg100_set_powerstat(RIG *rig, powerstat_t status); static int frg100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); #if 0 static int rig2mode(RIG *rig, int md, rmode_t *mode, pbwidth_t *width); #endif static int mode2rig(RIG *rig, rmode_t mode, pbwidth_t width); /* * frg100 rigs capabilities. * Also this struct is READONLY! * * TODO: * - Memory recall * - VFO->M & M->VFO * - Lock, Up/Down * - Status update * - Clock set, Timer * - Scan skip * - Step Frequency Size * - Dim */ const struct rig_caps frg100_caps = { .rig_model = RIG_MODEL_FRG100, .model_name = "FRG-100", .mfg_name = "Yaesu", .version = "0.4", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 20, .post_write_delay = 300, .timeout = 2000, .retry = 0, .has_get_func = RIG_FUNC_LOCK, .has_set_func = RIG_FUNC_LOCK, .has_get_level = RIG_LEVEL_RAWSTR, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_BACKLIGHT, .vfo_ops = RIG_OP_FROM_VFO|RIG_OP_TO_VFO|RIG_OP_UP|RIG_OP_DOWN, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_NONE, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 0x32, RIG_MTYPE_MEM, FRG100_MEM_CAP }, { 0x33, 0x34, RIG_MTYPE_EDGE }, }, .rx_range_list1 = { {kHz(50), MHz(30), FRG100_MODES, -1, -1, FRG100_VFOS, FRG100_ANTS }, RIG_FRNG_END, }, /* Region 1 rx ranges */ .tx_range_list1 = { RIG_FRNG_END, }, /* region 1 TX ranges */ .rx_range_list2 = { {kHz(50), MHz(30), FRG100_MODES, -1, -1, FRG100_VFOS, FRG100_ANTS }, RIG_FRNG_END, }, /* Region 2 rx ranges */ .tx_range_list2 = { RIG_FRNG_END, }, /* region 2 TX ranges */ .tuning_steps = { {RIG_MODE_SSB|RIG_MODE_CW, Hz(10)}, {RIG_MODE_FM|RIG_MODE_AM, Hz(100)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.4)}, {RIG_MODE_CW, Hz(500)}, {RIG_MODE_AM, kHz(6)}, {RIG_MODE_AM, kHz(4)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .str_cal = FRG100_STR_CAL, .rig_open = frg100_open, .set_freq = frg100_set_freq, .set_mode = frg100_set_mode, .set_vfo = frg100_set_vfo, .get_level = frg100_get_level, .set_powerstat = frg100_set_powerstat, }; /* * frg100_open routine * */ int frg100_open(RIG *rig) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0e}; rig_debug(RIG_DEBUG_TRACE, "frg100: frg100_open called\n"); /* send 0 delay pacing */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int frg100_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0a}; /* store bcd format in cmd (LSB) */ to_bcd(cmd, freq/10, 8); /* Frequency set */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int frg100_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0c}; /* fill in p1 */ cmd[3] = mode2rig(rig, mode, width); return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } /* * Actually, this is tape relay, 0xfe=on */ int frg100_set_powerstat(RIG *rig, powerstat_t status) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x20}; rig_debug(RIG_DEBUG_TRACE,"frg100: frg100_set_powerstat called\n"); cmd[3] = status == RIG_POWER_OFF ? 0x00 : 0x01; /* Frequency set */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int frg100_set_vfo(RIG *rig, vfo_t vfo) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x00}; switch(vfo) { case RIG_VFO_CURR: return RIG_OK; case RIG_VFO_VFO: case RIG_VFO_A: cmd[4] = 0x05; break; case RIG_VFO_MEM: /* TODO: cmd[3] = priv->current_mem_chan; */ cmd[4] = 0x02; break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int frg100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0xf7}; int retval; if (level != RIG_LEVEL_RAWSTR) return -RIG_EINVAL; serial_flush(&rig->state.rigport); /* send READ STATUS(Meter only) cmd to rig */ retval = write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); if (retval < 0) return retval; /* read back the 1 byte */ retval = read_block(&rig->state.rigport, (char *) cmd, 5); if (retval < 1) { rig_debug(RIG_DEBUG_ERR,"%s: read meter failed %d\n", __FUNCTION__,retval); return retval < 0 ? retval : -RIG_EIO; } val->i = cmd[0]; return RIG_OK; } #define MODE_LSB 0x00 #define MODE_USB 0x01 #define MODE_CWW 0x02 #define MODE_CWN 0x03 #define MODE_AMW 0x04 #define MODE_AMN 0x05 #define MODE_FMW 0x06 #define MODE_FMN 0x07 int mode2rig(RIG *rig, rmode_t mode, pbwidth_t width) { int md; /* * translate mode from generic to frg100 specific */ switch(mode) { case RIG_MODE_USB: md = MODE_USB; break; case RIG_MODE_LSB: md = MODE_LSB; break; case RIG_MODE_AM: if (width != RIG_PASSBAND_NORMAL || width < rig_passband_normal(rig, mode)) md = MODE_AMN; else md = MODE_AMW; break; case RIG_MODE_FM: if (width != RIG_PASSBAND_NORMAL || width < rig_passband_normal(rig, mode)) md = MODE_FMN; else md = MODE_FMW; break; case RIG_MODE_CW: if (width != RIG_PASSBAND_NORMAL || width < rig_passband_normal(rig, mode)) md = MODE_CWN; else md = MODE_CWW; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } return md; } /* function not used */ #if 0 int rig2mode(RIG *rig, int md, rmode_t *mode, pbwidth_t *width) { /* * translate mode from frg100 specific to generic */ switch(md) { case MODE_USB: *mode = RIG_MODE_USB; break; case MODE_LSB: *mode = RIG_MODE_LSB; break; case MODE_AMW: case MODE_AMN: *mode = RIG_MODE_AM; break; case MODE_FMW: case MODE_FMN: *mode = RIG_MODE_FM; break; case MODE_CWW: case MODE_CWN: *mode = RIG_MODE_CW; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } if (md == MODE_CWN || md == MODE_AMN || md == MODE_FMN) *width = rig_passband_narrow(rig, *mode); else *width = rig_passband_normal(rig, *mode); return RIG_OK; } #endif hamlib-1.2.15.3/yaesu/ft890.c0000644000175000017500000012414512044564477012306 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft890.c - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * (C) Stephane Fillod 2002-2005 (fillods at users.sourceforge.net) * (C) Nate Bargmann 2002, 2003 (n0nb at arrl.net) * * This shared library provides an API for communicating * via serial interface to an FT-890 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "bandplan.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "ft890.h" /* * Functions considered to be Beta code (2003-04-11): * set_freq * get_freq * set_mode * get_mode * set_vfo * get_vfo * set_ptt * get_ptt * set_split * get_split * set_rit * get_rit * set_func * get_func * get_level * * Functions considered to be Alpha code (2003-04-11): * vfo_op * * functions not yet implemented (2003-04-11): * set_split_freq * get_split_freq * set_split_mode * get_split_mode * */ /* Private helper function prototypes */ static int ft890_get_update_data(RIG *rig, unsigned char ci, unsigned char rl); static int ft890_send_static_cmd(RIG *rig, unsigned char ci); static int ft890_send_dynamic_cmd(RIG *rig, unsigned char ci, unsigned char p1, unsigned char p2, unsigned char p3, unsigned char p4); static int ft890_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq); static int ft890_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit); /* * Native ft890 cmd set prototypes. These are READ ONLY as each * rig instance will copy from these and modify if required. * Complete sequences (1) can be read and used directly as a cmd sequence. * Incomplete sequences (0) must be completed with extra parameters * eg: mem number, or freq etc.. * * TODO: Shorten this static array with parameter substitution -N0NB * */ static const yaesu_cmd_set_t ncmd[] = { { 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* split = off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* split = on */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* recall memory */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* memory operations */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* select vfo A */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* select vfo B */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x06 } }, /* copy memory data to vfo A */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, /* clarifier operations */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* set display freq */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* mode set */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0e } }, /* update interval/pacing */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0f } }, /* PTT off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0f } }, /* PTT on */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x10 } }, /* Status Update Data--Memory Channel Number (1 byte) */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x10 } }, /* Status Update Data--Current operating data for VFO/Memory (19 bytes) */ { 1, { 0x00, 0x00, 0x00, 0x03, 0x10 } }, /* Status Update DATA--VFO A and B Data (18 bytes) */ { 0, { 0x00, 0x00, 0x00, 0x04, 0x10 } }, /* Status Update Data--Memory Channel Data (19 bytes) P4 = 0x01-0x20 Memory Channel Number */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x81 } }, /* tuner off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x81 } }, /* tuner on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x82 } }, /* tuner start*/ { 1, { 0x00, 0x00, 0x00, 0x00, 0xf7 } }, /* Read meter, S on RX, ALC|PO|SWR on TX */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xfa } }, /* Read status flags */ }; /* * future - private data * * FIXME: Does this need to be exposed to the application/frontend through * ft890_caps.priv? -N0NB */ struct ft890_priv_data { unsigned char pacing; /* pacing value */ unsigned int read_update_delay; /* depends on pacing value */ vfo_t current_vfo; /* active VFO from last cmd */ unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */ yaesu_cmd_set_t pcs[FT890_NATIVE_SIZE]; /* private cmd set */ unsigned char update_data[FT890_ALL_DATA_LENGTH]; /* returned data--max value, some are less */ unsigned char current_mem; /* private memory channel number */ }; /* * ft890 rigs capabilities. * Also this struct is READONLY! * */ const struct rig_caps ft890_caps = { .rig_model = RIG_MODEL_FT890, .model_name = "FT-890", .mfg_name = "Yaesu", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT890_WRITE_DELAY, .post_write_delay = FT890_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = RIG_FUNC_TUNER, .has_set_func = RIG_FUNC_TUNER, .has_get_level = RIG_LEVEL_STRENGTH, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(0), .max_ifshift = Hz(0), .vfo_ops = RIG_OP_TUNE, .targetable_vfo = RIG_TARGETABLE_ALL, .transceive = RIG_TRN_OFF, /* Yaesus have to be polled, sigh */ .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, /* FIXME: memory channel list: 32 */ .rx_range_list1 = { {kHz(100), MHz(30), FT890_ALL_RX_MODES, -1, -1, FT890_VFO_ALL, FT890_ANTS}, /* General coverage + ham */ RIG_FRNG_END, }, /* FIXME: Are these the correct Region 1 values? */ .tx_range_list1 = { FRQ_RNG_HF(1, FT890_OTHER_TX_MODES, W(5), W(100), FT890_VFO_ALL, FT890_ANTS), FRQ_RNG_HF(1, FT890_AM_TX_MODES, W(2), W(25), FT890_VFO_ALL, FT890_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100), MHz(30), FT890_ALL_RX_MODES, -1, -1, FT890_VFO_ALL, FT890_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2, FT890_OTHER_TX_MODES, W(5), W(100), FT890_VFO_ALL, FT890_ANTS), FRQ_RNG_HF(2, FT890_AM_TX_MODES, W(2), W(25), FT890_VFO_ALL, FT890_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {FT890_SSB_CW_RX_MODES, Hz(10)}, /* Normal */ {FT890_SSB_CW_RX_MODES, Hz(100)}, /* Fast */ {FT890_AM_RX_MODES, Hz(100)}, /* Normal */ {FT890_AM_RX_MODES, kHz(1)}, /* Fast */ {FT890_FM_RX_MODES, Hz(100)}, /* Normal */ {FT890_FM_RX_MODES, kHz(1)}, /* Fast */ RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_SSB, kHz(2.2)}, /* standard SSB filter bandwidth */ {RIG_MODE_CW, kHz(2.2)}, /* normal CW filter */ {RIG_MODE_CW, kHz(0.5)}, /* CW filter with narrow selection (must be installed!) */ {RIG_MODE_AM, kHz(6)}, /* normal AM filter */ {RIG_MODE_AM, kHz(2.2)}, /* AM filter with narrow selection (SSB filter switched in) */ {RIG_MODE_FM, kHz(12)}, /* FM */ RIG_FLT_END, }, .priv = NULL, /* private data FIXME: */ .rig_init = ft890_init, .rig_cleanup = ft890_cleanup, .rig_open = ft890_open, /* port opened */ .rig_close = ft890_close, /* port closed */ .set_freq = ft890_set_freq, .get_freq = ft890_get_freq, .set_mode = ft890_set_mode, .get_mode = ft890_get_mode, .set_vfo = ft890_set_vfo, .get_vfo = ft890_get_vfo, .set_ptt = ft890_set_ptt, .get_ptt = ft890_get_ptt, .set_split_vfo = ft890_set_split_vfo, .get_split_vfo = ft890_get_split_vfo, .set_rit = ft890_set_rit, .get_rit = ft890_get_rit, .set_func = ft890_set_func, .get_level = ft890_get_level, .vfo_op = ft890_vfo_op, }; /* * ************************************ * * Hamlib API functions * * ************************************ */ /* * rig_init * */ static int ft890_init(RIG *rig) { struct ft890_priv_data *priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft890_priv_data *)malloc(sizeof(struct ft890_priv_data)); if (!priv) /* whoops! memory shortage! */ return -RIG_ENOMEM; /* * Copy native cmd set to private cmd storage area */ memcpy(priv->pcs, ncmd, sizeof(ncmd)); /* TODO: read pacing from preferences */ priv->pacing = FT890_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */ priv->read_update_delay = FT890_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */ priv->current_vfo = RIG_VFO_MAIN; /* default to whatever */ rig->state.priv = (void *)priv; return RIG_OK; } /* * rig_cleanup * * the serial port is closed by the frontend * */ static int ft890_cleanup(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * rig_open * */ static int ft890_open(RIG *rig) { struct rig_state *rig_s; struct ft890_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft890_priv_data *)rig->state.priv; rig_s = &rig->state; rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n", __func__, rig_s->rigport.write_delay); rig_debug(RIG_DEBUG_TRACE, "%s: post_write_delay = %i msec\n", __func__, rig_s->rigport.post_write_delay); rig_debug(RIG_DEBUG_TRACE, "%s: read pacing = %i\n", __func__, priv->pacing); err = ft890_send_dynamic_cmd(rig, FT890_NATIVE_PACING, priv->pacing, 0, 0, 0); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_close * */ static int ft890_close(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; return RIG_OK; } /* * rig_set_freq * * Set frequency for a given VFO * * If vfo is set to RIG_VFO_CUR then vfo from priv_data is used. * If vfo differs from stored value then VFO will be set to the * passed vfo. * */ static int ft890_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct ft890_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft890_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq); if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } else if (vfo != priv->current_vfo) { /* force a VFO change if requested vfo value differs from stored value */ err = ft890_set_vfo(rig, vfo); if (err != RIG_OK) return err; } err = ft890_send_dial_freq(rig, FT890_NATIVE_FREQ_SET, freq); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_freq * * Return Freq for a given VFO * */ static int ft890_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft890_priv_data *priv; unsigned char *p; unsigned char offset; freq_t f; int err, cmd_index, count; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); if (!rig) return -RIG_EINVAL; priv = (struct ft890_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { err = ft890_get_vfo(rig, &priv->current_vfo); if (err != RIG_OK) return err; vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: cmd_index = FT890_NATIVE_VFO_DATA; offset = FT890_SUMO_VFO_A_FREQ; count = FT890_VFO_DATA_LENGTH; break; case RIG_VFO_B: cmd_index = FT890_NATIVE_VFO_DATA; offset = FT890_SUMO_VFO_B_FREQ; count = FT890_VFO_DATA_LENGTH; break; case RIG_VFO_MEM: case RIG_VFO_MAIN: cmd_index = FT890_NATIVE_OP_DATA; offset = FT890_SUMO_DISPLAYED_FREQ; count = FT890_OP_DATA_LENGTH; break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } err = ft890_get_update_data(rig, cmd_index, count); if (err != RIG_OK) return err; p = &priv->update_data[offset]; /* big endian integer */ f = ((((p[0]<<8) + p[1])<<8) + p[2]) * 10; rig_debug(RIG_DEBUG_TRACE, "%s: freq = %"PRIfreq" Hz for vfo 0x%02x\n", __func__, f, vfo); *freq = f; /* return displayed frequency */ return RIG_OK; } /* * rig_set_mode * * set mode and passband: eg AM, CW etc for a given VFO * * If vfo is set to RIG_VFO_CUR then vfo from priv_data is used. * */ static int ft890_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) { struct ft890_priv_data *priv; unsigned char mode_parm; /* mode parameter */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed mode = %i\n", __func__, mode); rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %li Hz\n", __func__, width); priv = (struct ft890_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } /* translate mode from generic to ft890 specific */ switch(vfo) { case RIG_VFO_A: /* force to VFO */ case RIG_VFO_VFO: err = ft890_set_vfo(rig, RIG_VFO_A); if (err != RIG_OK) return err; break; case RIG_VFO_B: err = ft890_set_vfo(rig, RIG_VFO_B); if (err != RIG_OK) return err; break; case RIG_VFO_MEM: /* MEM TUNE or user doesn't care */ case RIG_VFO_MAIN: break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } switch(mode) { case RIG_MODE_AM: mode_parm = MODE_SET_AM_W; break; case RIG_MODE_CW: mode_parm = MODE_SET_CW_W; break; case RIG_MODE_USB: mode_parm = MODE_SET_USB; break; case RIG_MODE_LSB: mode_parm = MODE_SET_LSB; break; case RIG_MODE_FM: mode_parm = MODE_SET_FM; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } /* * Now set width (shamelessly stolen from ft847.c and then butchered :) * The FT-890 only supports narrow width in AM and CW modes * */ if (width == rig_passband_narrow(rig, mode)) { switch(mode) { case RIG_MODE_CW: mode_parm = MODE_SET_CW_N; break; case RIG_MODE_AM: mode_parm = MODE_SET_AM_N; break; default: return -RIG_EINVAL; /* Invalid mode, how can caller know? */ } } else { if (width != RIG_PASSBAND_NORMAL && width != rig_passband_normal(rig, mode)) { return -RIG_EINVAL; /* Invalid width, how can caller know? */ } } rig_debug(RIG_DEBUG_TRACE, "%s: set mode_parm = 0x%02x\n", __func__, mode_parm); err = ft890_send_dynamic_cmd(rig, FT890_NATIVE_MODE_SET, mode_parm, 0, 0, 0); if (err != RIG_OK) return err; return RIG_OK; /* good */ } /* * rig_get_mode * * get mode eg AM, CW etc for a given VFO * */ static int ft890_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct ft890_priv_data *priv; unsigned char my_mode, m_offset; /* ft890 mode, mode offset */ unsigned char flag, f_offset; /* CW/AM narrow flag */ int err, cmd_index, norm, count; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft890_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: cmd_index = FT890_NATIVE_VFO_DATA; m_offset = FT890_SUMO_VFO_A_MODE; f_offset = FT890_SUMO_VFO_A_FLAG; count = FT890_VFO_DATA_LENGTH; break; case RIG_VFO_B: cmd_index = FT890_NATIVE_VFO_DATA; m_offset = FT890_SUMO_VFO_B_MODE; f_offset = FT890_SUMO_VFO_B_FLAG; count = FT890_VFO_DATA_LENGTH; break; case RIG_VFO_MEM: case RIG_VFO_MAIN: cmd_index = FT890_NATIVE_OP_DATA; m_offset = FT890_SUMO_DISPLAYED_MODE; f_offset = FT890_SUMO_DISPLAYED_FLAG; count = FT890_OP_DATA_LENGTH; break; default: return -RIG_EINVAL; } err = ft890_get_update_data(rig, cmd_index, count); if (err != RIG_OK) return err; my_mode = MODE_MASK & priv->update_data[m_offset]; flag = FLAG_MASK & priv->update_data[f_offset]; rig_debug(RIG_DEBUG_TRACE, "%s: mode = 0x%02x\n", __func__, mode); rig_debug(RIG_DEBUG_TRACE, "%s: flag = 0x%02x\n", __func__, flag); /* * translate mode from ft890 to generic. */ switch(my_mode) { case MODE_LSB: *mode = RIG_MODE_LSB; norm = TRUE; break; case MODE_USB: *mode = RIG_MODE_USB; norm = TRUE; break; case MODE_CW: *mode = RIG_MODE_CW; if (flag & FLAG_CW_N) { norm = FALSE; } else { norm = TRUE; } break; case MODE_AM: *mode = RIG_MODE_AM; if (flag & FLAG_AM_N) { norm = FALSE; } else { norm = TRUE; } break; case MODE_FM: *mode = RIG_MODE_FM; norm = TRUE; break; default: return -RIG_EINVAL; /* Oops! file bug report */ } if (norm) { *width = rig_passband_normal(rig, *mode); } else { *width = rig_passband_narrow(rig, *mode); } rig_debug(RIG_DEBUG_TRACE, "%s: set mode = %i\n", __func__, *mode); rig_debug(RIG_DEBUG_TRACE, "%s: set width = %li Hz\n", __func__, *width); return RIG_OK; } /* * rig_set_vfo * * set vfo and store requested vfo for later RIG_VFO_CURR * requests. * */ static int ft890_set_vfo(RIG *rig, vfo_t vfo) { struct ft890_priv_data *priv; unsigned char cmd_index; /* index of sequence to send */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft890_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } /* FIXME: Include support for RIG_VFO_MAIN */ switch(vfo) { case RIG_VFO_A: cmd_index = FT890_NATIVE_VFO_A; priv->current_vfo = vfo; /* update active VFO */ break; case RIG_VFO_B: cmd_index = FT890_NATIVE_VFO_B; priv->current_vfo = vfo; break; case RIG_VFO_MEM: /* reset to memory channel stored by previous get_vfo * The recall mem channel command uses 0x01 though 0x20 */ err = ft890_send_dynamic_cmd(rig, FT890_NATIVE_RECALL_MEM, (priv->current_mem + 1), 0, 0, 0); if (err != RIG_OK) return err; priv->current_vfo = vfo; rig_debug(RIG_DEBUG_TRACE, "%s: set mem channel = 0x%02x\n", __func__, priv->current_mem); return RIG_OK; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } rig_debug(RIG_DEBUG_TRACE, "%s: set cmd_index = %i\n", __func__, cmd_index); err = ft890_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_vfo * * get current RX vfo/mem and store requested vfo for * later RIG_VFO_CURR requests plus pass the tested vfo/mem * back to the frontend. * */ static int ft890_get_vfo(RIG *rig, vfo_t *vfo) { struct ft890_priv_data *priv; unsigned char status_0; /* ft890 status flag 0 */ unsigned char stat_vfo, stat_mem; /* status tests */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft890_priv_data *)rig->state.priv; /* Get flags for VFO status */ err = ft890_get_update_data(rig, FT890_NATIVE_READ_FLAGS, FT890_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; status_0 = priv->update_data[FT890_SUMO_DISPLAYED_STATUS_0]; stat_vfo = status_0 & SF_VFO_MASK; /* get VFO active bits */ stat_mem = status_0 & SF_MEM_MASK; /* get MEM active bits */ rig_debug(RIG_DEBUG_TRACE, "%s: vfo status_0 = 0x%02x\n", __func__, status_0); rig_debug(RIG_DEBUG_TRACE, "%s: stat_vfo = 0x%02x\n", __func__, stat_vfo); rig_debug(RIG_DEBUG_TRACE, "%s: stat_mem = 0x%02x\n", __func__, stat_mem); /* * translate vfo and mem status from ft890 to generic. * * First a test is made on bits 6 and 7 of status_0. Bit 7 is set * when FT-890 is in VFO mode on display. Bit 6 is set when VFO B * is active and cleared when VFO A is active. * * Conversely, bit 7 is cleared when MEM or MEM TUNE mode is selected * Bit 6 still follows last selected VFO (A or B), but this is not * tested right now. */ switch (stat_vfo) { case SF_VFOA: *vfo = RIG_VFO_A; priv->current_vfo = RIG_VFO_A; break; case SF_VFOB: *vfo = RIG_VFO_B; priv->current_vfo = RIG_VFO_B; break; default: switch (stat_mem) { case SF_MT: case SF_MR: *vfo = RIG_VFO_MEM; priv->current_vfo = RIG_VFO_MEM; /* * Per Hamlib policy capture and store memory channel number * for future set_vfo command. */ err = ft890_get_update_data(rig, FT890_NATIVE_MEM_CHNL, FT890_MEM_CHNL_LENGTH); if (err != RIG_OK) return err; priv->current_mem = priv->update_data[FT890_SUMO_MEM_CHANNEL]; rig_debug(RIG_DEBUG_TRACE, "%s: stored mem channel = 0x%02x\n", __func__, priv->current_mem); break; default: /* Oops! */ return -RIG_EINVAL; /* sorry, wrong current VFO */ } } rig_debug(RIG_DEBUG_TRACE, "%s: set vfo = 0x%02x\n", __func__, *vfo); return RIG_OK; } /* * rig_set_ptt * * set the '890 into TX mode * * vfo is respected by calling ft890_set_vfo if * passed vfo != priv->current_vfo * */ static int ft890_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { struct ft890_priv_data *priv; unsigned char cmd_index; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft890_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt); if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } else if (vfo != priv->current_vfo) { ft890_set_vfo(rig, vfo); } switch (ptt) { case RIG_PTT_OFF: cmd_index = FT890_NATIVE_PTT_OFF; break; case RIG_PTT_ON: cmd_index = FT890_NATIVE_PTT_ON; break; default: return -RIG_EINVAL; /* wrong PTT state! */ } err = ft890_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_ptt * * get current PTT status * */ static int ft890_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct ft890_priv_data *priv; unsigned char status_2; /* ft890 status flag 2 */ unsigned char stat_ptt; /* status tests */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft890_priv_data *)rig->state.priv; /* Get flags for VFO status */ err = ft890_get_update_data(rig, FT890_NATIVE_READ_FLAGS, FT890_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; status_2 = priv->update_data[FT890_SUMO_DISPLAYED_STATUS_2]; stat_ptt = status_2 & SF_PTT_MASK; /* get PTT active bit */ rig_debug(RIG_DEBUG_TRACE, "%s: ptt status_2 = 0x%02x\n", __func__, status_2); switch (stat_ptt) { case SF_PTT_OFF: *ptt = RIG_PTT_OFF; break; case SF_PTT_ON: *ptt = RIG_PTT_ON; break; default: /* Oops! */ return -RIG_EINVAL; /* Invalid PTT bit?! */ } return RIG_OK; } /* * rig_set_split_vfo * * set the '890 into split TX/RX mode * * VFO cannot be set as the set split on command only changes the * TX to the other VFO. Setting split off returns the TX to the * main display. * */ static int ft890_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { unsigned char cmd_index; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed split = 0x%02x\n", __func__, split); switch(split) { case RIG_SPLIT_OFF: cmd_index = FT890_NATIVE_SPLIT_OFF; break; case RIG_SPLIT_ON: cmd_index = FT890_NATIVE_SPLIT_ON; break; default: return -RIG_EINVAL; } err = ft890_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_split_vfo * * Get whether the '890 is in split mode * * vfo value is not used * */ static int ft890_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { struct ft890_priv_data *priv; unsigned char status_0; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft890_priv_data *)rig->state.priv; /* Get flags for VFO split status */ err = ft890_get_update_data(rig, FT890_NATIVE_READ_FLAGS, FT890_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; /* get Split active bit */ status_0 = SF_SPLIT & priv->update_data[FT890_SUMO_DISPLAYED_STATUS_0]; rig_debug(RIG_DEBUG_TRACE, "%s: split status_0 = 0x%02x\n", __func__, status_0); switch (status_0) { case SF_SPLIT: *split = RIG_SPLIT_ON; break; default: *split = RIG_SPLIT_OFF; break; } return RIG_OK; } /* * rig_set_rit * * VFO and MEM rit values are independent. * * passed vfo value is respected. * * Clarifier offset is retained in the rig for either VFO when the * VFO is changed. Offset is not retained when in memory tune mode * and VFO mode is selected or another memory channel is selected. * */ static int ft890_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { struct ft890_priv_data *priv; // unsigned char offset; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; if (rit < -9990 || rit > 9990) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li\n", __func__, rit); priv = (struct ft890_priv_data *)rig->state.priv; /* * The assumption here is that the user hasn't changed * the VFO manually. Does it really need to be checked * every time? My goal is to reduce the traffic on the * serial line to a minimum, but respect the application's * request to change the VFO with this call. * */ if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous rig_get_vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } else if (vfo != priv->current_vfo) { ft890_set_vfo(rig, vfo); } /* * Shuts clarifier off but does not set frequency to 0 Hz */ if (rit == 0) { err = ft890_send_dynamic_cmd(rig, FT890_NATIVE_CLARIFIER_OPS, CLAR_RX_OFF, 0, 0, 0); return RIG_OK; } /* * Clarifier must first be turned on then the frequency can * be set, +9990 Hz to -9990 Hz */ err = ft890_send_dynamic_cmd(rig, FT890_NATIVE_CLARIFIER_OPS, CLAR_RX_ON, 0, 0, 0); if (err != RIG_OK) return err; err = ft890_send_rit_freq(rig, FT890_NATIVE_CLARIFIER_OPS, rit); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_rit * * Rig returns offset as hex from 0x0000 to 0x03e7 for 0 to +9.990 kHz * and 0xffff to 0xfc19 for -1 to -9.990 kHz * */ static int ft890_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { struct ft890_priv_data *priv; unsigned char *p; unsigned char offset; shortfreq_t f; int err, cmd_index, length; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft890_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_MEM: cmd_index = FT890_NATIVE_OP_DATA; offset = FT890_SUMO_DISPLAYED_CLAR; length = FT890_OP_DATA_LENGTH; break; case RIG_VFO_A: case RIG_VFO_VFO: cmd_index = FT890_NATIVE_VFO_DATA; offset = FT890_SUMO_VFO_A_CLAR; length = FT890_VFO_DATA_LENGTH; break; case RIG_VFO_B: cmd_index = FT890_NATIVE_VFO_DATA; offset = FT890_SUMO_VFO_B_CLAR; length = FT890_VFO_DATA_LENGTH; break; default: return -RIG_EINVAL; } rig_debug(RIG_DEBUG_TRACE, "%s: set cmd_index = %i\n", __func__, cmd_index); rig_debug(RIG_DEBUG_TRACE, "%s: set offset = 0x%02x\n", __func__, offset); err = ft890_get_update_data(rig, cmd_index, length); if (err != RIG_OK) return err; p = &priv->update_data[offset]; /* big endian integer */ f = (p[0]<<8) + p[1]; /* returned value is hex to nearest hundred Hz */ if (f > 0xfc18) /* 0xfc19 to 0xffff is negative offset */ f = ~(0xffff - f); rig_debug(RIG_DEBUG_TRACE, "%s: read freq = %li Hz\n", __func__, f * 10); *rit = f * 10; /* store clarifier frequency */ return RIG_OK; } /* * rig_set_func * * set the '890 supported functions * * vfo is ignored for tuner as it is an independent function * */ static int ft890_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { int err, cmd_index; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed func = 0x%02x\n", __func__, func); rig_debug(RIG_DEBUG_TRACE, "%s: passed status = %i\n", __func__, status); switch (func) { case RIG_FUNC_TUNER: switch (status) { case OFF: cmd_index = FT890_NATIVE_TUNER_OFF; break; case ON: cmd_index = FT890_NATIVE_TUNER_ON; break; default: return -RIG_EINVAL; } break; default: return -RIG_EINVAL; } err = ft890_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_level * * get the '890 meter level * * vfo is ignored for now * * Meter level returned from FT-890 is S meter when rig is in RX * Meter level returned is one of ALC or PO or SWR when rig is in TX * depending on front panel meter selection. Meter selection is NOT * available via CAT. * * TODO: Add support for TX values * */ static int ft890_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct ft890_priv_data *priv; unsigned char *p; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed level = 0x%02x\n", __func__, level); priv = (struct ft890_priv_data *)rig->state.priv; switch (level) { case RIG_LEVEL_STRENGTH: err = ft890_get_update_data(rig, FT890_NATIVE_READ_METER, FT890_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; p = &priv->update_data[FT890_SUMO_METER]; /* * My FT-890 returns a range of 0x00 to 0x44 for S0 to S9 and 0x44 to * 0x9d for S9 to S9 +60 * * For ease of calculation I rounded S9 up to 0x48 (72 decimal) and * S9 +60 up to 0xa0 (160 decimal). I calculated a divisor for readings * less than S9 by dividing 72 by 54 and the divisor for readings greater * than S9 by dividing 88 (160 - 72) by 60. The result tracks rather well. * * The greatest error is around S1 and S2 and then from S9 to S9 +35. Such * is life when mapping non-linear S-meters to a linear scale. * */ if (*p > 160) { val->i = 60; } else if (*p <= 72) { val->i = ((72 - *p) / 1.3333) * -1; } else { val->i = ((*p - 72) / 1.4667); } rig_debug(RIG_DEBUG_TRACE, "%s: calculated level = %i\n", __func__, val->i); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * rig_vfo_op * * VFO operations--tuner start, etc * * vfo is ignored for now * */ static int ft890_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { int err, cmd_index; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed op = 0x%02x\n", __func__, op); switch (op) { case RIG_OP_TUNE: cmd_index = FT890_NATIVE_TUNER_START; break; default: return -RIG_EINVAL; } err = ft890_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * ************************************ * * Private functions to ft890 backend * * ************************************ */ /* * Private helper function. Retrieves update data from rig. * using pacing value and buffer indicated in *priv struct. * Extended to be command agnostic as 890 has several ways to * get data and several ways to return it. * * Need to use this when doing ft890_get_* stuff * * Arguments: *rig Valid RIG instance * ci command index * rl expected length of returned data in octets * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft890_get_update_data(RIG *rig, unsigned char ci, unsigned char rl) { struct rig_state *rig_s; struct ft890_priv_data *priv; int n, err; /* for read_ */ rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft890_priv_data *)rig->state.priv; rig_s = &rig->state; err = ft890_send_static_cmd(rig, ci); if (err != RIG_OK) return err; n = read_block(&rig_s->rigport, (char *) priv->update_data, rl); if (n < 0) return n; /* die returning read_block error */ rig_debug(RIG_DEBUG_TRACE, "%s: read %i bytes\n", __func__, n); return RIG_OK; } /* * Private helper function to send a complete command sequence. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft890_send_static_cmd(RIG *rig, unsigned char ci) { struct rig_state *rig_s; struct ft890_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft890_priv_data *)rig->state.priv; rig_s = &rig->state; if (!priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to send incomplete sequence\n", __func__); return -RIG_EINVAL; } err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } /* * Private helper function to build and then send a complete command * sequence. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * p1-p4 Command parameters * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft890_send_dynamic_cmd(RIG *rig, unsigned char ci, unsigned char p1, unsigned char p2, unsigned char p3, unsigned char p4) { struct rig_state *rig_s; struct ft890_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n", __func__, p1, p2, p3, p4); priv = (struct ft890_priv_data *)rig->state.priv; if (priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n", __func__); return -RIG_EINVAL; } rig_s = &rig->state; memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); priv->p_cmd[P1] = p1; /* ick */ priv->p_cmd[P2] = p2; priv->p_cmd[P3] = p3; priv->p_cmd[P4] = p4; err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } /* * Private helper function to build and send a complete command to * change the display frequency. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * freq freq_t frequency value * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft890_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq) { struct rig_state *rig_s; struct ft890_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq); priv = (struct ft890_priv_data *)rig->state.priv; if (priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n", __func__); return -RIG_EINVAL; } rig_s = &rig->state; /* Copy native cmd freq_set to private cmd storage area */ memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); /* store bcd format in in p_cmd */ to_bcd(priv->p_cmd, freq/10, FT890_BCD_DIAL); rig_debug(RIG_DEBUG_TRACE, "%s: requested freq after conversion = %"PRIll" Hz\n", __func__, from_bcd(priv->p_cmd, FT890_BCD_DIAL)* 10); err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } /* * Private helper function to build and send a complete command to * change the RIT frequency. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * rit shortfreq_t frequency value * p1 P1 value -- CLAR_SET_FREQ * p2 P2 value -- CLAR_OFFSET_PLUS || CLAR_OFFSET_MINUS * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion * * Assumes: rit doesn't exceed tuning limits of rig */ static int ft890_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit) { struct rig_state *rig_s; struct ft890_priv_data *priv; unsigned char p1; unsigned char p2; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit); priv = (struct ft890_priv_data *)rig->state.priv; if (priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n", __func__); return -RIG_EINVAL; } rig_s = &rig->state; p1 = CLAR_SET_FREQ; if (rit < 0) { rit = labs(rit); /* get absolute value of rit */ p2 = CLAR_OFFSET_MINUS; } else { p2 = CLAR_OFFSET_PLUS; } /* Copy native cmd clarifier ops to private cmd storage area */ memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); /* store bcd format in in p_cmd */ to_bcd(priv->p_cmd, rit/10, FT890_BCD_RIT); rig_debug(RIG_DEBUG_TRACE, "%s: requested rit after conversion = %li Hz\n", __func__, from_bcd(priv->p_cmd, FT890_BCD_RIT)* 10); priv->p_cmd[P1] = p1; /* ick */ priv->p_cmd[P2] = p2; err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } hamlib-1.2.15.3/yaesu/ft1000d.c0000644000175000017500000002062012044564477012503 00000000000000/* * hamlib - (C) Stephane Fillod 2002-2009 (fillods at users.sourceforge.net) * * ft1000d.c - (C) Berndt Josef Wulf (wulf at ping.net.au) * * This shared library provides an API for communicating * via serial interface to an FT-1000D using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "bandplan.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "ft990.h" /* Receiver caps */ #define FT1000D_ALL_RX_MODES (RIG_MODE_LSB|RIG_MODE_USB|RIG_MODE_CW|RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_RTTY|RIG_MODE_RTTYR) #define FT1000D_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB) #define FT1000D_RTTY_RX_MODES (RIG_MODE_RTTY|RIG_MODE_RTTYR) #define FT1000D_AM_RX_MODES (RIG_MODE_AM) #define FT1000D_FM_RX_MODES (RIG_MODE_FM) /* TX caps */ #define FT1000D_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_FM) /* 100 W class */ #define FT1000D_AM_TX_MODES (RIG_MODE_AM ) /* set 25W max */ /* Other features */ #define FT1000D_VFO_ALL (RIG_VFO_A|RIG_VFO_B) #define FT1000D_ANTS 0 /* Timing values in mS */ #define FT1000D_WRITE_DELAY 50 /* Delay sequential fast writes */ #define FT1000D_POST_WRITE_DELAY 5 #define FT1000D_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .rit = 1, \ .xit = 1, \ .rptr_shift = 1, \ .flags = 1, \ } /* * FT1000D rigs capabilities. * * Right now, this backend is a clone of the FT990 backend. * * If someone with an FT1000D can test and confirm hamlib working using the * existing FT990 support (-m 116) we perhaps could add support for this rig. * According to the documentation at hand, the protocol for the FT1000D is, * with the exception of dual VFO operation, identical to the FT990. * * Essentially the differences are: * - additional commands concerning dual band operation * - additional 8 channels in update packet giving a total of 1636 bytes * - flags byte 1 bit 1 - dual receive operation instead of VFO B in use * - flags byte 1 bit 2 - Antenna now tuning instead of fast tuning rate * - flags byte 1 bit 4 - VFO B in use (RX or TX) instead of antenna tuning * - flags byte 3 bit 7 - Sub VFO tuning know locked instead of sidetone active */ const struct rig_caps ft1000d_caps = { .rig_model = RIG_MODEL_FT1000D, .model_name = "FT-1000D", .mfg_name = "Yaesu", .version = "0.0.6", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT1000D_WRITE_DELAY, .post_write_delay = FT1000D_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = RIG_FUNC_LOCK | RIG_FUNC_TUNER | RIG_FUNC_MON, .has_set_func = RIG_FUNC_LOCK | RIG_FUNC_TUNER, .has_get_level = RIG_LEVEL_STRENGTH | RIG_LEVEL_SWR | RIG_LEVEL_ALC | \ RIG_LEVEL_ALC | RIG_LEVEL_RFPOWER, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_BACKLIGHT, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(1200), .vfo_ops = RIG_OP_CPY | RIG_OP_FROM_VFO | RIG_OP_TO_VFO | RIG_OP_UP | RIG_OP_DOWN | RIG_OP_TUNE | RIG_OP_TOGGLE, .targetable_vfo = RIG_TARGETABLE_ALL, .transceive = RIG_TRN_OFF, /* Yaesus have to be polled, sigh */ .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { {1, 99, RIG_MTYPE_MEM, FT1000D_MEM_CAP}, RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100), MHz(30), FT1000D_ALL_RX_MODES, -1, -1, FT1000D_VFO_ALL, FT1000D_ANTS}, /* General coverage + ham */ RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1, FT1000D_OTHER_TX_MODES, W(5), W(100), FT1000D_VFO_ALL, FT1000D_ANTS), FRQ_RNG_HF(1, FT1000D_AM_TX_MODES, W(2), W(25), FT1000D_VFO_ALL, FT1000D_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100), MHz(30), FT1000D_ALL_RX_MODES, -1, -1, FT1000D_VFO_ALL, FT1000D_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2, FT1000D_OTHER_TX_MODES, W(5), W(100), FT1000D_VFO_ALL, FT1000D_ANTS), FRQ_RNG_HF(2, FT1000D_AM_TX_MODES, W(2), W(25), FT1000D_VFO_ALL, FT1000D_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {FT1000D_SSB_CW_RX_MODES, Hz(10)}, /* Normal */ {FT1000D_SSB_CW_RX_MODES, Hz(100)}, /* Fast */ {FT1000D_AM_RX_MODES, Hz(100)}, /* Normal */ {FT1000D_AM_RX_MODES, kHz(1)}, /* Fast */ {FT1000D_FM_RX_MODES, Hz(100)}, /* Normal */ {FT1000D_FM_RX_MODES, kHz(1)}, /* Fast */ {FT1000D_RTTY_RX_MODES, Hz(10)}, /* Normal */ {FT1000D_RTTY_RX_MODES, Hz(100)}, /* Fast */ RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_SSB, RIG_FLT_ANY}, /* Enable all filters for SSB */ {RIG_MODE_CW, RIG_FLT_ANY}, /* Enable all filters for CW */ {RIG_MODE_AM, kHz(6)}, /* normal AM filter */ {RIG_MODE_AM, kHz(2.4)}, /* AM filter with narrow selection (SSB filter switched in) */ {RIG_MODE_FM, kHz(8)}, /* FM standard filter */ {RIG_MODE_RTTY, RIG_FLT_ANY}, /* Enable all filters for RTTY */ {RIG_MODE_RTTYR,RIG_FLT_ANY}, /* Enable all filters for Reverse RTTY */ {RIG_MODE_PKTLSB,RIG_FLT_ANY}, /* Enable all filters for Packet Radio LSB */ {RIG_MODE_PKTFM,kHz(8)}, /* FM standard filter for Packet Radio FM */ RIG_FLT_END, }, .priv = NULL, /* private data FIXME: */ .rig_init = ft990_init, .rig_cleanup = ft990_cleanup, .rig_open = ft990_open, /* port opened */ .rig_close = ft990_close, /* port closed */ .set_freq = ft990_set_freq, .get_freq = ft990_get_freq, .set_mode = ft990_set_mode, .get_mode = ft990_get_mode, .set_vfo = ft990_set_vfo, .get_vfo = ft990_get_vfo, .set_ptt = ft990_set_ptt, .get_ptt = ft990_get_ptt, .set_rptr_shift = ft990_set_rptr_shift, .get_rptr_shift = ft990_get_rptr_shift, .set_rptr_offs = ft990_set_rptr_offs, .set_split_vfo = ft990_set_split_vfo, .get_split_vfo = ft990_get_split_vfo, .set_rit = ft990_set_rit, .get_rit = ft990_get_rit, .set_xit = ft990_set_xit, .get_xit = ft990_get_xit, .set_func = ft990_set_func, .get_func = ft990_get_func, .set_parm = ft990_set_parm, .get_level = ft990_get_level, .set_mem = ft990_set_mem, .get_mem = ft990_get_mem, .vfo_op = ft990_vfo_op, .set_channel = ft990_set_channel, .get_channel = ft990_get_channel, }; hamlib-1.2.15.3/yaesu/ft900.c0000644000175000017500000012414612044564477012277 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft900.c - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * (C) Stephane Fillod 2002-2005 (fillods at users.sourceforge.net) * (C) Nate Bargmann 2002, 2003 (n0nb at arrl.net) * * This shared library provides an API for communicating * via serial interface to an FT-900 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "bandplan.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "ft900.h" /* * Functions considered to be Beta code (2003-04-11): * set_freq * get_freq * set_mode * get_mode * set_vfo * get_vfo * set_ptt * get_ptt * set_split * get_split * set_rit * get_rit * set_func * get_func * get_level * * Functions considered to be Alpha code (2003-04-11): * vfo_op * * functions not yet implemented (2003-04-11): * set_split_freq * get_split_freq * set_split_mode * get_split_mode * */ /* Private helper function prototypes */ static int ft900_get_update_data(RIG *rig, unsigned char ci, unsigned char rl); static int ft900_send_static_cmd(RIG *rig, unsigned char ci); static int ft900_send_dynamic_cmd(RIG *rig, unsigned char ci, unsigned char p1, unsigned char p2, unsigned char p3, unsigned char p4); static int ft900_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq); static int ft900_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit); /* * Native ft900 cmd set prototypes. These are READ ONLY as each * rig instance will copy from these and modify if required. * Complete sequences (1) can be read and used directly as a cmd sequence. * Incomplete sequences (0) must be completed with extra parameters * eg: mem number, or freq etc.. * * TODO: Shorten this static array with parameter substitution -N0NB * */ static const yaesu_cmd_set_t ncmd[] = { { 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* split = off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* split = on */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* recall memory */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* memory operations */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* select vfo A */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* select vfo B */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x06 } }, /* copy memory data to vfo A */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, /* clarifier operations */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* set display freq */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* mode set */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0e } }, /* update interval/pacing */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0f } }, /* PTT off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0f } }, /* PTT on */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x10 } }, /* Status Update Data--Memory Channel Number (1 byte) */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x10 } }, /* Status Update Data--Current operating data for VFO/Memory (19 bytes) */ { 1, { 0x00, 0x00, 0x00, 0x03, 0x10 } }, /* Status Update DATA--VFO A and B Data (18 bytes) */ { 0, { 0x00, 0x00, 0x00, 0x04, 0x10 } }, /* Status Update Data--Memory Channel Data (19 bytes) P4 = 0x01-0x20 Memory Channel Number */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x81 } }, /* tuner off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x81 } }, /* tuner on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x82 } }, /* tuner start*/ { 1, { 0x00, 0x00, 0x00, 0x00, 0xf7 } }, /* Read meter, S on RX, ALC|PO|SWR on TX */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xfa } }, /* Read status flags */ }; /* * future - private data * * FIXME: Does this need to be exposed to the application/frontend through * ft900_caps.priv? -N0NB */ struct ft900_priv_data { unsigned char pacing; /* pacing value */ unsigned int read_update_delay; /* depends on pacing value */ vfo_t current_vfo; /* active VFO from last cmd */ unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */ yaesu_cmd_set_t pcs[FT900_NATIVE_SIZE]; /* private cmd set */ unsigned char update_data[FT900_ALL_DATA_LENGTH]; /* returned data--max value, some are less */ unsigned char current_mem; /* private memory channel number */ }; /* * ft900 rigs capabilities. * Also this struct is READONLY! * */ const struct rig_caps ft900_caps = { .rig_model = RIG_MODEL_FT900, .model_name = "FT-900", .mfg_name = "Yaesu", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT900_WRITE_DELAY, .post_write_delay = FT900_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = RIG_FUNC_TUNER, .has_set_func = RIG_FUNC_TUNER, .has_get_level = RIG_LEVEL_STRENGTH, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(0), .max_ifshift = Hz(0), .vfo_ops = RIG_OP_TUNE, .targetable_vfo = RIG_TARGETABLE_ALL, .transceive = RIG_TRN_OFF, /* Yaesus have to be polled, sigh */ .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, /* FIXME: memory channel list: 32 */ .rx_range_list1 = { {kHz(100), MHz(30), FT900_ALL_RX_MODES, -1, -1, FT900_VFO_ALL, FT900_ANTS}, /* General coverage + ham */ RIG_FRNG_END, }, /* FIXME: Are these the correct Region 1 values? */ .tx_range_list1 = { FRQ_RNG_HF(1, FT900_OTHER_TX_MODES, W(5), W(100), FT900_VFO_ALL, FT900_ANTS), FRQ_RNG_HF(1, FT900_AM_TX_MODES, W(2), W(25), FT900_VFO_ALL, FT900_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100), MHz(30), FT900_ALL_RX_MODES, -1, -1, FT900_VFO_ALL, FT900_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2, FT900_OTHER_TX_MODES, W(5), W(100), FT900_VFO_ALL, FT900_ANTS), FRQ_RNG_HF(2, FT900_AM_TX_MODES, W(2), W(25), FT900_VFO_ALL, FT900_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {FT900_SSB_CW_RX_MODES, Hz(10)}, /* Normal */ {FT900_SSB_CW_RX_MODES, Hz(100)}, /* Fast */ {FT900_AM_RX_MODES, Hz(100)}, /* Normal */ {FT900_AM_RX_MODES, kHz(1)}, /* Fast */ {FT900_FM_RX_MODES, Hz(100)}, /* Normal */ {FT900_FM_RX_MODES, kHz(1)}, /* Fast */ RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_SSB, kHz(2.2)}, /* standard SSB filter bandwidth */ {RIG_MODE_CW, kHz(2.2)}, /* normal CW filter */ {RIG_MODE_CW, kHz(0.5)}, /* CW filter with narrow selection (must be installed!) */ {RIG_MODE_AM, kHz(6)}, /* normal AM filter */ {RIG_MODE_AM, kHz(2.2)}, /* AM filter with narrow selection (SSB filter switched in) */ {RIG_MODE_FM, kHz(12)}, /* FM */ RIG_FLT_END, }, .priv = NULL, /* private data FIXME: */ .rig_init = ft900_init, .rig_cleanup = ft900_cleanup, .rig_open = ft900_open, /* port opened */ .rig_close = ft900_close, /* port closed */ .set_freq = ft900_set_freq, .get_freq = ft900_get_freq, .set_mode = ft900_set_mode, .get_mode = ft900_get_mode, .set_vfo = ft900_set_vfo, .get_vfo = ft900_get_vfo, .set_ptt = ft900_set_ptt, .get_ptt = ft900_get_ptt, .set_split_vfo = ft900_set_split_vfo, .get_split_vfo = ft900_get_split_vfo, .set_rit = ft900_set_rit, .get_rit = ft900_get_rit, .set_func = ft900_set_func, .get_level = ft900_get_level, .vfo_op = ft900_vfo_op, }; /* * ************************************ * * Hamlib API functions * * ************************************ */ /* * rig_init * */ static int ft900_init(RIG *rig) { struct ft900_priv_data *priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft900_priv_data *)malloc(sizeof(struct ft900_priv_data)); if (!priv) /* whoops! memory shortage! */ return -RIG_ENOMEM; /* * Copy native cmd set to private cmd storage area */ memcpy(priv->pcs, ncmd, sizeof(ncmd)); /* TODO: read pacing from preferences */ priv->pacing = FT900_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */ priv->read_update_delay = FT900_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */ priv->current_vfo = RIG_VFO_MAIN; /* default to whatever */ rig->state.priv = (void *)priv; return RIG_OK; } /* * rig_cleanup * * the serial port is closed by the frontend * */ static int ft900_cleanup(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * rig_open * */ static int ft900_open(RIG *rig) { struct rig_state *rig_s; struct ft900_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft900_priv_data *)rig->state.priv; rig_s = &rig->state; rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n", __func__, rig_s->rigport.write_delay); rig_debug(RIG_DEBUG_TRACE, "%s: post_write_delay = %i msec\n", __func__, rig_s->rigport.post_write_delay); rig_debug(RIG_DEBUG_TRACE, "%s: read pacing = %i\n", __func__, priv->pacing); err = ft900_send_dynamic_cmd(rig, FT900_NATIVE_PACING, priv->pacing, 0, 0, 0); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_close * */ static int ft900_close(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; return RIG_OK; } /* * rig_set_freq * * Set frequency for a given VFO * * If vfo is set to RIG_VFO_CUR then vfo from priv_data is used. * If vfo differs from stored value then VFO will be set to the * passed vfo. * */ static int ft900_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct ft900_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft900_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq); if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } else if (vfo != priv->current_vfo) { /* force a VFO change if requested vfo value differs from stored value */ err = ft900_set_vfo(rig, vfo); if (err != RIG_OK) return err; } err = ft900_send_dial_freq(rig, FT900_NATIVE_FREQ_SET, freq); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_freq * * Return Freq for a given VFO * */ static int ft900_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft900_priv_data *priv; unsigned char *p; unsigned char offset; freq_t f; int err, cmd_index, count; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); if (!rig) return -RIG_EINVAL; priv = (struct ft900_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { err = ft900_get_vfo(rig, &priv->current_vfo); if (err != RIG_OK) return err; vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: cmd_index = FT900_NATIVE_VFO_DATA; offset = FT900_SUMO_VFO_A_FREQ; count = FT900_VFO_DATA_LENGTH; break; case RIG_VFO_B: cmd_index = FT900_NATIVE_VFO_DATA; offset = FT900_SUMO_VFO_B_FREQ; count = FT900_VFO_DATA_LENGTH; break; case RIG_VFO_MEM: case RIG_VFO_MAIN: cmd_index = FT900_NATIVE_OP_DATA; offset = FT900_SUMO_DISPLAYED_FREQ; count = FT900_OP_DATA_LENGTH; break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } err = ft900_get_update_data(rig, cmd_index, count); if (err != RIG_OK) return err; p = &priv->update_data[offset]; /* big endian integer */ f = ((((p[0]<<8) + p[1])<<8) + p[2]) * 10; rig_debug(RIG_DEBUG_TRACE, "%s: freq = %"PRIfreq" Hz for vfo 0x%02x\n", __func__, f, vfo); *freq = f; /* return displayed frequency */ return RIG_OK; } /* * rig_set_mode * * set mode and passband: eg AM, CW etc for a given VFO * * If vfo is set to RIG_VFO_CUR then vfo from priv_data is used. * */ static int ft900_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) { struct ft900_priv_data *priv; unsigned char mode_parm; /* mode parameter */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed mode = %i\n", __func__, mode); rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %li Hz\n", __func__, width); priv = (struct ft900_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } /* translate mode from generic to ft900 specific */ switch(vfo) { case RIG_VFO_A: /* force to VFO */ case RIG_VFO_VFO: err = ft900_set_vfo(rig, RIG_VFO_A); if (err != RIG_OK) return err; break; case RIG_VFO_B: err = ft900_set_vfo(rig, RIG_VFO_B); if (err != RIG_OK) return err; break; case RIG_VFO_MEM: /* MEM TUNE or user doesn't care */ case RIG_VFO_MAIN: break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } switch(mode) { case RIG_MODE_AM: mode_parm = MODE_SET_AM_W; break; case RIG_MODE_CW: mode_parm = MODE_SET_CW_W; break; case RIG_MODE_USB: mode_parm = MODE_SET_USB; break; case RIG_MODE_LSB: mode_parm = MODE_SET_LSB; break; case RIG_MODE_FM: mode_parm = MODE_SET_FM; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } /* * Now set width (shamelessly stolen from ft847.c and then butchered :) * The FT-900 only supports narrow width in AM and CW modes * */ if (width == rig_passband_narrow(rig, mode)) { switch(mode) { case RIG_MODE_CW: mode_parm = MODE_SET_CW_N; break; case RIG_MODE_AM: mode_parm = MODE_SET_AM_N; break; default: return -RIG_EINVAL; /* Invalid mode, how can caller know? */ } } else { if (width != RIG_PASSBAND_NORMAL && width != rig_passband_normal(rig, mode)) { return -RIG_EINVAL; /* Invalid width, how can caller know? */ } } rig_debug(RIG_DEBUG_TRACE, "%s: set mode_parm = 0x%02x\n", __func__, mode_parm); err = ft900_send_dynamic_cmd(rig, FT900_NATIVE_MODE_SET, mode_parm, 0, 0, 0); if (err != RIG_OK) return err; return RIG_OK; /* good */ } /* * rig_get_mode * * get mode eg AM, CW etc for a given VFO * */ static int ft900_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct ft900_priv_data *priv; unsigned char my_mode, m_offset; /* ft900 mode, mode offset */ unsigned char flag, f_offset; /* CW/AM narrow flag */ int err, cmd_index, norm, count; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft900_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: cmd_index = FT900_NATIVE_VFO_DATA; m_offset = FT900_SUMO_VFO_A_MODE; f_offset = FT900_SUMO_VFO_A_FLAG; count = FT900_VFO_DATA_LENGTH; break; case RIG_VFO_B: cmd_index = FT900_NATIVE_VFO_DATA; m_offset = FT900_SUMO_VFO_B_MODE; f_offset = FT900_SUMO_VFO_B_FLAG; count = FT900_VFO_DATA_LENGTH; break; case RIG_VFO_MEM: case RIG_VFO_MAIN: cmd_index = FT900_NATIVE_OP_DATA; m_offset = FT900_SUMO_DISPLAYED_MODE; f_offset = FT900_SUMO_DISPLAYED_FLAG; count = FT900_OP_DATA_LENGTH; break; default: return -RIG_EINVAL; } err = ft900_get_update_data(rig, cmd_index, count); if (err != RIG_OK) return err; my_mode = MODE_MASK & priv->update_data[m_offset]; flag = FLAG_MASK & priv->update_data[f_offset]; rig_debug(RIG_DEBUG_TRACE, "%s: mode = 0x%02x\n", __func__, mode); rig_debug(RIG_DEBUG_TRACE, "%s: flag = 0x%02x\n", __func__, flag); /* * translate mode from ft900 to generic. */ switch(my_mode) { case MODE_LSB: *mode = RIG_MODE_LSB; norm = TRUE; break; case MODE_USB: *mode = RIG_MODE_USB; norm = TRUE; break; case MODE_CW: *mode = RIG_MODE_CW; if (flag & FLAG_CW_N) { norm = FALSE; } else { norm = TRUE; } break; case MODE_AM: *mode = RIG_MODE_AM; if (flag & FLAG_AM_N) { norm = FALSE; } else { norm = TRUE; } break; case MODE_FM: *mode = RIG_MODE_FM; norm = TRUE; break; default: return -RIG_EINVAL; /* Oops! file bug report */ } if (norm) { *width = rig_passband_normal(rig, *mode); } else { *width = rig_passband_narrow(rig, *mode); } rig_debug(RIG_DEBUG_TRACE, "%s: set mode = %i\n", __func__, *mode); rig_debug(RIG_DEBUG_TRACE, "%s: set width = %li Hz\n", __func__, *width); return RIG_OK; } /* * rig_set_vfo * * set vfo and store requested vfo for later RIG_VFO_CURR * requests. * */ static int ft900_set_vfo(RIG *rig, vfo_t vfo) { struct ft900_priv_data *priv; unsigned char cmd_index; /* index of sequence to send */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft900_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } /* FIXME: Include support for RIG_VFO_MAIN */ switch(vfo) { case RIG_VFO_A: cmd_index = FT900_NATIVE_VFO_A; priv->current_vfo = vfo; /* update active VFO */ break; case RIG_VFO_B: cmd_index = FT900_NATIVE_VFO_B; priv->current_vfo = vfo; break; case RIG_VFO_MEM: /* reset to memory channel stored by previous get_vfo * The recall mem channel command uses 0x01 though 0x20 */ err = ft900_send_dynamic_cmd(rig, FT900_NATIVE_RECALL_MEM, (priv->current_mem + 1), 0, 0, 0); if (err != RIG_OK) return err; priv->current_vfo = vfo; rig_debug(RIG_DEBUG_TRACE, "%s: set mem channel = 0x%02x\n", __func__, priv->current_mem); return RIG_OK; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } rig_debug(RIG_DEBUG_TRACE, "%s: set cmd_index = %i\n", __func__, cmd_index); err = ft900_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_vfo * * get current RX vfo/mem and store requested vfo for * later RIG_VFO_CURR requests plus pass the tested vfo/mem * back to the frontend. * */ static int ft900_get_vfo(RIG *rig, vfo_t *vfo) { struct ft900_priv_data *priv; unsigned char status_0; /* ft900 status flag 0 */ unsigned char stat_vfo, stat_mem; /* status tests */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft900_priv_data *)rig->state.priv; /* Get flags for VFO status */ err = ft900_get_update_data(rig, FT900_NATIVE_READ_FLAGS, FT900_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; status_0 = priv->update_data[FT900_SUMO_DISPLAYED_STATUS_0]; stat_vfo = status_0 & SF_VFO_MASK; /* get VFO active bits */ stat_mem = status_0 & SF_MEM_MASK; /* get MEM active bits */ rig_debug(RIG_DEBUG_TRACE, "%s: vfo status_0 = 0x%02x\n", __func__, status_0); rig_debug(RIG_DEBUG_TRACE, "%s: stat_vfo = 0x%02x\n", __func__, stat_vfo); rig_debug(RIG_DEBUG_TRACE, "%s: stat_mem = 0x%02x\n", __func__, stat_mem); /* * translate vfo and mem status from ft900 to generic. * * First a test is made on bits 6 and 7 of status_0. Bit 7 is set * when FT-900 is in VFO mode on display. Bit 6 is set when VFO B * is active and cleared when VFO A is active. * * Conversely, bit 7 is cleared when MEM or MEM TUNE mode is selected * Bit 6 still follows last selected VFO (A or B), but this is not * tested right now. */ switch (stat_vfo) { case SF_VFOA: *vfo = RIG_VFO_A; priv->current_vfo = RIG_VFO_A; break; case SF_VFOB: *vfo = RIG_VFO_B; priv->current_vfo = RIG_VFO_B; break; default: switch (stat_mem) { case SF_MT: case SF_MR: *vfo = RIG_VFO_MEM; priv->current_vfo = RIG_VFO_MEM; /* * Per Hamlib policy capture and store memory channel number * for future set_vfo command. */ err = ft900_get_update_data(rig, FT900_NATIVE_MEM_CHNL, FT900_MEM_CHNL_LENGTH); if (err != RIG_OK) return err; priv->current_mem = priv->update_data[FT900_SUMO_MEM_CHANNEL]; rig_debug(RIG_DEBUG_TRACE, "%s: stored mem channel = 0x%02x\n", __func__, priv->current_mem); break; default: /* Oops! */ return -RIG_EINVAL; /* sorry, wrong current VFO */ } } rig_debug(RIG_DEBUG_TRACE, "%s: set vfo = 0x%02x\n", __func__, *vfo); return RIG_OK; } /* * rig_set_ptt * * set the '900 into TX mode * * vfo is respected by calling ft900_set_vfo if * passed vfo != priv->current_vfo * */ static int ft900_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { struct ft900_priv_data *priv; unsigned char cmd_index; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft900_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt); if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } else if (vfo != priv->current_vfo) { ft900_set_vfo(rig, vfo); } switch (ptt) { case RIG_PTT_OFF: cmd_index = FT900_NATIVE_PTT_OFF; break; case RIG_PTT_ON: cmd_index = FT900_NATIVE_PTT_ON; break; default: return -RIG_EINVAL; /* wrong PTT state! */ } err = ft900_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_ptt * * get current PTT status * */ static int ft900_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct ft900_priv_data *priv; unsigned char status_2; /* ft900 status flag 2 */ unsigned char stat_ptt; /* status tests */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft900_priv_data *)rig->state.priv; /* Get flags for VFO status */ err = ft900_get_update_data(rig, FT900_NATIVE_READ_FLAGS, FT900_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; status_2 = priv->update_data[FT900_SUMO_DISPLAYED_STATUS_2]; stat_ptt = status_2 & SF_PTT_MASK; /* get PTT active bit */ rig_debug(RIG_DEBUG_TRACE, "%s: ptt status_2 = 0x%02x\n", __func__, status_2); switch (stat_ptt) { case SF_PTT_OFF: *ptt = RIG_PTT_OFF; break; case SF_PTT_ON: *ptt = RIG_PTT_ON; break; default: /* Oops! */ return -RIG_EINVAL; /* Invalid PTT bit?! */ } return RIG_OK; } /* * rig_set_split_vfo * * set the '900 into split TX/RX mode * * VFO cannot be set as the set split on command only changes the * TX to the other VFO. Setting split off returns the TX to the * main display. * */ static int ft900_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { unsigned char cmd_index; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed split = 0x%02x\n", __func__, split); switch(split) { case RIG_SPLIT_OFF: cmd_index = FT900_NATIVE_SPLIT_OFF; break; case RIG_SPLIT_ON: cmd_index = FT900_NATIVE_SPLIT_ON; break; default: return -RIG_EINVAL; } err = ft900_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_split_vfo * * Get whether the '900 is in split mode * * vfo value is not used * */ static int ft900_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { struct ft900_priv_data *priv; unsigned char status_0; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft900_priv_data *)rig->state.priv; /* Get flags for VFO split status */ err = ft900_get_update_data(rig, FT900_NATIVE_READ_FLAGS, FT900_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; /* get Split active bit */ status_0 = SF_SPLIT & priv->update_data[FT900_SUMO_DISPLAYED_STATUS_0]; rig_debug(RIG_DEBUG_TRACE, "%s: split status_0 = 0x%02x\n", __func__, status_0); switch (status_0) { case SF_SPLIT: *split = RIG_SPLIT_ON; break; default: *split = RIG_SPLIT_OFF; break; } return RIG_OK; } /* * rig_set_rit * * VFO and MEM rit values are independent. * * passed vfo value is respected. * * Clarifier offset is retained in the rig for either VFO when the * VFO is changed. Offset is not retained when in memory tune mode * and VFO mode is selected or another memory channel is selected. * */ static int ft900_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { struct ft900_priv_data *priv; // unsigned char offset; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; if (rit < -9990 || rit > 9990) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li\n", __func__, rit); priv = (struct ft900_priv_data *)rig->state.priv; /* * The assumption here is that the user hasn't changed * the VFO manually. Does it really need to be checked * every time? My goal is to reduce the traffic on the * serial line to a minimum, but respect the application's * request to change the VFO with this call. * */ if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous rig_get_vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } else if (vfo != priv->current_vfo) { ft900_set_vfo(rig, vfo); } /* * Shuts clarifier off but does not set frequency to 0 Hz */ if (rit == 0) { err = ft900_send_dynamic_cmd(rig, FT900_NATIVE_CLARIFIER_OPS, CLAR_RX_OFF, 0, 0, 0); return RIG_OK; } /* * Clarifier must first be turned on then the frequency can * be set, +9990 Hz to -9990 Hz */ err = ft900_send_dynamic_cmd(rig, FT900_NATIVE_CLARIFIER_OPS, CLAR_RX_ON, 0, 0, 0); if (err != RIG_OK) return err; err = ft900_send_rit_freq(rig, FT900_NATIVE_CLARIFIER_OPS, rit); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_rit * * Rig returns offset as hex from 0x0000 to 0x03e7 for 0 to +9.990 kHz * and 0xffff to 0xfc19 for -1 to -9.990 kHz * */ static int ft900_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { struct ft900_priv_data *priv; unsigned char *p; unsigned char offset; shortfreq_t f; int err, cmd_index, length; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft900_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_MEM: cmd_index = FT900_NATIVE_OP_DATA; offset = FT900_SUMO_DISPLAYED_CLAR; length = FT900_OP_DATA_LENGTH; break; case RIG_VFO_A: case RIG_VFO_VFO: cmd_index = FT900_NATIVE_VFO_DATA; offset = FT900_SUMO_VFO_A_CLAR; length = FT900_VFO_DATA_LENGTH; break; case RIG_VFO_B: cmd_index = FT900_NATIVE_VFO_DATA; offset = FT900_SUMO_VFO_B_CLAR; length = FT900_VFO_DATA_LENGTH; break; default: return -RIG_EINVAL; } rig_debug(RIG_DEBUG_TRACE, "%s: set cmd_index = %i\n", __func__, cmd_index); rig_debug(RIG_DEBUG_TRACE, "%s: set offset = 0x%02x\n", __func__, offset); err = ft900_get_update_data(rig, cmd_index, length); if (err != RIG_OK) return err; p = &priv->update_data[offset]; /* big endian integer */ f = (p[0]<<8) + p[1]; /* returned value is hex to nearest hundred Hz */ if (f > 0xfc18) /* 0xfc19 to 0xffff is negative offset */ f = ~(0xffff - f); rig_debug(RIG_DEBUG_TRACE, "%s: read freq = %li Hz\n", __func__, f * 10); *rit = f * 10; /* store clarifier frequency */ return RIG_OK; } /* * rig_set_func * * set the '900 supported functions * * vfo is ignored for tuner as it is an independent function * */ static int ft900_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { int err, cmd_index; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed func = 0x%02x\n", __func__, func); rig_debug(RIG_DEBUG_TRACE, "%s: passed status = %i\n", __func__, status); switch (func) { case RIG_FUNC_TUNER: switch (status) { case OFF: cmd_index = FT900_NATIVE_TUNER_OFF; break; case ON: cmd_index = FT900_NATIVE_TUNER_ON; break; default: return -RIG_EINVAL; } break; default: return -RIG_EINVAL; } err = ft900_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_level * * get the '900 meter level * * vfo is ignored for now * * Meter level returned from FT-900 is S meter when rig is in RX * Meter level returned is one of ALC or PO or SWR when rig is in TX * depending on front panel meter selection. Meter selection is NOT * available via CAT. * * TODO: Add support for TX values * */ static int ft900_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct ft900_priv_data *priv; unsigned char *p; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed level = 0x%02x\n", __func__, level); priv = (struct ft900_priv_data *)rig->state.priv; switch (level) { case RIG_LEVEL_STRENGTH: err = ft900_get_update_data(rig, FT900_NATIVE_READ_METER, FT900_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; p = &priv->update_data[FT900_SUMO_METER]; /* * My FT-900 returns a range of 0x00 to 0x44 for S0 to S9 and 0x44 to * 0x9d for S9 to S9 +60 * * For ease of calculation I rounded S9 up to 0x48 (72 decimal) and * S9 +60 up to 0xa0 (160 decimal). I calculated a divisor for readings * less than S9 by dividing 72 by 54 and the divisor for readings greater * than S9 by dividing 88 (160 - 72) by 60. The result tracks rather well. * * The greatest error is around S1 and S2 and then from S9 to S9 +35. Such * is life when mapping non-linear S-meters to a linear scale. * */ if (*p > 160) { val->i = 60; } else if (*p <= 72) { val->i = ((72 - *p) / 1.3333) * -1; } else { val->i = ((*p - 72) / 1.4667); } rig_debug(RIG_DEBUG_TRACE, "%s: calculated level = %i\n", __func__, val->i); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * rig_vfo_op * * VFO operations--tuner start, etc * * vfo is ignored for now * */ static int ft900_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { int err, cmd_index; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed op = 0x%02x\n", __func__, op); switch (op) { case RIG_OP_TUNE: cmd_index = FT900_NATIVE_TUNER_START; break; default: return -RIG_EINVAL; } err = ft900_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * ************************************ * * Private functions to ft900 backend * * ************************************ */ /* * Private helper function. Retrieves update data from rig. * using pacing value and buffer indicated in *priv struct. * Extended to be command agnostic as 900 has several ways to * get data and several ways to return it. * * Need to use this when doing ft900_get_* stuff * * Arguments: *rig Valid RIG instance * ci command index * rl expected length of returned data in octets * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft900_get_update_data(RIG *rig, unsigned char ci, unsigned char rl) { struct rig_state *rig_s; struct ft900_priv_data *priv; int n, err; /* for read_ */ rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft900_priv_data *)rig->state.priv; rig_s = &rig->state; err = ft900_send_static_cmd(rig, ci); if (err != RIG_OK) return err; n = read_block(&rig_s->rigport, (char *) priv->update_data, rl); if (n < 0) return n; /* die returning read_block error */ rig_debug(RIG_DEBUG_TRACE, "%s: read %i bytes\n", __func__, n); return RIG_OK; } /* * Private helper function to send a complete command sequence. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft900_send_static_cmd(RIG *rig, unsigned char ci) { struct rig_state *rig_s; struct ft900_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft900_priv_data *)rig->state.priv; rig_s = &rig->state; if (!priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to send incomplete sequence\n", __func__); return -RIG_EINVAL; } err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } /* * Private helper function to build and then send a complete command * sequence. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * p1-p4 Command parameters * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft900_send_dynamic_cmd(RIG *rig, unsigned char ci, unsigned char p1, unsigned char p2, unsigned char p3, unsigned char p4) { struct rig_state *rig_s; struct ft900_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n", __func__, p1, p2, p3, p4); priv = (struct ft900_priv_data *)rig->state.priv; if (priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n", __func__); return -RIG_EINVAL; } rig_s = &rig->state; memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); priv->p_cmd[P1] = p1; /* ick */ priv->p_cmd[P2] = p2; priv->p_cmd[P3] = p3; priv->p_cmd[P4] = p4; err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } /* * Private helper function to build and send a complete command to * change the display frequency. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * freq freq_t frequency value * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft900_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq) { struct rig_state *rig_s; struct ft900_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq); priv = (struct ft900_priv_data *)rig->state.priv; if (priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n", __func__); return -RIG_EINVAL; } rig_s = &rig->state; /* Copy native cmd freq_set to private cmd storage area */ memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); /* store bcd format in in p_cmd */ to_bcd(priv->p_cmd, freq/10, FT900_BCD_DIAL); rig_debug(RIG_DEBUG_TRACE, "%s: requested freq after conversion = %"PRIll" Hz\n", __func__, from_bcd(priv->p_cmd, FT900_BCD_DIAL)* 10); err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } /* * Private helper function to build and send a complete command to * change the RIT frequency. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * rit shortfreq_t frequency value * p1 P1 value -- CLAR_SET_FREQ * p2 P2 value -- CLAR_OFFSET_PLUS || CLAR_OFFSET_MINUS * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion * * Assumes: rit doesn't exceed tuning limits of rig */ static int ft900_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit) { struct rig_state *rig_s; struct ft900_priv_data *priv; unsigned char p1; unsigned char p2; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit); priv = (struct ft900_priv_data *)rig->state.priv; if (priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n", __func__); return -RIG_EINVAL; } rig_s = &rig->state; p1 = CLAR_SET_FREQ; if (rit < 0) { rit = labs(rit); /* get absolute value of rit */ p2 = CLAR_OFFSET_MINUS; } else { p2 = CLAR_OFFSET_PLUS; } /* Copy native cmd clarifier ops to private cmd storage area */ memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); /* store bcd format in in p_cmd */ to_bcd(priv->p_cmd, rit/10, FT900_BCD_RIT); rig_debug(RIG_DEBUG_TRACE, "%s: requested rit after conversion = %li Hz\n", __func__, from_bcd(priv->p_cmd, FT900_BCD_RIT)* 10); priv->p_cmd[P1] = p1; /* ick */ priv->p_cmd[P2] = p2; err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } hamlib-1.2.15.3/yaesu/ft847.c0000644000175000017500000007306512044564477012314 00000000000000/* * hamlib - (C) Frank Singleton 2000,2001 (vk3fcs@ix.netcom.com) * (C) Stephane Fillod 2000-2010 * * ft847.c - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com) * (C) Stephane Fillod 2000-2010 * * This shared library provides an API for communicating * via serial interface to an FT-847 using the "CAT" interface. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * TODO - Remove static stuff, see ft747 for new style [started] * - create yaesu.h for common command structure etc..[started] * - add mode set before freq set to avoid prior mode offset (eg: CW) * */ /* * Notes on limitations in RIG control capabilities. These are * related to the Yaesu's FT847 design, not my program :-) * * 1. Rig opcodes allow only 10Hz resolution. * 2. Cannot select VFO B * 3. Using CAT and Tuner controls simultaneously can * cause problems. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "serial.h" #include "yaesu.h" #include "ft847.h" #include "misc.h" #include "bandplan.h" #include "tones.h" /* prototypes */ static int ft847_send_priv_cmd(RIG *rig, int cmd_index); /* Native ft847 cmd set prototypes. These are READ ONLY as each */ /* rig instance will copy from these and modify if required . */ /* Complete sequences (1) can be read and used directly as a cmd sequence . */ /* Incomplete sequences (0) must be completed with extra parameters */ /* eg: mem number, or freq etc.. */ static const yaesu_cmd_set_t ncmd[] = { { 1, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* CAT = On */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x80 } }, /* CAT = Off */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* ptt on */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x88 } }, /* ptt off */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x4e } }, /* sat mode on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x8e } }, /* sat mode off */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* set freq main */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x11 } }, /* set freq sat rx */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x21 } }, /* set freq sat tx */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main LSB */ { 1, { 0x01, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main USB */ { 1, { 0x02, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main CW */ { 1, { 0x03, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main CWR */ { 1, { 0x04, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main AM */ { 1, { 0x08, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main FM */ { 1, { 0x82, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main CWN */ { 1, { 0x83, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main CWRN */ { 1, { 0x84, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main AMN */ { 1, { 0x88, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main FMN */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x17 } }, /* mode set sat rx LSB */ { 1, { 0x01, 0x00, 0x00, 0x00, 0x17 } }, /* mode set sat rx USB */ { 1, { 0x02, 0x00, 0x00, 0x00, 0x17 } }, /* mode set sat rx CW */ { 1, { 0x03, 0x00, 0x00, 0x00, 0x17 } }, /* mode set sat rx CWR */ { 1, { 0x04, 0x00, 0x00, 0x00, 0x17 } }, /* mode set sat rx AM */ { 1, { 0x08, 0x00, 0x00, 0x00, 0x17 } }, /* mode set sat rx FM */ { 1, { 0x82, 0x00, 0x00, 0x00, 0x17 } }, /* mode set sat rx CWN */ { 1, { 0x83, 0x00, 0x00, 0x00, 0x17 } }, /* mode set sat rx CWRN */ { 1, { 0x84, 0x00, 0x00, 0x00, 0x17 } }, /* mode set sat rx AMN */ { 1, { 0x88, 0x00, 0x00, 0x00, 0x17 } }, /* mode set sat rx FMN */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x27 } }, /* mode set sat tx LSB */ { 1, { 0x01, 0x00, 0x00, 0x00, 0x27 } }, /* mode set sat tx USB */ { 1, { 0x02, 0x00, 0x00, 0x00, 0x27 } }, /* mode set sat tx CW */ { 1, { 0x03, 0x00, 0x00, 0x00, 0x27 } }, /* mode set sat tx CWR */ { 1, { 0x04, 0x00, 0x00, 0x00, 0x27 } }, /* mode set sat tx AM */ { 1, { 0x08, 0x00, 0x00, 0x00, 0x27 } }, /* mode set sat tx FM */ { 1, { 0x82, 0x00, 0x00, 0x00, 0x27 } }, /* mode set sat tx CWN */ { 1, { 0x83, 0x00, 0x00, 0x00, 0x27 } }, /* mode set sat tx CWRN */ { 1, { 0x84, 0x00, 0x00, 0x00, 0x27 } }, /* mode set sat tx AMN */ { 1, { 0x88, 0x00, 0x00, 0x00, 0x27 } }, /* mode set sat tx FMN */ { 1, { 0x0a, 0x00, 0x00, 0x00, 0x0a } }, /* set DCS on, main */ { 1, { 0x2a, 0x00, 0x00, 0x00, 0x0a } }, /* set CTCSS/DCS enc/dec on, main */ { 1, { 0x4a, 0x00, 0x00, 0x00, 0x0a } }, /* set CTCSS/DCS enc on, main */ { 1, { 0x8a, 0x00, 0x00, 0x00, 0x0a } }, /* set CTCSS/DCS off, main */ { 1, { 0x0a, 0x00, 0x00, 0x00, 0x1a } }, /* set DCS on, sat rx */ { 1, { 0x2a, 0x00, 0x00, 0x00, 0x1a } }, /* set CTCSS/DCS enc/dec on, sat rx */ { 1, { 0x4a, 0x00, 0x00, 0x00, 0x1a } }, /* set CTCSS/DCS enc on, sat rx */ { 1, { 0x8a, 0x00, 0x00, 0x00, 0x1a } }, /* set CTCSS/DCS off, sat rx */ { 1, { 0x0a, 0x00, 0x00, 0x00, 0x2a } }, /* set DCS on, sat tx */ { 1, { 0x2a, 0x00, 0x00, 0x00, 0x2a } }, /* set CTCSS/DCS enc/dec on, sat tx */ { 1, { 0x4a, 0x00, 0x00, 0x00, 0x2a } }, /* set CTCSS/DCS enc on, sat tx */ { 1, { 0x8a, 0x00, 0x00, 0x00, 0x2a } }, /* set CTCSS/DCS off, sat tx */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0b } }, /* set CTCSS freq, main */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x1b } }, /* set CTCSS freq, sat rx */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x2b } }, /* set CTCSS freq, sat tx */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* set DCS code, main */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x1c } }, /* set DCS code, sat rx */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x2c } }, /* set DCS code, sat tx */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, /* set RPT shift MINUS */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x49 } }, /* set RPT shift PLUS */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x89 } }, /* set RPT shift SIMPLEX */ { 0, { 0x00, 0x00, 0x00, 0x00, 0xf9 } }, /* set RPT offset freq */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xe7 } }, /* get RX status */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xf7 } }, /* get TX status */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* get FREQ and MODE status, main */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x13 } }, /* get FREQ and MODE status, sat rx */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x23 } }, /* get FREQ and MODE status, sat tx */ }; /* * Receiver caps */ #define FT847_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_FM) #define FT847_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB) #define FT847_AM_FM_RX_MODES (RIG_MODE_AM|RIG_MODE_FM) /* tx doesn't have WFM. * 100W in 160-6m (25 watts AM carrier) * 50W in 2m/70cm (12.5 watts AM carrier) */ #define FT847_OTHER_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM) #define FT847_AM_TX_MODES (RIG_MODE_AM) #define FT847_FUNC_ALL (RIG_FUNC_TONE|RIG_FUNC_TSQL) #define FT847_LEVEL_ALL (RIG_LEVEL_RAWSTR|RIG_LEVEL_STRENGTH|RIG_LEVEL_ALC) #define FT847_VFOS (RIG_VFO_MAIN|RIG_VFO_SUB) /* FT-847 has different antennas connectors, but no rig_set_ant() ability */ #define FT847_ANTS RIG_ANT_1 #define FT847_STR_CAL { 3, \ { \ { 0, -60 }, /* S0 */ \ { 16, 0 }, /* S9 */ \ { 31, 60 }, /* +60 dB */ \ } } /* * 39 CTCSS sub-audible tones * c.f. ft847_set_ctcss_tone() */ static const tone_t ft847_ctcss_list[] = { 670, 693, 719, 744, 770, 797, 825, 854, 885, 915, 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, 1365, 1413, 1462, 1514, 1567, 1622, 1679, 1738, 1799, 1862, 1928, 2035, 2107, 2181, 2257, 2336, 2418, 2503, 0 }; /* * ft847 rigs capabilities. * Notice that some rigs share the same functions. * Also this struct is READONLY! */ const struct rig_caps ft847_caps = { .rig_model = RIG_MODEL_FT847, .model_name = "FT-847", .mfg_name = "Yaesu", .version = "0.5", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 57600, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT847_WRITE_DELAY, .post_write_delay = FT847_POST_WRITE_DELAY, .timeout = 1000, .retry = 0, .has_get_func = RIG_FUNC_NONE, .has_set_func = FT847_FUNC_ALL, .has_get_level = FT847_LEVEL_ALL, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, /* granularity */ .parm_gran = {}, .ctcss_list = ft847_ctcss_list, .dcs_list = common_dcs_list, .preamp = { RIG_DBLST_END, }, /* no preamp/att in CAT */ .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_FREQ|RIG_TARGETABLE_MODE|RIG_TARGETABLE_TONE|RIG_TARGETABLE_FUNC, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .str_cal = FT847_STR_CAL, .chan_list = { RIG_CHAN_END, }, /* FIXME: memory chan list: 78, but only in clonable mode? */ .rx_range_list1 = { {kHz(100),MHz(30),FT847_ALL_RX_MODES,-1,-1}, /* rx range begin */ {MHz(36),MHz(76),FT847_ALL_RX_MODES,-1,-1}, {MHz(108),MHz(174),FT847_ALL_RX_MODES,-1,-1}, {MHz(420),MHz(512),FT847_ALL_RX_MODES,-1,-1}, RIG_FRNG_END, }, /* rx range end */ .tx_range_list1 = { FRQ_RNG_HF(1,FT847_OTHER_TX_MODES, W(5),W(100),FT847_VFOS,FT847_ANTS), FRQ_RNG_HF(1,FT847_AM_TX_MODES, W(1),W(25),FT847_VFOS,FT847_ANTS), FRQ_RNG_6m(2,FT847_OTHER_TX_MODES, W(5),W(100),FT847_VFOS,FT847_ANTS), FRQ_RNG_6m(2,FT847_AM_TX_MODES, W(1),W(25),FT847_VFOS,FT847_ANTS), FRQ_RNG_2m(2,FT847_OTHER_TX_MODES, W(1),W(50),FT847_VFOS,FT847_ANTS), FRQ_RNG_2m(2,FT847_AM_TX_MODES, W(1),W(12.5),FT847_VFOS,FT847_ANTS), FRQ_RNG_70cm(2,FT847_OTHER_TX_MODES, W(1),W(50),FT847_VFOS,FT847_ANTS), FRQ_RNG_70cm(2,FT847_AM_TX_MODES, W(1),W(12.5),FT847_VFOS,FT847_ANTS), RIG_FRNG_END, }, /* tx range end */ .rx_range_list2 = { {kHz(100),MHz(30),FT847_ALL_RX_MODES,-1,-1}, /* rx range begin */ {MHz(36),MHz(76),FT847_ALL_RX_MODES,-1,-1}, {MHz(108),MHz(174),FT847_ALL_RX_MODES,-1,-1}, {MHz(420),MHz(512),FT847_ALL_RX_MODES,-1,-1}, RIG_FRNG_END, }, /* rx range end */ .tx_range_list2 = { FRQ_RNG_HF(2,FT847_OTHER_TX_MODES, W(5),W(100),FT847_VFOS,FT847_ANTS), FRQ_RNG_HF(2,FT847_AM_TX_MODES, W(1),W(25),FT847_VFOS,FT847_ANTS), FRQ_RNG_6m(2,FT847_OTHER_TX_MODES, W(5),W(100),FT847_VFOS,FT847_ANTS), FRQ_RNG_6m(2,FT847_AM_TX_MODES, W(1),W(25),FT847_VFOS,FT847_ANTS), FRQ_RNG_2m(2,FT847_OTHER_TX_MODES, W(1),W(50),FT847_VFOS,FT847_ANTS), FRQ_RNG_2m(2,FT847_AM_TX_MODES, W(1),W(12.5),FT847_VFOS,FT847_ANTS), FRQ_RNG_70cm(2,FT847_OTHER_TX_MODES, W(1),W(50),FT847_VFOS,FT847_ANTS), FRQ_RNG_70cm(2,FT847_AM_TX_MODES, W(1),W(12.5),FT847_VFOS,FT847_ANTS), RIG_FRNG_END, }, .tuning_steps = { {FT847_SSB_CW_RX_MODES,1}, /* normal */ {FT847_SSB_CW_RX_MODES,10}, /* fast */ {FT847_SSB_CW_RX_MODES,100}, /* faster */ {FT847_AM_FM_RX_MODES,10}, /* normal */ {FT847_AM_FM_RX_MODES,100}, /* fast */ RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR, kHz(2.2)}, {RIG_MODE_CW|RIG_MODE_CWR, Hz(500)}, {RIG_MODE_AM, kHz(9)}, {RIG_MODE_AM, kHz(2.2)}, {RIG_MODE_FM, kHz(15)}, {RIG_MODE_FM, kHz(9)}, RIG_FLT_END, }, .priv = NULL, .rig_init = ft847_init, .rig_cleanup = ft847_cleanup, .rig_open = ft847_open, .rig_close = ft847_close, .set_freq = ft847_set_freq, /* set freq */ .get_freq = ft847_get_freq, /* get freq */ .set_mode = ft847_set_mode, /* set mode */ .get_mode = ft847_get_mode, /* get mode */ .set_split_vfo = ft847_set_split_vfo, .get_split_vfo = ft847_get_split_vfo, .set_split_freq = ft847_set_split_freq, .get_split_freq = ft847_get_split_freq, .set_split_mode = ft847_set_split_mode, .get_split_mode = ft847_get_split_mode, .set_ptt = ft847_set_ptt, /* set ptt */ .get_ptt = ft847_get_ptt, /* get ptt */ .get_dcd = ft847_get_dcd, /* get dcd */ .get_level = ft847_get_level, /* get level */ .set_func = ft847_set_func, .set_ctcss_tone = ft847_set_ctcss_tone, .set_ctcss_sql = ft847_set_ctcss_sql, .set_dcs_sql = ft847_set_dcs_sql, .set_rptr_shift = ft847_set_rptr_shift, .set_rptr_offs = ft847_set_rptr_offs, }; /* * Function definitions below */ /* * setup *priv * serial port is already open (rig->state->fd) */ int ft847_init(RIG *rig) { struct ft847_priv_data *p; rig_debug(RIG_DEBUG_VERBOSE,"%s called \n", __func__); if (!rig) return -RIG_EINVAL; p = (struct ft847_priv_data*)malloc(sizeof(struct ft847_priv_data)); if (!p) { /* whoops! memory shortage! */ return -RIG_ENOMEM; } p->sat_mode = RIG_SPLIT_OFF; rig->state.priv = (void*)p; return RIG_OK; } /* * ft847_cleanup routine * the serial port is closed by the frontend */ int ft847_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; rig_debug(RIG_DEBUG_VERBOSE,"ft847:ft847_cleanup called \n"); return RIG_OK; } /* * ft847_open routine * */ int ft847_open(RIG *rig) { /* Good time to set CAT ON */ rig_debug(RIG_DEBUG_VERBOSE,"ft847:ft847_open called \n"); return ft847_send_priv_cmd(rig,FT_847_NATIVE_CAT_ON); } /* * ft847_close routine * */ int ft847_close(RIG *rig) { /* Good time to set CAT OFF */ rig_debug(RIG_DEBUG_VERBOSE,"ft847:ft847_close called \n"); /* don't care about return value */ ft847_send_priv_cmd(rig,FT_847_NATIVE_CAT_OFF); return RIG_OK; } /* * private helper function to send a private command * sequence . Must only be complete sequences. * */ static int ft847_send_priv_cmd(RIG *rig, int cmd_index) { struct rig_state *rig_s; unsigned char *cmd; /* points to sequence to send */ if (!rig) return -RIG_EINVAL; if (! ncmd[cmd_index].ncomp) { rig_debug(RIG_DEBUG_VERBOSE,"ft847: Attempt to send incomplete sequence \n"); return -RIG_EINVAL; } rig_s = &rig->state; cmd = (unsigned char *) ncmd[cmd_index].nseq; /* get native sequence */ return write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH); } /* * opcode_vfo() copy into cmd the 5 byte command designated by cmd_index, * and patch the opcode with VFO targetting (MAIN 0x0-, SAT RX 0x1-, SAT TX 0x2-) */ static int opcode_vfo(RIG *rig, unsigned char * cmd, int cmd_index, vfo_t vfo) { struct ft847_priv_data *p = (struct ft847_priv_data*)rig->state.priv; memcpy(cmd, &ncmd[cmd_index].nseq,YAESU_CMD_LENGTH); /* If the sat_mode is not enabled, * then leave the OpCode untouched (MAIN VFO) */ if (p->sat_mode == RIG_SPLIT_ON) { switch(vfo) { case RIG_VFO_CURR: case RIG_VFO_MAIN: cmd[4] &= 0x0f; cmd[4] |= 0x10; /* MAIN VFO -> SAT RX VFO */ break; case RIG_VFO_SUB: case RIG_VFO_TX: cmd[4] &= 0x0f; cmd[4] |= 0x20; /* SAT TX VFO */ break; default: rig_debug(RIG_DEBUG_WARN,"%s: Unsupported VFO %s\n", rig_strvfo(vfo)); return -RIG_EINVAL; /* sorry, wrong VFO */ } } return RIG_OK; } /* * Set frequency to freq Hz. Note 10 Hz resolution -- YUK -- FS * */ int ft847_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct rig_state *rig_s; unsigned char p_cmd[YAESU_CMD_LENGTH]; /* sequence to send */ int ret; if (!rig) return -RIG_EINVAL; rig_s = &rig->state; rig_debug(RIG_DEBUG_VERBOSE,"ft847: requested freq = %"PRIfreq" Hz, vfo=%s\n", freq, rig_strvfo(vfo)); ret = opcode_vfo(rig, p_cmd, FT_847_NATIVE_CAT_SET_FREQ_MAIN, vfo); if (ret != RIG_OK) return ret; to_bcd_be(p_cmd,freq/10,8); /* store bcd format in in p_cmd */ rig_debug(RIG_DEBUG_VERBOSE,"ft847: requested freq after conversion = %"PRIll" Hz \n", from_bcd_be(p_cmd,8)* 10 ); return write_block(&rig_s->rigport, (char*)p_cmd, YAESU_CMD_LENGTH); } #define MD_LSB 0x00 #define MD_USB 0x01 #define MD_CW 0x02 #define MD_CWR 0x03 #define MD_AM 0x04 #define MD_FM 0x08 #define MD_CWN 0x82 #define MD_CWNR 0x83 #define MD_AMN 0x84 #define MD_FMN 0x88 static int get_freq_and_mode(RIG *rig, vfo_t vfo, freq_t *freq, rmode_t *mode, pbwidth_t *width) { struct rig_state *rs = &rig->state; unsigned char p_cmd[YAESU_CMD_LENGTH]; /* sequence to send */ unsigned char cmd_index; /* index of sequence to send */ unsigned char data[8]; int n; rig_debug(RIG_DEBUG_VERBOSE,"ft847: %s vfo =%s \n", __func__, rig_strvfo(vfo)); cmd_index = FT_847_NATIVE_CAT_GET_FREQ_MODE_STATUS_MAIN; memcpy(p_cmd,&ncmd[cmd_index].nseq,YAESU_CMD_LENGTH); /* change opcode according to vfo */ n = opcode_vfo(rig, p_cmd, cmd_index, vfo); if (n != RIG_OK) return n; n = write_block(&rs->rigport, (char *) p_cmd, YAESU_CMD_LENGTH); if (n < 0) return n; n = read_block(&rs->rigport, (char *) data, YAESU_CMD_LENGTH); if (n != YAESU_CMD_LENGTH) { rig_debug(RIG_DEBUG_ERR,"ft847: read_block returned %d\n", n); return n < 0 ? n : -RIG_EPROTO; } /* Remember, this is 10Hz resolution */ *freq = 10*from_bcd_be(data, 8); *width = RIG_PASSBAND_NORMAL; switch (data[4]) { case MD_LSB: *mode = RIG_MODE_LSB; break; case MD_USB: *mode = RIG_MODE_USB; break; case MD_CWN: *width = rig_passband_narrow(rig, RIG_MODE_CW); case MD_CW: *mode = RIG_MODE_CW; break; case MD_CWNR: *width = rig_passband_narrow(rig, RIG_MODE_CW); case MD_CWR: *mode = RIG_MODE_CWR; break; case MD_AMN: *width = rig_passband_narrow(rig, RIG_MODE_AM); case MD_AM: *mode = RIG_MODE_AM; break; case MD_FMN: *width = rig_passband_narrow(rig, RIG_MODE_FM); case MD_FM: *mode = RIG_MODE_FM; break; default: *mode = RIG_MODE_NONE; rig_debug(RIG_DEBUG_VERBOSE,"ft847: Unknown mode %02x\n", data[4]); } if (*width == RIG_PASSBAND_NORMAL) *width = rig_passband_normal(rig, *mode); return RIG_OK; } /* * Note taken from http://www.supercontrol.de/cat/ft847faq/page4.htm#pollingcodes * The FT-847, as originally delivered, could not poll the radio for frequency * and mode information. This was added beginning with the 8G05 production * runs. The Operating Manual does not show the codes for polling the radio. * Note that you cannot query the sub-VFO, nor can you swap VFOs via software. */ int ft847_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { rmode_t mode; pbwidth_t width; return get_freq_and_mode(rig, vfo, freq, &mode, &width); } int ft847_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { unsigned char cmd_index; /* index of sequence to send */ struct rig_state *rs = &rig->state; unsigned char p_cmd[YAESU_CMD_LENGTH]; /* sequence to send */ int ret; /* * translate mode from generic to ft847 specific */ rig_debug(RIG_DEBUG_VERBOSE,"ft847: generic mode = %x \n", mode); switch(mode) { case RIG_MODE_AM: cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_AM; break; case RIG_MODE_CW: cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_CW; break; case RIG_MODE_CWR: cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_CWR; break; case RIG_MODE_USB: cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_USB; break; case RIG_MODE_LSB: cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_LSB; break; case RIG_MODE_FM: cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_FM; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } /* * Now set width */ if (width == rig_passband_narrow(rig, mode)) { switch(mode) { case RIG_MODE_AM: cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_AMN; break; case RIG_MODE_FM: cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_FMN; break; case RIG_MODE_CW: cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_CWN; break; case RIG_MODE_CWR: cmd_index = FT_847_NATIVE_CAT_SET_MODE_MAIN_CWRN; break; case RIG_MODE_USB: case RIG_MODE_LSB: break; default: rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode/width: %s/%d, narrow: %d\n", __FUNCTION__, rig_strrmode(mode), width, rig_passband_narrow(rig, mode)); return -RIG_EINVAL; /* sorry, wrong MODE/WIDTH combo */ } } else { if (width != RIG_PASSBAND_NORMAL && width != rig_passband_normal(rig, mode)) { return -RIG_EINVAL; /* sorry, wrong MODE/WIDTH combo */ } } /* * Now send the command */ ret = opcode_vfo(rig, p_cmd, cmd_index, vfo); if (ret != RIG_OK) return ret; return write_block(&rs->rigport, (char*)p_cmd, YAESU_CMD_LENGTH); } int ft847_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { freq_t freq; return get_freq_and_mode(rig, vfo, &freq, mode, width); } /* * Not exactly Split mode, this will set *SAT* Mode */ int ft847_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { struct ft847_priv_data *priv = (struct ft847_priv_data*)rig->state.priv; unsigned char cmd_index; /* index of sequence to send */ int ret; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __func__); switch(split) { case RIG_SPLIT_ON: cmd_index = FT_847_NATIVE_CAT_SAT_MODE_ON; break; case RIG_SPLIT_OFF: cmd_index = FT_847_NATIVE_CAT_SAT_MODE_OFF; break; default: return -RIG_EINVAL; /* sorry, wrong split range */ } ret = ft847_send_priv_cmd(rig,cmd_index); if (ret == RIG_OK) priv->sat_mode = split; return ret; } int ft847_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { struct ft847_priv_data *priv = (struct ft847_priv_data*)rig->state.priv; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __func__); *split = priv->sat_mode; *tx_vfo = RIG_VFO_SUB; return RIG_OK; } int ft847_set_split_freq(RIG *rig, vfo_t vfo, freq_t freq) { return ft847_set_freq(rig, RIG_VFO_TX, freq); } int ft847_get_split_freq(RIG *rig, vfo_t vfo, freq_t *freq) { return ft847_get_freq(rig, RIG_VFO_TX, freq); } int ft847_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { return ft847_set_mode(rig, RIG_VFO_TX, mode, width); } int ft847_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { return ft847_get_mode(rig, RIG_VFO_TX, mode, width); } /* * _set_ptt * */ int ft847_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { unsigned char cmd_index; /* index of sequence to send */ rig_debug(RIG_DEBUG_VERBOSE,"ft847:ft847_set_ptt called \n"); switch(ptt) { case RIG_PTT_ON: cmd_index = FT_847_NATIVE_CAT_PTT_ON; break; case RIG_PTT_OFF: cmd_index = FT_847_NATIVE_CAT_PTT_OFF; break; default: return -RIG_EINVAL; /* sorry, wrong ptt range */ } /* * phew! now send cmd to rig */ return ft847_send_priv_cmd(rig,cmd_index); } static int ft847_get_status(RIG *rig, int status_ci) { struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv; unsigned char *data; int len; int n; switch (status_ci) { case FT_847_NATIVE_CAT_GET_RX_STATUS: data = &p->rx_status; len = 1; break; case FT_847_NATIVE_CAT_GET_TX_STATUS: data = &p->tx_status; len = 1; break; default: rig_debug(RIG_DEBUG_ERR, "ft847_get_status: Internal error!\n"); return -RIG_EINTERNAL; } serial_flush(&rig->state.rigport); n = write_block(&rig->state.rigport, (char *) ncmd[status_ci].nseq, YAESU_CMD_LENGTH); if (n < 0) return n; n = read_block(&rig->state.rigport, (char *) data, len); if (n < 0) return n; if (n != len) return -RIG_EPROTO; return RIG_OK; } int ft847_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv; int n; n = ft847_get_status(rig, FT_847_NATIVE_CAT_GET_TX_STATUS); if (n < 0) return n; *ptt = (p->tx_status & 0x80) ? RIG_PTT_OFF : RIG_PTT_ON; return RIG_OK; } int ft847_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv; int n; n = ft847_get_status(rig, FT_847_NATIVE_CAT_GET_RX_STATUS); if (n < 0) return n; *dcd = (p->rx_status & 0x80) ? RIG_DCD_OFF : RIG_DCD_ON; return RIG_OK; } /* * Get the 'raw' signal strength * This number corresponds to the number of 'dots' in * the FT-847 display */ static int ft847_get_rawstr_level(RIG *rig, value_t *val) { struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv; int n; n = ft847_get_status(rig, FT_847_NATIVE_CAT_GET_RX_STATUS); if (n < 0) return n; n = (p->rx_status & 0x1F); val->i = n; return RIG_OK; } /* * Get S-meter reading (in dB) */ static int ft847_get_smeter_level(RIG *rig, value_t *val) { int n; n = ft847_get_rawstr_level(rig, val); if (n < 0) return n; /* * The FT-847 S-meter readings over CAT returns * an integer that corresponds to the number of * 'dots' lit in the display. Use a conversion * function to convert the raw signal strength to dB */ n = val->i; if (n < 4) /* <= S1 */ val->i = -54 + (n * 2); else if (n < 20) /* S1 - S9 */ val->i = -48 + ((n -3) * 3); else { /* > S9 */ n -= 19; val->i = (n * 5); } return RIG_OK; } /* * Get the PO/ALC Meter Data */ static int ft847_get_alc_level(RIG *rig, value_t *val) { struct ft847_priv_data *p = (struct ft847_priv_data *) rig->state.priv; int n; n = ft847_get_status(rig, FT_847_NATIVE_CAT_GET_TX_STATUS); if (n < 0) return n; n = (p->tx_status & 0x1F); val->f = (float)n / 0x1F; return RIG_OK; } /* * Get "level" data from rig. * The 847 supports S-meter readings in receive mode * and PO/ALC in transmit mode. There is no way * to determine whether it's PO or ALC, unfortunately. */ int ft847_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t * val) { if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; switch (level) { case RIG_LEVEL_STRENGTH: return ft847_get_smeter_level(rig, val); case RIG_LEVEL_RAWSTR: return ft847_get_rawstr_level(rig, val); case RIG_LEVEL_ALC: return ft847_get_alc_level(rig, val); default: return -RIG_EINVAL; } return RIG_OK; } int ft847_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { unsigned char p_cmd[YAESU_CMD_LENGTH]; /* sequence to send */ int ret; ft847_native_cmd_t fcmd; if (!rig) return -RIG_EINVAL; switch (func) { case RIG_FUNC_TONE: fcmd = status ? FT_847_NATIVE_CAT_SET_CTCSS_ENC_ON_MAIN : FT_847_NATIVE_CAT_SET_CTCSS_DCS_OFF_MAIN; break; case RIG_FUNC_TSQL: fcmd = status ? FT_847_NATIVE_CAT_SET_CTCSS_ENC_DEC_ON_MAIN : FT_847_NATIVE_CAT_SET_CTCSS_DCS_OFF_MAIN; break; default: return -RIG_EINVAL; } ret = opcode_vfo(rig, p_cmd, fcmd, vfo); if (ret != RIG_OK) return ret; return write_block(&rig->state.rigport, (char*)p_cmd, YAESU_CMD_LENGTH); } int ft847_set_ctcss_tone (RIG *rig, vfo_t vfo, tone_t tone) { unsigned char p_cmd[YAESU_CMD_LENGTH]; /* sequence to send */ int i, ret; /* * 39 CTCSS CAT codes corresponding to ft847_ctcss_list */ static const unsigned char ft847_ctcss_cat[] = { 0x3F, 0x39, 0x1F, 0x3E, 0x0F, 0x3D, 0x1E, 0x3C, 0x0E, 0x3B, 0x1D, 0x3A, 0x0D, 0x1C, 0x0C, 0x1B, 0x0B, 0x1A, 0x0A, 0x19, 0x09, 0x18, 0x08, 0x17, 0x07, 0x16, 0x06, 0x15, 0x05, 0x14, 0x04, 0x13, 0x03, 0x12, 0x02, 0x11, 0x01, 0x10, 0x00, }; ret = opcode_vfo(rig, p_cmd, FT_847_NATIVE_CAT_SET_CTCSS_FREQ_MAIN, vfo); if (ret != RIG_OK) return ret; #define FT847_CTCSS_NB 39 for (i = 0; istate.rigport, (char*)p_cmd, YAESU_CMD_LENGTH); } int ft847_set_ctcss_sql (RIG *rig, vfo_t vfo, tone_t tone) { /* same opcode as tone */ return ft847_set_ctcss_tone(rig, vfo, tone); } int ft847_set_dcs_sql (RIG *rig, vfo_t vfo, tone_t code) { unsigned char p_cmd[YAESU_CMD_LENGTH]; /* sequence to send */ int ret; ret = opcode_vfo(rig, p_cmd, FT_847_NATIVE_CAT_SET_DCS_CODE_MAIN, vfo); if (ret != RIG_OK) return ret; /* TODO: FT_847_NATIVE_CAT_SET_DCS_ON_MAIN here or with new RIG_FUNC_DCS? */ /* DCS Code # (i.e. 07, 54=DCS Code 754) */ to_bcd_be(p_cmd, code,4); /* store bcd format in in p_cmd */ return write_block(&rig->state.rigport, (char*)p_cmd, YAESU_CMD_LENGTH); } int ft847_set_rptr_shift (RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift) { unsigned char cmd_index; /* index of sequence to send */ if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; switch(rptr_shift) { case RIG_RPT_SHIFT_NONE: cmd_index = FT_847_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX; break; case RIG_RPT_SHIFT_MINUS: cmd_index = FT_847_NATIVE_CAT_SET_RPT_SHIFT_MINUS; break; case RIG_RPT_SHIFT_PLUS: cmd_index = FT_847_NATIVE_CAT_SET_RPT_SHIFT_PLUS; break; default: return -RIG_EINVAL; /* sorry, wrong shift */ } return ft847_send_priv_cmd(rig,cmd_index); } int ft847_set_rptr_offs (RIG *rig, vfo_t vfo, shortfreq_t rptr_offs) { unsigned char p_cmd[YAESU_CMD_LENGTH]; /* sequence to send */ if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; memcpy(p_cmd,&ncmd[FT_847_NATIVE_CAT_SET_RPT_OFFSET].nseq,YAESU_CMD_LENGTH); to_bcd_be(p_cmd,rptr_offs/10,8); /* store bcd format in in p_cmd */ return write_block(&rig->state.rigport, (char*)p_cmd, YAESU_CMD_LENGTH); } hamlib-1.2.15.3/yaesu/ft1000mp.c0000644000175000017500000011461512044564477012704 00000000000000/* * ft1000.c - (C) Stephane Fillod 2002-2005 (fillods@users.sourceforge.net) * * This shared library provides an API for communicating * via serial interface to an FT-1000MP using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * Right now, this FT-1000MP implementation is a big mess. * This is actually a fast copy past (from ft920.c), * just to make get_freq/set_freq and co to work for a friend of mine. * I wouln't mind if someone could take over the maintenance * of this piece of code, and eventually rewrite it. * '02, Stephane */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "bandplan.h" #include "serial.h" #include "misc.h" #include "cal.h" #include "yaesu.h" #include "ft1000mp.h" /* * Differences between FT1000MP: * The FT1000MP MARK-V Field appears to be identical to FT1000MP, * whereas the FT1000MP MARK-V is a FT1000MP with 200W. TBC. */ /* Private helper function prototypes */ static int ft1000mp_get_update_data(RIG *rig, unsigned char ci, unsigned char rl); static int ft1000mp_send_priv_cmd(RIG *rig, unsigned char ci); /* * Native ft1000mp cmd set prototypes. These are READ ONLY as each * rig instance will copy from these and modify if required. * Complete sequences (1) can be read and used directly as a cmd sequence. * Incomplete sequences (0) must be completed with extra parameters * eg: mem number, or freq etc.. * */ static const yaesu_cmd_set_t ncmd[] = { { 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* split = off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* split = on */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* recall memory */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* memory operations */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* select vfo A */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* select vfo B */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x06 } }, /* copy memory data to vfo A */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, /* RX clarifier on */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x09 } }, /* RX clarifier off */ { 1, { 0x00, 0x00, 0x00, 0x80, 0x09 } }, /* TX clarifier on */ { 1, { 0x00, 0x00, 0x00, 0x81, 0x09 } }, /* TX clarifier off */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* set VFOA freq */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x8a } }, /* set VFOB freq */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* vfo A mode set LSB */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0c } }, /* vfo A mode set USB */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x0c } }, /* vfo A mode set CW-USB */ { 1, { 0x00, 0x00, 0x00, 0x03, 0x0c } }, /* vfo A mode set CW-LSB */ { 1, { 0x00, 0x00, 0x00, 0x04, 0x0c } }, /* vfo A mode set AM */ { 1, { 0x00, 0x00, 0x00, 0x05, 0x0c } }, /* vfo A mode set AM sync */ { 1, { 0x00, 0x00, 0x00, 0x06, 0x0c } }, /* vfo A mode set FM */ { 1, { 0x00, 0x00, 0x00, 0x07, 0x0c } }, /* vfo A mode set FMW? */ { 1, { 0x00, 0x00, 0x00, 0x08, 0x0c } }, /* vfo A mode set RTTY-LSB */ { 1, { 0x00, 0x00, 0x00, 0x09, 0x0c } }, /* vfo A mode set RTTY-USB */ { 1, { 0x00, 0x00, 0x00, 0x0a, 0x0c } }, /* vfo A mode set DATA-LSB */ { 1, { 0x00, 0x00, 0x00, 0x0b, 0x0c } }, /* vfo A mode set DATA-FM */ /* { 1, { 0x00, 0x00, 0x00, 0x80, 0x0c } }, */ /* vfo B mode set LSB */ /* { 1, { 0x00, 0x00, 0x00, 0x81, 0x0c } }, */ /* vfo B mode set USB */ /* { 1, { 0x00, 0x00, 0x00, 0x82, 0x0c } }, */ /* vfo B mode set CW-USB */ /* { 1, { 0x00, 0x00, 0x00, 0x83, 0x0c } }, */ /* vfo B mode set CW-LSB */ /* { 1, { 0x00, 0x00, 0x00, 0x84, 0x0c } }, */ /* vfo B mode set AM */ /* { 1, { 0x00, 0x00, 0x00, 0x85, 0x0c } }, */ /* vfo B mode set AM */ /* { 1, { 0x00, 0x00, 0x00, 0x86, 0x0c } }, */ /* vfo B mode set FM */ /* { 1, { 0x00, 0x00, 0x00, 0x87, 0x0c } }, */ /* vfo B mode set FMN */ /* { 1, { 0x00, 0x00, 0x00, 0x88, 0x0c } }, */ /* vfo B mode set DATA-LSB */ /* { 1, { 0x00, 0x00, 0x00, 0x89, 0x0c } }, */ /* vfo B mode set DATA-LSB */ /* { 1, { 0x00, 0x00, 0x00, 0x8a, 0x0c } }, */ /* vfo B mode set DATA-USB */ /* { 1, { 0x00, 0x00, 0x00, 0x8b, 0x0c } }, */ /* vfo B mode set DATA-FM */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0e } }, /* update interval/pacing */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0F } }, /* PTT OFF */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0F } }, /* PTT ON */ { 1, { 0x00, 0x00, 0x00, 0x03, 0x10 } }, /* status update VFO A & B update */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x10 } }, /* status update operating data */ { 1, { 0x00, 0x00, 0x00, 0x01, 0xFA } }, /* Read status flags */ /* { 0, { 0x00, 0x00, 0x00, 0x00, 0x70 } }, */ /* keyer commands */ /* { 1, { 0x00, 0x00, 0x00, 0x00, 0x81 } }, */ /* tuner off */ /* { 1, { 0x00, 0x00, 0x00, 0x01, 0x81 } }, */ /* tuner on */ /* { 1, { 0x00, 0x00, 0x00, 0x00, 0x82 } }, */ /* tuner start*/ }; #define FT1000MP_ALL_RX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_AM|RIG_MODE_FM) /* * TX caps */ #define FT1000MP_OTHER_TX_MODES (RIG_MODE_CW| RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_FM) /* 100 W class */ #define FT1000MP_AM_TX_MODES (RIG_MODE_AM ) /* set 25W max */ #define FT1000MP_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN|RIG_FUNC_LOCK /* |RIG_FUNC_TUNER */) /* FIXME */ #define FT1000MP_LEVEL_GET (RIG_LEVEL_RAWSTR|RIG_LEVEL_ALC|RIG_LEVEL_SWR|RIG_LEVEL_RFPOWER|RIG_LEVEL_COMP|RIG_LEVEL_MICGAIN|RIG_LEVEL_CWPITCH) #define FT1000MP_VFOS (RIG_VFO_A|RIG_VFO_B) #define FT1000MP_ANTS 0 /* FIXME: declare antenna connectors: ANT-A, ANT-B, RX ANT */ #define FT1000MP_VFO_OPS (RIG_OP_TO_VFO|RIG_OP_FROM_VFO|RIG_OP_CPY|RIG_OP_UP|RIG_OP_DOWN) /** * 33 CTCSS sub-audible tones */ static const tone_t ft1000mp_ctcss_list[] = { 670, 719, 770, 825, 885, 948, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, 1365, 1413, 1462, 1514, 1567, 1598, 1622, 1679, 1738, 1799, 1862, 1928, 2035, 2107, 2181, 2257, 2336, 2418, 2503, 0, }; #define FT1000MP_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .ant = 1, \ .rit = 1, \ .xit = 1, \ .rptr_shift = 1, \ .flags = 1, \ } #define FT1000MP_STR_CAL { 12, \ { \ { 0, -60 }, \ { 17, -54 }, /* S0 */ \ { 17, -48 }, \ { 34, -42 }, \ { 51, -36 }, \ { 68, -30 }, \ { 85, -24 }, \ { 102, -18 }, \ { 119, -12 }, \ { 136, -6 }, \ { 160, 0 }, /* S9 */ \ { 255, 60 } /* +60 */ \ } } /* * future - private data * */ struct ft1000mp_priv_data { unsigned char pacing; /* pacing value */ unsigned int read_update_delay; /* depends on pacing value */ unsigned char current_vfo; /* active VFO from last cmd */ unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */ yaesu_cmd_set_t pcs[FT1000MP_NATIVE_SIZE]; /* private cmd set */ unsigned char update_data[2*FT1000MP_STATUS_UPDATE_LENGTH];/* returned data--max value, some are less */ }; /* * ft1000mp rigs capabilities. * Also this struct is READONLY! * */ const struct rig_caps ft1000mp_caps = { .rig_model = RIG_MODEL_FT1000MP, .model_name = "FT-1000MP", .mfg_name = "Yaesu", .version = "0.1.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT1000MP_WRITE_DELAY, .post_write_delay = FT1000MP_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = FT1000MP_FUNC_ALL, .has_set_func = FT1000MP_FUNC_ALL, .has_get_level = FT1000MP_LEVEL_GET, .has_set_level = RIG_LEVEL_NONE, /* as strange as it could be */ .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = ft1000mp_ctcss_list, .dcs_list = NULL, .vfo_ops = FT1000MP_VFO_OPS, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = kHz(1.12), .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM, FT1000MP_MEM_CAP }, { 100, 108, RIG_MTYPE_EDGE }, /* P1 .. P9 */ { 109, 113, RIG_MTYPE_MEMOPAD }, /* Q1 .. Q5 */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100), MHz(30), FT1000MP_ALL_RX_MODES, -1, -1, FT1000MP_VFOS, FT1000MP_ANTS }, /* General coverage + ham */ RIG_FRNG_END, }, /* Region 1 rx ranges */ .tx_range_list1 = { FRQ_RNG_HF(1,FT1000MP_OTHER_TX_MODES, W(5),W(100),FT1000MP_VFOS,FT1000MP_ANTS), FRQ_RNG_HF(1,FT1000MP_AM_TX_MODES, W(2),W(25),FT1000MP_VFOS,FT1000MP_ANTS), /* AM class */ RIG_FRNG_END, }, /* region 1 TX ranges */ .rx_range_list2 = { {kHz(100), MHz(30), FT1000MP_ALL_RX_MODES, -1, -1, FT1000MP_VFOS, FT1000MP_ANTS }, /* General coverage + ham */ RIG_FRNG_END, }, /* Region 2 rx ranges */ .tx_range_list2 = { FRQ_RNG_HF(1,FT1000MP_OTHER_TX_MODES, W(5),W(100),FT1000MP_VFOS,FT1000MP_ANTS), FRQ_RNG_HF(1,FT1000MP_AM_TX_MODES, W(2),W(25),FT1000MP_VFOS,FT1000MP_ANTS), /* AM class */ RIG_FRNG_END, }, /* region 2 TX ranges */ .tuning_steps = { {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY, Hz(10)}, /* Normal */ {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY, Hz(100)}, /* Fast */ {RIG_MODE_AM, Hz(100)}, /* Normal */ {RIG_MODE_AM, kHz(1)}, /* Fast */ {RIG_MODE_FM, Hz(100)}, /* Normal */ {RIG_MODE_FM, kHz(1)}, /* Fast */ RIG_TS_END, /* * The FT-1000MP has a Fine tuning step which increments in 1 Hz steps * for SSB_CW_RX_MODES, and 10 Hz steps for AM_RX_MODES and * FM_RX_MODES. It doesn't appear that anything finer than 10 Hz * is available through the CAT interface, however. -N0NB * */ }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.0)}, {RIG_MODE_CW|RIG_MODE_RTTY, Hz(500)}, {RIG_MODE_CW|RIG_MODE_RTTY, Hz(250)}, {RIG_MODE_AM, kHz(5)}, /* wide */ {RIG_MODE_FM, kHz(8)}, /* FM */ RIG_FLT_END, }, .str_cal = FT1000MP_STR_CAL, .priv = NULL, /* private data */ .rig_init = ft1000mp_init, .rig_cleanup = ft1000mp_cleanup, .rig_open = ft1000mp_open, /* port opened */ .set_freq = ft1000mp_set_freq, /* set freq */ .get_freq = ft1000mp_get_freq, /* get freq */ .set_mode = ft1000mp_set_mode, /* set mode */ .get_mode = ft1000mp_get_mode, /* get mode */ .set_vfo = ft1000mp_set_vfo, /* set vfo */ .get_vfo = ft1000mp_get_vfo, /* get vfo */ .get_rit = ft1000mp_get_rit, .set_rit = ft1000mp_set_rit, .get_xit = ft1000mp_get_xit, .set_xit = ft1000mp_set_xit, .get_level = ft1000mp_get_level, .set_ptt = ft1000mp_set_ptt, /* TODO: the remaining ... */ }; const struct rig_caps ft1000mpmkv_caps = { .rig_model = RIG_MODEL_FT1000MPMKV, .model_name = "MARK-V FT-1000MP", .mfg_name = "Yaesu", .version = "0.0.5", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT1000MP_WRITE_DELAY, .post_write_delay = FT1000MP_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = FT1000MP_FUNC_ALL, .has_set_func = FT1000MP_FUNC_ALL, .has_get_level = FT1000MP_LEVEL_GET, .has_set_level = RIG_LEVEL_NONE, /* as strange as it could be */ .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = ft1000mp_ctcss_list, .dcs_list = NULL, .vfo_ops = FT1000MP_VFO_OPS, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = kHz(1.12), .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM, FT1000MP_MEM_CAP }, { 100, 108, RIG_MTYPE_EDGE }, /* P1 .. P9 */ { 109, 113, RIG_MTYPE_MEMOPAD }, /* Q1 .. Q5 */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100), MHz(30), FT1000MP_ALL_RX_MODES, -1, -1, FT1000MP_VFOS, FT1000MP_ANTS }, /* General coverage + ham */ RIG_FRNG_END, }, /* Region 1 rx ranges */ .tx_range_list1 = { FRQ_RNG_HF(1,FT1000MP_OTHER_TX_MODES, W(5),W(200),FT1000MP_VFOS,FT1000MP_ANTS), FRQ_RNG_HF(1,FT1000MP_AM_TX_MODES, W(2),W(50),FT1000MP_VFOS,FT1000MP_ANTS), /* AM class */ RIG_FRNG_END, }, /* region 1 TX ranges */ .rx_range_list2 = { {kHz(100), MHz(30), FT1000MP_ALL_RX_MODES, -1, -1, FT1000MP_VFOS, FT1000MP_ANTS }, /* General coverage + ham */ RIG_FRNG_END, }, /* Region 2 rx ranges */ .tx_range_list2 = { FRQ_RNG_HF(1,FT1000MP_OTHER_TX_MODES, W(5),W(200),FT1000MP_VFOS,FT1000MP_ANTS), FRQ_RNG_HF(1,FT1000MP_AM_TX_MODES, W(2),W(50),FT1000MP_VFOS,FT1000MP_ANTS), /* AM class */ RIG_FRNG_END, }, /* region 2 TX ranges */ .tuning_steps = { {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY, Hz(10)}, /* Normal */ {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY, Hz(100)}, /* Fast */ {RIG_MODE_AM, Hz(100)}, /* Normal */ {RIG_MODE_AM, kHz(1)}, /* Fast */ {RIG_MODE_FM, Hz(100)}, /* Normal */ {RIG_MODE_FM, kHz(1)}, /* Fast */ RIG_TS_END, /* * The FT-1000MP has a Fine tuning step which increments in 1 Hz steps * for SSB_CW_RX_MODES, and 10 Hz steps for AM_RX_MODES and * FM_RX_MODES. It doesn't appear that anything finer than 10 Hz * is available through the CAT interface, however. -N0NB * */ }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.0)}, {RIG_MODE_CW|RIG_MODE_RTTY, Hz(500)}, {RIG_MODE_CW|RIG_MODE_RTTY, Hz(250)}, {RIG_MODE_AM, kHz(5)}, /* wide */ {RIG_MODE_FM, kHz(8)}, /* FM */ RIG_FLT_END, }, .str_cal = FT1000MP_STR_CAL, .priv = NULL, /* private data */ .rig_init = ft1000mp_init, .rig_cleanup = ft1000mp_cleanup, .rig_open = ft1000mp_open, /* port opened */ .set_freq = ft1000mp_set_freq, /* set freq */ .get_freq = ft1000mp_get_freq, /* get freq */ .set_mode = ft1000mp_set_mode, /* set mode */ .get_mode = ft1000mp_get_mode, /* get mode */ .set_vfo = ft1000mp_set_vfo, /* set vfo */ .get_vfo = ft1000mp_get_vfo, /* get vfo */ .get_rit = ft1000mp_get_rit, .set_rit = ft1000mp_set_rit, .get_xit = ft1000mp_get_xit, .set_xit = ft1000mp_set_xit, .get_level = ft1000mp_get_level, .set_ptt = ft1000mp_set_ptt, /* TODO: the remaining ... */ }; const struct rig_caps ft1000mpmkvfld_caps = { .rig_model = RIG_MODEL_FT1000MPMKVFLD, .model_name = "MARK-V Field FT-1000MP", .mfg_name = "Yaesu", .version = "0.0.5", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT1000MP_WRITE_DELAY, .post_write_delay = FT1000MP_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = FT1000MP_FUNC_ALL, .has_set_func = FT1000MP_FUNC_ALL, .has_get_level = FT1000MP_LEVEL_GET, .has_set_level = RIG_LEVEL_NONE, /* as strange as it could be */ .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = ft1000mp_ctcss_list, .dcs_list = NULL, .vfo_ops = FT1000MP_VFO_OPS, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = kHz(1.12), .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 1, 99, RIG_MTYPE_MEM, FT1000MP_MEM_CAP }, { 100, 108, RIG_MTYPE_EDGE }, /* P1 .. P9 */ { 109, 113, RIG_MTYPE_MEMOPAD }, /* Q1 .. Q5 */ RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100), MHz(30), FT1000MP_ALL_RX_MODES, -1, -1, FT1000MP_VFOS, FT1000MP_ANTS }, /* General coverage + ham */ RIG_FRNG_END, }, /* Region 1 rx ranges */ .tx_range_list1 = { FRQ_RNG_HF(1,FT1000MP_OTHER_TX_MODES, W(5),W(100),FT1000MP_VFOS,FT1000MP_ANTS), FRQ_RNG_HF(1,FT1000MP_AM_TX_MODES, W(2),W(25),FT1000MP_VFOS,FT1000MP_ANTS), /* AM class */ RIG_FRNG_END, }, /* region 1 TX ranges */ .rx_range_list2 = { {kHz(100), MHz(30), FT1000MP_ALL_RX_MODES, -1, -1, FT1000MP_VFOS, FT1000MP_ANTS }, /* General coverage + ham */ RIG_FRNG_END, }, /* Region 2 rx ranges */ .tx_range_list2 = { FRQ_RNG_HF(1,FT1000MP_OTHER_TX_MODES, W(5),W(100),FT1000MP_VFOS,FT1000MP_ANTS), FRQ_RNG_HF(1,FT1000MP_AM_TX_MODES, W(2),W(25),FT1000MP_VFOS,FT1000MP_ANTS), /* AM class */ RIG_FRNG_END, }, /* region 2 TX ranges */ .tuning_steps = { {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY, Hz(10)}, /* Normal */ {RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY, Hz(100)}, /* Fast */ {RIG_MODE_AM, Hz(100)}, /* Normal */ {RIG_MODE_AM, kHz(1)}, /* Fast */ {RIG_MODE_FM, Hz(100)}, /* Normal */ {RIG_MODE_FM, kHz(1)}, /* Fast */ RIG_TS_END, /* * The FT-1000MP has a Fine tuning step which increments in 1 Hz steps * for SSB_CW_RX_MODES, and 10 Hz steps for AM_RX_MODES and * FM_RX_MODES. It doesn't appear that anything finer than 10 Hz * is available through the CAT interface, however. -N0NB * */ }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY|RIG_MODE_AM, kHz(2.4)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_RTTY, kHz(2.0)}, {RIG_MODE_CW|RIG_MODE_RTTY, Hz(500)}, {RIG_MODE_CW|RIG_MODE_RTTY, Hz(250)}, {RIG_MODE_AM, kHz(5)}, /* wide */ {RIG_MODE_FM, kHz(8)}, /* FM */ RIG_FLT_END, }, .str_cal = FT1000MP_STR_CAL, .priv = NULL, /* private data */ .rig_init = ft1000mp_init, .rig_cleanup = ft1000mp_cleanup, .rig_open = ft1000mp_open, /* port opened */ .set_freq = ft1000mp_set_freq, /* set freq */ .get_freq = ft1000mp_get_freq, /* get freq */ .set_mode = ft1000mp_set_mode, /* set mode */ .get_mode = ft1000mp_get_mode, /* get mode */ .set_vfo = ft1000mp_set_vfo, /* set vfo */ .get_vfo = ft1000mp_get_vfo, /* get vfo */ .get_rit = ft1000mp_get_rit, .set_rit = ft1000mp_set_rit, .get_xit = ft1000mp_get_xit, .set_xit = ft1000mp_set_xit, .get_level = ft1000mp_get_level, .set_ptt = ft1000mp_set_ptt, /* TODO: the remaining ... */ }; /* * _init * */ int ft1000mp_init(RIG *rig) { struct ft1000mp_priv_data *p; rig_debug(RIG_DEBUG_TRACE,"ft1000mp: ft1000mp_init called \n"); p = (struct ft1000mp_priv_data*)malloc(sizeof(struct ft1000mp_priv_data)); if (!p) /* whoops! memory shortage! */ return -RIG_ENOMEM; /* * Copy native cmd set to private cmd storage area */ memcpy(p->pcs,ncmd,sizeof(ncmd)); /* TODO: read pacing from preferences */ p->pacing = FT1000MP_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */ p->read_update_delay = FT1000MP_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */ p->current_vfo = RIG_VFO_A; /* default to VFO_A ? */ rig->state.priv = (void*)p; return RIG_OK; } /* * ft1000mp_cleanup routine * the serial port is closed by the frontend * */ int ft1000mp_cleanup(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "ft1000mp: ft1000mp_cleanup called\n"); if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * ft1000mp_open routine * */ int ft1000mp_open(RIG *rig) { struct rig_state *rig_s; struct ft1000mp_priv_data *p; unsigned char *cmd; /* points to sequence to send */ rig_debug(RIG_DEBUG_VERBOSE, "ft1000mp: ft1000mp_open called\n"); rig_s = &rig->state; p = (struct ft1000mp_priv_data *)rig_s->priv; rig_debug(RIG_DEBUG_TRACE,"ft1000mp: rig_open: write_delay = %i msec \n", rig_s->rigport.write_delay); rig_debug(RIG_DEBUG_TRACE,"ft1000mp: rig_open: post_write_delay = %i msec \n", rig_s->rigport.post_write_delay); /* * Copy native cmd PACING to private cmd storage area */ memcpy(&p->p_cmd, &ncmd[FT1000MP_NATIVE_PACING].nseq, YAESU_CMD_LENGTH); p->p_cmd[3] = p->pacing; /* get pacing value, and store in private cmd */ rig_debug(RIG_DEBUG_TRACE,"ft1000mp: read pacing = %i\n",p->pacing); /* send PACING cmd to rig */ cmd = p->p_cmd; write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH); /* TODO */ return RIG_OK; } int ft1000mp_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct rig_state *rig_s; struct ft1000mp_priv_data *p; unsigned char *cmd; /* points to sequence to send */ int cmd_index = 0; rig_debug(RIG_DEBUG_TRACE,"ft1000mp: ft1000mp_set_freq called\n"); p = (struct ft1000mp_priv_data*)rig->state.priv; rig_s = &rig->state; rig_debug(RIG_DEBUG_TRACE,"ft1000mp: requested freq = %"PRIfreq" Hz \n", freq); if (vfo == RIG_VFO_CURR) vfo = p->current_vfo; switch (vfo) { case RIG_VFO_A: cmd_index = FT1000MP_NATIVE_FREQA_SET; break; case RIG_VFO_B: cmd_index = FT1000MP_NATIVE_FREQB_SET; break; case RIG_VFO_MEM: /* TODO, hint: store current memory number */ return -RIG_ENIMPL; default: rig_debug(RIG_DEBUG_WARN,"ft1000mp: unknown VFO %d\n", vfo); return -RIG_EINVAL; } /* * Copy native cmd freq_set to private cmd storage area */ memcpy(&p->p_cmd,&ncmd[cmd_index].nseq,YAESU_CMD_LENGTH); to_bcd(p->p_cmd,freq/10,8); /* store bcd format in in p_cmd */ /* TODO -- fix 10Hz resolution -- FS */ rig_debug(RIG_DEBUG_TRACE,"ft1000mp: requested freq after conversion = %"PRIll" Hz\n", from_bcd(p->p_cmd,8)* 10 ); cmd = p->p_cmd; /* get native sequence */ write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH); return RIG_OK; } /* * Return Freq for a given VFO * */ int ft1000mp_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft1000mp_priv_data *priv; unsigned char *p; freq_t f; int cmd_index, len, retval; rig_debug(RIG_DEBUG_VERBOSE,"ft1000mp: ft1000mp_get_freq called\n"); priv = (struct ft1000mp_priv_data*)rig->state.priv; if (vfo == RIG_VFO_A || vfo == RIG_VFO_B) { cmd_index = FT1000MP_NATIVE_VFO_UPDATE; len = 2*FT1000MP_STATUS_UPDATE_LENGTH; } else { /* RIG_VFO_CURR or RIG_VFO_MEM */ cmd_index = FT1000MP_NATIVE_CURR_VFO_UPDATE; len = FT1000MP_STATUS_UPDATE_LENGTH; } /* * get record from rig */ retval = ft1000mp_get_update_data(rig, cmd_index, len); if (retval < 0) return retval; if (vfo == RIG_VFO_B) p = &priv->update_data[FT1000MP_SUMO_VFO_B_FREQ]; else p = &priv->update_data[FT1000MP_SUMO_VFO_A_FREQ]; /* CURR_VFO has VFOA offset */ /* big endian integer, kinda */ f = ((((((p[0]<<8) + p[1])<<8) + p[2])<<8) + p[3])*10/16; rig_debug(RIG_DEBUG_TRACE,"ft1000mp: freq = %"PRIfreq" Hz for VFO [%x]\n", f, vfo); *freq = f; /* return diplayed frequency */ return RIG_OK; } /* * set mode : eg AM, CW etc for a given VFO * */ int ft1000mp_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) { unsigned char cmd_index = 0; /* index of sequence to send */ rig_debug(RIG_DEBUG_VERBOSE,"ft1000mp: ft1000mp_set_mode called\n"); /* frontend sets VFO for us */ rig_debug(RIG_DEBUG_TRACE,"ft1000mp: generic mode = %x\n", mode); /* * translate mode from generic to ft1000mp specific */ switch(mode) { case RIG_MODE_AM: cmd_index = FT1000MP_NATIVE_MODE_SET_AM; break; case RIG_MODE_CW: cmd_index = FT1000MP_NATIVE_MODE_SET_CW; break; case RIG_MODE_USB: cmd_index = FT1000MP_NATIVE_MODE_SET_USB; break; case RIG_MODE_LSB: cmd_index = FT1000MP_NATIVE_MODE_SET_LSB; break; case RIG_MODE_FM: cmd_index = FT1000MP_NATIVE_MODE_SET_FM; break; case RIG_MODE_RTTY: cmd_index = FT1000MP_NATIVE_MODE_SET_RTTY_LSB; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } /* * Now set width * FIXME: so far setting passband is buggy, only 0 is accepted */ /* * phew! now send cmd to rig */ ft1000mp_send_priv_cmd(rig,cmd_index); rig_debug(RIG_DEBUG_TRACE,"ft1000mp: cmd_index = %i\n", cmd_index); return RIG_OK; /* good */ } /* * get mode : eg AM, CW etc for a given VFO * */ int ft1000mp_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct ft1000mp_priv_data *priv; unsigned char mymode; /* ft1000mp mode */ int cmd_index, len, retval; rig_debug(RIG_DEBUG_VERBOSE,"ft1000mp: ft1000mp_get_mode called\n"); priv = (struct ft1000mp_priv_data*)rig->state.priv; if (vfo == RIG_VFO_A || vfo == RIG_VFO_B) { cmd_index = FT1000MP_NATIVE_VFO_UPDATE; len = 2*FT1000MP_STATUS_UPDATE_LENGTH; } else { /* RIG_VFO_CURR or RIG_VFO_MEM */ cmd_index = FT1000MP_NATIVE_CURR_VFO_UPDATE; len = FT1000MP_STATUS_UPDATE_LENGTH; } /* * get record from rig */ retval = ft1000mp_get_update_data(rig, cmd_index, len); if (retval < 0) return retval; if (vfo == RIG_VFO_B) mymode = priv->update_data[FT1000MP_SUMO_VFO_B_MODE]; else mymode = priv->update_data[FT1000MP_SUMO_VFO_A_MODE]; /* CURR_VFO is VFOA offset */ rig_debug(RIG_DEBUG_TRACE,"ft1000mp: mymode = %x (before)\n", mymode); mymode &= MODE_MASK; rig_debug(RIG_DEBUG_TRACE,"ft1000mp: mymode = %x (after)\n", mymode); /* * translate mode from ft1000mp to generic. * TODO: Add DATA, and Narrow modes. CW on LSB? -N0NB */ switch(mymode) { case MODE_CW: *mode = RIG_MODE_CW; break; case MODE_USB: *mode = RIG_MODE_USB; break; case MODE_LSB: *mode = RIG_MODE_LSB; break; case MODE_AM: *mode = RIG_MODE_AM; break; case MODE_FM: *mode = RIG_MODE_FM; break; case MODE_RTTY: *mode = RIG_MODE_RTTY; break; default: return -RIG_EINVAL; /* sorry, wrong mode */ break; } rig_debug(RIG_DEBUG_TRACE,"ft1000mp: mode = %s\n", rig_strrmode(*mode)); /* TODO: set real IF filter selection */ *width = RIG_PASSBAND_NORMAL; return RIG_OK; } /* * set vfo and store requested vfo for later RIG_VFO_CURR * requests. * */ int ft1000mp_set_vfo(RIG *rig, vfo_t vfo) { struct ft1000mp_priv_data *p; unsigned char cmd_index = 0; /* index of sequence to send */ rig_debug(RIG_DEBUG_TRACE,"ft1000mp: ft1000mp_set_vfo called %s\n", rig_strvfo(vfo)); p = (struct ft1000mp_priv_data*)rig->state.priv; /* * RIG_VFO_VFO/RIG_VFO_MEM are not available * so try to emulate them. * looks like there's no RIG_VFO_MEM, maybe setting mem# * switch to it automatically? */ if (vfo == RIG_VFO_VFO) { vfo = p->current_vfo; } switch(vfo) { case RIG_VFO_A: cmd_index = FT1000MP_NATIVE_VFO_A; p->current_vfo = vfo; /* update active VFO */ rig_debug(RIG_DEBUG_TRACE,"ft1000mp: vfo == RIG_VFO_A\n"); break; case RIG_VFO_B: cmd_index = FT1000MP_NATIVE_VFO_B; p->current_vfo = vfo; /* update active VFO */ rig_debug(RIG_DEBUG_TRACE,"ft1000mp: vfo == RIG_VFO_B\n"); break; case RIG_VFO_CURR: /* do nothing, we're already at it! */ return RIG_OK; default: rig_debug(RIG_DEBUG_VERBOSE,"ft1000mp: Unknown default VFO %d\n", vfo); return -RIG_EINVAL; /* sorry, wrong VFO */ } /* * phew! now send cmd to rig */ ft1000mp_send_priv_cmd(rig,cmd_index); return RIG_OK; } /* * get vfo and store requested vfo for later RIG_VFO_CURR * requests. * */ int ft1000mp_get_vfo(RIG *rig, vfo_t *vfo) { struct ft1000mp_priv_data *p; int retval; rig_debug(RIG_DEBUG_VERBOSE,"ft1000mp: ft1000mp_get_vfo called\n"); p = (struct ft1000mp_priv_data*)rig->state.priv; /* Get flags for VFO status */ retval = ft1000mp_get_update_data(rig, FT1000MP_NATIVE_UPDATE, FT1000MP_STATUS_FLAGS_LENGTH); if (retval < 0) return retval; if (p->update_data[1] & 0x40) *vfo = RIG_VFO_MEM; else if (p->update_data[FT1000MP_SUMO_DISPLAYED_STATUS] & SF_VFOAB) *vfo = p->current_vfo = RIG_VFO_B; else *vfo = p->current_vfo = RIG_VFO_A; rig_debug(RIG_DEBUG_TRACE,"ft1000mp: vfo status = %x %x\n", p->update_data[0], p->update_data[1]); return RIG_OK; } /* * set_rit only support vfo = RIG_VFO_CURR */ int ft1000mp_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { struct rig_state *rs; struct ft1000mp_priv_data *priv; unsigned char *cmd; /* points to sequence to send */ rig_debug(RIG_DEBUG_TRACE,"ft1000mp: ft1000mp_set_rit called\n"); rs = &rig->state; priv = (struct ft1000mp_priv_data*)rs->priv; rig_debug(RIG_DEBUG_TRACE,"ft1000mp: requested freq = %li Hz \n", rit); /* * Copy native cmd freq_set to private cmd storage area */ memcpy(&priv->p_cmd,&ncmd[FT1000MP_NATIVE_RIT_ON].nseq,YAESU_CMD_LENGTH); to_bcd(priv->p_cmd, labs(rit)/10, 4); /* store bcd format in in p_cmd */ priv->p_cmd[2] = rit >= 0 ? 0x00 : 0xff; cmd = priv->p_cmd; /* get native sequence */ write_block(&rs->rigport, (char *) cmd, YAESU_CMD_LENGTH); return RIG_OK; } /* * Return RIT for a given VFO * */ int ft1000mp_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { struct ft1000mp_priv_data *priv; unsigned char *p; shortfreq_t f; int cmd_index, len, retval; rig_debug(RIG_DEBUG_VERBOSE,"ft1000mp: ft1000mp_get_rit called\n"); priv = (struct ft1000mp_priv_data*)rig->state.priv; if (vfo == RIG_VFO_CURR) vfo = priv->current_vfo; if (vfo == RIG_VFO_A || vfo == RIG_VFO_B) { cmd_index = FT1000MP_NATIVE_VFO_UPDATE; len = 2*FT1000MP_STATUS_UPDATE_LENGTH; } else { /* RIG_VFO_CURR or RIG_VFO_MEM */ cmd_index = FT1000MP_NATIVE_CURR_VFO_UPDATE; len = FT1000MP_STATUS_UPDATE_LENGTH; } /* * get record from rig */ retval = ft1000mp_get_update_data(rig, cmd_index, len); if (retval < 0) return retval; if (vfo == RIG_VFO_B) p = &priv->update_data[FT1000MP_SUMO_VFO_B_CLAR]; else p = &priv->update_data[FT1000MP_SUMO_VFO_A_CLAR]; /* CURR_VFO has VFOA offset */ /* big endian integer, kinda */ if (p[0] & 0x80) f = (p[0]<<8) + p[1] - 65536; else f = (p[0]<<8) + p[1]; f = f*10/16; rig_debug(RIG_DEBUG_TRACE,"ft1000mp: freq = %li Hz for VFO [%x]\n", f, vfo); *rit = f; /* return diplayed frequency */ return RIG_OK; } /* * set_xit only support vfo = RIG_VFO_CURR */ int ft1000mp_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit) { struct rig_state *rs; struct ft1000mp_priv_data *priv; unsigned char *cmd; /* points to sequence to send */ rig_debug(RIG_DEBUG_TRACE,"ft1000mp: ft1000mp_set_xit called\n"); rs = &rig->state; priv = (struct ft1000mp_priv_data*)rs->priv; rig_debug(RIG_DEBUG_TRACE,"ft1000mp: requested freq = %li Hz \n", xit); /* * Copy native cmd freq_set to private cmd storage area */ memcpy(&priv->p_cmd,&ncmd[FT1000MP_NATIVE_XIT_ON].nseq,YAESU_CMD_LENGTH); to_bcd(priv->p_cmd, labs(xit)/10, 4); /* store bcd format in in p_cmd */ priv->p_cmd[2] = xit >= 0 ? 0x00 : 0xff; cmd = priv->p_cmd; /* get native sequence */ write_block(&rs->rigport, (char *) cmd, YAESU_CMD_LENGTH); return RIG_OK; } /* * Return XIT for a given VFO * */ int ft1000mp_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit) { struct ft1000mp_priv_data *priv; unsigned char *p; shortfreq_t f; int cmd_index, len, retval; rig_debug(RIG_DEBUG_VERBOSE,"ft1000mp: ft1000mp_get_xit called\n"); priv = (struct ft1000mp_priv_data*)rig->state.priv; if (vfo == RIG_VFO_CURR) vfo = priv->current_vfo; if (vfo == RIG_VFO_A || vfo == RIG_VFO_B) { cmd_index = FT1000MP_NATIVE_VFO_UPDATE; len = 2*FT1000MP_STATUS_UPDATE_LENGTH; } else { /* RIG_VFO_CURR or RIG_VFO_MEM */ cmd_index = FT1000MP_NATIVE_CURR_VFO_UPDATE; len = FT1000MP_STATUS_UPDATE_LENGTH; } /* * get record from rig */ retval = ft1000mp_get_update_data(rig, cmd_index, len); if (retval < 0) return retval; if (vfo == RIG_VFO_B) p = &priv->update_data[FT1000MP_SUMO_VFO_B_CLAR]; else p = &priv->update_data[FT1000MP_SUMO_VFO_A_CLAR]; /* CURR_VFO has VFOA offset */ /* big endian integer, kinda */ if (p[0] & 0x80) f = (p[0]<<8) + p[1] - 65536; else f = (p[0]<<8) + p[1]; f = f*10/16; rig_debug(RIG_DEBUG_TRACE,"ft1000mp: freq = %li Hz for VFO [%x]\n", f, vfo); *xit = f; /* return diplayed frequency */ return RIG_OK; } int ft1000mp_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct ft1000mp_priv_data *priv; struct rig_state *rs; unsigned char lvl_data[YAESU_CMD_LENGTH]; int m; int retval; rs = &rig->state; priv = (struct ft1000mp_priv_data*)rs->priv; /* Optimize: * sort the switch cases with the most frequent first */ switch (level) { case RIG_LEVEL_RAWSTR: if (vfo == RIG_VFO_CURR) vfo = priv->current_vfo; m = vfo == RIG_VFO_B ? 0x01 : 0x00; break; case RIG_LEVEL_RFPOWER: m = 0x80; break; case RIG_LEVEL_ALC: m = 0x81; break; case RIG_LEVEL_COMP: m = 0x83; break; case RIG_LEVEL_SWR: m = 0x85; break; case RIG_LEVEL_MICGAIN: /* not sure ... */ m = 0x86; break; case RIG_LEVEL_CWPITCH: m = 0xf1; break; case RIG_LEVEL_IF: /* not sure ... */ m = 0xf3; break; default: rig_debug(RIG_DEBUG_ERR,"Unsupported get_level %d", level); return -RIG_EINVAL; } memset(&priv->p_cmd, m, YAESU_CMD_LENGTH-1); priv->p_cmd[4] = 0xf7; write_block(&rs->rigport, (char *) priv->p_cmd, YAESU_CMD_LENGTH); retval = read_block(&rs->rigport, (char *) lvl_data, YAESU_CMD_LENGTH); if (retval != YAESU_CMD_LENGTH) { rig_debug(RIG_DEBUG_ERR,"ft1000mp_get_level: ack NG %d", retval); return retval; } switch (level) { case RIG_LEVEL_RAWSTR: val->i = lvl_data[0]; break; default: if (RIG_LEVEL_IS_FLOAT(level)) val->f = (float)lvl_data[0]/255; else val->i = lvl_data[0]; } rig_debug(RIG_DEBUG_TRACE,"ft1000mp_get_level: %d %d %f\n", lvl_data[0], val->i, val->f); return RIG_OK; } int ft1000mp_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { unsigned char cmd_index; /* index of sequence to send */ rig_debug(RIG_DEBUG_TRACE,"ft1000mp: ft1000mp_set_ptt called %d\n", ptt); cmd_index = ptt ? FT1000MP_NATIVE_PTT_ON : FT1000MP_NATIVE_PTT_OFF; ft1000mp_send_priv_cmd(rig,cmd_index); return RIG_OK; } /* * private helper function. Retrieves update data from rig. * using buffer indicated in *priv struct. * Extended to be command agnostic as 1000mp has several ways to * get data and several ways to return it. * * need to use this when doing ft1000mp_get_* stuff * * Variables: ci = command index, rl = read length of returned data * */ static int ft1000mp_get_update_data(RIG *rig, unsigned char ci, unsigned char rl) { struct rig_state *rig_s; struct ft1000mp_priv_data *p; int n; /* for read_ */ rig_debug(RIG_DEBUG_VERBOSE,"ft1000mp: ft1000mp_get_update_data called\n"); p = (struct ft1000mp_priv_data*)rig->state.priv; rig_s = &rig->state; /* send UPDATE comand to fetch data*/ ft1000mp_send_priv_cmd(rig, ci); n = read_block(&rig_s->rigport, (char *) p->update_data, rl); return n; } /* * private helper function to send a private command * sequence . Must only be complete sequences. * TODO: place variant of this in yaesu.c * */ static int ft1000mp_send_priv_cmd(RIG *rig, unsigned char ci) { struct rig_state *rig_s; struct ft1000mp_priv_data *p; unsigned char *cmd; /* points to sequence to send */ unsigned char cmd_index; /* index of sequence to send */ rig_debug(RIG_DEBUG_VERBOSE,"ft1000mp: ft1000mp_send_priv_cmd called\n"); p = (struct ft1000mp_priv_data*)rig->state.priv; rig_s = &rig->state; cmd_index = ci; /* get command */ if (! p->pcs[cmd_index].ncomp) { rig_debug(RIG_DEBUG_TRACE,"ft1000mp: Attempt to send incomplete sequence\n"); return -RIG_EINVAL; } cmd = (unsigned char *) p->pcs[cmd_index].nseq; /* get native sequence */ write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH); return RIG_OK; } hamlib-1.2.15.3/yaesu/ft920.c0000644000175000017500000020572212044564477012301 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft920.c - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * (C) Nate Bargmann 2002-2005 (n0nb at arrl.net) * (C) Stephane Fillod 2002-2010 (fillods at users.sourceforge.net) * * This shared library provides an API for communicating * via serial interface to an FT-920 using the "CAT" interface * Documentation can be found online at: * http://www.yaesu.com/amateur/pdf/manuals/ft_920.pdf * pages 86 to 90 * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "bandplan.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "ft920.h" /* * Functions considered to be Stable (2010-01-29): * set_vfo * get_vfo * set_freq * get_freq * set_mode * get_mode * set_split * get_split * set_split_freq * get_split_freq * set_split_mode * get_split_mode * set_rit * get_rit * set_xit * get_xit * set_ptt * get_ptt */ /* Private helper function prototypes */ static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl); static int ft920_send_static_cmd(RIG *rig, unsigned char ci); static int ft920_send_dynamic_cmd(RIG *rig, unsigned char ci, unsigned char p1, unsigned char p2, unsigned char p3, unsigned char p4); static int ft920_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq); static int ft920_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit); /* * Native ft920 cmd set prototypes. These are READ ONLY as each * rig instance will copy from these and modify if required. * Complete sequences (1) can be read and used directly as a cmd sequence. * Incomplete sequences (0) must be completed with extra parameters * eg: mem number, or freq etc.. * * TODO: Shorten this static array with parameter substitution -N0NB * */ static const yaesu_cmd_set_t ncmd[] = { { 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* split = off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* split = on */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* recall memory */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* memory operations */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* select vfo A */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* select vfo B */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x06 } }, /* copy memory data to vfo A */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, /* clarifier operations */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* set vfo A freq */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* mode set */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0e } }, /* update interval/pacing */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0f } }, /* PTT off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0f } }, /* PTT on */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x10 } }, /* Status Update Data--Memory Channel Number (1 byte) */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x10 } }, /* Status Update Data--Current operating data for VFO/Memory (28 bytes) */ { 1, { 0x00, 0x00, 0x00, 0x03, 0x10 } }, /* Status Update DATA--VFO A and B Data (28 bytes) */ { 0, { 0x00, 0x00, 0x00, 0x04, 0x10 } }, /* Status Update Data--Memory Channel Data (14 bytes) P4 = 0x00-0x89 Memory Channel Number */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x81 } }, /* Tuner bypass */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x81 } }, /* Tuner inline */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x82 } }, /* Tuner start tuning for match */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x8a } }, /* set vfo B frequency */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x8c } }, /* VFO A wide filter */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x8c } }, /* VFO A narrow filter */ { 1, { 0x00, 0x00, 0x00, 0x80, 0x8c } }, /* VFO B wide filter */ { 1, { 0x00, 0x00, 0x00, 0x82, 0x8c } }, /* VFO B narrow filter */ { 1, { 0x00, 0x00, 0x00, 0x01, 0xFA } }, /* Read status flags */ /* { 0, { 0x00, 0x00, 0x00, 0x00, 0x70 } }, */ /* keyer commands */ }; /* * future - private data * * FIXME: Does this need to be exposed to the application/frontend through * ft920_caps.priv? I'm guessing not as it's private to the backend. -N0NB */ struct ft920_priv_data { unsigned char pacing; /* pacing value */ unsigned int read_update_delay; /* depends on pacing value */ vfo_t current_vfo; /* active VFO from last cmd */ vfo_t split_vfo; /* TX VFO in split mode */ split_t split; /* split active or not */ unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */ yaesu_cmd_set_t pcs[FT920_NATIVE_SIZE]; /* private cmd set */ unsigned char update_data[FT920_VFO_DATA_LENGTH]; /* returned data--max value, some are less */ }; /* * ft920 rigs capabilities. * Also this struct is READONLY! * */ const struct rig_caps ft920_caps = { .rig_model = RIG_MODEL_FT920, .model_name = "FT-920", .mfg_name = "Yaesu", .version = "2010-08-23", /* YYYY-MM-DD */ .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT920_WRITE_DELAY, .post_write_delay = FT920_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = FT920_FUNC_ALL, .has_set_func = RIG_FUNC_TUNER, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(0), .announces = RIG_ANN_NONE, .vfo_ops = RIG_OP_NONE, .scan_ops = RIG_SCAN_NONE, .targetable_vfo = RIG_TARGETABLE_ALL, .transceive = RIG_TRN_OFF, /* Yaesus have to be polled, sigh */ .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, /* FIXME: memory channel list: 122 (!) */ .rx_range_list1 = { {kHz(100), MHz(30), FT920_ALL_RX_MODES, -1, -1, FT920_VFO_ALL, FT920_ANTS}, /* General coverage + ham */ {MHz(48), MHz(56), FT920_ALL_RX_MODES, -1, -1, FT920_VFO_ALL, FT920_ANTS}, /* 6m! */ RIG_FRNG_END, }, /* FIXME: Are these the correct Region 1 values? */ .tx_range_list1 = { FRQ_RNG_HF(1, FT920_OTHER_TX_MODES, W(5), W(100), FT920_VFO_ALL, FT920_ANTS), FRQ_RNG_HF(1, FT920_AM_TX_MODES, W(2), W(25), FT920_VFO_ALL, FT920_ANTS), /* AM class */ FRQ_RNG_6m(1, FT920_OTHER_TX_MODES, W(5), W(100), FT920_VFO_ALL, FT920_ANTS), FRQ_RNG_6m(1, FT920_AM_TX_MODES, W(2), W(25), FT920_VFO_ALL, FT920_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100), MHz(30), FT920_ALL_RX_MODES, -1, -1, FT920_VFO_ALL, FT920_ANTS}, {MHz(48), MHz(56), FT920_ALL_RX_MODES, -1, -1, FT920_VFO_ALL, FT920_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2, FT920_OTHER_TX_MODES, W(5), W(100), FT920_VFO_ALL, FT920_ANTS), FRQ_RNG_HF(2, FT920_AM_TX_MODES, W(2), W(25), FT920_VFO_ALL, FT920_ANTS), /* AM class */ FRQ_RNG_6m(2, FT920_OTHER_TX_MODES, W(5), W(100), FT920_VFO_ALL, FT920_ANTS), FRQ_RNG_6m(2, FT920_AM_TX_MODES, W(2), W(25), FT920_VFO_ALL, FT920_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {FT920_SSB_CW_RX_MODES, Hz(10)}, /* Normal */ {FT920_SSB_CW_RX_MODES, Hz(100)}, /* Fast */ {FT920_AM_RX_MODES, Hz(100)}, /* Normal */ {FT920_AM_RX_MODES, kHz(1)}, /* Fast */ {FT920_FM_RX_MODES, Hz(100)}, /* Normal */ {FT920_FM_RX_MODES, kHz(1)}, /* Fast */ RIG_TS_END, /* * The FT-920 has a Fine tuning step which increments in 1 Hz steps * for SSB_CW_RX_MODES, and 10 Hz steps for AM_RX_MODES and * FM_RX_MODES. It doesn't appear that anything finer than 10 Hz * is available through the CAT interface, however. -N0NB * */ }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_SSB, kHz(2.4)}, /* standard SSB filter bandwidth */ {RIG_MODE_CW, kHz(2.4)}, /* normal CW filter */ {RIG_MODE_CW, kHz(0.5)}, /* CW filter with narrow selection (must be installed!) */ {RIG_MODE_AM, kHz(15)}, /* normal AM filter (stock radio has no AM filter!) */ {RIG_MODE_AM, kHz(2.4)}, /* AM filter with narrow selection (SSB filter switched in) */ {RIG_MODE_FM, kHz(12)}, /* FM with optional FM unit */ {RIG_MODE_WFM, kHz(12)}, /* WideFM, with optional FM unit. */ {RIG_MODE_PKTLSB, kHz(1.8)},/* Alias of MODE_DATA_L */ {RIG_MODE_PKTLSB, kHz(0.5)},/* Alias of MODE_DATA_LN */ {RIG_MODE_PKTUSB,kHz(2.4)}, /* Alias for MODE DATA_U */ {RIG_MODE_PKTUSB, kHz(0.5)},/* Alias of MODE_DATA_UN */ {RIG_MODE_PKTFM, kHz(12)}, /* Alias for MODE_DATA _F */ {RIG_MODE_PKTFM, kHz(6)}, /* Alias for MODE_DATA_FN */ RIG_FLT_END, }, .str_cal = EMPTY_STR_CAL, .cfgparams = NULL, .priv = NULL, /* private data FIXME: ?? */ .rig_init = ft920_init, .rig_cleanup = ft920_cleanup, .rig_open = ft920_open, /* port opened */ .rig_close = ft920_close, /* port closed */ .set_freq = ft920_set_freq, .get_freq = ft920_get_freq, .set_mode = ft920_set_mode, .get_mode = ft920_get_mode, .set_vfo = ft920_set_vfo, .get_vfo = ft920_get_vfo, .set_ptt = ft920_set_ptt, .get_ptt = ft920_get_ptt, .get_dcd = NULL, .set_rptr_shift = NULL, .get_rptr_shift = NULL, .set_rptr_offs = NULL, .get_rptr_offs= NULL, .set_split_freq = ft920_set_split_freq, .get_split_freq = ft920_get_split_freq, .set_split_mode = ft920_set_split_mode, .get_split_mode = ft920_get_split_mode, .set_split_vfo = ft920_set_split_vfo, .get_split_vfo = ft920_get_split_vfo, .set_rit = ft920_set_rit, .get_rit = ft920_get_rit, .set_xit = ft920_set_xit, .get_xit = ft920_get_xit, .set_ts = NULL, .get_ts = NULL, .set_dcs_code = NULL, .get_dcs_code = NULL, .set_tone = NULL, .get_tone = NULL, .set_ctcss_tone = NULL, .get_ctcss_tone = NULL, .set_dcs_sql = NULL, .get_dcs_sql = NULL, .set_tone_sql = NULL, .get_tone_sql = NULL, .set_ctcss_sql = NULL, .get_ctcss_sql = NULL, .power2mW = NULL, .mW2power = NULL, .set_powerstat = NULL, .get_powerstat = NULL, .reset = NULL, .set_ant = NULL, .get_ant = NULL, .set_level = NULL, .get_level = NULL, .set_func = ft920_set_func, .get_func = ft920_get_func, .set_parm = NULL, .get_parm = NULL, .set_ext_level = NULL, .get_ext_level = NULL, .set_ext_parm = NULL, .get_ext_parm = NULL, .set_conf = NULL, .get_conf = NULL, .send_dtmf = NULL, .recv_dtmf = NULL, .send_morse = NULL, .set_bank = NULL, .set_mem = NULL, .get_mem = NULL, .vfo_op = NULL, .scan = NULL, .set_trn = NULL, .get_trn = NULL, .decode_event = NULL, .set_channel = NULL, .get_channel = NULL, .get_info = NULL, .set_chan_all_cb = NULL, .get_chan_all_cb = NULL, .set_mem_all_cb = NULL, .get_mem_all_cb = NULL, .clone_combo_set = NULL, .clone_combo_get = NULL, }; /* * ************************************ * * Hamlib API functions * * ************************************ */ /* * rig_init* * */ static int ft920_init(RIG *rig) { struct ft920_priv_data *priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft920_priv_data *)malloc(sizeof(struct ft920_priv_data)); if (!priv) return -RIG_ENOMEM; /* whoops! memory shortage! */ /* * Copy native cmd set to private cmd storage area */ memcpy(priv->pcs, ncmd, sizeof(ncmd)); /* TODO: read pacing from preferences */ priv->pacing = FT920_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */ priv->read_update_delay = FT920_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */ priv->current_vfo = RIG_VFO_A; /* default to VFO_A */ rig->state.priv = (void *)priv; return RIG_OK; } /* * rig_cleanup* * * the serial port is closed by the frontend * */ static int ft920_cleanup(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * rig_open* * */ static int ft920_open(RIG *rig) { struct rig_state *rig_s; struct ft920_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft920_priv_data *)rig->state.priv; rig_s = &rig->state; rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n", __func__, rig_s->rigport.write_delay); rig_debug(RIG_DEBUG_TRACE, "%s: post_write_delay = %i msec\n", __func__, rig_s->rigport.post_write_delay); /* Copy native cmd PACING to private cmd storage area */ memcpy(&priv->p_cmd, &ncmd[FT920_NATIVE_PACING].nseq, YAESU_CMD_LENGTH); /* get pacing value, and store in private cmd */ priv->p_cmd[P1] = priv->pacing; rig_debug(RIG_DEBUG_TRACE, "%s: read pacing = %i\n", __func__, priv->pacing); err = write_block(&rig_s->rigport, (char *) priv->p_cmd, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; /* TODO: more initialization as necessary */ return RIG_OK; } /* * rig_close* * */ static int ft920_close(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; return RIG_OK; } /* * rig_set_freq* * * Set freq for a given VFO * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | RIG_VFO_A, RIG_VFO_B, RIG_VFO_MEM * freq | input | frequency to passed VFO * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: If vfo is set to RIG_VFO_CUR then vfo from * priv_data is used. * */ static int ft920_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct ft920_priv_data *priv; int err, cmd_index; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft920_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq); if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_A: /* force main display to VFO */ case RIG_VFO_VFO: err = ft920_set_vfo(rig, RIG_VFO_A); if (err != RIG_OK) return err; case RIG_VFO_MEM: /* MEM TUNE or user doesn't care */ case RIG_VFO_MAIN: cmd_index = FT920_NATIVE_VFO_A_FREQ_SET; break; case RIG_VFO_B: case RIG_VFO_SUB: cmd_index = FT920_NATIVE_VFO_B_FREQ_SET; break; default: return -RIG_EINVAL; /* sorry, unsupported VFO */ } rig_debug(RIG_DEBUG_TRACE, "%s: set cmd_index = 0x%02x\n", __func__, cmd_index); err = ft920_send_dial_freq(rig, cmd_index, freq); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_freq* * * Return Freq for a given VFO * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | RIG_VFO_A, RIG_VFO_B, RIG_VFO_MEM * *freq | output | displayed frequency based on passed VFO * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * */ static int ft920_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft920_priv_data *priv; unsigned char *p; unsigned char offset; freq_t f; int err, cmd_index; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); if (!rig) return -RIG_EINVAL; priv = (struct ft920_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: cmd_index = FT920_NATIVE_VFO_DATA; offset = FT920_SUMO_VFO_A_FREQ; break; case RIG_VFO_B: case RIG_VFO_SUB: cmd_index = FT920_NATIVE_OP_DATA; offset = FT920_SUMO_VFO_B_FREQ; break; case RIG_VFO_MEM: case RIG_VFO_MAIN: cmd_index = FT920_NATIVE_OP_DATA; offset = FT920_SUMO_DISPLAYED_FREQ; break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } err = ft920_get_update_data(rig, cmd_index, FT920_VFO_DATA_LENGTH); if (err != RIG_OK) return err; p = &priv->update_data[offset]; /* big endian integer */ f = (((((p[0]<<8) + p[1])<<8) + p[2])<<8) + p[3]; rig_debug(RIG_DEBUG_TRACE, "%s: freq = %"PRIfreq" Hz for vfo 0x%02x\n", __func__, f, vfo); *freq = f; /* return displayed frequency */ return RIG_OK; } /* * rig_set_mode* * * Set mode and passband: eg AM, CW etc for a given VFO * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | RIG_VFO_A, RIG_VFO_B, RIG_VFO_MEM * mode | input | supported modes (see ft920.h) * width | input | supported widths (see ft920.h) * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: If vfo is set to RIG_VFO_CUR then vfo from * priv_data is used. * */ static int ft920_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) { struct ft920_priv_data *priv; unsigned char cmd_index = FT920_NATIVE_VFO_A_PASSBAND_WIDE; /* index of sequence to send */ unsigned char mode_parm; /* mode parameter */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed mode = %i\n", __func__, mode); rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %li Hz\n", __func__, width); priv = (struct ft920_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } /* translate mode from generic to ft920 specific */ switch(vfo) { case RIG_VFO_A: /* force to VFO */ case RIG_VFO_VFO: err = ft920_set_vfo(rig, RIG_VFO_A); if (err != RIG_OK) return err; case RIG_VFO_MEM: /* MEM TUNE or user doesn't care */ case RIG_VFO_MAIN: switch(mode) { case RIG_MODE_AM: mode_parm = MODE_SET_A_AM_W; break; case RIG_MODE_CW: mode_parm = MODE_SET_A_CW_U; break; case RIG_MODE_USB: mode_parm = MODE_SET_A_USB; break; case RIG_MODE_LSB: mode_parm = MODE_SET_A_LSB; break; case RIG_MODE_FM: mode_parm = MODE_SET_A_FM_W; break; case RIG_MODE_RTTY: mode_parm = MODE_SET_A_DATA_L; break; case RIG_MODE_PKTLSB: mode_parm = MODE_SET_A_DATA_L; break; case RIG_MODE_PKTUSB: mode_parm = MODE_SET_A_DATA_U; break; case RIG_MODE_PKTFM: mode_parm = MODE_SET_A_DATA_F; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } break; /* Now VFO B */ case RIG_VFO_B: case RIG_VFO_SUB: switch(mode) { case RIG_MODE_AM: mode_parm = MODE_SET_B_AM_W; break; case RIG_MODE_CW: mode_parm = MODE_SET_B_CW_U; break; case RIG_MODE_USB: mode_parm = MODE_SET_B_USB; break; case RIG_MODE_LSB: mode_parm = MODE_SET_B_LSB; break; case RIG_MODE_FM: mode_parm = MODE_SET_B_FM_W; break; case RIG_MODE_RTTY: mode_parm = MODE_SET_B_DATA_L; break; case RIG_MODE_PKTLSB: mode_parm = MODE_SET_B_DATA_L; break; case RIG_MODE_PKTUSB: mode_parm = MODE_SET_B_DATA_U; break; case RIG_MODE_PKTFM: mode_parm = MODE_SET_B_DATA_F; break; default: return -RIG_EINVAL; } break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } /* * Now set width (shamelessly stolen from ft847.c and then butchered :) * The FT-920 doesn't appear to support narrow width in USB or LSB modes * * Yeah, it's ugly... -N0NB * */ if (width == RIG_PASSBAND_NORMAL || width == rig_passband_normal(rig, mode)) { switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: case RIG_VFO_MEM: case RIG_VFO_MAIN: cmd_index = FT920_NATIVE_VFO_A_PASSBAND_WIDE; break; case RIG_VFO_B: case RIG_VFO_SUB: cmd_index = FT920_NATIVE_VFO_B_PASSBAND_WIDE; break; } } else { if (width == rig_passband_narrow(rig, mode)) { switch(mode) { case RIG_MODE_CW: case RIG_MODE_AM: case RIG_MODE_FM: case RIG_MODE_PKTFM: case RIG_MODE_RTTY: switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: case RIG_VFO_MEM: case RIG_VFO_MAIN: cmd_index = FT920_NATIVE_VFO_A_PASSBAND_NAR; break; case RIG_VFO_B: case RIG_VFO_SUB: cmd_index = FT920_NATIVE_VFO_B_PASSBAND_NAR; break; } break; default: return -RIG_EINVAL; /* Invalid mode; how can caller know? */ } } else { if (width != RIG_PASSBAND_NORMAL && width != rig_passband_normal(rig, mode)) { return -RIG_EINVAL; /* Invalid width; how can caller know? */ } } } rig_debug(RIG_DEBUG_TRACE, "%s: set mode_parm = 0x%02x\n", __func__, mode_parm); rig_debug(RIG_DEBUG_TRACE, "%s: set cmd_index = %i\n", __func__, cmd_index); err = ft920_send_dynamic_cmd(rig, FT920_NATIVE_MODE_SET, mode_parm, 0, 0, 0); if (err != RIG_OK) return err; err = ft920_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; /* Whew! */ } /* * rig_get_mode* * * Get mode and passband: eg AM, CW etc for a given VFO * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | RIG_VFO_A, RIG_VFO_B, RIG_VFO_MEM * *mode | output | supported modes (see ft920.h) * *width | output | supported widths (see ft920.h) * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * */ static int ft920_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct ft920_priv_data *priv; unsigned char mymode, offset; /* ft920 mode, flag offset */ int err, cmd_index, norm; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft920_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: cmd_index = FT920_NATIVE_VFO_DATA; offset = FT920_SUMO_DISPLAYED_MODE; break; case RIG_VFO_B: case RIG_VFO_SUB: cmd_index = FT920_NATIVE_VFO_DATA; offset = FT920_SUMO_VFO_B_MODE; break; case RIG_VFO_MEM: case RIG_VFO_MAIN: cmd_index = FT920_NATIVE_OP_DATA; offset = FT920_SUMO_DISPLAYED_MODE; break; default: return -RIG_EINVAL; } err = ft920_get_update_data(rig, cmd_index, FT920_VFO_DATA_LENGTH); if (err != RIG_OK) return err; mymode = priv->update_data[offset]; mymode &= MODE_MASK; rig_debug(RIG_DEBUG_TRACE, "%s: mymode = 0x%02x\n", __func__, mymode); /* * translate mode from ft920 to generic. * * FIXME: FT-920 has 3 DATA modes, LSB, USB, and FM * do we need more bit fields in rmode_t? -N0NB * */ switch(mymode) { case MODE_USBN: /* not sure this even exists */ *mode = RIG_MODE_USB; norm = FALSE; break; case MODE_USB: *mode = RIG_MODE_USB; norm = TRUE; break; case MODE_LSBN: /* not sure this even exists */ *mode = RIG_MODE_LSB; norm = FALSE; break; case MODE_LSB: *mode = RIG_MODE_LSB; norm = TRUE; break; case MODE_CW_UN: case MODE_CW_LN: *mode = RIG_MODE_CW; norm = FALSE; break; case MODE_CW_U: case MODE_CW_L: *mode = RIG_MODE_CW; norm = TRUE; break; case MODE_AMN: *mode = RIG_MODE_AM; norm = FALSE; break; case MODE_AM: *mode = RIG_MODE_AM; norm = TRUE; break; case MODE_FMN: *mode = RIG_MODE_FM; norm = FALSE; break; case MODE_FM: *mode = RIG_MODE_FM; norm = TRUE; break; case MODE_DATA_LN: *mode = RIG_MODE_PKTLSB; norm = FALSE; break; case MODE_DATA_L: *mode = RIG_MODE_PKTLSB; norm = TRUE; break; case MODE_DATA_UN: *mode = RIG_MODE_PKTUSB; norm = FALSE; break; case MODE_DATA_U: *mode = RIG_MODE_PKTUSB; norm = TRUE; break; case MODE_DATA_F: *mode = RIG_MODE_PKTFM; norm = TRUE; break; case MODE_DATA_FN: *mode = RIG_MODE_PKTFM; norm = FALSE; break; default: return -RIG_EINVAL; /* Oops! file bug report */ } if (norm) { *width = rig_passband_normal(rig, *mode); } else { *width = rig_passband_narrow(rig, *mode); } rig_debug(RIG_DEBUG_TRACE, "%s: set mode = %i\n", __func__, *mode); rig_debug(RIG_DEBUG_TRACE, "%s: set width = %li Hz\n", __func__, *width); return RIG_OK; } /* * rig_set_vfo* * * Get active VFO * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | RIG_VFO_A, RIG_VFO_B * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: Set vfo and store requested vfo for later * RIG_VFO_CURR requests. * */ static int ft920_set_vfo(RIG *rig, vfo_t vfo) { struct ft920_priv_data *priv; unsigned char cmd_index; /* index of sequence to send */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft920_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: case RIG_VFO_MAIN: cmd_index = FT920_NATIVE_VFO_A; priv->current_vfo = vfo; /* update active VFO */ break; case RIG_VFO_B: case RIG_VFO_SUB: cmd_index = FT920_NATIVE_VFO_B; priv->current_vfo = vfo; break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } rig_debug(RIG_DEBUG_TRACE, "%s: set cmd_index = %i\n", __func__, cmd_index); err = ft920_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_vfo* * * Get active VFO * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * *vfo | output | RIG_VFO_A, RIG_VFO_B, RIG_VFO_MEM * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: Get current RX vfo/mem and store requested vfo for * later RIG_VFO_CURR requests plus pass the tested * vfo/mem back to the frontend. * */ static int ft920_get_vfo(RIG *rig, vfo_t *vfo) { struct ft920_priv_data *priv; unsigned char status_0; /* ft920 status flag 0 */ unsigned char status_1; /* ft920 status flag 1 */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft920_priv_data *)rig->state.priv; /* Get flags for VFO status */ err = ft920_get_update_data(rig, FT920_NATIVE_STATUS_FLAGS, FT920_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; status_0 = priv->update_data[FT920_SUMO_DISPLAYED_STATUS_0]; status_0 &= SF_VFOB; /* get VFO B (sub display) active bits */ status_1 = priv->update_data[FT920_SUMO_DISPLAYED_STATUS_1]; status_1 &= SF_VFO_MASK; /* get VFO/MEM (main display) active bits */ rig_debug(RIG_DEBUG_TRACE, "%s: vfo status_0 = 0x%02x\n", __func__, status_0); rig_debug(RIG_DEBUG_TRACE, "%s: vfo status_1 = 0x%02x\n", __func__, status_1); /* * translate vfo status from ft920 to generic. * * Figuring out whether VFO B is the active RX vfo is tough as * Status Flag 0 bits 0 & 1 contain this information. Testing * Status Flag 1 only gives us the state of the main display. * */ switch (status_0) { case SF_VFOB: *vfo = RIG_VFO_B; priv->current_vfo = RIG_VFO_B; break; case SF_SPLITB: /* Split operation, RX on VFO B */ *vfo = RIG_VFO_B; priv->current_vfo = RIG_VFO_B; break; } /* * Okay now test for the active MEM/VFO status of the main display * */ switch (status_1) { case SF_QMB: case SF_MT: case SF_MR: *vfo = RIG_VFO_MEM; priv->current_vfo = RIG_VFO_MEM; break; case SF_VFO: switch (status_0){ case SF_SPLITA: /* Split operation, RX on VFO A */ *vfo = RIG_VFO_A; priv->current_vfo = RIG_VFO_A; break; case SF_VFOA: *vfo = RIG_VFO_A; priv->current_vfo = RIG_VFO_A; break; } break; default: /* Oops! */ return -RIG_EINVAL; /* sorry, wrong current VFO */ } rig_debug(RIG_DEBUG_TRACE, "%s: set vfo = 0x%02x\n", __func__, *vfo); return RIG_OK; } /* * rig_set_split_vfo* * * Set the '920 into split TX/RX mode * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | not used * split | input | RIG_SPLIT_ON, RIG_SPLIT_OFF * tx_vfo | input | VFO to use for TX (not used) * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: VFO cannot be set as the set split_on command only * changes the TX to the sub display. Setting split off * returns the TX to the main display. * */ static int ft920_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { unsigned char cmd_index; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed split = 0x%02x\n", __func__, split); rig_debug(RIG_DEBUG_TRACE, "%s: passed tx_vfo = 0x%02x\n", __func__, tx_vfo); switch(tx_vfo) { case RIG_VFO_A: case RIG_VFO_MAIN: case RIG_VFO_VFO: break; case RIG_VFO_B: case RIG_VFO_SUB: break; default: return -RIG_EINVAL; } switch(split) { case RIG_SPLIT_OFF: cmd_index = FT920_NATIVE_SPLIT_OFF; break; case RIG_SPLIT_ON: cmd_index = FT920_NATIVE_SPLIT_ON; break; default: return -RIG_EINVAL; } err = ft920_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_split_vfo* * * Get whether the '920 is in split mode * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | not used * *split | output | RIG_SPLIT_ON, RIG_SPLIT_OFF * *tx_vfo | output | not used * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * */ static int ft920_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { struct ft920_priv_data *priv; unsigned char status_0; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft920_priv_data *)rig->state.priv; /* Get flags for VFO split status */ err = ft920_get_update_data(rig, FT920_NATIVE_STATUS_FLAGS, FT920_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; status_0 = priv->update_data[FT920_SUMO_DISPLAYED_STATUS_0]; status_0 &= SF_VFOB; /* get VFO B (sub display) active bits */ rig_debug(RIG_DEBUG_TRACE, "%s: split status_0 = 0x%02x\n", __func__, status_0); switch (status_0) { case SF_SPLITA: /* VFOB (sub display) is TX Got that? */ *tx_vfo = RIG_VFO_B; *split = RIG_SPLIT_ON; break; case SF_SPLITB: /* VFOA is TX */ *tx_vfo = RIG_VFO_A; *split = RIG_SPLIT_ON; break; case SF_VFOA: *tx_vfo = RIG_VFO_A; *split = RIG_SPLIT_OFF; break; case SF_VFOB: *tx_vfo = RIG_VFO_B; *split = RIG_SPLIT_OFF; break; default: return -RIG_EINVAL; } return RIG_OK; } /* * rig_set_split_freq* * * Set the '920 split TX freq * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * tx_freq | input | split transmit frequency * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: Checks to see if 920 is in split mode and if so sets * the frequency of the TX VFO. If not in split mode * does nothing and returns. * */ static int ft920_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) { struct ft920_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, tx_freq); priv = (struct ft920_priv_data *)rig->state.priv; err = ft920_get_split_vfo(rig, vfo, &priv->split, &priv->split_vfo); if (err != RIG_OK) return err; switch ((int)priv->split) { case TRUE: /* '920 is in split mode */ err = ft920_set_freq(rig, priv->split_vfo, tx_freq); if (err != RIG_OK) return err; break; default: break; } return RIG_OK; } /* * rig_get_split_freq* * * Get the '920 split TX freq * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * *tx_freq | output | split transmit frequency * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: Checks to see if the 920 is in split mode, if so it * checks which VFO is set for TX and then gets the * frequency of that VFO and stores it into *tx_freq. * If not in split mode returns 0 Hz. * */ static int ft920_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) { struct ft920_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft920_priv_data *)rig->state.priv; err = ft920_get_split_vfo(rig, vfo, &priv->split, &priv->split_vfo); if (err != RIG_OK) return err; switch ((int)priv->split) { case TRUE: /* '920 is in split mode */ err = ft920_get_freq(rig, priv->split_vfo, tx_freq); if (err != RIG_OK) return err; break; default: *tx_freq = 0; break; } return RIG_OK; } /* * rig_set_split_mode * * Set the '920 split TX mode * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * tx_mode | input | supported modes * tx_width | input | supported widths * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: Checks to see if 920 is in split mode and if so sets * the mode and passband of the TX VFO. If not in split mode * does nothing and returns. * */ static int ft920_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width) { struct ft920_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed mode = %i\n", __func__, tx_mode); rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %li Hz\n", __func__, tx_width); priv = (struct ft920_priv_data *)rig->state.priv; err = ft920_get_split_vfo(rig, vfo, &priv->split, &priv->split_vfo); if (err != RIG_OK) return err; switch ((int)priv->split) { case TRUE: /* '920 is in split mode */ err = ft920_set_mode(rig, priv->split_vfo, tx_mode, tx_width); if (err != RIG_OK) return err; break; default: break; } return RIG_OK; } /* * rig_get_split_mode* * * Get the '920 split TX mode * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * *tx_mode | output | supported modes * *tx_width | output | supported widths * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: Checks to see if the 920 is in split mode, if so it * checks which VFO is set for TX and then gets the * mode and passband of that VFO and stores it into *tx_mode * and tx_width respectively. If not in split mode returns * RIG_MODE_NONE and 0 Hz. * */ static int ft920_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width) { struct ft920_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft920_priv_data *)rig->state.priv; err = ft920_get_split_vfo(rig, vfo, &priv->split, &priv->split_vfo); if (err != RIG_OK) return err; switch ((int)priv->split) { case TRUE: /* '920 is in split mode */ err = ft920_get_mode(rig, priv->split_vfo, tx_mode, tx_width); if (err != RIG_OK) return err; break; default: *tx_mode = RIG_MODE_NONE; *tx_width = 0; break; } return RIG_OK; } /* * rig_set_rit* * * Set the RIT offset * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * rit | input | -9999 to 9999 Hz * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: vfo is ignored as RIT cannot be changed on sub VFO * * FIXME: Should rig be forced into VFO mode if RIG_VFO_A * or RIG_VFO_VFO is received? * * VFO and MEM rit values are independent. The sub display * carries an RIT value only if A<>B button is pressed or * set_vfo is called with RIG_VFO_B and the main display has * an RIT value. */ static int ft920_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { unsigned char offset; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; if (rit < -9999 || rit > 9999) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li\n", __func__, rit); if (rit == 0) { offset = CLAR_RX_OFF; } else { offset = CLAR_RX_ON; } rig_debug(RIG_DEBUG_TRACE, "%s: set offset = 0x%02x\n", __func__, offset); err = ft920_send_dynamic_cmd(rig, FT920_NATIVE_CLARIFIER_OPS, offset, 0, 0, 0); if (err != RIG_OK) return err; err = ft920_send_rit_freq(rig, FT920_NATIVE_CLARIFIER_OPS, rit); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_rit* * * Get the RIT offset * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * *rit | output | -9999 to 9999 Hz * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: Value of vfo is ignored as it's not needed. * * Rig returns offset as hex from 0x0000 to 0x270f for * 0 to +9999 Hz and 0xffff to 0xd8f1 for -1 to -9999 Hz * * VFO and MEM rit values are independent. The sub display * carries an RIT value only if A<>B button is pressed or * set_vfo is called with RIG_VFO_B and the main display has * an RIT value. */ static int ft920_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { struct ft920_priv_data *priv; unsigned char *p; unsigned char offset; shortfreq_t f; int err, cmd_index; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft920_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_MEM: case RIG_VFO_MAIN: cmd_index = FT920_NATIVE_OP_DATA; offset = FT920_SUMO_DISPLAYED_CLAR; break; case RIG_VFO_A: case RIG_VFO_VFO: cmd_index = FT920_NATIVE_VFO_DATA; offset = FT920_SUMO_VFO_A_CLAR; break; case RIG_VFO_B: case RIG_VFO_SUB: cmd_index = FT920_NATIVE_VFO_DATA; offset = FT920_SUMO_VFO_B_CLAR; break; default: return -RIG_EINVAL; } rig_debug(RIG_DEBUG_TRACE, "%s: set cmd_index = %i\n", __func__, cmd_index); rig_debug(RIG_DEBUG_TRACE, "%s: set offset = 0x%02x\n", __func__, offset); err = ft920_get_update_data(rig, cmd_index, FT920_VFO_DATA_LENGTH); if (err != RIG_OK) return err; p = &priv->update_data[offset]; /* big endian integer */ f = (p[0]<<8) + p[1]; if (f > 0xd8f0) /* 0xd8f1 to 0xffff is negative offset */ f = ~(0xffff - f); rig_debug(RIG_DEBUG_TRACE, "%s: read freq = %li Hz\n", __func__, f); *rit = f; /* store clarifier frequency */ return RIG_OK; } /* * rig_set_xit * * Set the XIT offset * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * xit | input | -9999 to 9999 Hz * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: vfo is ignored as XIT cannot be changed on sub VFO * * FIXME: Should rig be forced into VFO mode if RIG_VFO_A * or RIG_VFO_VFO is received? */ static int ft920_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit) { unsigned char offset; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; if (xit < -9999 || xit > 9999) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed xit = %li\n", __func__, xit); if (xit == 0) { offset = CLAR_TX_OFF; } else { offset = CLAR_TX_ON; } rig_debug(RIG_DEBUG_TRACE, "%s: set offset = 0x%02x\n", __func__, offset); err = ft920_send_dynamic_cmd(rig, FT920_NATIVE_CLARIFIER_OPS, offset, 0, 0, 0); if (err != RIG_OK) return err; err = ft920_send_rit_freq(rig, FT920_NATIVE_CLARIFIER_OPS, xit); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_xit* * * Get the XIT offset * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * *xit | output | -9999 to 9999 Hz * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: Value of vfo is ignored as it's not needed * * Rig returns offset as hex from 0x0000 to 0x270f for * 0 to +9999 Hz and 0xffff to 0xd8f1 for -1 to -9999 Hz */ static int ft920_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit) { int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; err = ft920_get_rit(rig, vfo, xit); /* abuse get_rit and store in *xit */ if (err != RIG_OK) return err; return RIG_OK; } /* * rig_set_ptt* * * Set the '920 into TX mode * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * ptt | input | RIG_PTT_OFF, RIG_PTT_ON * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: vfo is respected by calling ft920_set_vfo if * passed vfo != priv->current_vfo * * This command is not documented in my '920 manual, * but it works! -N0NB * */ static int ft920_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { struct ft920_priv_data *priv; unsigned char cmd_index; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft920_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt); if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } else if (vfo != priv->current_vfo) { ft920_set_vfo(rig, vfo); } switch (ptt) { case RIG_PTT_OFF: cmd_index = FT920_NATIVE_PTT_OFF; break; case RIG_PTT_ON: cmd_index = FT920_NATIVE_PTT_ON; break; default: return -RIG_EINVAL; /* wrong PTT state! */ } err = ft920_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_ptt* * * Get current PTT status * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * *ptt | output | RIG_PTT_OFF, RIG_PTT_ON * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: Get the PTT state */ static int ft920_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct ft920_priv_data *priv; unsigned char stat_0; /* ft920 status flag 0 */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft920_priv_data *)rig->state.priv; /* Get flags for VFO status */ err = ft920_get_update_data(rig, FT920_NATIVE_STATUS_FLAGS, FT920_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; /* * The FT-920 status gives two flags for PTT, one if the PTT * line is grounded externally and the other if the PTT line * is grounded as the result of a CAT command. However, the * 7th bit of status byte 0 is set or cleared in each case * and gives an accurate state of the PTT line. */ stat_0 = priv->update_data[FT920_SUMO_DISPLAYED_STATUS_0]; stat_0 &= SF_PTT_MASK; /* get external PTT active bit */ rig_debug(RIG_DEBUG_TRACE, "%s: stat_0 = 0x%02x\n", __func__, stat_0); switch (stat_0) { case SF_PTT_OFF: *ptt = RIG_PTT_OFF; break; case SF_PTT_ON: *ptt = RIG_PTT_ON; break; default: /* Oops! */ return -RIG_EINVAL; /* Invalid PTT bit?! */ } return RIG_OK; } /* * rig_set_func* * * Set rig function * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * func | input | TUNER * status | input | 0 = bypass, 1 =inline, 2 = start tuning * | | (toggle) * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: Set the tuner to on, off, or start */ static int ft920_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { struct ft920_priv_data *priv; unsigned char cmd_index; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft920_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x, func = 0x%02x, status = %d\n", __func__, vfo, func, status); if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } else if (vfo != priv->current_vfo) ft920_set_vfo(rig, vfo); switch(func) { case RIG_FUNC_TUNER: switch(status) { case TUNER_BYPASS: cmd_index = FT920_NATIVE_TUNER_BYPASS; break; case TUNER_INLINE: cmd_index = FT920_NATIVE_TUNER_INLINE; break; case TUNER_TUNING: cmd_index = FT920_NATIVE_TUNER_START; break; default: return -RIG_EINVAL; /* wrong tuner status! */ } break; default: return -RIG_EINVAL; /* wrong function! */ } err = ft920_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_func* * * Get rig function * * Parameter | Type | Accepted/expected values * ------------------------------------------------------------------ * *rig | input | pointer to private data * vfo | input | currVFO, VFOA, VFOB, MEM * func | input | TUNER * *status | output | 0 = bypass, 1 = inline, 2 = tuning * ------------------------------------------------------------------ * Returns RIG_OK on success or an error code on failure * * Comments: Read the tuner status from status flags */ static int ft920_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { struct ft920_priv_data *priv; unsigned char stat_0, stat_2; /* ft920 status flags 0, 2 */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft920_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x, func = 0x%02x\n", __func__, vfo, func); if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } else if (vfo != priv->current_vfo) ft920_set_vfo(rig, vfo); /* Get flags for VFO status */ err = ft920_get_update_data(rig, FT920_NATIVE_STATUS_FLAGS, FT920_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; /* * The FT-920 status gives three flags for the tuner state, * one if the tuner is On/tuning, another if the tuner is * "inline" and the last if the "WAIT" light is on. * * Currently, will only check if tuner is tuning and inline. */ stat_0 = priv->update_data[FT920_SUMO_DISPLAYED_STATUS_0]; // stat_0 &= SF_TUNER_TUNE; /* get tuning state */ stat_2 = priv->update_data[FT920_SUMO_DISPLAYED_STATUS_2]; // stat_2 &= SF_TUNER_INLINE; /* get tuner inline state */ rig_debug(RIG_DEBUG_TRACE, "%s: stat_0 = 0x%02x, stat_2 = 0x%02x\n", __func__, stat_0, stat_2); switch(func) { case RIG_FUNC_TUNER: if (stat_0 & SF_TUNER_TUNE) *status = TUNER_TUNING; else if (stat_2 & SF_TUNER_INLINE) *status = TUNER_INLINE; else *status = TUNER_BYPASS; break; case RIG_FUNC_LOCK: switch(vfo) { case RIG_VFO_A: if (stat_2 & SF_VFOA_LOCK) *status = TRUE; else *status = FALSE; break; case RIG_VFO_B: if (stat_2 & SF_VFOB_LOCK) *status = TRUE; else *status = FALSE; break; } break; default: return -RIG_EINVAL; /* wrong function! */ } return RIG_OK; } /* * ************************************ * * Private functions to ft920 backend * * ************************************ */ /* * Private helper function to retrieve update data from rig. * using pacing value and buffer indicated in *priv struct. * Extended to be command agnostic as 920 has several ways to * get data and several ways to return it. * * Need to use this when doing ft920_get_* stuff * * Arguments: *rig Valid RIG instance * ci command index * rl expected length of returned data in octets * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft920_get_update_data(RIG *rig, unsigned char ci, unsigned char rl) { struct rig_state *rig_s; struct ft920_priv_data *priv; int n; /* for read_ */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft920_priv_data *)rig->state.priv; rig_s = &rig->state; err = ft920_send_static_cmd(rig, ci); if (err != RIG_OK) return err; n = read_block(&rig_s->rigport, (char *)priv->update_data, rl); if (n < 0) return n; /* die returning read_block error */ rig_debug(RIG_DEBUG_TRACE, "%s: read %i bytes\n", __func__, n); return RIG_OK; } /* * Private helper function to send a complete command sequence. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft920_send_static_cmd(RIG *rig, unsigned char ci) { struct rig_state *rig_s; struct ft920_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft920_priv_data *)rig->state.priv; rig_s = &rig->state; /* * If we've been passed a command index (ci) that is marked * as dynamic (0), then bail out. */ if (!priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to send incomplete sequence\n", __func__); return -RIG_EINVAL; } err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } /* * Private helper function to build and then send a complete command * sequence. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * p1-p4 Command parameters * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft920_send_dynamic_cmd(RIG *rig, unsigned char ci, unsigned char p1, unsigned char p2, unsigned char p3, unsigned char p4) { struct rig_state *rig_s; struct ft920_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n", __func__, p1, p2, p3, p4); priv = (struct ft920_priv_data *)rig->state.priv; /* * If we've been passed a command index (ci) that is marked * as static (1), then bail out. */ if (priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempted to modify a complete command sequence: %i\n", __func__, ci); return -RIG_EINVAL; } rig_s = &rig->state; memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); priv->p_cmd[P1] = p1; /* ick */ priv->p_cmd[P2] = p2; priv->p_cmd[P3] = p3; priv->p_cmd[P4] = p4; err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } /* * Private helper function to build and send a complete command to * change the Main or Sub display frequency. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * freq freq_t frequency value * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft920_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq) { struct rig_state *rig_s; struct ft920_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq); priv = (struct ft920_priv_data *)rig->state.priv; /* * If we've been passed a command index (ci) that is marked * as static (1), then bail out. */ if (priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n", __func__); return -RIG_EINVAL; } rig_s = &rig->state; /* Copy native cmd freq_set to private cmd storage area */ memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); /* store bcd format in in p_cmd */ to_bcd(priv->p_cmd, freq/10, FT920_BCD_DIAL); rig_debug(RIG_DEBUG_TRACE, "%s: requested freq after conversion = %"PRIll" Hz\n", __func__, from_bcd(priv->p_cmd, FT920_BCD_DIAL)* 10); err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } /* * Private helper function to build and send a complete command to * change the RIT/XIT frequency. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * rit shortfreq_t frequency value * p1 P1 value -- CLAR_SET_FREQ * p2 P2 value -- CLAR_OFFSET_PLUS || CLAR_OFFSET_MINUS * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion * * Assumes: rit doesn't exceed tuning limits of rig */ static int ft920_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit) { struct rig_state *rig_s; struct ft920_priv_data *priv; unsigned char p1; unsigned char p2; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit); priv = (struct ft920_priv_data *)rig->state.priv; /* * If we've been passed a command index (ci) that is marked * as static (1), then bail out. */ if (priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n", __func__); return -RIG_EINVAL; } rig_s = &rig->state; p1 = CLAR_SET_FREQ; if (rit < 0) { rit = labs(rit); /* get absolute value of rit */ p2 = CLAR_OFFSET_MINUS; } else { p2 = CLAR_OFFSET_PLUS; } /* Copy native cmd clarifier ops to private cmd storage area */ memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); /* store bcd format in in p_cmd */ to_bcd(priv->p_cmd, rit/10, FT920_BCD_RIT); rig_debug(RIG_DEBUG_TRACE, "%s: requested rit after conversion = %li Hz\n", __func__, from_bcd(priv->p_cmd, FT920_BCD_RIT)* 10); priv->p_cmd[P1] = p1; /* ick */ priv->p_cmd[P2] = p2; err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } hamlib-1.2.15.3/yaesu/ft757gx.c0000644000175000017500000004765712044564477012663 00000000000000/* * hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com) * * ft757gx.c - (C) Stephane Fillod 2004 * (C) Nate Bargmann 2008 * * This shared library provides an API for communicating * via serial interface to an FT-757GX/FT-757GXII using the * "CAT" interface box (FIF-232C) or similar. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * TODO * * 1. Allow cached reads * 2. set_mem/get_mem, vfo_op, get_channel, set_split/get_split, * set_func/get_func * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "ft757gx.h" /* Private helper function prototypes */ static int ft757_get_update_data(RIG *rig); static int mode2rig(RIG *rig, rmode_t mode, pbwidth_t width); static int rig2mode(RIG *rig, int md, rmode_t *mode, pbwidth_t *width); /* * future - private data * */ struct ft757_priv_data { unsigned char pacing; /* pacing value */ unsigned int read_update_delay; /* depends on pacing value */ unsigned char current_vfo; /* active VFO from last cmd , can be either RIG_VFO_A or RIG_VFO_B only */ unsigned char update_data[FT757GX_STATUS_UPDATE_DATA_LENGTH]; /* returned data */ }; /* * ft757gx rig capabilities. * Also this struct is READONLY! */ const struct rig_caps ft757gx_caps = { .rig_model = RIG_MODEL_FT757, .model_name = "FT-757GX", .mfg_name = "Yaesu", .version = "0.4.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_MOBILE, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT757GX_WRITE_DELAY, .post_write_delay = FT757GX_POST_WRITE_DELAY, .timeout = FT757GX_DEFAULT_READ_TIMEOUT, .retry = 10, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9999), .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, }, /* FIXME: memory channel list:20 */ .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { { .start = kHz(500), .end = 29999990, .modes = FT757GX_ALL_RX_MODES,.low_power = -1,.high_power = -1}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {kHz(1500),1999900,FT757GX_ALL_TX_MODES,.low_power = 5000,.high_power = 100000}, {.start = kHz(3500),3999900,FT757GX_ALL_TX_MODES,5000,100000}, {.start = kHz(7000),7499900,FT757GX_ALL_TX_MODES,5000,100000}, {.start = MHz(10),10499900,FT757GX_ALL_TX_MODES,5000,100000}, {.start = MHz(14),14499900,FT757GX_ALL_TX_MODES,5000,100000}, {.start = MHz(18),18499900,FT757GX_ALL_TX_MODES,5000,100000}, {.start = MHz(21),21499900,FT757GX_ALL_TX_MODES,5000,100000}, {.start = kHz(24500),24999900,FT757GX_ALL_TX_MODES,5000,100000}, {.start = MHz(28),29999900,FT757GX_ALL_TX_MODES,5000,100000}, RIG_FRNG_END, }, .tuning_steps = { {FT757GX_ALL_RX_MODES,10}, {FT757GX_ALL_RX_MODES,100}, RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { RIG_FLT_END, }, .priv = NULL, /* private data */ .rig_init = ft757_init, .rig_cleanup = ft757_cleanup, .rig_open = ft757_open, /* port opened */ .rig_close = NULL, /* port closed */ .set_freq = ft757_set_freq, /* set freq */ .get_freq = NULL, /* get freq */ .set_mode = NULL, /* set mode */ .get_mode = NULL, /* get mode */ .set_vfo = ft757_set_vfo, /* set vfo */ .get_vfo = NULL, /* get vfo */ .set_ptt = NULL, /* set ptt */ .get_ptt = NULL, /* get ptt */ }; /* * ft757gx2 rig capabilities. * Also this struct is READONLY! */ const struct rig_caps ft757gx2_caps = { .rig_model = RIG_MODEL_FT757GXII, .model_name = "FT-757GXII", .mfg_name = "Yaesu", .version = "0.4", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_MOBILE, .ptt_type = RIG_PTT_SERIAL_DTR, /* CAT port pin 4 per manual */ .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT757GX_WRITE_DELAY, .post_write_delay = FT757GX_POST_WRITE_DELAY, .timeout = FT757GX_DEFAULT_READ_TIMEOUT, .retry = 10, .has_get_func = RIG_FUNC_LOCK, .has_set_func = RIG_FUNC_LOCK, .has_get_level = RIG_LEVEL_RAWSTR, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .vfo_ops = RIG_OP_CPY | RIG_OP_FROM_VFO | RIG_OP_TO_VFO | RIG_OP_UP | RIG_OP_DOWN, .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 = { { 0, 9, RIG_MTYPE_MEM, FT757_MEM_CAP }, RIG_CHAN_END }, .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { { .start = kHz(150), .end = 29999990, .modes = FT757GX_ALL_RX_MODES,.low_power = -1,.high_power = -1}, RIG_FRNG_END, }, /* rx range */ /* FIXME: 10m is "less" and AM is 25W carrier */ .tx_range_list2 = { {kHz(1500),1999900,FT757GX_ALL_TX_MODES,.low_power = 5000,.high_power = 100000}, {.start = kHz(3500),3999900,FT757GX_ALL_TX_MODES,5000,100000}, {.start = kHz(7000),7499900,FT757GX_ALL_TX_MODES,5000,100000}, {.start = MHz(10),10499900,FT757GX_ALL_TX_MODES,5000,100000}, {.start = MHz(14),14499900,FT757GX_ALL_TX_MODES,5000,100000}, {.start = MHz(18),18499900,FT757GX_ALL_TX_MODES,5000,100000}, {.start = MHz(21),21499900,FT757GX_ALL_TX_MODES,5000,100000}, {.start = kHz(24500),24999900,FT757GX_ALL_TX_MODES,5000,100000}, {.start = MHz(28),29999900,FT757GX_ALL_TX_MODES,5000,100000}, RIG_FRNG_END, }, .tuning_steps = { {FT757GX_ALL_RX_MODES,10}, RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW, kHz(2.7)}, {RIG_MODE_CW, Hz(600)}, /* narrow */ {RIG_MODE_AM, kHz(6)}, {RIG_MODE_FM, kHz(15)}, RIG_FLT_END, }, .str_cal = FT757GXII_STR_CAL, .priv = NULL, /* private data */ .rig_init = ft757_init, .rig_cleanup = ft757_cleanup, .rig_open = ft757_open, /* port opened */ .rig_close = NULL, /* port closed */ .set_freq = ft757_set_freq, /* set freq */ .get_freq = ft757_get_freq, /* get freq */ .set_mode = ft757_set_mode, /* set mode */ .get_mode = ft757_get_mode, /* get mode */ .set_vfo = ft757_set_vfo, /* set vfo */ .get_vfo = ft757_get_vfo, /* get vfo */ .get_level = ft757_get_level, .get_ptt = ft757_get_ptt, /* get ptt */ }; /* * _init * */ int ft757_init(RIG *rig) { struct ft757_priv_data *p; rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__); if (!rig) return -RIG_EINVAL; p = (struct ft757_priv_data *)malloc(sizeof(struct ft757_priv_data)); if (!p) /* whoops! memory shortage! */ return -RIG_ENOMEM; /* TODO: read pacing from preferences */ p->pacing = FT757GX_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */ p->read_update_delay = FT757GX_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */ p->current_vfo = RIG_VFO_A; /* default to VFO_A ? */ rig->state.priv = (void *)p; return RIG_OK; } /* * ft757_cleanup routine * the serial port is closed by the frontend */ int ft757_cleanup(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__); if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * ft757_open routine * */ int ft757_open(RIG *rig) { struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv; int retval; rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__); /* FT757GX has a write-only serial port: don't try to read status data */ if (rig->caps->rig_model == RIG_MODEL_FT757) { memset(priv->update_data, 0, FT757GX_STATUS_UPDATE_DATA_LENGTH); } else { /* read back the 75 status bytes from FT757GXII */ retval = ft757_get_update_data(rig); if (retval < 0) { memset(priv->update_data, 0, FT757GX_STATUS_UPDATE_DATA_LENGTH); return retval; } } return RIG_OK; } /* * This command only functions when operating on a vfo. * TODO: test Status Update Byte 1 * */ int ft757_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0a}; rig_debug(RIG_DEBUG_VERBOSE, "%s called. Freq=%"PRIfreq"\n", __func__, freq); if (!rig) return -RIG_EINVAL; /* fill in first four bytes */ to_bcd(cmd, freq/10, BCD_LEN); return write_block(&rig->state.rigport, (char *)cmd, YAESU_CMD_LENGTH); } int ft757_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x0c}; rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: mode = %d, width = %d\n", __func__, mode, width); if (mode == RIG_MODE_NONE) return -RIG_EINVAL; /* fill in p1 */ cmd[3] = mode2rig(rig, mode, width); return write_block(&rig->state.rigport, (char *)cmd, YAESU_CMD_LENGTH); } /* * Return Freq */ int ft757_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv; int retval; rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__); if (!rig) return -RIG_EINVAL; retval = ft757_get_update_data(rig); /* get whole shebang from rig */ if (retval < 0) return retval; /* grab freq (little endian format) and convert */ switch(vfo) { case RIG_VFO_CURR: *freq = 10 * from_bcd(priv->update_data+STATUS_CURR_FREQ, BCD_LEN); break; case RIG_VFO_A: *freq = 10 * from_bcd(priv->update_data+STATUS_VFOA_FREQ, BCD_LEN); break; case RIG_VFO_B: *freq = 10 * from_bcd(priv->update_data+STATUS_VFOB_FREQ, BCD_LEN); break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } rig_debug(RIG_DEBUG_VERBOSE,"%s returning: Freq=%"PRIfreq"\n", __func__, *freq ); return RIG_OK; } int ft757_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv; int retval; rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__); if (!rig) return -RIG_EINVAL; retval = ft757_get_update_data(rig); /* get whole shebang from rig */ if (retval < 0) return retval; switch(vfo) { case RIG_VFO_CURR: retval = rig2mode(rig, priv->update_data[STATUS_CURR_MODE], mode, width); break; case RIG_VFO_A: retval = rig2mode(rig, priv->update_data[STATUS_VFOA_MODE], mode, width); break; case RIG_VFO_B: retval = rig2mode(rig, priv->update_data[STATUS_VFOB_MODE], mode, width); break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } return retval; } /* * set vfo and store requested vfo for later RIG_VFO_CURR * requests. * */ int ft757_set_vfo(RIG *rig, vfo_t vfo) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x05}; struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__); if (!rig) return -RIG_EINVAL; switch(vfo) { case RIG_VFO_CURR: return RIG_OK; case RIG_VFO_A: cmd[3] = 0x00; /* VFO A */ break; case RIG_VFO_B: cmd[3] = 0x01; /* VFO B */ break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } priv->current_vfo = vfo; return write_block(&rig->state.rigport, (char *)cmd, YAESU_CMD_LENGTH); } int ft757_get_vfo(RIG *rig, vfo_t *vfo) { struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv; int retval; rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__); if (!rig) return -RIG_EINVAL; retval = ft757_get_update_data(rig); /* get whole shebang from rig */ if (retval < 0) return retval; if (priv->update_data[0] & 0x10) return RIG_VFO_MEM; else if (priv->update_data[0] & 0x08) return RIG_VFO_B; else return RIG_VFO_A; return RIG_OK; } int ft757_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv; int retval; rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__); if (!rig) return -RIG_EINVAL; retval = ft757_get_update_data(rig); /* get whole shebang from rig */ if (retval < 0) return retval; *ptt = priv->update_data[0] & 0x20 ? RIG_PTT_ON : RIG_PTT_OFF; return RIG_OK; } int ft757_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x01, 0x10}; int retval; rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__); if (!rig) return -RIG_EINVAL; if (level != RIG_LEVEL_RAWSTR) return -RIG_EINVAL; serial_flush(&rig->state.rigport); /* send READ STATUS(Meter only) cmd to rig */ retval = write_block(&rig->state.rigport, (char *)cmd, YAESU_CMD_LENGTH); if (retval < 0) return retval; /* read back the 1 byte */ retval = read_block(&rig->state.rigport, (char *)cmd, 1); if (retval != 1) { rig_debug(RIG_DEBUG_ERR,"%s: read meter failed %d.\n", __func__, retval); return retval < 0 ? retval : -RIG_EIO; } val->i = cmd[0]; return RIG_OK; } /* * private helper function. Retrieves update data from rig. * using pacing value and buffer indicated in *priv struct. * * need to use this when doing ft757_get_* stuff */ int ft757_get_update_data(RIG *rig) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x10}; struct ft757_priv_data *priv = (struct ft757_priv_data *)rig->state.priv; int retval=0; int nbtries ; /* Maximum number of attempts to ask/read the data. */ int maxtries = rig->state.rigport.retry ; rig_debug(RIG_DEBUG_VERBOSE, "%s called. Timeout=%ld ms, Retry=%d\n", __func__, rig->state.rigport.timeout, maxtries); /* At least on one model, returns erraticaly a timeout. Increasing the timeout does not fix things. So we restart the read from scratch, it works most of times. */ for( nbtries = 0 ; nbtries < maxtries ; nbtries++ ) { serial_flush(&rig->state.rigport); /* send READ STATUS cmd to rig */ retval = write_block(&rig->state.rigport, (char *)cmd, YAESU_CMD_LENGTH); if (retval < 0) return retval; /* read back the 75 status bytes */ retval = read_block(&rig->state.rigport, (char *)priv->update_data, FT757GX_STATUS_UPDATE_DATA_LENGTH); if (retval == FT757GX_STATUS_UPDATE_DATA_LENGTH) { break ; } rig_debug(RIG_DEBUG_ERR, "%s: read update_data failed, %d octets of %d read, retry %d out of %d\n", __func__, retval, FT757GX_STATUS_UPDATE_DATA_LENGTH, nbtries, maxtries); /* The delay is quadratic. */ sleep(nbtries*nbtries); } if (retval != FT757GX_STATUS_UPDATE_DATA_LENGTH) { rig_debug(RIG_DEBUG_ERR,"%s: read update_data failed, %d octets of %d read.\n", __func__, retval, FT757GX_STATUS_UPDATE_DATA_LENGTH); return retval < 0 ? retval : -RIG_EIO; } return RIG_OK; } int mode2rig(RIG *rig, rmode_t mode, pbwidth_t width) { int md; rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__); if (!rig) return -RIG_EINVAL; /* * translate mode from generic to ft757 specific */ switch(mode) { case RIG_MODE_AM: md = MODE_AM; break; case RIG_MODE_USB: md = MODE_USB; break; case RIG_MODE_LSB: md = MODE_LSB; break; case RIG_MODE_FM: md = MODE_FM; break; case RIG_MODE_CW: if (width == RIG_PASSBAND_NORMAL || width >= rig_passband_normal(rig, mode)) md = MODE_CWW; else md = MODE_CWN; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } return md; } int rig2mode(RIG *rig, int md, rmode_t *mode, pbwidth_t *width) { rig_debug(RIG_DEBUG_VERBOSE, "%s called.\n", __func__); if (!rig) return -RIG_EINVAL; /* * translate mode from ft757 specific to generic */ switch(md) { case MODE_AM: *mode = RIG_MODE_AM; break; case MODE_USB: *mode = RIG_MODE_USB; break; case MODE_LSB: *mode = RIG_MODE_LSB; break; case MODE_FM: *mode = RIG_MODE_FM; break; case MODE_CWW: case MODE_CWN: *mode = RIG_MODE_CW; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } if (md == MODE_CWN) *width = rig_passband_narrow(rig, *mode); else *width = rig_passband_normal(rig, *mode); return RIG_OK; } hamlib-1.2.15.3/yaesu/ft950.h0000644000175000017500000001050312044564477012300 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft950.h - (C) Nate Bargmann 2007 (n0nb at arrl.net) * (C) Stephane Fillod 2008 * * This shared library provides an API for communicating * via serial interface to an FT-950 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT950_H #define _FT950_H 1 #define TRUE 1 #define FALSE 0 #define ON TRUE #define OFF FALSE #define FT950_VFO_ALL (RIG_VFO_A|RIG_VFO_B) /* Receiver caps */ #define FT950_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|\ RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM) #define FT950_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|\ RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB) #define FT950_AM_RX_MODES (RIG_MODE_AM) #define FT950_FM_RX_MODES (RIG_MODE_FM|RIG_MODE_PKTFM) #define FT950_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR) #define FT950_CW_RTTY_PKT_RX_MODES (RIG_MODE_RTTY|RIG_MODE_RTTYR|\ RIG_MODE_PKTUSB|RIG_MODE_PKTLSB|RIG_MODE_CW|RIG_MODE_CWR) /* TRX caps */ #define FT950_OTHER_TX_MODES (RIG_MODE_CW| RIG_MODE_USB| RIG_MODE_LSB ) /* 100 W class */ #define FT950_AM_TX_MODES (RIG_MODE_AM ) /* set 25W max */ #define FT950_LEVELS (RIG_LEVEL_ATT|RIG_LEVEL_PREAMP|\ RIG_LEVEL_ALC|RIG_LEVEL_RAWSTR|RIG_LEVEL_SWR|\ RIG_LEVEL_RFPOWER|RIG_LEVEL_RF|RIG_LEVEL_SQL|\ RIG_LEVEL_MICGAIN|RIG_LEVEL_IF|RIG_LEVEL_CWPITCH|\ RIG_LEVEL_KEYSPD|RIG_LEVEL_AF|RIG_LEVEL_AGC|\ RIG_LEVEL_METER|RIG_LEVEL_BKINDL|RIG_LEVEL_SQL|\ RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY|RIG_LEVEL_COMP|\ RIG_LEVEL_ANTIVOX|RIG_LEVEL_NR|RIG_LEVEL_NOTCHF) #define FT950_FUNCS (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_LOCK|\ RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\ RIG_FUNC_FBKIN|RIG_FUNC_COMP|RIG_FUNC_ANF|RIG_FUNC_MN) #define FT950_VFO_OPS (RIG_OP_TUNE|RIG_OP_CPY|RIG_OP_XCHG|\ RIG_OP_UP|RIG_OP_DOWN|RIG_OP_BAND_UP|RIG_OP_BAND_DOWN|\ RIG_OP_TO_VFO|RIG_OP_FROM_VFO|RIG_OP_TOGGLE) /* TBC */ #define FT950_STR_CAL { 16, \ { \ { 0, -54 }, /* S0 */ \ { 12, -48 }, /* S1 */ \ { 27, -42 }, /* S2 */ \ { 40, -36 }, /* S3 */ \ { 55, -30 }, /* S4 */ \ { 65, -24 }, /* S5 */ \ { 80, -18 }, /* S6 */ \ { 95, -12 }, /* S7 */ \ { 112, -6 }, /* S8 */ \ { 130, 0 }, /* S9 */ \ { 150, 10 }, /* +10 */ \ { 172, 20 }, /* +20 */ \ { 190, 30 }, /* +30 */ \ { 220, 40 }, /* +40 */ \ { 240, 50 }, /* +50 */ \ { 255, 60 }, /* +60 */ \ } } /* * Other features (used by rig_caps) * */ #define FT950_ANTS (RIG_ANT_1|RIG_ANT_2) #define FT950_MEM_CHNL_LENGTH 1 /* 0x10 P1 = 01 return size */ #define FT950_OP_DATA_LENGTH 19 /* 0x10 P1 = 03 return size */ #define FT950_VFO_DATA_LENGTH 18 /* 0x10 P1 = 03 return size -- A & B returned */ #define FT950_MEM_CHNL_DATA_LENGTH 19 /* 0x10 P1 = 04, P4 = 0x01-0x20 return size */ #define FT950_STATUS_FLAGS_LENGTH 5 /* 0xf7, 0xfa return size */ #define FT950_ALL_DATA_LENGTH 649 /* 0x10 P1 = 00 return size */ /* Timing values in mS */ // #define FT950_PACING_INTERVAL 5 // #define FT950_PACING_DEFAULT_VALUE 0 /* Delay between bytes sent to FT-950 * Should not exceed value set in CAT TOT menu (rig default is 10 mSec) */ #define FT950_WRITE_DELAY 0 /* Delay sequential fast writes */ #define FT950_POST_WRITE_DELAY 5 #endif /* _FT950_H */ hamlib-1.2.15.3/yaesu/ft100.c0000644000175000017500000006332012044564477012263 00000000000000/* * hamlib - (C) Frank Singleton 2000-2003 * (C) Stephane Fillod 2000-2010 * * ft100.c - (C) Chris Karpinsky 2001 (aa1vl@arrl.net) * This shared library provides an API for communicating * via serial interface to an FT-100 using the "CAT" interface. * The starting point for this code was Frank's ft847 implementation. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include #include "hamlib/rig.h" #include "serial.h" #include "yaesu.h" #include "ft100.h" #include "misc.h" #include "bandplan.h" /* prototypes */ static int ft100_send_priv_cmd(RIG *rig, unsigned char ci); /* Native ft100 cmd set prototypes. These are READ ONLY as each */ /* rig instance will copy from these and modify if required . */ /* Complete sequences (1) can be read and used directly as a cmd sequence . */ /* Incomplete sequences (0) must be completed with extra parameters */ /* eg: mem number, or freq etc.. */ /* kc2ivl - what works on a ft100 as of 02/27/2002 */ /* ptt on/off */ /* set mode AM,CW,USB,LSB,FM use RTTY for DIG mode */ /* set split on/off */ /* set repeater +, - splx */ /* set frequency of current vfo */ static const yaesu_cmd_set_t ncmd[] = { { 0, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* lock on */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* lock off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0f } }, /* ptt on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0f } }, /* ptt off */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* set freq */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* mode set main LSB */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0c } }, /* mode set main USB */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x0c } }, /* mode set main CW */ { 1, { 0x00, 0x00, 0x00, 0x03, 0x0c } }, /* mode set main CWR */ { 1, { 0x00, 0x00, 0x00, 0x04, 0x0c } }, /* mode set main AM */ { 1, { 0x00, 0x00, 0x00, 0x06, 0x0c } }, /* mode set main FM */ { 1, { 0x00, 0x00, 0x00, 0x05, 0x0c } }, /* mode set main DIG */ { 1, { 0x00, 0x00, 0x00, 0x07, 0x0c } }, /* mode set main WFM */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* clar on */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* clar off */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* set clar freq */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* toggle vfo a/b */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* select vfo a */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* select vfo b */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* split on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* split off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x84 } }, /* set RPT shift MINUS */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x84 } }, /* set RPT shift PLUS */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x84 } }, /* set RPT shift SIMPLEX */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* set RPT offset freq */ /* fix me */ { 1, { 0x00, 0x00, 0x00, 0x03, 0x92 } }, /* set DCS on */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x92 } }, /* set CTCSS/DCS enc/dec on */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x92 } }, /* set CTCSS/DCS enc on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x92 } }, /* set CTCSS/DCS off */ /* em xif */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x90 } }, /* set CTCSS tone */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x91 } }, /* set DCS code */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* get RX status */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* get TX status */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x10 } }, /* get FREQ and MODE status */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* pwr wakeup sequence */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* pwr on */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* pwr off */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x10 } }, /* read status block */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xf7 } }, /* read meter block */ { 1, { 0x00, 0x00, 0x00, 0x01, 0xfa } } /* read flags block */ }; static const tone_t ft100_ctcss_list[] = { 670, 693, 719, 744, 770, 797, 825, 854, 885, 915, \ 948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, \ 1318, 1365, 1413, 1462, 1514, 1567, 1622, 1679, \ 1738, 1799, 1862, 1928, \ 2035, 2107, 2181, 2257, 2336, 2418, 2503, \ 0, }; static const tone_t ft100_dcs_list[] = { 23, 25, 26, 31, 32, 36, 43, 47, 51, 53, \ 54, 65, 71, 72, 73, 74, 114, 115, 116, 122, 125, 131, \ 132, 134, 143, 145, 152, 155, 156, 162, 165, 172, 174, 205, \ 212, 223, 225, 226, 243, 244, 245, 246, 251, 252, 255, 261, \ 263, 265, 266, 271, 274, 306, 311, 315, 325, 331, 332, 343, \ 346, 351, 356, 364, 365, 371, 411, 412, 413, 423, 431, 432, \ 445, 446, 452, 454, 455, 462, 464, 465, 466, 503, 506, 516, \ 523, 526, 532, 546, 565, 606, 612, 624, 627, 631, 632, 654, \ 662, 664, 703, 712, 723, 731, 732, 734, 743, 754, \ 0, }; #define FT100_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_USB|RIG_MODE_LSB|RIG_MODE_RTTY|RIG_MODE_FM) #define FT100_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_USB|RIG_MODE_LSB) #define FT100_AM_FM_RX_MODES (RIG_MODE_AM|RIG_MODE_FM) #define FT100_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_USB|RIG_MODE_LSB|RIG_MODE_RTTY|RIG_MODE_FM) #define FT100_AM_TX_MODES (RIG_MODE_AM) #define FT100_GET_RIG_LEVELS (RIG_LEVEL_RAWSTR|RIG_LEVEL_RFPOWER|\ RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_MICGAIN|RIG_LEVEL_SQL) #define FT100_FUNC_ALL (RIG_FUNC_TONE|RIG_FUNC_TSQL) #define FT100_VFO_ALL (RIG_VFO_A|RIG_VFO_B) #define FT100_ANT (RIG_ANT_1) /* S-meter calibration, ascending order of RAW values */ #define FT100_STR_CAL { 9, \ { \ { 90, 60 }, /* +60 */ \ { 105, 40 }, /* +40 */ \ { 115, 20 }, /* +20 */ \ { 120, 0 }, /* S9 */ \ { 130, -6 }, /* S8 */ \ { 140, -12 }, /* S7 */ \ { 160, -18 }, /* S6 */ \ { 180, -24 }, /* S5 */ \ { 200, -54 } /* S0 */ \ } } const struct rig_caps ft100_caps = { .rig_model = RIG_MODEL_FT100, .model_name = "FT-100", .mfg_name = "Yaesu", .version = "0.4.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, /* ft100/d 4800 only */ .serial_rate_max = 4800, /* no others allowed */ .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT100_WRITE_DELAY, .post_write_delay = FT100_POST_WRITE_DELAY, .timeout = 100, .retry = 0, .has_get_func = RIG_FUNC_NONE, .has_set_func = FT100_FUNC_ALL, .has_get_level = FT100_GET_RIG_LEVELS, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, /* FIXME: parms */ .level_gran = {}, /* granularity */ .parm_gran = {}, .ctcss_list = ft100_ctcss_list, .dcs_list = ft100_dcs_list, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_NONE, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, /* FIXME: memory chan .list = 78 */ .rx_range_list1 = { {kHz(100),MHz(56), FT100_ALL_RX_MODES,-1,-1,FT100_VFO_ALL}, {MHz(76), MHz(108),RIG_MODE_WFM, -1,-1,FT100_VFO_ALL}, {MHz(108),MHz(154),FT100_ALL_RX_MODES,-1,-1,FT100_VFO_ALL}, {MHz(420),MHz(470),FT100_ALL_RX_MODES,-1,-1,FT100_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1, FT100_OTHER_TX_MODES, W(0.5), W(100), FT100_VFO_ALL, FT100_ANT), FRQ_RNG_HF(1, FT100_AM_TX_MODES, W(0.5), W(25), FT100_VFO_ALL, FT100_ANT), FRQ_RNG_6m(1, FT100_OTHER_TX_MODES, W(0.5), W(100), FT100_VFO_ALL, FT100_ANT), FRQ_RNG_6m(1, FT100_AM_TX_MODES, W(0.5), W(25), FT100_VFO_ALL, FT100_ANT), FRQ_RNG_2m(1, FT100_OTHER_TX_MODES, W(0.5), W(50), FT100_VFO_ALL, FT100_ANT), FRQ_RNG_2m(1, FT100_AM_TX_MODES, W(0.5), W(12.5), FT100_VFO_ALL, FT100_ANT), FRQ_RNG_70cm(1, FT100_OTHER_TX_MODES, W(0.5), W(20), FT100_VFO_ALL, FT100_ANT), FRQ_RNG_70cm(1, FT100_AM_TX_MODES, W(0.5), W(5), FT100_VFO_ALL, FT100_ANT), }, .rx_range_list2 = { {kHz(100),MHz(56), FT100_ALL_RX_MODES,-1,-1,FT100_VFO_ALL}, {MHz(76), MHz(108),RIG_MODE_WFM, -1,-1,FT100_VFO_ALL}, {MHz(108),MHz(154),FT100_ALL_RX_MODES,-1,-1,FT100_VFO_ALL}, {MHz(420),MHz(470),FT100_ALL_RX_MODES,-1,-1,FT100_VFO_ALL}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2, FT100_OTHER_TX_MODES, W(0.5), W(100), FT100_VFO_ALL, FT100_ANT), FRQ_RNG_HF(2, FT100_AM_TX_MODES, W(0.5), W(25), FT100_VFO_ALL, FT100_ANT), FRQ_RNG_6m(2, FT100_OTHER_TX_MODES, W(0.5), W(100), FT100_VFO_ALL, FT100_ANT), FRQ_RNG_6m(2, FT100_AM_TX_MODES, W(0.5), W(25), FT100_VFO_ALL, FT100_ANT), FRQ_RNG_2m(2, FT100_OTHER_TX_MODES, W(0.5), W(50), FT100_VFO_ALL, FT100_ANT), FRQ_RNG_2m(2, FT100_AM_TX_MODES, W(0.5), W(12.5), FT100_VFO_ALL, FT100_ANT), FRQ_RNG_70cm(2, FT100_OTHER_TX_MODES, W(0.5), W(20), FT100_VFO_ALL, FT100_ANT), FRQ_RNG_70cm(2, FT100_AM_TX_MODES, W(0.5), W(5), FT100_VFO_ALL, FT100_ANT), RIG_FRNG_END, }, .tuning_steps = { /* FIXME */ {FT100_SSB_CW_RX_MODES,10}, {FT100_SSB_CW_RX_MODES,100}, {FT100_AM_FM_RX_MODES,10}, {FT100_AM_FM_RX_MODES,100}, {RIG_MODE_WFM, kHz(5)}, {RIG_MODE_WFM, kHz(50)}, RIG_TS_END, }, .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY, kHz(2.4)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY, Hz(300)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY, Hz(500)}, {RIG_MODE_AM|RIG_MODE_FM, kHz(6)}, {RIG_MODE_WFM, kHz(230)}, RIG_FLT_END, }, .str_cal = FT100_STR_CAL, .priv = NULL, .rig_init = ft100_init, .rig_cleanup = ft100_cleanup, .rig_open = ft100_open, .rig_close = ft100_close, .set_freq = ft100_set_freq, .get_freq = ft100_get_freq, .set_mode = ft100_set_mode, .get_mode = ft100_get_mode, .set_vfo = ft100_set_vfo, .get_vfo = ft100_get_vfo, .set_ptt = ft100_set_ptt, .get_ptt = ft100_get_ptt, .get_dcd = NULL, .set_rptr_shift = ft100_set_rptr_shift, .get_rptr_shift = NULL, .set_rptr_offs = NULL, .get_rptr_offs = NULL, .set_split_freq = NULL, .get_split_freq = NULL, .set_split_mode = NULL, .get_split_mode = NULL, .set_split_vfo = ft100_set_split_vfo, .get_split_vfo = ft100_get_split_vfo, .set_rit = NULL, .get_rit = NULL, .set_xit = NULL, .get_xit = NULL, .set_ts = NULL, .get_ts = NULL, .set_dcs_code = ft100_set_dcs_code, .get_dcs_code = NULL, .set_ctcss_tone = ft100_set_ctcss_tone, .get_ctcss_tone = NULL, .set_dcs_sql = NULL, .get_dcs_sql = NULL, .set_ctcss_sql = NULL, .get_ctcss_sql = NULL, .set_powerstat = NULL, .get_powerstat = NULL, .reset = NULL, .set_ant = NULL, .get_ant = NULL, .set_level = NULL, .get_level = ft100_get_level, .set_func = NULL, .get_func = NULL, .set_parm = NULL, .get_parm = NULL, }; int ft100_init(RIG *rig) { struct ft100_priv_data *priv; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __func__); priv = (struct ft100_priv_data*)malloc(sizeof(struct ft100_priv_data)); if (!priv) return -RIG_ENOMEM; memset(priv, 0, sizeof(struct ft100_priv_data)); rig->state.priv = (void*)priv; return RIG_OK; } int ft100_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; rig_debug(RIG_DEBUG_VERBOSE,"ft100:ft100_cleanup called \n"); return RIG_OK; } int ft100_open(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"ft100:ft100_open called \n"); return RIG_OK; } int ft100_close(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"ft100:ft100_close called \n"); return RIG_OK; } /* * private helper function to send a private command * sequence . Must only be complete sequences. * */ static int ft100_send_priv_cmd(RIG *rig, unsigned char cmd_index) { struct rig_state *rig_s; unsigned char *cmd; /* points to sequence to send */ rig_debug(RIG_DEBUG_VERBOSE,"%s called (%d)\n", __func__, cmd_index); if (!rig) return -RIG_EINVAL; rig_s = &rig->state; cmd = (unsigned char *) &ncmd[cmd_index].nseq; /* get native sequence */ return write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH); } static int ft100_read_status(RIG *rig) { struct ft100_priv_data *priv; int ret; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __func__); priv = (struct ft100_priv_data*)rig->state.priv; serial_flush( &rig->state.rigport ); ret = ft100_send_priv_cmd(rig, FT100_NATIVE_CAT_READ_STATUS); if (ret != RIG_OK) return ret; ret = read_block( &rig->state.rigport, (char*)&priv->status, sizeof(FT100_STATUS_INFO)); rig_debug(RIG_DEBUG_VERBOSE,"%s: read status=%i \n", __func__, ret); if (ret < 0) return ret; return RIG_OK; } static int ft100_read_flags(RIG *rig) { struct ft100_priv_data *priv = (struct ft100_priv_data*)rig->state.priv; int ret; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __func__); serial_flush( &rig->state.rigport ); ret = ft100_send_priv_cmd(rig, FT100_NATIVE_CAT_READ_FLAGS); if (ret != RIG_OK) return ret; ret = read_block( &rig->state.rigport, (char*)&priv->flags, sizeof(FT100_FLAG_INFO)); rig_debug(RIG_DEBUG_VERBOSE,"%s: read flags=%i \n", __func__, ret); if (ret < 0) return ret; return RIG_OK; } int ft100_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct rig_state *rig_s; unsigned char p_cmd[YAESU_CMD_LENGTH]; unsigned char cmd_index; /* index of sequence to send */ if (!rig) return -RIG_EINVAL; rig_s = &rig->state; rig_debug(RIG_DEBUG_VERBOSE,"ft100: requested freq = %"PRIfreq" Hz \n", freq); cmd_index = FT100_NATIVE_CAT_SET_FREQ; memcpy(p_cmd,&ncmd[cmd_index].nseq,YAESU_CMD_LENGTH); /* fixed 10Hz bug by OH2MMY */ freq = (int)freq/10; to_bcd(p_cmd,freq,8); /* store bcd format in in p_cmd */ return write_block(&rig_s->rigport, (char *) p_cmd, YAESU_CMD_LENGTH); } int ft100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft100_priv_data *priv = (struct ft100_priv_data*)rig->state.priv; freq_t d1, d2; char freq_str[10]; int ret; rig_debug(RIG_DEBUG_VERBOSE,"ft100: get_freq \n"); if( !freq ) return -RIG_EINVAL; ret = ft100_read_status(rig); if (ret != RIG_OK) return ret; rig_debug(RIG_DEBUG_VERBOSE,"ft100: Freq= %3i %3i %3i %3i \n", (int)priv->status.freq[0], (int)priv->status.freq[1], (int)priv->status.freq[2], (int)priv->status.freq[3]); /* now convert it .... */ sprintf(freq_str, "%02X%02X%02X%02X", priv->status.freq[0], priv->status.freq[1], priv->status.freq[2], priv->status.freq[3]); d1=strtol(freq_str,NULL,16); d2=(d1*1.25); /* fixed 10Hz bug by OH2MMY */ rig_debug(RIG_DEBUG_VERBOSE,"ft100: d1=%"PRIfreq" d2=%"PRIfreq"\n",d1,d2); rig_debug(RIG_DEBUG_VERBOSE,"ft100: get_freq= %8"PRIll" \n",(int64_t)d2); *freq = d2; return RIG_OK; } int ft100_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { unsigned char cmd_index; /* index of sequence to send */ unsigned char p_cmd[YAESU_CMD_LENGTH]; int ret; rig_debug(RIG_DEBUG_VERBOSE,"ft100: generic mode = %x, width %d\n", mode, width); switch(mode) { case RIG_MODE_AM: cmd_index = FT100_NATIVE_CAT_SET_MODE_AM; break; case RIG_MODE_CW: cmd_index = FT100_NATIVE_CAT_SET_MODE_CW; break; case RIG_MODE_CWR: cmd_index = FT100_NATIVE_CAT_SET_MODE_CWR; break; case RIG_MODE_USB: cmd_index = FT100_NATIVE_CAT_SET_MODE_USB; break; case RIG_MODE_LSB: cmd_index = FT100_NATIVE_CAT_SET_MODE_LSB; break; case RIG_MODE_FM: cmd_index = FT100_NATIVE_CAT_SET_MODE_FM; break; case RIG_MODE_RTTY: cmd_index = FT100_NATIVE_CAT_SET_MODE_DIG; break; case RIG_MODE_WFM: cmd_index = FT100_NATIVE_CAT_SET_MODE_WFM; break; default: return -RIG_EINVAL; } ret = ft100_send_priv_cmd(rig,cmd_index); if (ret != RIG_OK) return ret; #if 1 if (mode != RIG_MODE_FM && mode != RIG_MODE_WFM && width <= kHz(6)) { p_cmd[0] = 0x00; p_cmd[1] = 0x00; p_cmd[2] = 0x00; p_cmd[3] = 0x00; /* to be filled in */ p_cmd[4] = 0x8C; /* Op: filter selection */ if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); switch(width) { case 2400: p_cmd[3] = 0x00; break; case 6000: p_cmd[3] = 0x01; break; case 500: p_cmd[3] = 0x02; break; case 300: p_cmd[3] = 0x03; break; default: return -RIG_EINVAL; }; ret = write_block(&rig->state.rigport, (char *) p_cmd, YAESU_CMD_LENGTH); if (ret != RIG_OK) return ret; } #endif return RIG_OK; } /* ft100_get_mode fixed by OH2MMY * Still answers wrong if on AM. Bug in rig's firmware? * The rig answers something weird then, not what the manual says * and the answer is different every time. Other modes do work. */ int ft100_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct ft100_priv_data *priv = (struct ft100_priv_data*)rig->state.priv; int ret; if( !mode || !width ) return -RIG_EINVAL; ret = ft100_read_status(rig); if (ret < 0) return ret; switch( priv->status.mode & 0x0f ) { case 0x00: *mode = RIG_MODE_LSB; break; case 0x01: *mode = RIG_MODE_USB; break; case 0x02: *mode = RIG_MODE_CW; break; case 0x03: *mode = RIG_MODE_CWR; break; case 0x04: *mode = RIG_MODE_AM; break; case 0x05: *mode = RIG_MODE_RTTY; break; case 0x06: *mode = RIG_MODE_FM; break; case 0x07: *mode = RIG_MODE_WFM; break; default: *mode = RIG_MODE_NONE; }; switch( priv->status.mode >> 4 ) { case 0x00: *width = Hz(6000); break; case 0x01: *width = Hz(2400); break; case 0x02: *width = Hz(500); break; case 0x03: *width = Hz(300); break; default: *width = RIG_PASSBAND_NORMAL; }; return RIG_OK; } /* Function ft100_set_vfo fixed by OH2MMY */ int ft100_set_vfo(RIG *rig, vfo_t vfo) { int ret; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __func__); switch(vfo) { case RIG_VFO_A: ret = ft100_send_priv_cmd( rig, FT100_NATIVE_CAT_SET_VFOA ); if( ret != RIG_OK ) return ret; break; case RIG_VFO_B: ret = ft100_send_priv_cmd( rig, FT100_NATIVE_CAT_SET_VFOB ); if( ret != RIG_OK ) return ret; break; default: return -RIG_EINVAL; } return RIG_OK; } /* Function ft100_get_vfo written again by OH2MMY * Tells the right answer if in VFO mode. * TODO: handle memory modes. */ int ft100_get_vfo(RIG *rig, vfo_t *vfo) { struct ft100_priv_data *priv = (struct ft100_priv_data*)rig->state.priv; int ret; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __func__); if( !vfo ) return -RIG_EINVAL; ret = ft100_read_flags(rig); if (ret < 0) return ret; if ((priv->flags.byte[1] & 0x04) == 0x04) { *vfo = RIG_VFO_B; } else { *vfo = RIG_VFO_A; } return RIG_OK; } int ft100_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { unsigned char cmd_index; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __func__); switch(ptt) { case RIG_PTT_ON: cmd_index = FT100_NATIVE_CAT_PTT_ON; break; case RIG_PTT_OFF: cmd_index = FT100_NATIVE_CAT_PTT_OFF; break; default: return -RIG_EINVAL; } return ft100_send_priv_cmd(rig,cmd_index); } int ft100_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct ft100_priv_data *priv = (struct ft100_priv_data*)rig->state.priv; int ret; if( !ptt ) return -RIG_EINVAL; ret = ft100_read_flags(rig); if (ret < 0) return ret; *ptt = (priv->flags.byte[0] & 0x80) == 0x80 ? RIG_PTT_ON : RIG_PTT_OFF; return RIG_OK; } /* * Rem: The FT-100(D) has no set_level ability */ /* * blind implementation of get_level. * Please test on real hardware and send report on hamlib mailing list */ int ft100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { int ret; float f; FT100_METER_INFO ft100_meter; if( !rig ) return -RIG_EINVAL; if( !val ) return -RIG_EINVAL; rig_debug(RIG_DEBUG_VERBOSE,"%s: %s\n", __func__, rig_strlevel(level)); ret = ft100_send_priv_cmd(rig,FT100_NATIVE_CAT_READ_METERS); if (ret != RIG_OK) return ret; ret = read_block( &rig->state.rigport, (char*)&ft100_meter, sizeof(FT100_METER_INFO)); rig_debug(RIG_DEBUG_VERBOSE,"%s: read meters=%d\n",__func__, ret); if (ret < 0) return ret; switch( level ) { case RIG_LEVEL_RAWSTR: val->i = ft100_meter.s_meter; break; case RIG_LEVEL_RFPOWER: val->f = (float)ft100_meter.tx_fwd_power/0xff; break; case RIG_LEVEL_SWR: if (ft100_meter.tx_fwd_power == 0) val->f = 0; else { f = sqrt((float)ft100_meter.tx_rev_power/(float)ft100_meter.tx_fwd_power); val->f = (1+f)/(1-f); } break; case RIG_LEVEL_ALC: /* need conversion ? */ val->f = (float)ft100_meter.alc_level/0xff; break; case RIG_LEVEL_MICGAIN: val->f = (float)ft100_meter.mic_level/0xff; break; case RIG_LEVEL_SQL: val->f = (float)ft100_meter.squelch_level/0xff; break; default: return -RIG_EINVAL; } return RIG_OK; } #if 0 /* TODO: all of this */ int ft100_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { return -RIG_ENIMPL; } int ft100_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status) { return -RIG_ENIMPL; } int ft100_set_parm(RIG *rig, setting_t parm, value_t val) { return -RIG_ENIMPL; } int ft100_get_parm(RIG *rig, setting_t parm, value_t *val) { return -RIG_ENIMPL; } #endif /* kc2ivl */ int ft100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { unsigned char cmd_index; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __func__); switch(split) { case RIG_SPLIT_ON: cmd_index = FT100_NATIVE_CAT_SPLIT_ON; break; case RIG_SPLIT_OFF: cmd_index = FT100_NATIVE_CAT_SPLIT_OFF; break; default: return -RIG_EINVAL; } return ft100_send_priv_cmd(rig,cmd_index); } int ft100_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { struct ft100_priv_data *priv = (struct ft100_priv_data*)rig->state.priv; int ret; rig_debug(RIG_DEBUG_VERBOSE,"%s called\n", __func__); if( !split ) return -RIG_EINVAL; ret = ft100_read_flags(rig); if (ret < 0) return ret; *split = (priv->flags.byte[0] & 0x01) == 0x01 ? RIG_SPLIT_ON : RIG_SPLIT_OFF; return RIG_OK; } int ft100_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift) { unsigned char cmd_index; rig_debug(RIG_DEBUG_VERBOSE,"ft100:ft100_set_rptr_shift called \n"); rig_debug(RIG_DEBUG_VERBOSE,"ft100: + - 0 %3i %3i %3i %3i %c\n", RIG_RPT_SHIFT_PLUS, RIG_RPT_SHIFT_MINUS, RIG_RPT_SHIFT_NONE, shift, (char)shift); switch(shift) { case RIG_RPT_SHIFT_PLUS: cmd_index = FT100_NATIVE_CAT_SET_RPT_SHIFT_PLUS; break; case RIG_RPT_SHIFT_MINUS: cmd_index = FT100_NATIVE_CAT_SET_RPT_SHIFT_MINUS; break; case RIG_RPT_SHIFT_NONE: cmd_index = FT100_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX; break; default: return -RIG_EINVAL; } return ft100_send_priv_cmd(rig,cmd_index); } /* * TODO: enable/disable encoding/decoding */ int ft100_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code) { struct rig_state *rig_s; unsigned char p_cmd[YAESU_CMD_LENGTH]; unsigned char cmd_index; /* index of sequence to send */ int pcode; rig_s = &rig->state; for (pcode = 0; pcode < 104 && ft100_dcs_list[pcode] !=0; pcode++) { if (ft100_dcs_list[pcode] == code) break; } /* there are 104 dcs codes available */ if (pcode >= 104 || ft100_dcs_list[pcode] == 0) return -RIG_EINVAL; rig_debug(RIG_DEBUG_VERBOSE,"%s = %03i, n=%d\n", __func__, code, pcode); cmd_index = FT100_NATIVE_CAT_SET_DCS_CODE; memcpy(p_cmd,&ncmd[cmd_index].nseq,YAESU_CMD_LENGTH); p_cmd[3]=(char)pcode; return write_block(&rig_s->rigport, (char *) p_cmd, YAESU_CMD_LENGTH); } /* * TODO: enable/disable encoding/decoding */ int ft100_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone) { struct rig_state *rig_s; unsigned char p_cmd[YAESU_CMD_LENGTH]; unsigned char cmd_index; /* index of sequence to send */ int ptone; for (ptone = 0; ptone < 39 && ft100_ctcss_list[ptone] !=0; ptone++) { if (ft100_ctcss_list[ptone] == tone) break; } /* there are 39 ctcss tones available */ if (ptone >= 39 || ft100_ctcss_list[ptone] == 0) return -RIG_EINVAL; rig_s = &rig->state; rig_debug(RIG_DEBUG_VERBOSE,"%s = %.1f Hz, n=%d\n",__func__, (float)tone/10, ptone); cmd_index = FT100_NATIVE_CAT_SET_CTCSS_FREQ; memcpy(p_cmd,&ncmd[cmd_index].nseq,YAESU_CMD_LENGTH); p_cmd[3]=(char)ptone; return write_block(&rig_s->rigport, (char *) p_cmd, YAESU_CMD_LENGTH); } hamlib-1.2.15.3/yaesu/ft767gx.c0000644000175000017500000012425312044564477012650 00000000000000/* * hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com) * * ft767gx.c - (C) Steve Conklin 2007 * adapted from ft757gx.c by Stephane Fillod 2004 * This shared library provides an API for communicating * via serial interface to an FT-767GX using the "CAT" interface * box (FIF-232C) or similar * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * TODO * * 1. Allow cached reads * 2. set_mem/get_mem, get_channel, set_split/get_split, * set_func/get_func * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "ft767gx.h" static int ft767_init(RIG *rig); static int ft767_cleanup(RIG *rig); static int ft767_open(RIG *rig); static int ft767_close(RIG *rig); static int ft767_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft767_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ft767_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); /* select mode */ static int ft767_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); /* get mode */ static int ft767_set_vfo(RIG *rig, vfo_t vfo); /* select vfo */ static int ft767_get_vfo(RIG *rig, vfo_t *vfo); /* get vfo */ static int ft767_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); static int ft767_set_ctcss_tone(RIG * rig, vfo_t vfo, tone_t tone); static int ft767_get_ctcss_tone(RIG * rig, vfo_t vfo, tone_t *tone); static int ft767_set_ctcss_sql(RIG * rig, vfo_t vfo, tone_t tone); static int ft767_get_ctcss_sql(RIG * rig, vfo_t vfo, tone_t *tone); static int ft767_set_split_freq(RIG * rig, vfo_t vfo, freq_t tx_freq); static int ft767_get_split_freq(RIG * rig, vfo_t vfo, freq_t * tx_freq); static int ft767_set_split_mode(RIG * rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width); static int ft767_get_split_mode(RIG * rig, vfo_t vfo, rmode_t * tx_mode, pbwidth_t * tx_width); static int ft767_set_split_vfo(RIG * rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int ft767_get_split_vfo(RIG * rig, vfo_t vfo, split_t * split, vfo_t *tx_vfo); /* Private helper function prototypes */ static int ft767_send_block_and_ack(RIG *rig, unsigned char *cmd, size_t length); static int ft767_get_update_data(RIG *rig); static int ft767_enter_CAT(RIG *rig); static int ft767_leave_CAT(RIG *rig); static int ft767_set_split(RIG *rig, unsigned int split); static unsigned char vfo2rig(RIG *rig, vfo_t vfo); static vfo_t rig2vfo(unsigned char status); static int mode2rig(RIG *rig, rmode_t mode); static int rig2mode(RIG *rig, int md, rmode_t *mode, pbwidth_t *width); /* static int ctcss2rig(RIG *rig, tone_t tone); */ static int rig2ctcss(RIG *rig, unsigned char tn, tone_t *tone); /* * On the rig used by the author of this software, the values returned * by the rig for the CTCSS tones are different than those in the Yaesu * documentation. This could possibly be because he tone module in that * rig is an aftermarket board sold by the piexx company. Leaving the * following undefined uses the values discovered by experimentation. For * The original values defined in the Yaesu documentation, uncomment it. */ /* #define USE_YAESU_PUBLISHED_TONES */ /* Valid command codes */ #define CMD_CAT_SW 0x00 #define CMD_CHECK 0x01 #define CMD_UP10HZ 0x02 #define CMD_DN10HZ 0x03 #define CMD_PROG_UP 0x04 #define CMD_PROG_DN 0x05 #define CMD_BAND_UP 0x06 #define CMD_BAND_DN 0x07 #define CMD_FREQ_SET 0x08 #define CMD_VFOMR 0x09 #define CMD_MULTICMD 0x0A /* This command code overloaded */ #define CMD_TONE_SET 0x0C #define CMD_ACK 0x0B /* subcommands for command code 0x0A */ /* values 0 - 9 select memories */ #define SUBCMD_MEM0 0x00 /* 8 bytes returned */ #define SUBCMD_MEM1 0x01 /* 8 bytes returned */ #define SUBCMD_MEM2 0x02 /* 8 bytes returned */ #define SUBCMD_MEM3 0x03 /* 8 bytes returned */ #define SUBCMD_MEM4 0x04 /* 8 bytes returned */ #define SUBCMD_MEM5 0x05 /* 8 bytes returned */ #define SUBCMD_MEM6 0x06 /* 8 bytes returned */ #define SUBCMD_MEM7 0x07 /* 8 bytes returned */ #define SUBCMD_MEM8 0x08 /* 8 bytes returned */ #define SUBCMD_MEM9 0x09 /* 8 bytes returned */ #define SUBCMD_MODE_LSB 0x10 /* 8 bytes returned */ #define SUBCMD_MODE_USB 0x11 /* 8 bytes returned */ #define SUBCMD_MODE_CW 0x12 /* 8 bytes returned */ #define SUBCMD_MODE_AM 0x13 /* 8 bytes returned */ #define SUBCMD_MODE_FM 0x14 /* 8 bytes returned */ #define SUBCMD_MODE_FSK 0x15 /* 8 bytes returned */ #define SUBCMD_HG_HAM 0x20 /* ham coverage */ #define SUBCMD_HG_GEN 0x21 /* general coverage */ #define SUBCMD_SPLIT 0x30 /* toggle split */ #define SUBCMD_CLAR 0x40 /* toggle clarifier */ #define SUBCMD_MTOV 0x50 /* memory to VFO */ #define SUBCMD_VTOM 0x60 /* VFO to memory */ #define SUBCMD_SWAP 0x70 /* swap VFO, memory */ #define SUBCMD_ACLR 0x80 /* turn off SPLIT, CLAR< OFFSET */ /* * Some useful offsets in the status update map (offset) * * Status Update Chart, FT767GXII */ #define STATUS_FLAGS 0 #define STATUS_CURR_FREQ 1 /* Operating Frequency */ #define STATUS_CURR_TONE 5 #define STATUS_CURR_MODE 6 #define STATUS_VFOA_FREQ 14 #define STATUS_VFOA_MODE 19 #define STATUS_VFOB_FREQ 20 #define STATUS_VFOB_MODE 25 /* Status bit masks */ #define STATUS_MASK_PTT 0x01 #define STATUS_MASK_HG 0x02 #define STATUS_MASK_TXINH 0x04 #define STATUS_MASK_SPLIT 0x08 #define STATUS_MASK_VFO 0x10 #define STATUS_MASK_MEM 0x20 #define STATUS_MASK_CLAR 0x40 #define STATUS_MASK_CAT 0x80 /* mode byte */ #define MODE_LSB 0x0 #define MODE_USB 0x1 #define MODE_CW 0x2 #define MODE_AM 0x3 #define MODE_FM 0x4 #define MODE_FSK 0x5 /* * Things that I need to figure out how to fit in */ //#define VFO_OPERATIONS_LIST (RIG_OP_FROM_VFO | RIG_OP_TO_VFO | RIG_OP_TOGGLE) /* These VFO OPS can only be applied to the current VFO */ // RIG_OP_UP = (1<<5), /*!< UP increment VFO freq by tuning step*/ // RIG_OP_DOWN = (1<<6), /*!< DOWN decrement VFO freq by tuning step*/ // RIG_OP_BAND_UP = (1<<7), /*!< Band UP */ /* #define FT767_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, .ctcss_tone = 1 \ } */ /* * End of things not put in yet */ /* * Receiver caps */ #define FT767GX_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_PKTFM) #define FT767GX_HF_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB) /* * TX caps */ #define FT767GX_ALL_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_FM|RIG_MODE_PKTFM) #define FT767GX_HF_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_SSB) #define CTCSS_TONE_LIST \ 670, 710, 747, 770, 797, 825, 854, 885, 915, 948, \ 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, 1365, \ 1413, 1462, 1514, 1567, 1622, 1679, 1738, 1799, 1862, 1928, \ 2035, 2107, 2181, 2257, 2336, 2418, 2503, 0 /* * future - private data * */ struct ft767_priv_data { unsigned char pacing; /* pacing value */ unsigned int read_update_delay; /* depends on pacing value */ unsigned char current_vfo; /* active VFO from last cmd , can be either RIG_VFO_A or RIG_VFO_B only */ unsigned char update_data[FT767GX_STATUS_UPDATE_DATA_LENGTH]; /* returned data */ unsigned char rx_data[FT767GX_STATUS_UPDATE_DATA_LENGTH]; /* returned data */ unsigned char ack_cmd[5]; }; const tone_t static_767gx_ctcss_list[] = { CTCSS_TONE_LIST }; /* * ft767gx rigs capabilities. * Also this struct is READONLY! */ const struct rig_caps ft767gx_caps = { .rig_model = RIG_MODEL_FT767, .model_name = "FT-767GX", .mfg_name = "Yaesu", .version = "1.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT767GX_WRITE_DELAY, .post_write_delay = FT767GX_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = static_767gx_ctcss_list, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9999), .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, }, /* TODO need memory channel capabilities here */ // .chan_list = {0, 9, RIG_MTYPE_MEM, RIG_CHAN_END, }, /* TODO need memory channel capabilities here */ .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { { .start = kHz(100), .end = 29999999, .modes = FT767GX_ALL_RX_MODES,.low_power = -1,.high_power = -1}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {kHz(1500),1999900,FT767GX_HF_TX_MODES,.low_power = 5000,.high_power = 100000}, {.start = kHz(3500),3999900,FT767GX_HF_TX_MODES,5000,100000}, {.start = kHz(7000),7499900,FT767GX_HF_TX_MODES,5000,100000}, {.start = MHz(10),10499900,FT767GX_HF_TX_MODES,5000,100000}, {.start = MHz(14),14499900,FT767GX_HF_TX_MODES,5000,100000}, {.start = MHz(18),18499900,FT767GX_HF_TX_MODES,5000,100000}, {.start = MHz(21),21499900,FT767GX_HF_TX_MODES,5000,100000}, {.start = kHz(24500),24999900,FT767GX_HF_TX_MODES,5000,100000}, {.start = MHz(28),29999900,FT767GX_HF_TX_MODES,5000,100000}, {.start = MHz(50),59999900,FT767GX_ALL_TX_MODES,5000,10000}, {.start = MHz(144),147999900,FT767GX_ALL_TX_MODES,5000,10000}, {.start = MHz(430),449999990,FT767GX_ALL_TX_MODES,5000,10000}, RIG_FRNG_END, }, .tuning_steps = { {FT767GX_ALL_RX_MODES,10}, {FT767GX_ALL_RX_MODES,100}, RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { RIG_FLT_END, }, .priv = NULL, /* private data */ .rig_init = ft767_init, .rig_cleanup = ft767_cleanup, .rig_open = ft767_open, /* port opened */ .rig_close = ft767_close, /* port closed */ .set_freq = ft767_set_freq, /* set freq */ .get_freq = ft767_get_freq, /* get freq */ .set_mode = ft767_set_mode, /* set mode */ .get_mode = ft767_get_mode, /* get mode */ .set_vfo = ft767_set_vfo, /* set vfo */ .get_vfo = ft767_get_vfo, /* get vfo */ .set_ptt = NULL, /* set ptt */ .get_ptt = ft767_get_ptt, /* get ptt */ .set_ctcss_tone = ft767_set_ctcss_tone, .get_ctcss_tone = ft767_get_ctcss_tone, .set_ctcss_sql = ft767_set_ctcss_sql, .get_ctcss_sql = ft767_get_ctcss_sql, .set_split_freq = ft767_set_split_freq, .get_split_freq = ft767_get_split_freq, .set_split_mode = ft767_set_split_mode, .get_split_mode = ft767_get_split_mode, .set_split_vfo = ft767_set_split_vfo, .get_split_vfo = ft767_get_split_vfo, }; /* * _init * */ int ft767_init(RIG *rig) { struct ft767_priv_data *p; if (!rig) return -RIG_EINVAL; p = (struct ft767_priv_data*)malloc(sizeof(struct ft767_priv_data)); if (!p) /* whoops! memory shortage! */ return -RIG_ENOMEM; rig_debug(RIG_DEBUG_TRACE,"%s called\n", __FUNCTION__); /* TODO: read pacing from preferences */ p->pacing = FT767GX_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */ p->read_update_delay = FT767GX_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */ p->current_vfo = RIG_VFO_A; /* default to VFO_A ? */ p->ack_cmd[0] = 00; p->ack_cmd[1] = 00; p->ack_cmd[2] = 00; p->ack_cmd[3] = 00; p->ack_cmd[4] = 0x0B; rig->state.priv = (void*)p; return RIG_OK; } /* * ft767_cleanup routine * the serial port is closed by the frontend */ int ft767_cleanup(RIG *rig) { if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s called\n", __FUNCTION__); if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * ft767_open routine * */ int ft767_open(RIG *rig) { struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; int retval; serial_flush(&rig->state.rigport); /* send 0 delay PACING cmd to rig */ retval = ft767_enter_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: enter_CAT %d\n", __FUNCTION__, retval); memset(priv->update_data,0,FT767GX_STATUS_UPDATE_DATA_LENGTH); return retval; } retval = ft767_leave_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: leave_CAT %d\n", __FUNCTION__, retval); memset(priv->update_data,0,FT767GX_STATUS_UPDATE_DATA_LENGTH); return retval; } rig->state.vfo_list = RIG_VFO_A | RIG_VFO_B; return RIG_OK; } /* * ft767_close routine * */ int ft767_close(RIG *rig) { serial_flush(&rig->state.rigport); return RIG_OK; } /* * This command only functions when operating on a vfo. * */ int ft767_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, CMD_FREQ_SET}; int retval; /* should the vfo be tested? */ /* fill in first four bytes */ to_bcd(cmd, freq/10, 8); retval = ft767_enter_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: enter_CAT %d\n", __FUNCTION__, retval); return retval; } retval = ft767_send_block_and_ack(rig, cmd, YAESU_CMD_LENGTH); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: failed to send command: status %d\n", __FUNCTION__, retval); return retval; } retval = ft767_leave_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: leave_CAT %d\n", __FUNCTION__, retval); } return retval; } int ft767_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, CMD_MULTICMD}; int retval; /* fill in p1 */ cmd[3] = mode2rig(rig, mode); retval = ft767_enter_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: enter_CAT %d\n", __FUNCTION__, retval); return retval; } retval = ft767_send_block_and_ack(rig, cmd, YAESU_CMD_LENGTH); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: failed to send command: status %d\n", __FUNCTION__, retval); return retval; } retval = ft767_leave_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: leave_CAT %d\n", __FUNCTION__, retval); } return retval; } /* * Return Freq */ int ft767_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; int retval; retval = ft767_get_update_data(rig); /* get whole shebang from rig */ if (retval < 0) return retval; /* grab freq and convert */ switch(vfo) { case RIG_VFO_CURR: *freq = from_bcd_be(priv->update_data+STATUS_CURR_FREQ, 8); break; case RIG_VFO_A: *freq = from_bcd_be(priv->update_data+STATUS_VFOA_FREQ, 8); break; case RIG_VFO_B: *freq = from_bcd_be(priv->update_data+STATUS_VFOB_FREQ, 8); break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } *freq *= 10.0; /* rig reads in 10 Hz increments*/ return RIG_OK; } int ft767_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; int retval; retval = ft767_get_update_data(rig); /* get whole shebang from rig */ if (retval < 0) return retval; switch(vfo) { case RIG_VFO_CURR: retval = rig2mode(rig, priv->update_data[STATUS_CURR_MODE], mode, width); break; case RIG_VFO_A: retval = rig2mode(rig, priv->update_data[STATUS_VFOA_MODE], mode, width); break; case RIG_VFO_B: retval = rig2mode(rig, priv->update_data[STATUS_VFOB_MODE], mode, width); break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } return retval; } /* * set vfo and store requested vfo for later RIG_VFO_CURR * requests. * */ int ft767_set_vfo(RIG *rig, vfo_t vfo) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, CMD_VFOMR}; struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; int retval; switch(vfo) { case RIG_VFO_CURR: return RIG_OK; case RIG_VFO_A: cmd[3] = 0x00; break; case RIG_VFO_B: cmd[3] = 0x01; break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } priv->current_vfo = vfo; retval = ft767_enter_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: enter_CAT %d\n", __FUNCTION__, retval); return retval; } retval = ft767_send_block_and_ack(rig, cmd, YAESU_CMD_LENGTH); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: failed to send command: status %d\n", __FUNCTION__, retval); return retval; } retval = ft767_leave_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: leave_CAT %d\n", __FUNCTION__, retval); } return retval; } int ft767_get_vfo(RIG *rig, vfo_t *vfo) { struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; int retval; retval = ft767_get_update_data(rig); /* get whole shebang from rig */ if (retval < 0) return retval; *vfo = rig2vfo(priv->update_data[STATUS_FLAGS]); return RIG_OK; } int ft767_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; int retval; retval = ft767_get_update_data(rig); /* get whole shebang from rig */ if (retval < 0) return retval; *ptt = priv->update_data[STATUS_FLAGS] & 0x01 ? RIG_PTT_ON : RIG_PTT_OFF; return RIG_OK; } /* on this rig, only one tone can be set per VFO or memory, * and it's active for both tx and receive. */ int ft767_set_ctcss_tone(RIG * rig, vfo_t vfo, tone_t tone) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, CMD_TONE_SET}; int retval; /* determine whether we have to send high-Q */ switch(tone) { case 747: case 797: case 854: case 915: cmd[1] = 1; /* High Q */ break; default: break; } /* fill in p2 and p1 with bcd tone value */ to_bcd(&cmd[2], tone, 4); /* cmd[3] = tone2rig(rig, tone); */ retval = ft767_enter_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: enter_CAT %d\n", __FUNCTION__, retval); return retval; } retval = ft767_send_block_and_ack(rig, cmd, YAESU_CMD_LENGTH); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: failed to send command: status %d\n", __FUNCTION__, retval); return retval; } retval = ft767_leave_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: leave_CAT %d\n", __FUNCTION__, retval); } return retval; } int ft767_get_ctcss_tone(RIG * rig, vfo_t vfo, tone_t *tone) { struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; int retval; retval = ft767_get_update_data(rig); /* get whole shebang from rig */ if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: get_update_data failed with status %d\n", __FUNCTION__, retval); return retval; } retval = rig2ctcss(rig, priv->update_data[STATUS_CURR_TONE], tone); return retval; } int ft767_set_ctcss_sql(RIG * rig, vfo_t vfo, tone_t tone) { return ft767_set_ctcss_tone(rig, vfo, tone); } int ft767_get_ctcss_sql(RIG * rig, vfo_t vfo, tone_t *tone) { return ft767_get_ctcss_tone(rig, vfo, tone); } /* split functions */ int ft767_set_split_freq(RIG * rig, vfo_t vfo, freq_t tx_freq) { struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; unsigned char freq_cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, CMD_FREQ_SET}; unsigned char vfo_cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, CMD_VFOMR}; vfo_t curr_vfo; vfo_t change_vfo; unsigned char curr_split; int retval; /* This appears to always pass in VFO_CURR as the vfo */ /* My decision is to only update the xmit VFO if we're in split mode */ retval = ft767_get_update_data(rig); /* get whole shebang from rig */ if (retval < 0) return retval; /* find out how we're currently configured */ curr_vfo = rig2vfo(priv->update_data[STATUS_FLAGS]); curr_split = priv->update_data[STATUS_FLAGS] & STATUS_MASK_SPLIT; if(curr_split) { switch(curr_vfo) { /* we need to set something */ case RIG_VFO_A: change_vfo = RIG_VFO_B; break; case RIG_VFO_B: change_vfo = RIG_VFO_A; break; case RIG_VFO_MEM: rig_debug(RIG_DEBUG_ERR,"%s: error, in both split and memory modes\n", __FUNCTION__); return RIG_OK; default: rig_debug(RIG_DEBUG_ERR,"%s: error, unknown vfo value %d\n", __FUNCTION__, curr_vfo); return RIG_OK; } } else { /* not in split mode, do nothing */ return RIG_OK; } /* fill in first four bytes */ to_bcd(freq_cmd, tx_freq/10, 8); retval = ft767_enter_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: enter_CAT %d\n", __FUNCTION__, retval); return retval; } /* change to the xmit VFO */ vfo_cmd[3] = vfo2rig(rig, change_vfo); retval = ft767_send_block_and_ack(rig, vfo_cmd, YAESU_CMD_LENGTH); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: failed to send command: status %d\n", __FUNCTION__, retval); return retval; } /* change the freq */ retval = ft767_send_block_and_ack(rig, freq_cmd, YAESU_CMD_LENGTH); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: failed to send command: status %d\n", __FUNCTION__, retval); return retval; } /* change back to the rcv VFO */ vfo_cmd[3] = vfo2rig(rig, curr_vfo); retval = ft767_send_block_and_ack(rig, vfo_cmd, YAESU_CMD_LENGTH); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: failed to send command: status %d\n", __FUNCTION__, retval); return retval; } retval = ft767_leave_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: leave_CAT %d\n", __FUNCTION__, retval); } return RIG_OK; } int ft767_get_split_freq(RIG * rig, vfo_t vfo, freq_t * tx_freq) { struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; int retval; unsigned int offset; vfo_t curr_vfo; unsigned char curr_split; retval = ft767_get_update_data(rig); /* get whole shebang from rig */ if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: get_update_data failed with status %d\n", __FUNCTION__, retval); return retval; } curr_vfo = rig2vfo(priv->update_data[STATUS_FLAGS]); curr_split = priv->update_data[STATUS_FLAGS] & STATUS_MASK_SPLIT; if(curr_split) { switch(curr_vfo) { /* we need to get something */ case RIG_VFO_A: offset = STATUS_VFOB_FREQ; break; case RIG_VFO_B: offset = STATUS_VFOA_FREQ; break; case RIG_VFO_MEM: rig_debug(RIG_DEBUG_ERR,"%s: error, in both split and memory modes\n", __FUNCTION__); return RIG_OK; default: rig_debug(RIG_DEBUG_ERR,"%s: error, unknown vfo value %d\n", __FUNCTION__, curr_vfo); return RIG_OK; } } else { /* not in split mode, do nothing */ return RIG_OK; } *tx_freq = from_bcd_be(priv->update_data+offset, 8); return RIG_OK; } int ft767_set_split_mode(RIG * rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width) { struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; unsigned char mode_cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, CMD_MULTICMD}; unsigned char vfo_cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, CMD_VFOMR}; vfo_t curr_vfo; vfo_t change_vfo; unsigned char curr_split; int retval; /* This appears to always pass in VFO_CURR as the vfo */ /* My decision is to only update the xmit mode if we're in split mode */ retval = ft767_get_update_data(rig); /* get whole shebang from rig */ if (retval < 0) return retval; /* find out how we're currently configured */ curr_vfo = rig2vfo(priv->update_data[STATUS_FLAGS]); curr_split = priv->update_data[STATUS_FLAGS] & STATUS_MASK_SPLIT; if(curr_split) { switch(curr_vfo) { /* we need to set something */ case RIG_VFO_A: change_vfo = RIG_VFO_B; break; case RIG_VFO_B: change_vfo = RIG_VFO_A; break; case RIG_VFO_MEM: rig_debug(RIG_DEBUG_ERR,"%s: error, in both split and memory modes\n", __FUNCTION__); return RIG_OK; default: rig_debug(RIG_DEBUG_ERR,"%s: error, unknown vfo value %d\n", __FUNCTION__, curr_vfo); return RIG_OK; } } else { /* not in split mode, do nothing */ return RIG_OK; } /* fill in p1 */ mode_cmd[3] = mode2rig(rig, tx_mode); retval = ft767_enter_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: enter_CAT %d\n", __FUNCTION__, retval); return retval; } /* change to the xmit VFO */ vfo_cmd[3] = vfo2rig(rig, change_vfo); retval = ft767_send_block_and_ack(rig, vfo_cmd, YAESU_CMD_LENGTH); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: failed to send vfo change 1 command: status %d\n", __FUNCTION__, retval); return retval; } /* change the mode */ retval = ft767_send_block_and_ack(rig, mode_cmd, YAESU_CMD_LENGTH); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: failed to send mode command: status %d\n", __FUNCTION__, retval); return retval; } /* change back to the rcv VFO */ vfo_cmd[3] = vfo2rig(rig, curr_vfo); retval = ft767_send_block_and_ack(rig, vfo_cmd, YAESU_CMD_LENGTH); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: failed to send vfo change 2command: status %d\n", __FUNCTION__, retval); return retval; } retval = ft767_leave_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: leave_CAT %d\n", __FUNCTION__, retval); } return RIG_OK; } int ft767_get_split_mode(RIG * rig, vfo_t vfo, rmode_t * tx_mode, pbwidth_t * tx_width) { struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; int retval; unsigned int offset; vfo_t curr_vfo; unsigned char curr_split; retval = ft767_get_update_data(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: get_update_data failed with status %d\n", __FUNCTION__, retval); return retval; } curr_vfo = rig2vfo(priv->update_data[STATUS_FLAGS]); curr_split = priv->update_data[STATUS_FLAGS] & STATUS_MASK_SPLIT; if(curr_split) { switch(curr_vfo) { /* we need to get something */ case RIG_VFO_A: offset = STATUS_VFOB_MODE; break; case RIG_VFO_B: offset = STATUS_VFOA_MODE; break; case RIG_VFO_MEM: rig_debug(RIG_DEBUG_ERR,"%s: error, in both split and memory modes\n", __FUNCTION__); return RIG_OK; default: rig_debug(RIG_DEBUG_ERR,"%s: error, unknown vfo value %d\n", __FUNCTION__, curr_vfo); return RIG_OK; } } else { /* not in split mode, do nothing */ return RIG_OK; } /* get the actual mode */ retval = rig2mode(rig, priv->update_data[offset], tx_mode, tx_width); return retval; } int ft767_set_split_vfo(RIG * rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x00}; int retval; vfo_t curr_vfo; vfo_t future_vfo; unsigned char curr_split; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed tx_vfo = 0x%02x\n", __func__, tx_vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed split = 0x%02x\n", __func__, split); if ((tx_vfo != RIG_VFO_A) && (tx_vfo != RIG_VFO_B)) return -RIG_EINVAL; retval = ft767_get_update_data(rig); /* get whole shebang from rig */ if (retval < 0) return retval; /* find out which VFO we're currently using */ curr_vfo = rig2vfo(priv->update_data[STATUS_FLAGS]); /* * If split is enabled, Set the current VFO to the opposite of * the one specified in tx_vfo. If split is not enabled, then don't change anything. */ switch(split) { case RIG_SPLIT_OFF: /* turn off split, leave everything else alone */ return ft767_set_split(rig, 0); break; case RIG_SPLIT_ON: switch(tx_vfo) { case RIG_VFO_CURR: // we need to switch VFOs if (curr_vfo == RIG_VFO_A) future_vfo = RIG_VFO_B; else if (curr_vfo == RIG_VFO_B) future_vfo = RIG_VFO_B; else { /* Currently using memory! */ rig_debug(RIG_DEBUG_ERR, "%s: RIG_VFO_CURR requested when it is a memory\n", __func__); return -RIG_EINVAL; } break; case RIG_VFO_A: future_vfo = RIG_VFO_B; break; case RIG_VFO_B: future_vfo = RIG_VFO_A; break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } serial_flush(&rig->state.rigport); retval = ft767_enter_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: enter_CAT %d\n", __FUNCTION__, retval); return retval; } /* See whether we need to toggle the split state */ curr_split = priv->update_data[STATUS_FLAGS] & STATUS_MASK_SPLIT; if (curr_split) curr_split = RIG_SPLIT_ON; if (curr_split != split) { cmd[3] = SUBCMD_SPLIT; cmd[4] = CMD_MULTICMD; retval = ft767_send_block_and_ack(rig, cmd, YAESU_CMD_LENGTH); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: failed to send split command: status %d\n", __FUNCTION__, retval); return retval; } } /* now set the rx vfo if needed */ if (curr_vfo != future_vfo) { cmd[3] = vfo2rig(rig, future_vfo); cmd[4] = CMD_VFOMR; retval = ft767_send_block_and_ack(rig, cmd, YAESU_CMD_LENGTH); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: failed to send set vfo command: status %d\n", __FUNCTION__, retval); return retval; } } /* Make sure clarifier is off */ if (priv->update_data[STATUS_FLAGS] & STATUS_MASK_CLAR) { cmd[3] = SUBCMD_CLAR; cmd[4] = CMD_MULTICMD; retval = ft767_send_block_and_ack(rig, cmd, YAESU_CMD_LENGTH); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: failed to send set clar command: status %d\n", __FUNCTION__, retval); return retval; } } retval = ft767_leave_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: leave_CAT %d\n", __FUNCTION__, retval); return retval; } break; default: return -RIG_EINVAL; } return RIG_OK; } int ft767_get_split_vfo(RIG * rig, vfo_t vfo, split_t * split, vfo_t *tx_vfo) { struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; int retval; vfo_t curr_vfo; retval = ft767_get_update_data(rig); /* get whole shebang from rig */ if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: get_update_data failed with status %d\n", __FUNCTION__, retval); return retval; } /* TODO if SPLIT is enabled, return which VFO is the transmit VFO!! */ if (priv->update_data[STATUS_FLAGS] & STATUS_MASK_SPLIT) *split = RIG_SPLIT_ON; else *split = RIG_SPLIT_OFF; curr_vfo = rig2vfo(priv->update_data[STATUS_FLAGS]); switch (curr_vfo) { case RIG_VFO_A: *tx_vfo = RIG_VFO_B; break; case RIG_VFO_B: *tx_vfo = RIG_VFO_A; break; default: /* we don't know how to deal with MEM, anything else is an error */ /* TODO make sure this is what we want to do here */ rig_debug(RIG_DEBUG_ERR,"%s: current vfo is %d with split\n", __FUNCTION__, curr_vfo); return -RIG_EINVAL; break; } return RIG_OK; } /* End of hamlib API-mapped functions */ /* * This function puts the radio in CAT mode */ int ft767_enter_CAT(RIG *rig) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, CMD_CAT_SW}; rig_debug(RIG_DEBUG_TRACE, "%s: Entered\n", __FUNCTION__); return ft767_send_block_and_ack(rig, cmd, YAESU_CMD_LENGTH); } /* * This function takes the radio out of CAT mode */ int ft767_leave_CAT(RIG *rig) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x01, CMD_CAT_SW}; rig_debug(RIG_DEBUG_TRACE, "%s: Entered\n", __FUNCTION__); return ft767_send_block_and_ack(rig, cmd, YAESU_CMD_LENGTH); } /* * The Yaesu interface is convoluted and braindead. * * Private helper function. The 767GX has a handshaking system that works like this: * * 5 byte command block sent to rig * (5 to 20 mS delay) * Rig echos 5 byte command block back * Send a 5 byte ACK block to the rig * (5 to 20 mS delay) * * Rig sends back a status update block (5-86 bytes) * The status update block is received in reverse byte order from the way it's structured * * In addition, You must send a command to enable CAT mode, and disable when done. * When in CAT mode, the front panel of the radio is locked out. * * There is an error in the manual, the response length for a TONE SET command * is 26 bytes, not 5. */ int ft767_send_block_and_ack(RIG *rig, unsigned char *cmd, size_t length) { struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; size_t replylen, cpycnt; unsigned char cmd_echo_buf[5]; int retval; unsigned char *src, *dst; /* Validate command and set length of data returned */ switch(cmd[4]) { case CMD_CHECK: case CMD_CAT_SW: replylen = 86; break; case CMD_UP10HZ: case CMD_DN10HZ: case CMD_PROG_UP: case CMD_PROG_DN: case CMD_BAND_UP: case CMD_BAND_DN: case CMD_FREQ_SET: case CMD_VFOMR: case CMD_ACK: replylen = 5; break; case CMD_TONE_SET: replylen = 26; /* the manual is wrong */ break; case CMD_MULTICMD: if (cmd[3] <= 0x15) { replylen = 8; } else { switch (cmd[3]) { case SUBCMD_HG_HAM: case SUBCMD_HG_GEN: case SUBCMD_SPLIT: case SUBCMD_CLAR: case SUBCMD_MTOV: replylen = 26; break; case SUBCMD_VTOM: replylen = 68; break; case SUBCMD_SWAP: case SUBCMD_ACLR: replylen = 5; break; default: /* invalid or unknown sub-command */ rig_debug(RIG_DEBUG_ERR,"%s: invalid sub-command 0x%x for command 0x%x\n", __FUNCTION__, cmd[3], cmd[4]); return -RIG_EINVAL; } } break; default: /* invalid or unknown command */ rig_debug(RIG_DEBUG_ERR,"%s: invalid command 0x%x\n", __FUNCTION__, cmd[4]); return -RIG_EINVAL; } /* send the command block */ write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); /* read back the command block echo */ retval = read_block(&rig->state.rigport, (char *) cmd_echo_buf, YAESU_CMD_LENGTH); /* see if it matches the command we sent */ if (memcmp(cmd_echo_buf, cmd, YAESU_CMD_LENGTH)) { rig_debug(RIG_DEBUG_ERR,"%s: Command echo doesn't match\n", __FUNCTION__); return -RIG_EINVAL; } /* send the ACK */ write_block(&rig->state.rigport, (char *) priv->ack_cmd, YAESU_CMD_LENGTH); /* read back the response (status bytes) */ retval = read_block(&rig->state.rigport, (char *) priv->rx_data, replylen); // update data if (retval != replylen) { rig_debug(RIG_DEBUG_ERR,"%s: Got unexpected number of bytes %d in response\n", __FUNCTION__, retval); return -RIG_EINVAL; } /* reverse the data buffer returned from the rig */ src = &priv->rx_data[0]; dst = &priv->update_data[replylen-1]; cpycnt = replylen; while (cpycnt--) *dst-- = *src++; return RIG_OK; } /* * private helper function. Retrieves update data from rig. * using pacing value and buffer indicated in *priv struct. * * need to use this when doing ft767_get_* stuff */ int ft767_get_update_data(RIG *rig) { /* unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x01, CMD_CHECK}; */ struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; int retval; serial_flush(&rig->state.rigport); /* Entering CAT updates our data structures */ retval = ft767_enter_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: enter_CAT %d\n", __FUNCTION__, retval); return retval; } retval = ft767_leave_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: leave_CAT %d\n", __FUNCTION__, retval); return retval; } rig_debug(RIG_DEBUG_TRACE, "%s: status = 0x%02x\n", __func__, priv->update_data[STATUS_FLAGS]); return RIG_OK; } int ft767_set_split(RIG *rig, unsigned int split) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, SUBCMD_SPLIT, CMD_MULTICMD}; struct ft767_priv_data *priv = (struct ft767_priv_data*)rig->state.priv; int retval; unsigned int curr_split; serial_flush(&rig->state.rigport); /* Entering CAT updates our data structures */ retval = ft767_enter_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: enter_CAT %d\n", __FUNCTION__, retval); return retval; } /* See whether we need to toggle */ curr_split = priv->update_data[STATUS_FLAGS] & STATUS_MASK_SPLIT; rig_debug(RIG_DEBUG_TRACE,"%s called curr_split = %d, split = %d\n", __FUNCTION__, curr_split, split); if (curr_split ^ split) { retval = ft767_send_block_and_ack(rig, cmd, YAESU_CMD_LENGTH); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: failed to send command: status %d\n", __FUNCTION__, retval); return retval; } } retval = ft767_leave_CAT(rig); if (retval < 0) { rig_debug(RIG_DEBUG_ERR,"%s: leave_CAT %d\n", __FUNCTION__, retval); return retval; } return RIG_OK; } unsigned char vfo2rig(RIG *rig, vfo_t vfo) { switch(vfo) { case RIG_VFO_CURR: return RIG_OK; case RIG_VFO_A: return 0x00; break; case RIG_VFO_B: return 0x01; break; case RIG_VFO_MEM: return 0x02; break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } } vfo_t rig2vfo(unsigned char status) { if (status & 0x20) return RIG_VFO_MEM; else if (status & 0x10) return RIG_VFO_B; else return RIG_VFO_A; } int mode2rig(RIG *rig, rmode_t mode) { int md; /* * translate mode from generic to ft767 specific */ switch(mode) { case RIG_MODE_LSB: md = SUBCMD_MODE_LSB; break; case RIG_MODE_USB: md = SUBCMD_MODE_USB; break; case RIG_MODE_CW: md = SUBCMD_MODE_CW; break; case RIG_MODE_AM: md = SUBCMD_MODE_AM; break; case RIG_MODE_FM: md = SUBCMD_MODE_FM; break; case RIG_MODE_PKTFM: md = SUBCMD_MODE_FSK; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } return md; } int rig2mode(RIG *rig, int md, rmode_t *mode, pbwidth_t *width) { /* * translate mode from ft767 specific to generic */ switch(md & 0x07) { case MODE_LSB: *mode = RIG_MODE_LSB; break; case MODE_USB: *mode = RIG_MODE_USB; break; case MODE_CW: *mode = RIG_MODE_CW; break; case MODE_AM: *mode = RIG_MODE_AM; break; case MODE_FM: *mode = RIG_MODE_FM; break; case MODE_FSK: *mode = RIG_MODE_PKTFM; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } return RIG_OK; } int rig2ctcss(RIG *rig, unsigned char tn, tone_t *tone) { /* * translate tone from ft767 specific to generic */ switch(tn) { #ifdef USE_YAESU_PUBLISHED_TONES /* Yaesu documentation */ case 0x3E: *tone = 670; break; case 0x1D: *tone = 670; break; /* High Q */ case 0x3D: *tone = 719; break; case 0x1C: *tone = 719; break; /* High Q */ case 0x1B: *tone = 747; break; /* High Q */ case 0x3C: *tone = 770; break; case 0x1A: *tone = 770; break; /* High Q */ case 0x19: *tone = 797; break; /* High Q */ case 0x3B: *tone = 825; break; case 0x18: *tone = 825; break; /* High Q */ case 0x17: *tone = 854; break; /* High Q */ case 0x3A: *tone = 885; break; case 0x16: *tone = 885; break; /* High Q */ case 0x15: *tone = 915; break; /* High Q */ case 0x39: *tone = 948; break; case 0x38: *tone = 1000; break; case 0x37: *tone = 1035; break; case 0x36: *tone = 1072; break; case 0x35: *tone = 1109; break; case 0x34: *tone = 1148; break; case 0x33: *tone = 1188; break; case 0x32: *tone = 1230; break; case 0x31: *tone = 1273; break; case 0x30: *tone = 1318; break; case 0x2F: *tone = 1365; break; case 0x2E: *tone = 1413; break; case 0x2D: *tone = 1462; break; case 0x2C: *tone = 1514; break; case 0x2B: *tone = 1567; break; case 0x2A: *tone = 1622; break; case 0x29: *tone = 1679; break; case 0x28: *tone = 1738; break; case 0x27: *tone = 1799; break; case 0x26: *tone = 1862; break; case 0x25: *tone = 1928; break; case 0x24: *tone = 2035; break; case 0x23: *tone = 2107; break; case 0x22: *tone = 2181; break; case 0x21: *tone = 2257; break; case 0x20: *tone = 2336; break; case 0x1F: *tone = 2418; break; case 0x1E: *tone = 2503; break; #else /* values found by experimentation */ case 0: *tone = 670; break; case 33: *tone = 670; break; /* High Q */ case 01: *tone = 719; break; case 34: *tone = 719; break; /* High Q */ case 35: *tone = 747; break; /* High Q */ case 2: *tone = 770; break; case 36: *tone = 770; break; /* High Q */ case 37: *tone = 797; break; /* High Q */ case 3: *tone = 825; break; case 38: *tone = 825; break; /* High Q */ case 39: *tone = 854; break; /* High Q */ case 4: *tone = 885; break; case 40: *tone = 885; break; /* High Q */ case 41: *tone = 915; break; /* High Q */ case 5: *tone = 948; break; case 6: *tone = 1000; break; case 7: *tone = 1035; break; case 8: *tone = 1072; break; case 9: *tone = 1109; break; case 10: *tone = 1148; break; case 11: *tone = 1188; break; case 12: *tone = 1230; break; case 13: *tone = 1273; break; case 14: *tone = 1318; break; case 15: *tone = 1365; break; case 16: *tone = 1413; break; case 17: *tone = 1462; break; case 18: *tone = 1514; break; case 19: *tone = 1567; break; case 20: *tone = 1622; break; case 21: *tone = 1679; break; case 22: *tone = 1738; break; case 23: *tone = 1799; break; case 24: *tone = 1862; break; case 25: *tone = 1928; break; case 26: *tone = 2035; break; case 27: *tone = 2107; break; case 28: *tone = 2181; break; case 29: *tone = 2257; break; case 30: *tone = 2336; break; case 31: *tone = 2418; break; case 32: *tone = 2503; break; #endif default: rig_debug(RIG_DEBUG_ERR,"%s: Invalid tone value from rig: 0x%02x\n", __FUNCTION__, tn); return -RIG_EINVAL; /* sorry, wrong TONE */ break; } return RIG_OK; } hamlib-1.2.15.3/yaesu/Makefile.in0000644000175000017500000005516712044564560013335 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 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. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = yaesu DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/ac_python_devel.m4 \ $(top_srcdir)/macros/aclocal-include.m4 \ $(top_srcdir)/macros/acx_pthread.m4 \ $(top_srcdir)/macros/gr_pwin32.m4 \ $(top_srcdir)/macros/gr_swig.m4 \ $(top_srcdir)/macros/hl_getaddrinfo.m4 \ $(top_srcdir)/macros/lf_warnings.m4 \ $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 \ $(top_srcdir)/macros/perl.m4 $(top_srcdir)/macros/tcl.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) hamlib_yaesu_la_DEPENDENCIES = $(top_builddir)/lib/libmisc.la \ $(top_builddir)/src/libhamlib.la am__objects_1 = ft100.lo ft747.lo ft817.lo ft847.lo ft890.lo ft900.lo \ ft920.lo ft1000mp.lo ft857.lo ft897.lo ft990.lo frg8800.lo \ ft757gx.lo ft736.lo frg100.lo frg9600.lo ft1000d.lo vr5000.lo \ ft767gx.lo ft840.lo ft980.lo vx1700.lo am__objects_2 = newcat.lo ft450.lo ft950.lo ft2000.lo ft9000.lo \ ft5000.lo am_hamlib_yaesu_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ yaesu.lo hamlib_yaesu_la_OBJECTS = $(am_hamlib_yaesu_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent hamlib_yaesu_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(hamlib_yaesu_la_LDFLAGS) $(LDFLAGS) \ -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(hamlib_yaesu_la_SOURCES) DIST_SOURCES = $(hamlib_yaesu_la_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_VERSION = @ABI_VERSION@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKENDEPS = @BACKENDEPS@ BACKENDLNK = @BACKENDLNK@ BACKEND_LIST = @BACKEND_LIST@ BINDINGS = @BINDINGS@ BINDING_ALL = @BINDING_ALL@ BINDING_CHECK = @BINDING_CHECK@ BINDING_CLEAN = @BINDING_CLEAN@ BINDING_DISTCHECK = @BINDING_DISTCHECK@ BINDING_DISTCLEAN = @BINDING_DISTCLEAN@ BINDING_INSTALL_EXEC = @BINDING_INSTALL_EXEC@ BINDING_LIB_TARGETS = @BINDING_LIB_TARGETS@ BINDING_LIST = @BINDING_LIST@ BINDING_UNINSTALL = @BINDING_UNINSTALL@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INCLTDL = @INCLTDL@ INCLUDES = @INCLUDES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBLTDL = @LIBLTDL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MATH_LIBS = @MATH_LIBS@ MKDIR_P = @MKDIR_P@ NET_LIBS = @NET_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OSXLDFLAGS = @OSXLDFLAGS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL_INC_DIR = @PERL_INC_DIR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PYTHON = @PYTHON@ PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ PYTHON_VERSION = @PYTHON_VERSION@ RANLIB = @RANLIB@ RIGMATRIX = @RIGMATRIX@ ROT_BACKENDEPS = @ROT_BACKENDEPS@ ROT_BACKENDLNK = @ROT_BACKENDLNK@ ROT_BACKEND_LIST = @ROT_BACKEND_LIST@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ TCL_BIN_DIR = @TCL_BIN_DIR@ TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@ TCL_LIB_FILE = @TCL_LIB_FILE@ TCL_LIB_SPEC = @TCL_LIB_SPEC@ TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@ TCL_SRC_DIR = @TCL_SRC_DIR@ USRP_CFLAGS = @USRP_CFLAGS@ USRP_LIBS = @USRP_LIBS@ VERSION = @VERSION@ WINEXELDFLAGS = @WINEXELDFLAGS@ WINLDFLAGS = @WINLDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ cf_with_bindings = @cf_with_bindings@ cf_with_cxx = @cf_with_cxx@ cf_with_rpcgen = @cf_with_rpcgen@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ hamlibdocdir = @hamlibdocdir@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgpyexecdir = @pkgpyexecdir@ pkgpythondir = @pkgpythondir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ YAESUSRC = ft100.c ft747.c ft817.c ft847.c ft890.c ft900.c ft920.c \ ft1000mp.c ft857.c ft897.c ft990.c frg8800.c \ ft757gx.c ft736.c frg100.c frg9600.c ft1000d.c \ vr5000.c ft767gx.c ft840.c ft980.c vx1700.c NEWCATSRC = newcat.c ft450.c ft950.c ft2000.c ft9000.c ft5000.c pkglib_LTLIBRARIES = hamlib-yaesu.la hamlib_yaesu_la_SOURCES = $(YAESUSRC) $(NEWCATSRC) yaesu.c hamlib_yaesu_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_yaesu_la_LIBADD = $(top_builddir)/lib/libmisc.la \ @MATH_LIBS@ \ $(top_builddir)/src/libhamlib.la EXTRA_DIST = README.ft890 README.ft920 noinst_HEADERS = ft100.h ft747.h ft817.h ft847.h ft890.h ft900.h ft920.h \ ft1000mp.h ft857.h ft897.h ft990.h yaesu.h \ ft757gx.h ft767gx.h ft450.h ft950.h ft2000.h ft9000.h ft5000.h \ ft840.h vx1700.h newcat.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu yaesu/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu yaesu/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done hamlib-yaesu.la: $(hamlib_yaesu_la_OBJECTS) $(hamlib_yaesu_la_DEPENDENCIES) $(AM_V_CCLD)$(hamlib_yaesu_la_LINK) -rpath $(pkglibdir) $(hamlib_yaesu_la_OBJECTS) $(hamlib_yaesu_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frg100.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frg8800.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frg9600.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft100.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft1000d.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft1000mp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft2000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft450.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft5000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft736.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft747.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft757gx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft767gx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft817.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft840.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft847.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft857.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft890.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft897.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft900.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft9000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft920.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft950.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft980.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft990.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newcat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vr5000.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vx1700.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yaesu.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkglibLTLIBRARIES \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-pkglibLTLIBRARIES # 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: hamlib-1.2.15.3/yaesu/ft900.h0000644000175000017500000002644612044564477012310 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft900.h - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * (C) Stephane Fillod 2002, 2003 (fillods at users.sourceforge.net) * (C) Nate Bargmann 2002, 2003 (n0nb at arrl.net) * * This shared library provides an API for communicating * via serial interface to an FT-900 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT900_H #define _FT900_H 1 #define TRUE 1 #define FALSE 0 #define ON TRUE #define OFF FALSE #define FT900_VFO_ALL (RIG_VFO_A|RIG_VFO_B) /* Receiver caps */ #define FT900_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB) #define FT900_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB) #define FT900_AM_RX_MODES (RIG_MODE_AM) #define FT900_FM_RX_MODES (RIG_MODE_FM) /* TX caps */ #define FT900_OTHER_TX_MODES (RIG_MODE_CW| RIG_MODE_USB| RIG_MODE_LSB ) /* 100 W class */ #define FT900_AM_TX_MODES (RIG_MODE_AM ) /* set 25W max */ #define FT900_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN) /* fix */ /* * Other features (used by rig_caps) * */ #define FT900_ANTS 0 /* Returned data length in bytes */ #define FT900_MEM_CHNL_LENGTH 1 /* 0x10 P1 = 01 return size */ #define FT900_OP_DATA_LENGTH 19 /* 0x10 P1 = 03 return size */ #define FT900_VFO_DATA_LENGTH 18 /* 0x10 P1 = 03 return size -- A & B returned */ #define FT900_MEM_CHNL_DATA_LENGTH 19 /* 0x10 P1 = 04, P4 = 0x01-0x20 return size */ #define FT900_STATUS_FLAGS_LENGTH 5 /* 0xf7, 0xfa return size */ #define FT900_ALL_DATA_LENGTH 1941 /* 0x10 P1 = 00 return size */ /* Timing values in mS */ #define FT900_PACING_INTERVAL 5 #define FT900_PACING_DEFAULT_VALUE 0 #define FT900_WRITE_DELAY 50 /* Delay sequential fast writes */ #define FT900_POST_WRITE_DELAY 5 /* Rough safe value for default timeout */ #define FT900_DEFAULT_READ_TIMEOUT 1941 * ( 5 + (FT900_PACING_INTERVAL * FT900_PACING_DEFAULT_VALUE)) /* BCD coded frequency length */ #define FT900_BCD_DIAL 8 #define FT900_BCD_RIT 3 /* * 8N2 and 1 start bit = 11 bits at 4800 bps => effective byte * rate = 1 byte in 2.2917 msec => 1941 bytes in 4448 msec * * delay for 28 bytes = (2.2917 + pace_interval) * 28 * * pace_interval time to read 1941 bytes * ------------ ---------------------- * * 0 4448 msec (backend default) * 1 6389 msec * 2 8330 msec * 5 14153 msec * 255 499.4 sec * */ /* * Native FT900 functions. More to come :-) * */ enum ft900_native_cmd_e { FT900_NATIVE_SPLIT_OFF = 0, FT900_NATIVE_SPLIT_ON, FT900_NATIVE_RECALL_MEM, FT900_NATIVE_VFO_TO_MEM, FT900_NATIVE_VFO_A, FT900_NATIVE_VFO_B, FT900_NATIVE_MEM_TO_VFO, FT900_NATIVE_CLARIFIER_OPS, FT900_NATIVE_FREQ_SET, FT900_NATIVE_MODE_SET, FT900_NATIVE_PACING, FT900_NATIVE_PTT_OFF, FT900_NATIVE_PTT_ON, FT900_NATIVE_MEM_CHNL, FT900_NATIVE_OP_DATA, FT900_NATIVE_VFO_DATA, FT900_NATIVE_MEM_CHNL_DATA, FT900_NATIVE_TUNER_OFF, FT900_NATIVE_TUNER_ON, FT900_NATIVE_TUNER_START, FT900_NATIVE_READ_METER, FT900_NATIVE_READ_FLAGS, FT900_NATIVE_SIZE /* end marker, value indicates number of */ /* native cmd entries */ }; typedef enum ft900_native_cmd_e ft900_native_cmd_t; /* * Internal MODES - when setting modes via FT900_NATIVE_MODE_SET * */ #define MODE_SET_LSB 0x00 #define MODE_SET_USB 0x01 #define MODE_SET_CW_W 0x02 #define MODE_SET_CW_N 0x03 #define MODE_SET_AM_W 0x04 #define MODE_SET_AM_N 0x05 #define MODE_SET_FM 0x06 /* * Internal Clarifier parms - when setting clarifier via * FT900_NATIVE_CLARIFIER_OPS * * The manual seems to be incorrect with regard to P1 and P2 values * P1 = 0x00 clarifier off * P1 = 0x01 clarifier on * P1 = 0xff clarifier set * P2 = 0x00 clarifier up * P2 = 0xff clarifier down */ /* P1 values */ #define CLAR_RX_OFF 0x00 #define CLAR_RX_ON 0x01 #define CLAR_SET_FREQ 0xff /* P2 values */ #define CLAR_OFFSET_PLUS 0x00 #define CLAR_OFFSET_MINUS 0xff /* * Some useful offsets in the status update flags (offset) * SUMO--Status Update Memory Offset? * * SF_ bit tests are now grouped with flag bytes for ease of reference * * FIXME: complete flags and bits * * CAT command 0xFA requests the FT-900 to return its status flags. * These flags consist of 3 bytes (plus 2 filler bytes) and are documented * in the FT-900 manual on page 33. * */ #define FT900_SUMO_DISPLAYED_STATUS_0 0x00 /* Status flag byte 0 */ #define SF_GC (1<<1) /* General Coverage Reception selected */ #define SF_SPLIT (1<<2) /* Split active */ #define SF_MCK (1<<3) /* memory Checking in progress */ #define SF_MT (1<<4) /* Memory Tuning in progress */ #define SF_MR (1<<5) /* Memory Mode selected */ #define SF_A (0<<6) /* bit 6 clear, VFO A */ #define SF_B (1<<6) /* bit 6 set, VFO B */ #define SF_VFO (1<<7) /* bit 7 set, VFO A or B active */ #define SF_VFOA (SF_VFO|SF_A) /* bit 7 set, bit 6 clear, VFO A */ #define SF_VFOB (SF_VFO|SF_B) /* bit 7 set, bit 6 set, VFO B */ #define SF_VFO_MASK (SF_VFOB) /* bits 6 and 7 */ #define SF_MEM_MASK (SF_MCK|SF_MT|SF_MR) /* bits 3, 4 and 5 */ #define FT900_SUMO_DISPLAYED_STATUS_1 0x01 /* Status flag byte 1 */ #define FT900_SUMO_DISPLAYED_STATUS_2 0x02 /* Status flag byte 1 */ #define SF_PTT_OFF (0<<7) /* bit 7 set, PTT open */ #define SF_PTT_ON (1<<7) /* bit 7 set, PTT closed */ #define SF_PTT_MASK (SF_PTT_ON) /* * Offsets for VFO record retrieved via 0x10 P1 = 02, 03, 04 * * The FT-900 returns frequency and mode data via three seperate commands. * CAT command 0x10, P1 = 02 returns the current main and sub displays' data (19 bytes) * CAT command 0x10, P1 = 03 returns VFO A & B data (18 bytes) * CAT command 0x10, P1 = 04, P4 = 0x01-0x20 returns memory channel data (19 bytes) * In all cases the format is (from the FT-900 manual page 32): * * Offset Value * 0x00 Band Selection (BPF selection: 0x00 - 0x30 (bit 7 =1 on a blanked memory)) * 0x01 Operating Frequency (Hex value of display--Not BCD!) * 0x04 Clarifier Offset (signed value between -999d (0xfc19) and +999d (0x03e7)) * 0x06 Mode Data * 0x07 CTCSS tone code (0x00 - 0x20) * 0x08 Flags (Operating flags -- manual page 33) * * Memory Channel data has the same layout and offsets as the operating * data record. * When either of the 19 byte records is read (P1 = 02, 04), the offset is * +1 as the leading byte is the memory channel number. * The VFO data command (P1 = 03) returns 18 bytes and the VFO B data has * the same layout, but the offset starts at 0x09 and continues through 0x12 * */ #define FT900_SUMO_MEM_CHANNEL 0x00 /* Memory Channel from 0xfa, P1 = 1 */ #define FT900_SUMO_DISPLAYED_FREQ 0x02 /* Current main display, can be VFO A, Memory data, Memory tune (3 bytes) */ #define FT900_SUMO_DISPLAYED_CLAR 0x05 /* RIT offset -- current display */ #define FT900_SUMO_DISPLAYED_MODE 0x07 /* Current main display mode */ #define FT900_SUMO_DISPLAYED_FLAG 0x09 #define FT900_SUMO_VFO_A_FREQ 0x01 /* VFO A frequency, not necessarily currently displayed! */ #define FT900_SUMO_VFO_A_CLAR 0x04 /* RIT offset -- VFO A */ #define FT900_SUMO_VFO_A_MODE 0x06 /* VFO A mode, not necessarily currently displayed! */ #define FT900_SUMO_VFO_A_FLAG 0x08 #define FT900_SUMO_VFO_B_FREQ 0x0a /* Current sub display && VFO B */ #define FT900_SUMO_VFO_B_CLAR 0x0d /* RIT offset -- VFO B */ #define FT900_SUMO_VFO_B_MODE 0x0f /* Current sub display && VFO B */ #define FT900_SUMO_VFO_B_FLAG 0x11 /* * Read meter offset * * FT-900 returns the level of the S meter when in RX and ALC or PO or SWR * when in TX. The level is replicated in the first four bytes sent by the * rig with the final byte being a constant 0xf7 * * The manual states that the returned value will range between 0x00 and 0xff * while "in practice the highest value returned will be around 0xf0". The * manual is silent when this value is returned as my rig returns 0x00 for * S0, 0x44 for S9 and 0x9D for S9 +60. * */ #define FT900_SUMO_METER 0x00 /* Meter level */ /* * Narrow filter selection flag from offset 0x08 or 0x11 * in VFO/Memory Record * * used when READING modes from FT-900 * */ #define FLAG_AM_N (1<<6) #define FLAG_CW_N (1<<7) #define FLAG_MASK (FLAG_AM_N|FLAG_CW_N) /* * Mode Bitmap from offset 0x06 or 0x0f in VFO/Memory Record. * * used when READING modes from FT-900 * */ #define MODE_LSB 0x00 #define MODE_USB 0x01 #define MODE_CW 0x02 #define MODE_AM 0x03 #define MODE_FM 0x04 /* All relevant bits */ #define MODE_MASK (MODE_LSB|MODE_USB|MODE_CW|MODE_AM|MODE_FM) /* * Command string parameter offsets */ #define P1 3 #define P2 2 #define P3 1 #define P4 0 /* * API local implementation * */ static int ft900_init(RIG *rig); static int ft900_cleanup(RIG *rig); static int ft900_open(RIG *rig); static int ft900_close(RIG *rig); static int ft900_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft900_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ft900_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ft900_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int ft900_set_vfo(RIG *rig, vfo_t vfo); static int ft900_get_vfo(RIG *rig, vfo_t *vfo); static int ft900_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); static int ft900_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); static int ft900_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int ft900_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); static int ft900_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); static int ft900_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit); static int ft900_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static int ft900_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int ft900_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); #endif /* _FT900_H */ hamlib-1.2.15.3/yaesu/ft840.c0000644000175000017500000013074412044564477012303 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft840.c - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * (C) Stephane Fillod 2002-2009 (fillods at users.sourceforge.net) * (C) Nate Bargmann 2002, 2003 (n0nb at arrl.net) * * This shared library provides an API for communicating * via serial interface to an FT-840 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "bandplan.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "ft840.h" /* * * The FT-840 backend is cloned after the FT-890 backend. * * The differences are (as reported by Thomas - DK6KD): * -the 840 has 100 Memory channel, the 890 has 20 * -the 840 has 5 flag bytes, like the 890 but the third isn't specified in * the manual (the 890 has the ptt_enabled bit there, which is used by the * FT-890's get_ptt function), i need to investigate if there is really no * information in the third byte from the 840. * -the 840 RIT offset can not be set by a CAT command. The command exists * but it can only enable/disable RIT, it seems that the following bytes * given to this command containing the offset are ignored. * -the display brightness of the 840 can not be set by CAT * (This is an important feature, isn't it? HI) */ /* * Functions considered to be Beta code (2003-04-11): * set_freq * get_freq * set_mode * get_mode * set_vfo * get_vfo * set_ptt * get_ptt * set_split * get_split * set_rit * get_rit * set_func * get_func * get_level * * Functions considered to be Alpha code (2003-04-11): * vfo_op * * functions not yet implemented (2003-04-11): * set_split_freq * get_split_freq * set_split_mode * get_split_mode * */ /* Enable these as needed: */ #undef USE_FT840_GET_PTT #undef USE_FT840_SET_RIT /* * API local implementation * */ static int ft840_init(RIG *rig); static int ft840_cleanup(RIG *rig); static int ft840_open(RIG *rig); static int ft840_close(RIG *rig); static int ft840_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft840_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ft840_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ft840_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int ft840_set_vfo(RIG *rig, vfo_t vfo); static int ft840_get_vfo(RIG *rig, vfo_t *vfo); static int ft840_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); #ifdef USE_FT840_GET_PTT static int ft840_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); #endif /* USE_FT840_GET_PTT */ static int ft840_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int ft840_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); #ifdef USE_FT840_SET_RIT static int ft840_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); #endif /* USE_FT840_SET_RIT */ static int ft840_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit); static int ft840_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static int ft840_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int ft840_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); /* Private helper function prototypes */ static int ft840_get_update_data(RIG *rig, unsigned char ci, unsigned char rl); static int ft840_send_static_cmd(RIG *rig, unsigned char ci); static int ft840_send_dynamic_cmd(RIG *rig, unsigned char ci, unsigned char p1, unsigned char p2, unsigned char p3, unsigned char p4); static int ft840_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq); #ifdef USE_FT840_SET_RIT static int ft840_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit); #endif /* USE_FT840_SET_RIT */ /* * Native ft840 cmd set prototypes. These are READ ONLY as each * rig instance will copy from these and modify if required. * Complete sequences (1) can be read and used directly as a cmd sequence. * Incomplete sequences (0) must be completed with extra parameters * eg: mem number, or freq etc.. * * TODO: Shorten this static array with parameter substitution -N0NB * */ static const yaesu_cmd_set_t ncmd[] = { { 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* split = off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* split = on */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* recall memory */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* memory operations */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* select vfo A */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* select vfo B */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x06 } }, /* copy memory data to vfo A */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, /* clarifier operations */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* set display freq */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* mode set */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0e } }, /* update interval/pacing */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0f } }, /* PTT off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0f } }, /* PTT on */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x10 } }, /* Status Update Data--Memory Channel Number (1 byte) */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x10 } }, /* Status Update Data--Current operating data for VFO/Memory (19 bytes) */ { 1, { 0x00, 0x00, 0x00, 0x03, 0x10 } }, /* Status Update DATA--VFO A and B Data (18 bytes) */ { 0, { 0x00, 0x00, 0x00, 0x04, 0x10 } }, /* Status Update Data--Memory Channel Data (19 bytes) P4 = 0x01-0x20 Memory Channel Number */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x81 } }, /* tuner off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x81 } }, /* tuner on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x82 } }, /* tuner start*/ { 1, { 0x00, 0x00, 0x00, 0x00, 0xf7 } }, /* Read meter, S on RX, ALC|PO|SWR on TX */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xfa } }, /* Read status flags */ }; /* * future - private data * * FIXME: Does this need to be exposed to the application/frontend through * ft840_caps.priv? -N0NB */ struct ft840_priv_data { unsigned char pacing; /* pacing value */ unsigned int read_update_delay; /* depends on pacing value */ vfo_t current_vfo; /* active VFO from last cmd */ unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */ yaesu_cmd_set_t pcs[FT840_NATIVE_SIZE]; /* private cmd set */ unsigned char update_data[FT840_ALL_DATA_LENGTH]; /* returned data--max value, some are less */ unsigned char current_mem; /* private memory channel number */ }; /* * ft840 rigs capabilities. * Also this struct is READONLY! * */ const struct rig_caps ft840_caps = { .rig_model = RIG_MODEL_FT840, .model_name = "FT-840", .mfg_name = "Yaesu", .version = "0.1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT840_WRITE_DELAY, .post_write_delay = FT840_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = RIG_FUNC_TUNER, .has_set_func = RIG_FUNC_TUNER, .has_get_level = RIG_LEVEL_STRENGTH, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(0), .max_ifshift = Hz(0), .vfo_ops = RIG_OP_TUNE, .targetable_vfo = RIG_TARGETABLE_ALL, .transceive = RIG_TRN_OFF, /* Yaesus have to be polled, sigh */ .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, /* FIXME: memory channel list: 100 */ .rx_range_list1 = { {kHz(100), MHz(30), FT840_ALL_RX_MODES, -1, -1, FT840_VFO_ALL, FT840_ANTS}, /* General coverage + ham */ RIG_FRNG_END, }, /* FIXME: Are these the correct Region 1 values? */ .tx_range_list1 = { FRQ_RNG_HF(1, FT840_OTHER_TX_MODES, W(5), W(100), FT840_VFO_ALL, FT840_ANTS), FRQ_RNG_HF(1, FT840_AM_TX_MODES, W(2), W(25), FT840_VFO_ALL, FT840_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100), MHz(30), FT840_ALL_RX_MODES, -1, -1, FT840_VFO_ALL, FT840_ANTS}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2, FT840_OTHER_TX_MODES, W(5), W(100), FT840_VFO_ALL, FT840_ANTS), FRQ_RNG_HF(2, FT840_AM_TX_MODES, W(2), W(25), FT840_VFO_ALL, FT840_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {FT840_SSB_CW_RX_MODES, Hz(10)}, /* Normal */ {FT840_SSB_CW_RX_MODES, Hz(100)}, /* Fast */ {FT840_AM_RX_MODES, Hz(100)}, /* Normal */ {FT840_AM_RX_MODES, kHz(1)}, /* Fast */ {FT840_FM_RX_MODES, Hz(100)}, /* Normal */ {FT840_FM_RX_MODES, kHz(1)}, /* Fast */ RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_SSB, kHz(2.2)}, /* standard SSB filter bandwidth */ {RIG_MODE_CW, kHz(2.2)}, /* normal CW filter */ {RIG_MODE_CW, kHz(0.5)}, /* CW filter with narrow selection (must be installed!) */ {RIG_MODE_AM, kHz(6)}, /* normal AM filter */ {RIG_MODE_AM, kHz(2.2)}, /* AM filter with narrow selection (SSB filter switched in) */ {RIG_MODE_FM, kHz(12)}, /* FM */ RIG_FLT_END, }, .rig_init = ft840_init, .rig_cleanup = ft840_cleanup, .rig_open = ft840_open, /* port opened */ .rig_close = ft840_close, /* port closed */ .set_freq = ft840_set_freq, .get_freq = ft840_get_freq, .set_mode = ft840_set_mode, .get_mode = ft840_get_mode, .set_vfo = ft840_set_vfo, .get_vfo = ft840_get_vfo, .set_ptt = ft840_set_ptt, #ifdef USE_FT840_GET_PTT .get_ptt = ft840_get_ptt, #endif /* USE_FT840_GET_PTT */ .set_split_vfo = ft840_set_split_vfo, .get_split_vfo = ft840_get_split_vfo, #ifdef USE_FT840_SET_RIT .set_rit = ft840_set_rit, #endif /* USE_FT840_SET_RIT */ .get_rit = ft840_get_rit, .set_func = ft840_set_func, .get_level = ft840_get_level, .vfo_op = ft840_vfo_op, }; /* * ************************************ * * Hamlib API functions * * ************************************ */ /* * rig_init * */ static int ft840_init(RIG *rig) { struct ft840_priv_data *priv; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft840_priv_data *)malloc(sizeof(struct ft840_priv_data)); if (!priv) /* whoops! memory shortage! */ return -RIG_ENOMEM; /* * Copy native cmd set to private cmd storage area */ memcpy(priv->pcs, ncmd, sizeof(ncmd)); /* TODO: read pacing from preferences */ priv->pacing = FT840_PACING_DEFAULT_VALUE; /* set pacing to minimum for now */ priv->read_update_delay = FT840_DEFAULT_READ_TIMEOUT; /* set update timeout to safe value */ priv->current_vfo = RIG_VFO_MAIN; /* default to whatever */ rig->state.priv = (void *)priv; return RIG_OK; } /* * rig_cleanup * * the serial port is closed by the frontend * */ static int ft840_cleanup(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * rig_open * */ static int ft840_open(RIG *rig) { struct rig_state *rig_s; struct ft840_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft840_priv_data *)rig->state.priv; rig_s = &rig->state; rig_debug(RIG_DEBUG_TRACE, "%s: write_delay = %i msec\n", __func__, rig_s->rigport.write_delay); rig_debug(RIG_DEBUG_TRACE, "%s: post_write_delay = %i msec\n", __func__, rig_s->rigport.post_write_delay); rig_debug(RIG_DEBUG_TRACE, "%s: read pacing = %i\n", __func__, priv->pacing); err = ft840_send_dynamic_cmd(rig, FT840_NATIVE_PACING, priv->pacing, 0, 0, 0); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_close * */ static int ft840_close(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; return RIG_OK; } /* * rig_set_freq * * Set frequency for a given VFO * * If vfo is set to RIG_VFO_CUR then vfo from priv_data is used. * If vfo differs from stored value then VFO will be set to the * passed vfo. * */ static int ft840_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct ft840_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft840_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq); if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } else if (vfo != priv->current_vfo) { /* force a VFO change if requested vfo value differs from stored value */ err = ft840_set_vfo(rig, vfo); if (err != RIG_OK) return err; } err = ft840_send_dial_freq(rig, FT840_NATIVE_FREQ_SET, freq); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_freq * * Return Freq for a given VFO * */ static int ft840_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft840_priv_data *priv; unsigned char *p; unsigned char offset; freq_t f; int err, cmd_index, count; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); if (!rig) return -RIG_EINVAL; priv = (struct ft840_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { err = ft840_get_vfo(rig, &priv->current_vfo); if (err != RIG_OK) return err; vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: cmd_index = FT840_NATIVE_VFO_DATA; offset = FT840_SUMO_VFO_A_FREQ; count = FT840_VFO_DATA_LENGTH; break; case RIG_VFO_B: cmd_index = FT840_NATIVE_VFO_DATA; offset = FT840_SUMO_VFO_B_FREQ; count = FT840_VFO_DATA_LENGTH; break; case RIG_VFO_MEM: case RIG_VFO_MAIN: cmd_index = FT840_NATIVE_OP_DATA; offset = FT840_SUMO_DISPLAYED_FREQ; count = FT840_OP_DATA_LENGTH; break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } err = ft840_get_update_data(rig, cmd_index, count); if (err != RIG_OK) return err; p = &priv->update_data[offset]; /* big endian integer */ f = ((((p[0]<<8) + p[1])<<8) + p[2]) * 10; rig_debug(RIG_DEBUG_TRACE, "%s: freq = %"PRIfreq" Hz for vfo 0x%02x\n", __func__, f, vfo); *freq = f; /* return displayed frequency */ return RIG_OK; } /* * rig_set_mode * * set mode and passband: eg AM, CW etc for a given VFO * * If vfo is set to RIG_VFO_CUR then vfo from priv_data is used. * */ static int ft840_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) { struct ft840_priv_data *priv; unsigned char mode_parm; /* mode parameter */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed mode = %i\n", __func__, mode); rig_debug(RIG_DEBUG_TRACE, "%s: passed width = %li Hz\n", __func__, width); priv = (struct ft840_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } /* translate mode from generic to ft840 specific */ switch(vfo) { case RIG_VFO_A: /* force to VFO */ case RIG_VFO_VFO: err = ft840_set_vfo(rig, RIG_VFO_A); if (err != RIG_OK) return err; break; case RIG_VFO_B: err = ft840_set_vfo(rig, RIG_VFO_B); if (err != RIG_OK) return err; break; case RIG_VFO_MEM: /* MEM TUNE or user doesn't care */ case RIG_VFO_MAIN: break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } switch(mode) { case RIG_MODE_AM: mode_parm = MODE_SET_AM_W; break; case RIG_MODE_CW: mode_parm = MODE_SET_CW_W; break; case RIG_MODE_USB: mode_parm = MODE_SET_USB; break; case RIG_MODE_LSB: mode_parm = MODE_SET_LSB; break; case RIG_MODE_FM: mode_parm = MODE_SET_FM; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } /* * Now set width (shamelessly stolen from ft847.c and then butchered :) * The FT-840 only supports narrow width in AM and CW modes * */ if (width == rig_passband_narrow(rig, mode)) { switch(mode) { case RIG_MODE_CW: mode_parm = MODE_SET_CW_N; break; case RIG_MODE_AM: mode_parm = MODE_SET_AM_N; break; default: return -RIG_EINVAL; /* Invalid mode, how can caller know? */ } } else { if (width != RIG_PASSBAND_NORMAL && width != rig_passband_normal(rig, mode)) { return -RIG_EINVAL; /* Invalid width, how can caller know? */ } } rig_debug(RIG_DEBUG_TRACE, "%s: set mode_parm = 0x%02x\n", __func__, mode_parm); err = ft840_send_dynamic_cmd(rig, FT840_NATIVE_MODE_SET, mode_parm, 0, 0, 0); if (err != RIG_OK) return err; return RIG_OK; /* good */ } /* * rig_get_mode * * get mode eg AM, CW etc for a given VFO * */ static int ft840_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct ft840_priv_data *priv; unsigned char my_mode, m_offset; /* ft840 mode, mode offset */ unsigned char flag, f_offset; /* CW/AM narrow flag */ int err, cmd_index, norm, count; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft840_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_A: case RIG_VFO_VFO: cmd_index = FT840_NATIVE_VFO_DATA; m_offset = FT840_SUMO_VFO_A_MODE; f_offset = FT840_SUMO_VFO_A_FLAG; count = FT840_VFO_DATA_LENGTH; break; case RIG_VFO_B: cmd_index = FT840_NATIVE_VFO_DATA; m_offset = FT840_SUMO_VFO_B_MODE; f_offset = FT840_SUMO_VFO_B_FLAG; count = FT840_VFO_DATA_LENGTH; break; case RIG_VFO_MEM: case RIG_VFO_MAIN: cmd_index = FT840_NATIVE_OP_DATA; m_offset = FT840_SUMO_DISPLAYED_MODE; f_offset = FT840_SUMO_DISPLAYED_FLAG; count = FT840_OP_DATA_LENGTH; break; default: return -RIG_EINVAL; } err = ft840_get_update_data(rig, cmd_index, count); if (err != RIG_OK) return err; my_mode = MODE_MASK & priv->update_data[m_offset]; flag = FLAG_MASK & priv->update_data[f_offset]; rig_debug(RIG_DEBUG_TRACE, "%s: mode = 0x%02x\n", __func__, mode); rig_debug(RIG_DEBUG_TRACE, "%s: flag = 0x%02x\n", __func__, flag); /* * translate mode from ft840 to generic. */ switch(my_mode) { case MODE_LSB: *mode = RIG_MODE_LSB; norm = TRUE; break; case MODE_USB: *mode = RIG_MODE_USB; norm = TRUE; break; case MODE_CW: *mode = RIG_MODE_CW; if (flag & FLAG_CW_N) { norm = FALSE; } else { norm = TRUE; } break; case MODE_AM: *mode = RIG_MODE_AM; if (flag & FLAG_AM_N) { norm = FALSE; } else { norm = TRUE; } break; case MODE_FM: *mode = RIG_MODE_FM; norm = TRUE; break; default: return -RIG_EINVAL; /* Oops! file bug report */ } if (norm) { *width = rig_passband_normal(rig, *mode); } else { *width = rig_passband_narrow(rig, *mode); } rig_debug(RIG_DEBUG_TRACE, "%s: set mode = %i\n", __func__, *mode); rig_debug(RIG_DEBUG_TRACE, "%s: set width = %li Hz\n", __func__, *width); return RIG_OK; } /* * rig_set_vfo * * set vfo and store requested vfo for later RIG_VFO_CURR * requests. * */ static int ft840_set_vfo(RIG *rig, vfo_t vfo) { struct ft840_priv_data *priv; unsigned char cmd_index; /* index of sequence to send */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft840_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } /* FIXME: Include support for RIG_VFO_MAIN */ switch(vfo) { case RIG_VFO_A: cmd_index = FT840_NATIVE_VFO_A; priv->current_vfo = vfo; /* update active VFO */ break; case RIG_VFO_B: cmd_index = FT840_NATIVE_VFO_B; priv->current_vfo = vfo; break; case RIG_VFO_MEM: /* reset to memory channel stored by previous get_vfo * The recall mem channel command uses 0x01 though 0x20 */ err = ft840_send_dynamic_cmd(rig, FT840_NATIVE_RECALL_MEM, (priv->current_mem + 1), 0, 0, 0); if (err != RIG_OK) return err; priv->current_vfo = vfo; rig_debug(RIG_DEBUG_TRACE, "%s: set mem channel = 0x%02x\n", __func__, priv->current_mem); return RIG_OK; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } rig_debug(RIG_DEBUG_TRACE, "%s: set cmd_index = %i\n", __func__, cmd_index); err = ft840_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_vfo * * get current RX vfo/mem and store requested vfo for * later RIG_VFO_CURR requests plus pass the tested vfo/mem * back to the frontend. * */ static int ft840_get_vfo(RIG *rig, vfo_t *vfo) { struct ft840_priv_data *priv; unsigned char status_0; /* ft840 status flag 0 */ unsigned char stat_vfo, stat_mem; /* status tests */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft840_priv_data *)rig->state.priv; /* Get flags for VFO status */ err = ft840_get_update_data(rig, FT840_NATIVE_READ_FLAGS, FT840_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; status_0 = priv->update_data[FT840_SUMO_DISPLAYED_STATUS_0]; stat_vfo = status_0 & SF_VFO_MASK; /* get VFO active bits */ stat_mem = status_0 & SF_MEM_MASK; /* get MEM active bits */ rig_debug(RIG_DEBUG_TRACE, "%s: vfo status_0 = 0x%02x\n", __func__, status_0); rig_debug(RIG_DEBUG_TRACE, "%s: stat_vfo = 0x%02x\n", __func__, stat_vfo); rig_debug(RIG_DEBUG_TRACE, "%s: stat_mem = 0x%02x\n", __func__, stat_mem); /* * translate vfo and mem status from ft840 to generic. * * First a test is made on bits 6 and 7 of status_0. Bit 7 is set * when FT-840 is in VFO mode on display. Bit 6 is set when VFO B * is active and cleared when VFO A is active. * * Conversely, bit 7 is cleared when MEM or MEM TUNE mode is selected * Bit 6 still follows last selected VFO (A or B), but this is not * tested right now. */ switch (stat_vfo) { case SF_VFOA: *vfo = RIG_VFO_A; priv->current_vfo = RIG_VFO_A; break; case SF_VFOB: *vfo = RIG_VFO_B; priv->current_vfo = RIG_VFO_B; break; default: switch (stat_mem) { case SF_MT: case SF_MR: *vfo = RIG_VFO_MEM; priv->current_vfo = RIG_VFO_MEM; /* * Per Hamlib policy capture and store memory channel number * for future set_vfo command. */ err = ft840_get_update_data(rig, FT840_NATIVE_MEM_CHNL, FT840_MEM_CHNL_LENGTH); if (err != RIG_OK) return err; priv->current_mem = priv->update_data[FT840_SUMO_MEM_CHANNEL]; rig_debug(RIG_DEBUG_TRACE, "%s: stored mem channel = 0x%02x\n", __func__, priv->current_mem); break; default: /* Oops! */ return -RIG_EINVAL; /* sorry, wrong current VFO */ } } rig_debug(RIG_DEBUG_TRACE, "%s: set vfo = 0x%02x\n", __func__, *vfo); return RIG_OK; } /* * rig_set_ptt * * set the '840 into TX mode * * vfo is respected by calling ft840_set_vfo if * passed vfo != priv->current_vfo * */ static int ft840_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { struct ft840_priv_data *priv; unsigned char cmd_index; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft840_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed ptt = 0x%02x\n", __func__, ptt); if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } else if (vfo != priv->current_vfo) { ft840_set_vfo(rig, vfo); } switch (ptt) { case RIG_PTT_OFF: cmd_index = FT840_NATIVE_PTT_OFF; break; case RIG_PTT_ON: cmd_index = FT840_NATIVE_PTT_ON; break; default: return -RIG_EINVAL; /* wrong PTT state! */ } err = ft840_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_ptt * * get current PTT status * */ #ifdef USE_FT840_GET_PTT static int ft840_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct ft840_priv_data *priv; unsigned char status_2; /* ft840 status flag 2 */ unsigned char stat_ptt; /* status tests */ int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft840_priv_data *)rig->state.priv; /* Get flags for VFO status */ err = ft840_get_update_data(rig, FT840_NATIVE_READ_FLAGS, FT840_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; status_2 = priv->update_data[FT840_SUMO_DISPLAYED_STATUS_2]; stat_ptt = status_2 & SF_PTT_MASK; /* get PTT active bit */ rig_debug(RIG_DEBUG_TRACE, "%s: ptt status_2 = 0x%02x\n", __func__, status_2); switch (stat_ptt) { case SF_PTT_OFF: *ptt = RIG_PTT_OFF; break; case SF_PTT_ON: *ptt = RIG_PTT_ON; break; default: /* Oops! */ return -RIG_EINVAL; /* Invalid PTT bit?! */ } return RIG_OK; } #endif /* USE_FT840_GET_PTT */ /* * rig_set_split_vfo * * set the '840 into split TX/RX mode * * VFO cannot be set as the set split on command only changes the * TX to the other VFO. Setting split off returns the TX to the * main display. * */ static int ft840_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { unsigned char cmd_index; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed split = 0x%02x\n", __func__, split); switch(split) { case RIG_SPLIT_OFF: cmd_index = FT840_NATIVE_SPLIT_OFF; break; case RIG_SPLIT_ON: cmd_index = FT840_NATIVE_SPLIT_ON; break; default: return -RIG_EINVAL; } err = ft840_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_split_vfo * * Get whether the '840 is in split mode * * vfo value is not used * */ static int ft840_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { struct ft840_priv_data *priv; unsigned char status_0; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft840_priv_data *)rig->state.priv; /* Get flags for VFO split status */ err = ft840_get_update_data(rig, FT840_NATIVE_READ_FLAGS, FT840_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; /* get Split active bit */ status_0 = SF_SPLIT & priv->update_data[FT840_SUMO_DISPLAYED_STATUS_0]; rig_debug(RIG_DEBUG_TRACE, "%s: split status_0 = 0x%02x\n", __func__, status_0); switch (status_0) { case SF_SPLIT: *split = RIG_SPLIT_ON; break; default: *split = RIG_SPLIT_OFF; break; } return RIG_OK; } /* * rig_set_rit * * VFO and MEM rit values are independent. * * passed vfo value is respected. * * Clarifier offset is retained in the rig for either VFO when the * VFO is changed. Offset is not retained when in memory tune mode * and VFO mode is selected or another memory channel is selected. * */ #ifdef USE_FT840_SET_RIT static int ft840_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { struct ft840_priv_data *priv; // unsigned char offset; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; if (rit < -9990 || rit > 9990) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li\n", __func__, rit); priv = (struct ft840_priv_data *)rig->state.priv; /* * The assumption here is that the user hasn't changed * the VFO manually. Does it really need to be checked * every time? My goal is to reduce the traffic on the * serial line to a minimum, but respect the application's * request to change the VFO with this call. * */ if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous rig_get_vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } else if (vfo != priv->current_vfo) { ft840_set_vfo(rig, vfo); } /* * Shuts clarifier off but does not set frequency to 0 Hz */ if (rit == 0) { err = ft840_send_dynamic_cmd(rig, FT840_NATIVE_CLARIFIER_OPS, CLAR_RX_OFF, 0, 0, 0); return RIG_OK; } /* * Clarifier must first be turned on then the frequency can * be set, +9990 Hz to -9990 Hz */ err = ft840_send_dynamic_cmd(rig, FT840_NATIVE_CLARIFIER_OPS, CLAR_RX_ON, 0, 0, 0); if (err != RIG_OK) return err; err = ft840_send_rit_freq(rig, FT840_NATIVE_CLARIFIER_OPS, rit); if (err != RIG_OK) return err; return RIG_OK; } #endif /* USE_FT840_SET_RIT */ /* * rig_get_rit * * Rig returns offset as hex from 0x0000 to 0x03e7 for 0 to +9.990 kHz * and 0xffff to 0xfc19 for -1 to -9.990 kHz * */ static int ft840_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) { struct ft840_priv_data *priv; unsigned char *p; unsigned char offset; shortfreq_t f; int err, cmd_index, length; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed vfo = 0x%02x\n", __func__, vfo); priv = (struct ft840_priv_data *)rig->state.priv; if (vfo == RIG_VFO_CURR) { vfo = priv->current_vfo; /* from previous vfo cmd */ rig_debug(RIG_DEBUG_TRACE, "%s: priv->current_vfo = 0x%02x\n", __func__, vfo); } switch(vfo) { case RIG_VFO_MEM: cmd_index = FT840_NATIVE_OP_DATA; offset = FT840_SUMO_DISPLAYED_CLAR; length = FT840_OP_DATA_LENGTH; break; case RIG_VFO_A: case RIG_VFO_VFO: cmd_index = FT840_NATIVE_VFO_DATA; offset = FT840_SUMO_VFO_A_CLAR; length = FT840_VFO_DATA_LENGTH; break; case RIG_VFO_B: cmd_index = FT840_NATIVE_VFO_DATA; offset = FT840_SUMO_VFO_B_CLAR; length = FT840_VFO_DATA_LENGTH; break; default: return -RIG_EINVAL; } rig_debug(RIG_DEBUG_TRACE, "%s: set cmd_index = %i\n", __func__, cmd_index); rig_debug(RIG_DEBUG_TRACE, "%s: set offset = 0x%02x\n", __func__, offset); err = ft840_get_update_data(rig, cmd_index, length); if (err != RIG_OK) return err; p = &priv->update_data[offset]; /* big endian integer */ f = (p[0]<<8) + p[1]; /* returned value is hex to nearest hundred Hz */ if (f > 0xfc18) /* 0xfc19 to 0xffff is negative offset */ f = ~(0xffff - f); rig_debug(RIG_DEBUG_TRACE, "%s: read freq = %li Hz\n", __func__, f * 10); *rit = f * 10; /* store clarifier frequency */ return RIG_OK; } /* * rig_set_func * * set the '840 supported functions * * vfo is ignored for tuner as it is an independent function * */ static int ft840_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { int err, cmd_index; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed func = 0x%02x\n", __func__, func); rig_debug(RIG_DEBUG_TRACE, "%s: passed status = %i\n", __func__, status); switch (func) { case RIG_FUNC_TUNER: switch (status) { case OFF: cmd_index = FT840_NATIVE_TUNER_OFF; break; case ON: cmd_index = FT840_NATIVE_TUNER_ON; break; default: return -RIG_EINVAL; } break; default: return -RIG_EINVAL; } err = ft840_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * rig_get_level * * get the '840 meter level * * vfo is ignored for now * * Meter level returned from FT-840 is S meter when rig is in RX * Meter level returned is one of ALC or PO or SWR when rig is in TX * depending on front panel meter selection. Meter selection is NOT * available via CAT. * * TODO: Add support for TX values * */ static int ft840_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { struct ft840_priv_data *priv; unsigned char *p; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed level = 0x%02x\n", __func__, level); priv = (struct ft840_priv_data *)rig->state.priv; switch (level) { case RIG_LEVEL_STRENGTH: err = ft840_get_update_data(rig, FT840_NATIVE_READ_METER, FT840_STATUS_FLAGS_LENGTH); if (err != RIG_OK) return err; p = &priv->update_data[FT840_SUMO_METER]; /* * My FT-840 returns a range of 0x00 to 0x44 for S0 to S9 and 0x44 to * 0x9d for S9 to S9 +60 * * For ease of calculation I rounded S9 up to 0x48 (72 decimal) and * S9 +60 up to 0xa0 (160 decimal). I calculated a divisor for readings * less than S9 by dividing 72 by 54 and the divisor for readings greater * than S9 by dividing 88 (160 - 72) by 60. The result tracks rather well. * * The greatest error is around S1 and S2 and then from S9 to S9 +35. Such * is life when mapping non-linear S-meters to a linear scale. * */ if (*p > 160) { val->i = 60; } else if (*p <= 72) { val->i = ((72 - *p) / 1.3333) * -1; } else { val->i = ((*p - 72) / 1.4667); } rig_debug(RIG_DEBUG_TRACE, "%s: calculated level = %i\n", __func__, val->i); break; default: return -RIG_EINVAL; } return RIG_OK; } /* * rig_vfo_op * * VFO operations--tuner start, etc * * vfo is ignored for now * */ static int ft840_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { int err, cmd_index; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed op = 0x%02x\n", __func__, op); switch (op) { case RIG_OP_TUNE: cmd_index = FT840_NATIVE_TUNER_START; break; default: return -RIG_EINVAL; } err = ft840_send_static_cmd(rig, cmd_index); if (err != RIG_OK) return err; return RIG_OK; } /* * ************************************ * * Private functions to ft840 backend * * ************************************ */ /* * Private helper function. Retrieves update data from rig. * using pacing value and buffer indicated in *priv struct. * Extended to be command agnostic as 840 has several ways to * get data and several ways to return it. * * Need to use this when doing ft840_get_* stuff * * Arguments: *rig Valid RIG instance * ci command index * rl expected length of returned data in octets * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft840_get_update_data(RIG *rig, unsigned char ci, unsigned char rl) { struct rig_state *rig_s; struct ft840_priv_data *priv; int n, err; /* for read_ */ rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft840_priv_data *)rig->state.priv; rig_s = &rig->state; err = ft840_send_static_cmd(rig, ci); if (err != RIG_OK) return err; n = read_block(&rig_s->rigport, (char *) priv->update_data, rl); if (n < 0) return n; /* die returning read_block error */ rig_debug(RIG_DEBUG_TRACE, "%s: read %i bytes\n", __func__, n); return RIG_OK; } /* * Private helper function to send a complete command sequence. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft840_send_static_cmd(RIG *rig, unsigned char ci) { struct rig_state *rig_s; struct ft840_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; priv = (struct ft840_priv_data *)rig->state.priv; rig_s = &rig->state; if (!priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to send incomplete sequence\n", __func__); return -RIG_EINVAL; } err = write_block(&rig_s->rigport, (char *) priv->pcs[ci].nseq, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } /* * Private helper function to build and then send a complete command * sequence. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * p1-p4 Command parameters * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft840_send_dynamic_cmd(RIG *rig, unsigned char ci, unsigned char p1, unsigned char p2, unsigned char p3, unsigned char p4) { struct rig_state *rig_s; struct ft840_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed p1 = 0x%02x, p2 = 0x%02x, p3 = 0x%02x, p4 = 0x%02x,\n", __func__, p1, p2, p3, p4); priv = (struct ft840_priv_data *)rig->state.priv; if (priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n", __func__); return -RIG_EINVAL; } rig_s = &rig->state; memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); priv->p_cmd[P1] = p1; /* ick */ priv->p_cmd[P2] = p2; priv->p_cmd[P3] = p3; priv->p_cmd[P4] = p4; err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } /* * Private helper function to build and send a complete command to * change the display frequency. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * freq freq_t frequency value * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int ft840_send_dial_freq(RIG *rig, unsigned char ci, freq_t freq) { struct rig_state *rig_s; struct ft840_priv_data *priv; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed freq = %"PRIfreq" Hz\n", __func__, freq); priv = (struct ft840_priv_data *)rig->state.priv; if (priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n", __func__); return -RIG_EINVAL; } rig_s = &rig->state; /* Copy native cmd freq_set to private cmd storage area */ memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); /* store bcd format in in p_cmd */ to_bcd(priv->p_cmd, freq/10, FT840_BCD_DIAL); rig_debug(RIG_DEBUG_TRACE, "%s: requested freq after conversion = %"PRIll" Hz\n", __func__, from_bcd(priv->p_cmd, FT840_BCD_DIAL)* 10); err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } /* * Private helper function to build and send a complete command to * change the RIT frequency. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the pcs struct * rit shortfreq_t frequency value * p1 P1 value -- CLAR_SET_FREQ * p2 P2 value -- CLAR_OFFSET_PLUS || CLAR_OFFSET_MINUS * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion * * Assumes: rit doesn't exceed tuning limits of rig */ #ifdef USE_FT840_SET_RIT static int ft840_send_rit_freq(RIG *rig, unsigned char ci, shortfreq_t rit) { struct rig_state *rig_s; struct ft840_priv_data *priv; unsigned char p1; unsigned char p2; int err; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!rig) return -RIG_EINVAL; rig_debug(RIG_DEBUG_TRACE, "%s: passed ci = %i\n", __func__, ci); rig_debug(RIG_DEBUG_TRACE, "%s: passed rit = %li Hz\n", __func__, rit); priv = (struct ft840_priv_data *)rig->state.priv; if (priv->pcs[ci].ncomp) { rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n", __func__); return -RIG_EINVAL; } rig_s = &rig->state; p1 = CLAR_SET_FREQ; if (rit < 0) { rit = labs(rit); /* get absolute value of rit */ p2 = CLAR_OFFSET_MINUS; } else { p2 = CLAR_OFFSET_PLUS; } /* Copy native cmd clarifier ops to private cmd storage area */ memcpy(&priv->p_cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); /* store bcd format in in p_cmd */ to_bcd(priv->p_cmd, rit/10, FT840_BCD_RIT); rig_debug(RIG_DEBUG_TRACE, "%s: requested rit after conversion = %li Hz\n", __func__, from_bcd(priv->p_cmd, FT840_BCD_RIT)* 10); priv->p_cmd[P1] = p1; /* ick */ priv->p_cmd[P2] = p2; err = write_block(&rig_s->rigport, (char *) &priv->p_cmd, YAESU_CMD_LENGTH); if (err != RIG_OK) return err; return RIG_OK; } #endif /* USE_FT840_SET_RIT */ hamlib-1.2.15.3/yaesu/ft450.h0000644000175000017500000001025512044564477012277 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft450.h - (C) Nate Bargmann 2007 (n0nb at arrl.net) * (C) Stephane Fillod 2008 * * This shared library provides an API for communicating * via serial interface to an FT-450 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT450_H #define _FT450_H 1 #define TRUE 1 #define FALSE 0 #define ON TRUE #define OFF FALSE #define FT450_VFO_ALL (RIG_VFO_A|RIG_VFO_B) /* Receiver caps */ /* FT450 USER-L == RIG_MODE_PKTLSB */ /* FT450 USER-U == RIG_MODE_PKTUSB */ /* */ #define FT450_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|\ RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM) #define FT450_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|\ RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB) #define FT450_AM_RX_MODES (RIG_MODE_AM) #define FT450_FM_RX_MODES (RIG_MODE_FM|RIG_MODE_PKTFM) #define FT450_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR) #define FT450_CW_RTTY_PKT_RX_MODES (RIG_MODE_RTTY|RIG_MODE_RTTYR|\ RIG_MODE_PKTUSB|RIG_MODE_PKTLSB|RIG_MODE_CW|RIG_MODE_CWR) /* TRX caps */ #define FT450_OTHER_TX_MODES (RIG_MODE_CW| RIG_MODE_USB| RIG_MODE_LSB ) /* 100 W class */ #define FT450_AM_TX_MODES (RIG_MODE_AM ) /* set 25W max */ #define FT450_LEVELS (RIG_LEVEL_ATT|RIG_LEVEL_PREAMP|\ RIG_LEVEL_ALC|RIG_LEVEL_RAWSTR|RIG_LEVEL_SWR|\ RIG_LEVEL_RFPOWER|RIG_LEVEL_RF|RIG_LEVEL_SQL|\ RIG_LEVEL_MICGAIN|RIG_LEVEL_IF|RIG_LEVEL_CWPITCH|\ RIG_LEVEL_KEYSPD|RIG_LEVEL_AF|RIG_LEVEL_AGC|\ RIG_LEVEL_METER|RIG_LEVEL_BKINDL|RIG_LEVEL_SQL|\ RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY) #define FT450_FUNCS (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_LOCK|\ RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\ RIG_FUNC_FBKIN|RIG_FUNC_MN) #define FT450_VFO_OPS (RIG_OP_TUNE|RIG_OP_CPY|RIG_OP_XCHG|\ RIG_OP_UP|RIG_OP_DOWN|RIG_OP_BAND_UP|RIG_OP_BAND_DOWN|\ RIG_OP_TOGGLE) /* TBC */ #define FT450_STR_CAL { 3, \ { \ { 10, -60 }, /* S0 */ \ { 125, 0 }, /* S9 */ \ { 240, 60 } /* +60 */ \ } } /* * Other features (used by rig_caps) * */ #define FT450_ANTS 0 #define FT450_MEM_CHNL_LENGTH 1 /* 0x10 P1 = 01 return size */ #define FT450_OP_DATA_LENGTH 19 /* 0x10 P1 = 03 return size */ #define FT450_VFO_DATA_LENGTH 18 /* 0x10 P1 = 03 return size -- A & B returned */ #define FT450_MEM_CHNL_DATA_LENGTH 19 /* 0x10 P1 = 04, P4 = 0x01-0x20 return size */ #define FT450_STATUS_FLAGS_LENGTH 5 /* 0xf7, 0xfa return size */ #define FT450_ALL_DATA_LENGTH 649 /* 0x10 P1 = 00 return size */ /* Timing values in mS */ // #define FT450_PACING_INTERVAL 5 // #define FT450_PACING_DEFAULT_VALUE 0 /* Delay between bytes sent to FT-450 * Should not exceed value set in CAT TOT menu (rig default is 10 mSec) */ #define FT450_WRITE_DELAY 0 /* Delay sequential fast writes */ #define FT450_POST_WRITE_DELAY 5 /* * API local implementation * */ //static int ft450_init(RIG *rig); //static int ft450_cleanup(RIG *rig); //static int ft450_open(RIG *rig); //static int ft450_close(RIG *rig); //static int ft450_set_freq(RIG *rig, vfo_t vfo, freq_t freq); //static int ft450_set_vfo(RIG *rig, vfo_t vfo); #endif /* _FT450_H */ hamlib-1.2.15.3/yaesu/ft736.c0000644000175000017500000003473112044564477012306 00000000000000/* * ft736.c - (C) Stephane Fillod 2004-2010 * * This shared library provides an API for communicating * via serial interface to an FT-736R using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "tones.h" #define FT736_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_FM) #define FT736_VFOS (RIG_VFO_A) /* Measurement by Ron W6FM using a signal generator. * Raw values supposed to be between 0x30 and 0xad according to manual. */ #define FT736_STR_CAL { 3, { \ { 0x1d, -54 }, /* S0 */ \ { 0x54, 0 }, /* S9 */ \ { 0x9d, 60 } /* +60 */ \ } } struct ft736_priv_data { split_t split; }; /* Private helper function prototypes */ static int ft736_open(RIG *rig); static int ft736_close(RIG *rig); static int ft736_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft736_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ft736_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int ft736_set_split_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft736_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ft736_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); static int ft736_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); static int ft736_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int ft736_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift); static int ft736_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs); static int ft736_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static int ft736_set_ctcss_tone (RIG *rig, vfo_t vfo, tone_t tone); static int ft736_set_ctcss_sql (RIG *rig, vfo_t vfo, tone_t tone); /* Some tones are present twice, the second value is * higher Q (80), according to manual. */ static const tone_t ft736_ctcss_list[] = { 670, 719, 770, 825, 885, 948, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273, 1318, 1365, 1413, 1462, 1514, 1567, 1622, 1679, 1738, 1799, 1862, 1928, 2035, 2107, 2181, 2257, 2336, 2418, 2503, 670, 719, 744, 770, 797, 825, 854, 885, 915, 0 }; #define FT736_CTCSS_NB 42 /* * ft736 rigs capabilities. * * TODO: * - AQS */ const struct rig_caps ft736_caps = { .rig_model = RIG_MODEL_FT736R, .model_name = "FT-736R", .mfg_name = "Yaesu", .version = "0.3", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, /* RTS low, DTR high, and CTS low. */ .write_delay = 30, /* 50ms to be real safe */ .post_write_delay = 0, .timeout = 2000, .retry = 0, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_TONE|RIG_FUNC_TSQL, .has_get_level = RIG_LEVEL_RAWSTR, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .vfo_ops = RIG_OP_NONE, .ctcss_list = ft736_ctcss_list, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, .rx_range_list1 = { {MHz(50), MHz(53.99999), FT736_MODES, -1, -1, FT736_VFOS }, {MHz(144), MHz(145.99999), FT736_MODES, -1, -1, FT736_VFOS }, {MHz(430), MHz(439.99999), FT736_MODES, -1, -1, FT736_VFOS }, {MHz(1240), MHz(1299.99999), FT736_MODES, -1, -1, FT736_VFOS }, RIG_FRNG_END, }, /* Region 1 rx ranges */ .tx_range_list1 = { {MHz(50), MHz(53.99999), FT736_MODES, W(5), W(30), FT736_VFOS }, {MHz(144), MHz(145.99999), FT736_MODES, W(5), W(60), FT736_VFOS }, {MHz(430), MHz(439.99999), FT736_MODES, W(5), W(60), FT736_VFOS }, {MHz(1240), MHz(1299.99999), FT736_MODES, W(5), W(45), FT736_VFOS }, RIG_FRNG_END, }, /* region 1 TX ranges */ .rx_range_list2 = { {MHz(50), MHz(53.99999), FT736_MODES, -1, -1, FT736_VFOS }, {MHz(144), MHz(147.99999), FT736_MODES, -1, -1, FT736_VFOS }, {MHz(220), MHz(224.99999), FT736_MODES, -1, -1, FT736_VFOS }, {MHz(430), MHz(449.99999), FT736_MODES, -1, -1, FT736_VFOS }, {MHz(1240), MHz(1299.99999), FT736_MODES, -1, -1, FT736_VFOS }, RIG_FRNG_END, }, /* Region 2 rx ranges */ .tx_range_list2 = { {MHz(50), MHz(53.99999), FT736_MODES, W(5), W(30), FT736_VFOS }, {MHz(144), MHz(147.99999), FT736_MODES, W(5), W(60), FT736_VFOS }, {MHz(220), MHz(224.99999), FT736_MODES, W(5), W(60), FT736_VFOS }, {MHz(430), MHz(449.99999), FT736_MODES, W(5), W(60), FT736_VFOS }, {MHz(1240), MHz(1299.99999), FT736_MODES, W(5), W(45), FT736_VFOS }, RIG_FRNG_END, }, /* region 2 TX ranges */ .tuning_steps = { {FT736_MODES, Hz(10)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_CWR, kHz(2.2)}, {RIG_MODE_CW|RIG_MODE_CWR, Hz(600)}, {RIG_MODE_FM, kHz(12)}, {RIG_MODE_FM, kHz(8)}, RIG_FLT_END, }, .str_cal = FT736_STR_CAL, .rig_open = ft736_open, .rig_close = ft736_close, .set_freq = ft736_set_freq, .set_mode = ft736_set_mode, .set_ptt = ft736_set_ptt, .get_dcd = ft736_get_dcd, .get_level = ft736_get_level, .set_split_vfo = ft736_set_split_vfo, .set_split_freq = ft736_set_split_freq, .set_split_mode = ft736_set_split_mode, .set_rptr_shift = ft736_set_rptr_shift, .set_rptr_offs = ft736_set_rptr_offs, .set_func = ft736_set_func, .set_ctcss_tone = ft736_set_ctcss_tone, .set_ctcss_sql = ft736_set_ctcss_sql, }; /* * ft736_open routine * */ int ft736_open(RIG *rig) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x00}; struct ft736_priv_data *priv; int ret; rig_debug(RIG_DEBUG_TRACE, "%s called\n",__FUNCTION__); priv = (struct ft736_priv_data*)malloc(sizeof(struct ft736_priv_data)); if (!priv) return -RIG_ENOMEM; priv->split = RIG_SPLIT_OFF; rig->state.priv = priv; /* send Ext Cntl ON: Activate CAT */ ret = write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); if (ret != RIG_OK) free(priv); return ret; } int ft736_close(RIG *rig) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x80, 0x80, 0x80, 0x80, 0x80}; rig_debug(RIG_DEBUG_TRACE, "%s called\n",__FUNCTION__); free(rig->state.priv); /* send Ext Cntl OFF: Deactivate CAT */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int ft736_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x01}; struct ft736_priv_data *priv = (struct ft736_priv_data *)rig->state.priv; if (priv->split == RIG_SPLIT_ON) cmd[4] = 0x1e; /* store bcd format in cmd (MSB) */ to_bcd_be(cmd,freq/10,8); /* special case for 1.2GHz band */ if (freq > GHz(1.2)) cmd[0] = (cmd[0] & 0x0f) | 0xc0; /* Frequency set */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } #define MD_LSB 0x00 #define MD_USB 0x01 #define MD_CW 0x02 #define MD_CWR 0x03 #define MD_AM 0x04 #define MD_FM 0x08 int ft736_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x07}; unsigned char md; struct ft736_priv_data *priv = (struct ft736_priv_data *)rig->state.priv; if (priv->split == RIG_SPLIT_ON) cmd[4] = 0x17; /* * translate mode from generic to ft736 specific */ switch(mode) { case RIG_MODE_CW: md = MD_CW; break; case RIG_MODE_CWR: md = MD_CWR; break; case RIG_MODE_USB: md = MD_USB; break; case RIG_MODE_LSB: md = MD_LSB; break; case RIG_MODE_FM: md = MD_FM; break; case RIG_MODE_AM: md = MD_AM; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } if (width != RIG_PASSBAND_NORMAL && width < rig_passband_normal(rig, mode)) { md |= 0x80; } cmd[0] = md; /* Mode set */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int ft736_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x8e}; struct ft736_priv_data *priv = (struct ft736_priv_data *)rig->state.priv; int ret; /* * this can be misleading as Yaesu call it "Full duplex" * or "sat mode", and split Yaesu terms is repeater shift. */ cmd[4] = split == RIG_SPLIT_ON ? 0x0e : 0x8e; ret = write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); if (ret == RIG_OK) priv->split = split; return ret; } int ft736_set_split_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x2e}; /* store bcd format in cmd (MSB) */ to_bcd_be(cmd,freq/10,8); /* special case for 1.2GHz band */ if (freq > GHz(1.2)) cmd[0] = (cmd[0] & 0x0f) | 0xc0; /* Frequency set */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int ft736_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x27}; unsigned char md; /* * translate mode from generic to ft736 specific */ switch(mode) { case RIG_MODE_CW: md = MD_CW; break; case RIG_MODE_CWR: md = MD_CWR; break; case RIG_MODE_USB: md = MD_USB; break; case RIG_MODE_LSB: md = MD_LSB; break; case RIG_MODE_FM: md = MD_FM; break; case RIG_MODE_AM: md = MD_AM; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } if (width != RIG_PASSBAND_NORMAL && width < rig_passband_normal(rig, mode)) { md |= 0x80; } cmd[0] = md; /* Mode set */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int ft736_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x88}; cmd[4] = ptt == RIG_PTT_ON ? 0x08 : 0x88; /* Tx/Rx set */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int ft736_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0xe7}; int retval; serial_flush(&rig->state.rigport); retval = write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); if (retval < 0) return retval; /* read back the 1 byte */ retval = read_block(&rig->state.rigport, (char *) cmd, 5); if (retval < 1) { rig_debug(RIG_DEBUG_ERR,"%s: read squelch failed %d\n", __FUNCTION__,retval); return retval < 0 ? retval : -RIG_EIO; } *dcd = cmd[0] == 0x00 ? RIG_DCD_OFF : RIG_DCD_ON; return RIG_OK; } int ft736_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0xf7}; int retval; if (level != RIG_LEVEL_RAWSTR) return -RIG_EINVAL; serial_flush(&rig->state.rigport); /* send Test S-meter cmd to rig */ retval = write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); if (retval < 0) return retval; /* read back the 1 byte */ retval = read_block(&rig->state.rigport, (char *) cmd, 5); if (retval < 1) { rig_debug(RIG_DEBUG_ERR,"%s: read meter failed %d\n", __FUNCTION__,retval); return retval < 0 ? retval : -RIG_EIO; } val->i = cmd[0]; return RIG_OK; } int ft736_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x89}; switch (shift) { case RIG_RPT_SHIFT_NONE: /* There's a typo in the manual. * "Split Dir. simplex" is in fact 0x89, and 0x88 is PTT off! */ cmd[4] = 0x89; break; case RIG_RPT_SHIFT_MINUS: cmd[4] = 0x09; break; case RIG_RPT_SHIFT_PLUS: cmd[4] = 0x49; break; default: return -RIG_EINVAL; } return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int ft736_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0xf9}; /* store bcd format in cmd (MSB) */ to_bcd_be(cmd,offs/10,8); /* Offset set */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int ft736_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x8a}; switch (func) { case RIG_FUNC_TONE: cmd[4] = status ? 0x4a : 0x8a; break; case RIG_FUNC_TSQL: cmd[4] = status ? 0x0a : 0x8a; break; default: return -RIG_EINVAL; } return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int ft736_set_ctcss_tone (RIG *rig, vfo_t vfo, tone_t tone) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0xfa}; int i; for (i=0; istate.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int ft736_set_ctcss_sql (RIG *rig, vfo_t vfo, tone_t tone) { /* same opcode as tone */ return ft736_set_ctcss_tone(rig, vfo, tone); } hamlib-1.2.15.3/yaesu/ft817.h0000644000175000017500000001340112044564477012302 00000000000000/* * hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com) * * ft817.h - (C) Chris Karpinsky 2001 (aa1vl@arrl.net) * This shared library provides an API for communicating * via serial interface to an FT-817 using the "CAT" interface. * The starting point for this code was Frank's ft847 implementation. * * Then, Tommi OH2BNS improved the code a lot in the framework of the * FT-857 backend. These improvements have now (August 2005) been * copied back and adopted for the FT-817. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT817_H #define _FT817_H 1 /* * No need to wait between written characters. */ #define FT817_WRITE_DELAY 0 /* * Wait 'delay' milliseconds after writing a command sequence. * * Setting this to zero means no delay but wait for an acknowledgement * from the rig after a command. This is undocumented but seems to work. * It's also the most optimal way as long as it works... * * A non-zero value disables waiting for the ack. Processing a command * seems to take about 60 ms so set this to 80 or so to be safe. */ #define FT817_POST_WRITE_DELAY 0 /* * Read timeout. */ #define FT817_TIMEOUT 200 /* * The time the TX, RX and FREQ/MODE status are cached (in millisec). * This optimises the common case of doing eg. rig_get_freq() and * rig_get_mode() in a row. * * The timeout is deliberately set lower than the time taken to process * a single command (~ 60 ms) so that a sequence * * rig_get_freq(); * rig_set_freq(); * rig_get_freq(); * * doesn't return a bogus (cached) value in the last rig_get_freq(). */ #define FT817_CACHE_TIMEOUT 50 enum ft817_native_cmd_e { FT817_NATIVE_CAT_LOCK_ON = 0, FT817_NATIVE_CAT_LOCK_OFF, FT817_NATIVE_CAT_PTT_ON, FT817_NATIVE_CAT_PTT_OFF, FT817_NATIVE_CAT_SET_FREQ, FT817_NATIVE_CAT_SET_MODE_LSB, FT817_NATIVE_CAT_SET_MODE_USB, FT817_NATIVE_CAT_SET_MODE_CW, FT817_NATIVE_CAT_SET_MODE_CWR, FT817_NATIVE_CAT_SET_MODE_AM, FT817_NATIVE_CAT_SET_MODE_FM, FT817_NATIVE_CAT_SET_MODE_FM_N, FT817_NATIVE_CAT_SET_MODE_DIG, FT817_NATIVE_CAT_SET_MODE_PKT, FT817_NATIVE_CAT_CLAR_ON, FT817_NATIVE_CAT_CLAR_OFF, FT817_NATIVE_CAT_SET_CLAR_FREQ, FT817_NATIVE_CAT_SET_VFOAB, FT817_NATIVE_CAT_SPLIT_ON, FT817_NATIVE_CAT_SPLIT_OFF, FT817_NATIVE_CAT_SET_RPT_SHIFT_MINUS, FT817_NATIVE_CAT_SET_RPT_SHIFT_PLUS, FT817_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX, FT817_NATIVE_CAT_SET_RPT_OFFSET, FT817_NATIVE_CAT_SET_DCS_ON, FT817_NATIVE_CAT_SET_CTCSS_ON, FT817_NATIVE_CAT_SET_CTCSS_ENC_ON, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF, FT817_NATIVE_CAT_SET_CTCSS_FREQ, FT817_NATIVE_CAT_SET_DCS_CODE, FT817_NATIVE_CAT_GET_RX_STATUS, FT817_NATIVE_CAT_GET_TX_STATUS, FT817_NATIVE_CAT_GET_FREQ_MODE_STATUS, FT817_NATIVE_CAT_PWR_WAKE, FT817_NATIVE_CAT_PWR_ON, FT817_NATIVE_CAT_PWR_OFF, FT817_NATIVE_SIZE /* end marker */ }; typedef enum ft817_native_cmd_e ft817_native_cmd_t; struct ft817_priv_data { yaesu_cmd_set_t pcs[FT817_NATIVE_SIZE]; /* TODO: why? */ /* rx status */ struct timeval rx_status_tv; unsigned char rx_status; /* tx status */ struct timeval tx_status_tv; unsigned char tx_status; /* freq & mode status */ struct timeval fm_status_tv; unsigned char fm_status[YAESU_CMD_LENGTH]; }; /* fixme: why declare static? it has no effect */ static int ft817_init (RIG *rig); static int ft817_open (RIG *rig); static int ft817_cleanup (RIG *rig); static int ft817_close (RIG *rig); static int ft817_set_freq (RIG *rig, vfo_t vfo, freq_t freq); static int ft817_get_freq (RIG *rig, vfo_t vfo, freq_t *freq); static int ft817_set_mode (RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ft817_get_mode (RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int ft817_set_ptt (RIG *rig, vfo_t vfo, ptt_t ptt); static int ft817_get_ptt (RIG *rig, vfo_t vfo, ptt_t *ptt); static int ft817_get_level (RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int ft817_set_func (RIG *rig, vfo_t vfo, setting_t func, int status); static int ft817_set_dcs_code (RIG *rig, vfo_t vfo, tone_t code); static int ft817_set_ctcss_tone (RIG *rig, vfo_t vfo, tone_t code); static int ft817_set_dcs_sql (RIG *rig, vfo_t vfo, tone_t code); static int ft817_set_ctcss_sql (RIG *rig, vfo_t vfo, tone_t tone); static int ft817_set_rptr_shift (RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift); static int ft817_set_rptr_offs (RIG *rig, vfo_t vfo, shortfreq_t offs); static int ft817_set_rit (RIG *rig, vfo_t vfo, shortfreq_t rit); static int ft817_get_dcd (RIG *rig, vfo_t vfo, dcd_t *dcd); static int ft817_set_powerstat (RIG *rig, powerstat_t status); static int ft817_vfo_op (RIG *rig, vfo_t vfo, vfo_op_t op); static int ft817_set_split_vfo (RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int ft817_power2mW (RIG *rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode); static int ft817_mW2power (RIG *rig, float *power, unsigned int mwpower, freq_t freq, rmode_t mode); #endif /* _FT817_H */ hamlib-1.2.15.3/yaesu/newcat.h0000644000175000017500000001244212044564477012716 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * and the Hamlib Group (hamlib-developer at lists.sourceforge.net) * * newcat.h - (C) Nate Bargmann 2007 (n0nb at arrl.net) * (C) Terry Embry 2008-2010 * * This shared library provides the backend API for communicating * via serial interface to any Yaesu radio using the new "CAT" * interface commands that are similar to the Kenwood command set. * * Models this code aims to support are FTDX-9000*, FT-2000, * FT-950, FT-450. Much testing remains. -N0NB * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _NEWCAT_H #define _NEWCAT_H 1 #include /* Handy constants */ #ifndef TRUE #define TRUE 1 #endif #define ON TRUE #ifndef FALSE #define FALSE 0 #endif #define OFF FALSE typedef char ncboolean; /* shared function version */ #define NEWCAT_VER "0.22" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129 /* arbitrary value for now. 11 bits (8N2+1) == 2.2917 mS @ 4800 bps */ #define NEWCAT_DEFAULT_READ_TIMEOUT (NEWCAT_DATA_LEN * 5) #define NEWCAT_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .rit = 1, \ .xit = 1, \ .rptr_shift = 1, \ .ctcss_tone = 1,\ .ctcss_sql = 1,\ } /* * Functions considered to be Stable: * * Functions considered to be Beta: * * Functions considered to be Alpha: * newcat_set_freq * newcat_get_freq * newcat_set_vfo * newcat_get_vfo * newcat_get_rit * newcat_set_rit * newcat_get_xit * newcat_set_xit * power2mW * mW2power * newcat_get_ant * newcat_set_ant * newcat_get_ptt * Functions not yet implemented * most everything at this time. * * At this time, CAT documentation for the FT-450 can be obtained from * the Yaesu website at: http://www.yaesu.com/downloadFile.cfm?FileID=2600&FileCatID=158&FileName=FT%2D450%5FCAT%5FOperation%5FReference%5FBook.pdf&FileContentType=application%2Fpdf * */ /* * newcat function definitions. * */ int newcat_init(RIG *rig); int newcat_cleanup(RIG *rig); int newcat_open(RIG *rig); int newcat_close(RIG *rig); int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq); int newcat_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); int newcat_set_vfo(RIG *rig, vfo_t vfo); int newcat_get_vfo(RIG *rig, vfo_t *vfo); int newcat_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); int newcat_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); int newcat_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); int newcat_get_ptt(RIG * rig, vfo_t vfo, ptt_t * ptt); int newcat_set_ant(RIG * rig, vfo_t vfo, ant_t ant); int newcat_get_ant(RIG * rig, vfo_t vfo, ant_t * ant); int newcat_set_level(RIG * rig, vfo_t vfo, setting_t level, value_t val); int newcat_get_level(RIG * rig, vfo_t vfo, setting_t level, value_t * val); int newcat_set_func(RIG * rig, vfo_t vfo, setting_t func, int status); int newcat_get_func(RIG * rig, vfo_t vfo, setting_t func, int *status); int newcat_set_mem(RIG * rig, vfo_t vfo, int ch); int newcat_get_mem(RIG * rig, vfo_t vfo, int *ch); int newcat_vfo_op(RIG * rig, vfo_t vfo, vfo_op_t op); const char *newcat_get_info(RIG * rig); int newcat_get_rit(RIG * rig, vfo_t vfo, shortfreq_t * rit); int newcat_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit); int newcat_get_xit(RIG * rig, vfo_t vfo, shortfreq_t * xit); int newcat_set_xit(RIG * rig, vfo_t vfo, shortfreq_t xit); int newcat_power2mW(RIG * rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode); int newcat_mW2power(RIG * rig, float *power, unsigned int mwpower, freq_t freq, rmode_t mode); int newcat_set_split_vfo(RIG * rig, vfo_t vfo, split_t split, vfo_t tx_vfo); int newcat_get_split_vfo(RIG * rig, vfo_t vfo, split_t * split, vfo_t *tx_vfo); int newcat_set_rptr_shift(RIG * rig, vfo_t vfo, rptr_shift_t rptr_shift); int newcat_get_rptr_shift(RIG * rig, vfo_t vfo, rptr_shift_t * rptr_shift); int newcat_set_ctcss_tone(RIG * rig, vfo_t vfo, tone_t tone); int newcat_get_ctcss_tone(RIG * rig, vfo_t vfo, tone_t * tone); int newcat_set_ctcss_sql(RIG * rig, vfo_t vfo, tone_t tone); int newcat_get_ctcss_sql(RIG * rig, vfo_t vfo, tone_t * tone); int newcat_set_powerstat(RIG * rig, powerstat_t status); int newcat_get_powerstat(RIG * rig, powerstat_t * status); int newcat_set_ts(RIG * rig, vfo_t vfo, shortfreq_t ts); int newcat_get_ts(RIG * rig, vfo_t vfo, shortfreq_t * ts); int newcat_set_trn(RIG * rig, int trn); int newcat_get_trn(RIG * rig, int *trn); int newcat_set_channel(RIG * rig, const channel_t * chan); int newcat_get_channel(RIG * rig, channel_t * chan); #endif /* _NEWCAT_H */ hamlib-1.2.15.3/yaesu/vx1700.c0000644000175000017500000007535712044564477012413 00000000000000/* * Copyright (c) 2010-2011 by Mikhail Kshevetskiy (mikhail.kshevetskiy@gmail.com) * * Code based on VX-1700 CAT manual: * http://www.vertexstandard.com/downloadFile.cfm?FileID=3397&FileCatID=135&FileName=VX-1700_CAT_MANUAL_10_14_2008.pdf&FileContentType=application%2Fpdf * * WARNING: this manual has two errors * 1) Status Update Command (10h), U=01 returns 0..199 for channels 1..200 * 2) Frequency Data (bytes 1--4 of 9-Byte VFO Data Assignment, Status Update * Command (10h), U=02 and U=03) uses bytes 1--3 for frequency, byte 4 is * not used and always zero. Thus bytes 0x15,0xBE,0x68,0x00 means * frequency = 10 * 0x15BE68 = 10 * 1425000 = 14.25 MHz * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "idx_builtin.h" #include "hamlib/rig.h" #include "bandplan.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "vx1700.h" static const yaesu_cmd_set_t ncmd[] = { { 0, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* Recall Memory */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* VFO to MEM */ { 0, { 0x00, 0x00, 0x01, 0x00, 0x03 } }, /* Hide Memory Channel */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* Select VFO (A) */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* Set Op Freq */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* OP Mode Set LSB */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0c } }, /* OP Mode Set USB */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x0c } }, /* OP Mode Set CW-W */ { 1, { 0x00, 0x00, 0x00, 0x03, 0x0c } }, /* OP Mode Set CW-N */ { 1, { 0x00, 0x00, 0x00, 0x04, 0x0c } }, /* OP Mode Set AM */ { 1, { 0x00, 0x00, 0x00, 0x08, 0x0c } }, /* OP Mode Set RTTY LSB-W */ { 1, { 0x00, 0x00, 0x00, 0x09, 0x0c } }, /* OP Mode Set RTTY USB-W */ { 1, { 0x00, 0x00, 0x00, 0x0d, 0x0c } }, /* OP Mode Set H3E */ { 1, { 0x00, 0x00, 0x00, 0x0e, 0x0c } }, /* OP Mode Set RTTY LSB-N */ { 1, { 0x00, 0x00, 0x00, 0x0f, 0x0c } }, /* OP Mode Set RTTY USB-N */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0f } }, /* PTT (OFF) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0f } }, /* PTT (ON) */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x10 } }, /* Update Memory Ch Number */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x10 } }, /* Update Op Data */ { 1, { 0x00, 0x00, 0x00, 0x03, 0x10 } }, /* Update VFO Data */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x18 } }, /* Set TX power low */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x28 } }, /* Set TX power mid */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x48 } }, /* Set TX power hi */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x85 } }, /* Copy RX to TX */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x8a } }, /* Set TX Freq only */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x8e } }, /* Step Operating Frequency Up */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x8e } }, /* Step Operating Frequency Down */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xf7 } }, /* Read Meter */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xfa } }, /* Read Status Flags */ }; /* * Private data */ struct vx1700_priv_data{ unsigned char ch; /* memory channel */ }; /* * vx1700 rigs capabilities. */ #define VX1700_MEM_CAP { \ .freq = 1, \ .tx_freq = 1, \ .mode = 1, \ .width = 1, \ } const struct rig_caps vx1700_caps = { .rig_model = RIG_MODEL_VX1700, .model_name = "VX-1700", .mfg_name = "Vertex Standard", .version = "1.1", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG_MICDATA, .dcd_type = RIG_DCD_NONE, /* we have DCD pin in DATA Jack, but get_dcd() is unavailable (yet?) */ .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 0, .timeout = 600, .retry = 3, .has_get_func = (RIG_FUNC_LOCK|RIG_FUNC_TUNER), .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_RFPOWER, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RFPOWER] = { .min = { .i = 0 }, .max = { .i = 2 } }, }, .parm_gran = {}, .preamp = { RIG_DBLST_END }, .attenuator = { RIG_DBLST_END }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .vfo_ops = VX1700_VFO_OPS, .targetable_vfo = 0, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { VX1700_MIN_CHANNEL, VX1700_MAX_CHANNEL, RIG_MTYPE_MEM, VX1700_MEM_CAP }, RIG_CHAN_END }, .rx_range_list1 = { { kHz(30), MHz(30), VX1700_MODES, -1, -1, VX1700_VFO_ALL, VX1700_ANTS }, RIG_FRNG_END, }, .tx_range_list1 = { { kHz(1600), MHz(4)-1, VX1700_MODES, W(31), W(125), VX1700_VFO_ALL, VX1700_ANTS }, { kHz(4000), MHz(30), VX1700_MODES, W(25), W(100), VX1700_VFO_ALL, VX1700_ANTS }, RIG_FRNG_END, }, .rx_range_list2 = { { kHz(30), MHz(30), VX1700_MODES, -1, -1, VX1700_VFO_ALL, VX1700_ANTS }, RIG_FRNG_END, }, .tx_range_list2 = { { kHz(1600), MHz(4)-1, VX1700_MODES, W(31), W(125), VX1700_VFO_ALL, VX1700_ANTS }, { kHz(4000), MHz(30), VX1700_MODES, W(25), W(100), VX1700_VFO_ALL, VX1700_ANTS }, RIG_FRNG_END, }, .tuning_steps = { { VX1700_MODES, 100 }, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { { RIG_MODE_AM, VX1700_FILTER_WIDTH_AM }, { RIG_MODE_SSB, VX1700_FILTER_WIDTH_SSB }, { RIG_MODE_CW | RIG_MODE_RTTY | RIG_MODE_RTTYR, VX1700_FILTER_WIDTH_WIDE }, { RIG_MODE_CW | RIG_MODE_RTTY | RIG_MODE_RTTYR, VX1700_FILTER_WIDTH_NARROW }, RIG_FLT_END, }, .priv = NULL, .rig_init = vx1700_init, .rig_open = vx1700_open, .rig_cleanup = vx1700_cleanup, .set_vfo = vx1700_set_vfo, .get_vfo = vx1700_get_vfo, .set_freq = vx1700_set_freq, .get_freq = vx1700_get_freq, .set_split_freq = vx1700_set_split_freq, .get_split_freq = vx1700_get_split_freq, .set_mode = vx1700_set_mode, .get_mode = vx1700_get_mode, .get_ptt = vx1700_get_ptt, .set_ptt = vx1700_set_ptt, .get_info = vx1700_get_info, .set_func = vx1700_set_func, .get_func = vx1700_get_func, .set_level = vx1700_set_level, .get_level = vx1700_get_level, .set_mem = vx1700_set_mem, .get_mem = vx1700_get_mem, .vfo_op = vx1700_vfo_op, }; static inline freq_t vx1700_read_freq_from_buf(const unsigned char p[]){ /* WARNING: documentation bug, actually frequency stored in bytes 0..2 only, byte 3 is not used and contain zero */ return ((((((unsigned)p[0]) << 8) + p[1]) << 8) + p[2]) * 10.0; } static inline int vx1700_channel_is_ok(unsigned char channel){ return ((channel >= VX1700_MIN_CHANNEL) && (channel <= VX1700_MAX_CHANNEL)) ? 1 : 0; } /* * Function definitions below */ static int vx1700_do_transaction(RIG *rig, const unsigned char cmd[YAESU_CMD_LENGTH], unsigned char *retbuf, size_t retbuf_len){ struct rig_state *rs; unsigned char default_retbuf[1]; int retval; if (retbuf == NULL){ retbuf = default_retbuf; retbuf_len = sizeof(default_retbuf); } rs = &rig->state; memset(retbuf, 0, retbuf_len); serial_flush(&rs->rigport); retval = write_block(&rs->rigport, (const char*)cmd, YAESU_CMD_LENGTH); if (retval != RIG_OK) return retval; retval = read_block(&rs->rigport, (char*)retbuf, retbuf_len); if (retval != retbuf_len){ if ((retval == 1) && (retbuf[0] == VX1700_CMD_RETCODE_ERROR)) return -RIG_ERJCTED; return -RIG_EIO; } if (retval == 1){ if ((cmd[4] == VX1700_CMD_UPDATE) && (cmd[3] == 0x01)){ /* read memory channel number */ if (vx1700_channel_is_ok(retbuf[0] + 1)){ /* WARNING: Documentation bug, actually we got 0--199 for channels 1--200 */ return RIG_OK; } if (retbuf[0] == VX1700_CMD_RETCODE_ERROR) return -RIG_ERJCTED; return -RIG_EIO; } if (retbuf[0] == VX1700_CMD_RETCODE_OK) return RIG_OK; if (retbuf[0] == VX1700_CMD_RETCODE_ERROR) return -RIG_ERJCTED; return -RIG_EIO; } return RIG_OK; } /* * Private helper function to send a complete command sequence. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the ncmd struct * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int vx1700_do_static_cmd(RIG *rig, unsigned char ci){ if (rig == NULL) return -RIG_EINVAL; if ( ! ncmd[ci].ncomp){ rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to send incomplete sequence\n", __func__); return -RIG_EINVAL; } return vx1700_do_transaction(rig, ncmd[ci].nseq, NULL, 0); } /* * Private helper function to build and then send a complete command * sequence. * * TODO: place variant of this in yaesu.c * * Arguments: *rig Valid RIG instance * ci Command index of the ncmd struct * p1-p4 Command parameters * * Returns: RIG_OK if all called functions are successful, * otherwise returns error from called functiion */ static int vx1700_do_dynamic_cmd(RIG *rig, unsigned char ci, unsigned char p1, unsigned char p2, unsigned char p3, unsigned char p4){ unsigned char cmd[YAESU_CMD_LENGTH]; if (rig == NULL) return -RIG_EINVAL; if (ncmd[ci].ncomp){ rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to modify complete sequence\n", __func__); return -RIG_EINVAL; } memcpy(&cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); cmd[3] = p1; cmd[2] = p2; cmd[1] = p3; cmd[0] = p4; return vx1700_do_transaction(rig, cmd, NULL, 0); } static int vx1700_do_freq_cmd(RIG *rig, unsigned char ci, freq_t freq){ unsigned char cmd[YAESU_CMD_LENGTH]; if (rig == NULL) return -RIG_EINVAL; if ((ci != VX1700_NATIVE_FREQ_SET) && (ci != VX1700_NATIVE_TX_FREQ_SET)){ rig_debug(RIG_DEBUG_TRACE, "%s: Attempt to use non freqency sequence\n", __func__); return -RIG_EINVAL; } memcpy(&cmd, &ncmd[ci].nseq, YAESU_CMD_LENGTH); to_bcd(cmd, freq / 10, VX1700_BCD_DIAL); return vx1700_do_transaction(rig, cmd, NULL, 0); } static inline int vx1700_read_mem_channel_number(RIG *rig, unsigned char *channel){ int ret; unsigned char reply[VX1700_MEM_CHNL_LENGTH]; ret = vx1700_do_transaction(rig, ncmd[VX1700_NATIVE_UPDATE_MEM_CHNL].nseq, reply, VX1700_MEM_CHNL_LENGTH); if (ret == -RIG_ERJCTED){ /* we are on VFO mode, so memory channel is not available at the moment */ *channel = VX1700_MIN_CHANNEL - 1; return RIG_OK; } if (ret != RIG_OK) return ret; /* WARNING: Documentation bug, actually we got 0--199 for channels 1--200 */ *channel = VX1700_MIN_CHANNEL + reply[0]; return RIG_OK; } static inline int vx1700_read_status_flags(RIG *rig, unsigned char reply[]){ if (rig == NULL) return -RIG_EINVAL; return vx1700_do_transaction(rig, ncmd[VX1700_NATIVE_READ_FLAGS].nseq, reply, VX1700_STATUS_FLAGS_LENGTH); } static inline int vx1700_read_meter(RIG *rig, unsigned char reply[]){ if (rig == NULL) return -RIG_EINVAL; return vx1700_do_transaction(rig, ncmd[VX1700_NATIVE_READ_METER].nseq, reply, VX1700_READ_METER_LENGTH); } static inline int vx1700_read_vfo_data_raw(RIG *rig, unsigned char reply[]){ if (rig == NULL) return -RIG_EINVAL; return vx1700_do_transaction(rig, ncmd[VX1700_NATIVE_UPDATE_VFO_DATA].nseq, reply, VX1700_VFO_DATA_LENGTH); } static inline int vx1700_read_op_data_raw(RIG *rig, unsigned char reply[]){ if (rig == NULL) return -RIG_EINVAL; return vx1700_do_transaction(rig, ncmd[VX1700_NATIVE_UPDATE_OP_DATA].nseq, reply, VX1700_OP_DATA_LENGTH); } #if 0 /* unused; re-enabled as needed. */ static int vx1700_read_vfo_data(RIG *rig, unsigned char *hwmode, freq_t *rx_freq, freq_t *tx_freq){ int ret; unsigned char reply[VX1700_VFO_DATA_LENGTH]; if ((ret = vx1700_read_vfo_data_raw(rig, reply)) != RIG_OK) return ret; if (hwmode != NULL) *hwmode = reply[6]; if (rx_freq != NULL) *rx_freq = vx1700_read_freq_from_buf(reply + 1); if (tx_freq != NULL) *tx_freq = vx1700_read_freq_from_buf(reply + 10); return RIG_OK; } #endif /* unused */ static int vx1700_read_op_data(RIG *rig, unsigned char *hwmode, freq_t *rx_freq, freq_t *tx_freq){ int ret; unsigned char reply[VX1700_OP_DATA_LENGTH]; if ((ret = vx1700_read_op_data_raw(rig, reply)) != RIG_OK) return ret; if (hwmode != NULL) *hwmode = reply[7]; if (rx_freq != NULL) *rx_freq = vx1700_read_freq_from_buf(reply + 2); if (tx_freq != NULL) *tx_freq = vx1700_read_freq_from_buf(reply + 11); return RIG_OK; } static const char* vx1700_get_hwmode_str(unsigned char hwmode){ switch(hwmode){ case VX1700_MODE_AM: return "AM (A3E)"; case VX1700_MODE_LSB: return "LSB (J3E)"; case VX1700_MODE_USB: return "USB (J3E)"; case VX1700_MODE_CW_W: return "CW (A1A-W)"; case VX1700_MODE_CW_N: return "CW (A1A-N)"; case VX1700_MODE_RTTY: return "RTTY[R] (J2B)"; default: return "unknown"; } } static void vx1700_parse_vfo_data(const char *func, const unsigned char buf[VX1700_VFO_DATA_LENGTH]){ rig_debug(RIG_DEBUG_TRACE, "%s: vfo-data: rx.band_data=0x%02d\n", func, buf[0]); rig_debug(RIG_DEBUG_TRACE, "%s: vfo-data: rx.freq=%f\n", func, vx1700_read_freq_from_buf(buf + 1)); rig_debug(RIG_DEBUG_TRACE, "%s: vfo-data: rx.mode=0x%02d, %s\n", func, buf[6], vx1700_get_hwmode_str(buf[6])); rig_debug(RIG_DEBUG_TRACE, "%s: vfo-data: tx.band_data=0x%02d\n", func, buf[9]); rig_debug(RIG_DEBUG_TRACE, "%s: vfo-data: tx.freq=%f\n", func, vx1700_read_freq_from_buf(buf + 10)); rig_debug(RIG_DEBUG_TRACE, "%s: vfo-data: tx.mode=0x%02d, %s\n", func, buf[15], vx1700_get_hwmode_str(buf[15])); } static void vx1700_parse_op_data(const char *func, const unsigned char buf[VX1700_OP_DATA_LENGTH]){ rig_debug(RIG_DEBUG_TRACE, "%s: op-data: Semi Duplex Memory Channel: %s\n", func, (buf[0] & 0x20) ? "yes" : "no"); rig_debug(RIG_DEBUG_TRACE, "%s: op-data: Alpha Numeric Channel: %s\n", func, (buf[0] & 0x40) ? "yes" : "no"); rig_debug(RIG_DEBUG_TRACE, "%s: op-data: Erased Memory Channel: %s\n", func, (buf[0] & 0x80) ? "yes" : "no"); rig_debug(RIG_DEBUG_TRACE, "%s: op-data: rx.band_data=0x%02d\n", func, buf[1]); rig_debug(RIG_DEBUG_TRACE, "%s: op-data: rx.freq=%f\n", func, vx1700_read_freq_from_buf(buf + 2)); rig_debug(RIG_DEBUG_TRACE, "%s: op-data: rx.mode=0x%02d, %s\n", func, buf[7], vx1700_get_hwmode_str(buf[7])); rig_debug(RIG_DEBUG_TRACE, "%s: op-data: tx.band_data=0x%02d\n", func, buf[10]); rig_debug(RIG_DEBUG_TRACE, "%s: op-data: tx.freq=%f\n", func, vx1700_read_freq_from_buf(buf + 11)); rig_debug(RIG_DEBUG_TRACE, "%s: op-data: tx.mode=0x%02d, %s\n", func, buf[16], vx1700_get_hwmode_str(buf[16])); } static void vx1700_parse_status_flags(const char *func, const unsigned char buf[VX1700_STATUS_FLAGS_LENGTH]){ rig_debug(RIG_DEBUG_TRACE, "%s: flags: Lock: %s\n", func, (buf[0] & VX1700_SF_LOCKED) ? "yes" : "no"); rig_debug(RIG_DEBUG_TRACE, "%s: flags: Memory Mode: %s\n", func, (buf[0] & VX1700_SF_MEM) ? "yes" : "no"); rig_debug(RIG_DEBUG_TRACE, "%s: flags: VFO Mode: %s\n", func, (buf[0] & VX1700_SF_VFO) ? "yes" : "no"); rig_debug(RIG_DEBUG_TRACE, "%s: flags: PTT closed by CAT: %s\n", func, (buf[1] & VX1700_SF_PTT_BY_CAT) ? "yes" : "no"); rig_debug(RIG_DEBUG_TRACE, "%s: flags: Scanning paused: %s\n", func, (buf[1] & VX1700_SF_MEM_SCAN_PAUSE) ? "yes" : "no"); rig_debug(RIG_DEBUG_TRACE, "%s: flags: Scanning enabled: %s\n", func, (buf[1] & VX1700_SF_MEM_SCAN) ? "yes" : "no"); rig_debug(RIG_DEBUG_TRACE, "%s: flags: Narrow RTTY filter: %s\n", func, (buf[1] & VX1700_SF_RTTY_FILTER_NARROW) ? "yes" : "no"); rig_debug(RIG_DEBUG_TRACE, "%s: flags: Narrow CW filter: %s\n", func, (buf[1] & VX1700_SF_CW_FILTER_NARROW) ? "yes" : "no"); rig_debug(RIG_DEBUG_TRACE, "%s: flags: USB for RTTY: %s\n", func, (buf[1] & VX1700_SF_RTTY_USB) ? "yes" : "no"); rig_debug(RIG_DEBUG_TRACE, "%s: flags: 10 Watt TX output: %s\n", func, (buf[2] & VX1700_SF_10W_TX) ? "yes" : "no"); rig_debug(RIG_DEBUG_TRACE, "%s: flags: Antenna Tuner: %s\n", func, (buf[2] & VX1700_SF_TUNER_ON) ? "on" : "off"); rig_debug(RIG_DEBUG_TRACE, "%s: flags: Transmission: %s\n", func, (buf[2] & VX1700_SF_TRANSMISSION_ON) ? "yes" : "no"); rig_debug(RIG_DEBUG_TRACE, "%s: flags: end bytes (0x06, 0x04): 0x%02x, 0x%02x\n", func, buf[3], buf[4]); } static void vx1700_parse_meter(const char *func, const unsigned char buf[VX1700_READ_METER_LENGTH]){ rig_debug(RIG_DEBUG_TRACE, "%s: meter: data: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n", __func__, buf[0], buf[1], buf[2], buf[3]); rig_debug(RIG_DEBUG_TRACE, "%s: meter: end byte (0xF7): 0x%02x\n", __func__, buf[4]); } static void dump_radio_state(RIG *rig){ unsigned char channel = 0; unsigned char reply[VX1700_OP_DATA_LENGTH]; int ret; if (rig == NULL) return; if ((ret = vx1700_read_mem_channel_number(rig, &channel)) != RIG_OK) return; if (vx1700_channel_is_ok(channel)) rig_debug(RIG_DEBUG_TRACE, "%s: Current Memory Channel %d\n", __func__, (int)channel); else rig_debug(RIG_DEBUG_TRACE, "%s: Memory Channel number is not available at the moment\n", __func__); if ((ret = vx1700_read_op_data_raw(rig, reply)) != RIG_OK) return; vx1700_parse_op_data(__func__, reply); if ((ret = vx1700_read_vfo_data_raw(rig, reply)) != RIG_OK) return; vx1700_parse_vfo_data(__func__, reply); if ((ret = vx1700_read_status_flags(rig, reply)) != RIG_OK) return; vx1700_parse_status_flags(__func__, reply); if ((ret = vx1700_read_meter(rig, reply)) != RIG_OK) return; vx1700_parse_meter(__func__, reply); } static int vx1700_init(RIG *rig){ struct vx1700_priv_data *priv; rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); priv = malloc(sizeof(struct vx1700_priv_data)); if (priv == NULL) return -RIG_ENOMEM; memset(priv, 0, sizeof(struct vx1700_priv_data)); priv->ch = 1; rig->state.priv = (rig_ptr_t)priv; return RIG_OK; } static int vx1700_open(RIG *rig){ struct vx1700_priv_data *priv = (struct vx1700_priv_data *)rig->state.priv; struct rig_state *state = &rig->state; int ret; rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); if ((ret = vx1700_get_vfo(rig, &state->current_vfo)) != RIG_OK) return ret; if ((ret = vx1700_get_mode(rig, RIG_VFO_CURR, &state->current_mode, &state->current_width)) != RIG_OK) return ret; if ((ret = vx1700_read_op_data(rig, NULL, &state->current_freq, NULL)) != RIG_OK) return ret; if ((ret = vx1700_read_mem_channel_number(rig, &priv->ch)) != RIG_OK) return ret; return RIG_OK; } static int vx1700_cleanup(RIG *rig){ rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); if (rig->state.priv != NULL) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } static const char * vx1700_get_info(RIG *rig){ rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); dump_radio_state(rig); return "NO_INFO"; } static int vx1700_set_vfo(RIG *rig, vfo_t vfo){ struct vx1700_priv_data *priv = (struct vx1700_priv_data *)rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s, vfo=%d\n", __func__, vfo); switch(vfo){ case RIG_VFO_CURR: return RIG_OK; case RIG_VFO_VFO: case RIG_VFO_A: return vx1700_do_static_cmd(rig, VX1700_NATIVE_VFO_A); case RIG_VFO_MEM: return vx1700_do_dynamic_cmd(rig, VX1700_NATIVE_RECALL_MEM, priv->ch, 0, 0, 0); default: return -RIG_EINVAL; } } static int vx1700_get_vfo(RIG *rig, vfo_t *vfo){ int ret; unsigned char reply[VX1700_STATUS_FLAGS_LENGTH]; rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); if ((ret = vx1700_read_status_flags(rig, reply)) != RIG_OK) return ret; *vfo = (reply[0] & VX1700_SF_MEM) ? RIG_VFO_MEM : RIG_VFO_A; return RIG_OK; } static int vx1700_set_freq(RIG *rig, vfo_t vfo, freq_t freq){ (void) vfo; rig_debug(RIG_DEBUG_TRACE, "%s: freq=%f\n", __func__, freq); return vx1700_do_freq_cmd(rig, VX1700_NATIVE_FREQ_SET, freq); } static int vx1700_get_freq(RIG *rig, vfo_t vfo, freq_t *freq){ (void) vfo; return vx1700_read_op_data(rig, NULL, freq, NULL); } static int vx1700_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq){ (void) vfo; rig_debug(RIG_DEBUG_TRACE, "%s: freq=%f\n", __func__, tx_freq); return vx1700_do_freq_cmd(rig, VX1700_NATIVE_TX_FREQ_SET, tx_freq); } static int vx1700_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq){ (void) vfo; rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); return vx1700_read_op_data(rig, NULL, NULL, tx_freq); } static int vx1700_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width){ (void) rig; (void) vfo; rig_debug(RIG_DEBUG_TRACE, "%s: mode=0x%04x, width=%d\n", __func__, (int) mode, (int) width); if (width == RIG_PASSBAND_NORMAL) width = rig_passband_normal(rig, mode); switch(mode){ case RIG_MODE_AM: return vx1700_do_static_cmd(rig, VX1700_NATIVE_MODE_SET_AM); case RIG_MODE_LSB: return vx1700_do_static_cmd(rig, VX1700_NATIVE_MODE_SET_LSB); case RIG_MODE_USB: return vx1700_do_static_cmd(rig, VX1700_NATIVE_MODE_SET_USB); case RIG_MODE_CW: if (width > (VX1700_FILTER_WIDTH_NARROW + VX1700_FILTER_WIDTH_WIDE) / 2) return vx1700_do_static_cmd(rig, VX1700_NATIVE_MODE_SET_CW_W); else return vx1700_do_static_cmd(rig, VX1700_NATIVE_MODE_SET_CW_N); case RIG_MODE_RTTY: if (width > (VX1700_FILTER_WIDTH_NARROW + VX1700_FILTER_WIDTH_WIDE) / 2) return vx1700_do_static_cmd(rig, VX1700_NATIVE_MODE_SET_RTTY_LSB_W); else return vx1700_do_static_cmd(rig, VX1700_NATIVE_MODE_SET_RTTY_LSB_N); case RIG_MODE_RTTYR: if (width > (VX1700_FILTER_WIDTH_NARROW + VX1700_FILTER_WIDTH_WIDE) / 2) return vx1700_do_static_cmd(rig, VX1700_NATIVE_MODE_SET_RTTY_USB_W); else return vx1700_do_static_cmd(rig, VX1700_NATIVE_MODE_SET_RTTY_USB_N); default: return -RIG_EINVAL; } } static int vx1700_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width){ int ret; unsigned char hwmode; unsigned char reply[VX1700_STATUS_FLAGS_LENGTH]; (void) rig; (void) vfo; rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); if ((ret = vx1700_read_op_data(rig, &hwmode, NULL, NULL)) != RIG_OK) return ret; switch(hwmode){ case VX1700_MODE_AM: *mode = RIG_MODE_AM; *width = VX1700_FILTER_WIDTH_AM; return RIG_OK; case VX1700_MODE_LSB: *mode = RIG_MODE_LSB; *width = VX1700_FILTER_WIDTH_SSB; return RIG_OK; case VX1700_MODE_USB: *mode = RIG_MODE_USB; *width = VX1700_FILTER_WIDTH_SSB; return RIG_OK; case VX1700_MODE_CW_W: *mode = RIG_MODE_CW; *width = VX1700_FILTER_WIDTH_WIDE; return RIG_OK; case VX1700_MODE_CW_N: *mode = RIG_MODE_CW; *width = VX1700_FILTER_WIDTH_NARROW; return RIG_OK; case VX1700_MODE_RTTY: if ((ret = vx1700_read_status_flags(rig, reply)) != RIG_OK) return ret; *mode = (reply[1] & VX1700_SF_RTTY_USB) ? RIG_MODE_RTTYR : RIG_MODE_RTTY; *width = (reply[1] & VX1700_SF_RTTY_FILTER_NARROW) ? VX1700_FILTER_WIDTH_NARROW : VX1700_FILTER_WIDTH_WIDE; return RIG_OK; default: return -RIG_EPROTO; } } static int vx1700_set_ptt_gps_jack(ptt_t ptt){ (void) ptt; /* * FIXME * * We are using GPIO to manage PTT pin in GPS/Data jack. * This highly binded to our specific device, so it makes * no sense to put our code here. * On regular PC this should be managed in another way, * probably via DTR/RTS. */ return -RIG_EINVAL; } static int vx1700_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt){ rmode_t mode; pbwidth_t width; int ret; unsigned char reply[VX1700_STATUS_FLAGS_LENGTH]; rig_debug(RIG_DEBUG_TRACE, "%s, ptt=%d\n", __func__, ptt); /* * We have 3 PTT source on Vertex Standard VX-1700: * 1) ptt on radio garniture (not checked, FIXME) * 2) PTT commands inside CAT operation protocol * - select radio garniture as audio input/output source * - does not work in RTTY/RTTYR modes * 3) PTT pin in GPS/Data jack * - select GPS/Data jack as input/output source * - does not work in CW/AM modes */ if ((ret = vx1700_get_mode(rig, vfo, &mode, &width)) != RIG_OK) return ret; switch(mode){ case RIG_MODE_AM: case RIG_MODE_CW: switch(ptt){ case RIG_PTT_ON: case RIG_PTT_ON_MIC: return vx1700_do_static_cmd(rig, VX1700_NATIVE_PTT_ON); case RIG_PTT_OFF: return vx1700_do_static_cmd(rig, VX1700_NATIVE_PTT_OFF); default: return -RIG_EINVAL; } case RIG_MODE_LSB: case RIG_MODE_USB: switch(ptt){ case RIG_PTT_ON: case RIG_PTT_ON_MIC: return vx1700_do_static_cmd(rig, VX1700_NATIVE_PTT_ON); case RIG_PTT_ON_DATA: return vx1700_set_ptt_gps_jack(RIG_PTT_ON); case RIG_PTT_OFF: if ((ret = vx1700_read_status_flags(rig, reply)) != RIG_OK) return ret; if (reply[1] & VX1700_SF_PTT_BY_CAT){ /* PTT was turned on by CAT command, turn it off accordingly */ return vx1700_do_static_cmd(rig, VX1700_NATIVE_PTT_OFF); } /* PTT was turned on via special pin on GPS/DATA jack */ return vx1700_set_ptt_gps_jack(RIG_PTT_OFF); default: return -RIG_EINVAL; } case RIG_MODE_RTTY: case RIG_MODE_RTTYR: switch(ptt){ case RIG_PTT_ON: case RIG_PTT_ON_DATA: return vx1700_set_ptt_gps_jack(RIG_PTT_ON); case RIG_PTT_OFF: return vx1700_set_ptt_gps_jack(RIG_PTT_OFF); default: return -RIG_EINVAL; } default: return -RIG_EINVAL; } } static int vx1700_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt){ int ret; unsigned char reply[VX1700_STATUS_FLAGS_LENGTH]; rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__); if ((ret = vx1700_read_status_flags(rig, reply)) != RIG_OK) return ret; *ptt = (reply[2] & VX1700_SF_TRANSMISSION_ON) ? RIG_PTT_ON : RIG_PTT_OFF; return RIG_OK; } static int vx1700_set_func(RIG *rig, vfo_t vfo, setting_t func, int status){ (void) rig; (void) vfo; rig_debug(RIG_DEBUG_TRACE, "%s: func=0x%04x, status=%d\n", __func__, func, status); return -RIG_EINVAL; } static int vx1700_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status){ int ret; unsigned char reply[VX1700_STATUS_FLAGS_LENGTH]; (void) rig; (void) vfo; rig_debug(RIG_DEBUG_TRACE, "%s: func=0x%04x\n", __func__, func); switch(func){ case RIG_FUNC_LOCK: if ((ret = vx1700_read_status_flags(rig, reply)) != RIG_OK) return ret; *status = (reply[0] & VX1700_SF_LOCKED) ? 1 : 0; return RIG_OK; case RIG_FUNC_TUNER: if ((ret = vx1700_read_status_flags(rig, reply)) != RIG_OK) return ret; *status = (reply[2] & VX1700_SF_TUNER_ON) ? 1 : 0; return RIG_OK; default: return -RIG_EINVAL; } } static int vx1700_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val){ (void) rig; (void) vfo; rig_debug(RIG_DEBUG_TRACE, "%s: level=0x%04x, val=???\n", __func__, level); switch(level){ case RIG_LEVEL_RFPOWER: if ((val.f < 0.0) || (val.f > 1.0)) return -RIG_EINVAL; if (val.f < (1.0 / 3.0)) return vx1700_do_static_cmd(rig, VX1700_NATIVE_TX_POWER_LOW); if (val.f < (2.0 / 3.0)) return vx1700_do_static_cmd(rig, VX1700_NATIVE_TX_POWER_MID); return vx1700_do_static_cmd(rig, VX1700_NATIVE_TX_POWER_HI); default: return -RIG_EINVAL; } } static int vx1700_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val){ (void) rig; (void) vfo; rig_debug(RIG_DEBUG_TRACE, "%s: level=0x%04x\n", __func__, level); return -RIG_EINVAL; } static int vx1700_set_mem(RIG *rig, vfo_t vfo, int ch){ struct vx1700_priv_data *priv = (struct vx1700_priv_data *)rig->state.priv; struct rig_state *state = &rig->state; int ret; if ( ! vx1700_channel_is_ok(ch)) return -RIG_EINVAL; if (vfo == RIG_VFO_CURR) vfo = state->current_vfo; if (vfo == RIG_VFO_MEM){ ret = vx1700_do_dynamic_cmd(rig, VX1700_NATIVE_RECALL_MEM, ch, 0, 0, 0); if (ret == RIG_OK) priv->ch = ch; return ret; } priv->ch = ch; return RIG_OK; } static int vx1700_get_mem(RIG *rig, vfo_t vfo, int *ch){ struct vx1700_priv_data *priv = (struct vx1700_priv_data *)rig->state.priv; struct rig_state *state = &rig->state; unsigned char channel = 0; int ret; if (vfo == RIG_VFO_CURR) vfo = state->current_vfo; if (vfo == RIG_VFO_MEM){ ret = vx1700_read_mem_channel_number(rig, &channel); if (ret != RIG_OK) return ret; if (vx1700_channel_is_ok(channel)){ *ch = priv->ch = channel; return RIG_OK; } return -RIG_ERJCTED; } if ( ! vx1700_channel_is_ok(priv->ch)) return -RIG_ERJCTED; *ch = priv->ch; return RIG_OK; } static int vx1700_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op){ struct vx1700_priv_data *priv = (struct vx1700_priv_data *)rig->state.priv; (void) rig; (void) vfo; rig_debug(RIG_DEBUG_TRACE, "%s: op=0x%04x\n", __func__, (int) op); switch(op){ case RIG_OP_TO_VFO: return vx1700_do_dynamic_cmd(rig, VX1700_NATIVE_RECALL_MEM, priv->ch, 0, 0, 0); case RIG_OP_FROM_VFO: return vx1700_do_dynamic_cmd(rig, VX1700_NATIVE_VFO_TO_MEM, priv->ch, 0, 0, 0); case RIG_OP_UP: return vx1700_do_static_cmd(rig, VX1700_NATIVE_OP_FREQ_STEP_UP); case RIG_OP_DOWN: return vx1700_do_static_cmd(rig, VX1700_NATIVE_OP_FREQ_STEP_DOWN); default: return -RIG_EINVAL; } } hamlib-1.2.15.3/yaesu/README.ft9200000644000175000017500000001362512044564477013013 00000000000000Quirks, known bugs, and other notes. ==================================== In this document I'll try to describe the behavior of the Yaesu FT-920 transceiver with Hamlib. Some of these are limitations of the radio while others are programming trade-offs with Hamlib. This document is organized by Hamlib function calls and documents observed behavior with each call. rig_set_mode * No matter the status of the main display, MEM or VFO, display will be set to VFO mode if RIG_VFO_A or RIG_VFO_VFO is passed. * If radio is in MEM or MEM TUNE state, main display mode can be changed when RIG_VFO_MEM or RIG_VFO_MAIN is passed. * When RIG_VFO_CURR is passed, the display will be set per the VFO stored by the last rig_get_vfo call. * Modes DATA USB and DATA FM cannot be set at this time (Hamlib limitation). See below. * My FT-920 does not support USB/LSB narrow so attempting to set a narrow passband with these modes will return an Invalib Parameter error. rig_get_mode * Modes DATA USB and DATA FM cannot be returned as rig.h only has RIG_MODE_RTTY (Hamlib limitation). * DATA LSB is mapped to RIG_MODE_RTTY. * I would like to hear from anyone who gets a narrow passband value in USB/LSB mode returned. rig_set_freq * When passed RIG_VFO_A or RIG_VFO_VFO the main display is forced to VFO mode and then the frequency is set. * When passed RIG_VFO_B or RIG_VFO_SUB, the sub display frequency is set. * When passed RIG_VFO_MEM, or RIG_VFO_MAIN, the main display frequency is set regardless of whether the main display is in memory (thus activating MEM Tune) or VFO mode. * When RIG_VFO_CURR is passed, the display will be set per the VFO stored by the last rig_get_vfo call. * RIG_TARGETABLE_ALL is properly handled (I think). rig_get_freq * When passed RIG_VFO_A or RIG_VFO_VFO, the radio returns the frequency in the main VFO, even if the main display is in MEM or MEM Tune. * When passed RIG_VFO_B or RIG_VFO_SUB, the sub-display frequency is returned. * When passed RIG_VFO_MEM or RIG_VFO_MAIN, the current main display frequency is returned regardless of main display mode. * When passed RIG_VFO_CURR, the display will be read per the VFO stored by the last rig_get_vfo call. rig_set_vfo * When called with RIG_VFO_A or RIG_VFO_VFO, the radio appears to do nothing, however, rig_state->current_vfo will be updated. * When called with RIG_VFO_B, the radio will swap the main and sub displays, the same as if the front panel A<>B button is pressed. * No provision exists to make VFO-B (sub display) the active RX through CAT. rig_get_split * Both split capabilities are tested, i.e. RX A/TX B and RX B/TX A, but Hamlib only supports an indication that the radio is split. * The VFO value passed is not used by the ft920 backend lib. FIXME: Is this a problem? rig_set_split * When called with RIG_SPLIT_OFF the radio will make TX A active if TX B was active, otherwise no change. * When called with RIG_SPLIT_ON the radio will make TX B active if TX A was active, otherwise no change. * The FT-920 has no capability to change the active RX to RX B (sub display) through CAT. Thus if VFO-B is active RX/TX the setting RIG_SPLIT_ON will make no visible change on the radio. * The VFO value passed is not used by the ft920 backend lib. FIXME: Is this a problem? rig_set_split_freq * Backend simply wraps rig_set_freq--calling app needs to specify target VFO to set frequency. Should backend determine split and set "proper" VFO? rig_get_split_freq * Backend simply wraps rig_get_freq--calling app needs to specify target VFO to set frequency. Should backend determine split and set "proper" VFO? rig_set_split_mode * Backend simply wraps rig_set_mode--calling app needs to specify target VFO to set frequency. Should backend determine split and set "proper" VFO? rig_get_split_mode * Backend simply wraps rig_get_mode--calling app needs to specify target VFO to set frequency. Should backend determine split and set "proper" VFO? rig_set_rit * Hamlib specificies that passing 0 as the RIT frequency disables RIT. Thus there is no way to meet the spec and mimic the front panel RIT off function whilst keeping the RIT offset on the display. The Hamlib spec causes behavior analogous to shutting RIT off and then pressing the Clear button. * There is no direct way to set RIT offset of VFOB/SUB. However, rig_set_vfo can be used to swap VFO B and main, then set RIT, then call rig_set_vfo to swap VFO B and main. FIXME: Should backend do this automatically? rig_get_rit * Backend returns clarifier offset regardless of whether RIT is on. * vfo is honored and stored RIT is returned. rig_set_xit * Hamlib specificies that passing 0 as the XIT frequency disables XIT. Thus there is no way to meet the spec and mimic the front panel XIT off function whilst keeping the XIT offset on the display. The Hamlib spec causes behavior analogous to shutting XIT off and then pressing the Clear button. * There is no direct way to set XIT offset of VFOB/SUB. However, rig_set_vfo can be used to swap VFO B and main, then set XIT, then call rig_set_vfo to swap VFO B and main. FIXME: Should backend do this automatically? rig_get_xit * Backend returns clarifier offset regardless of whether XIT is on. * vfo is honored and stored XIT is returned. General notes. As with most all Yaesu radios the radio must be polled by the application for status updates, i.e. no transceive mode in CAT. hamlib-1.2.15.3/yaesu/ft857.c0000644000175000017500000007035012044564477012307 00000000000000/* -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*- * * hamlib - (C) Frank Singleton 2000,2001 (vk3fcs@ix.netcom.com) * (C) Stephane Fillod 2000-2009 * * ft857.h - (C) Tomi Manninen 2003 (oh2bns@sral.fi) * * ...derived but heavily modified from: * * ft817.h - (C) Chris Karpinsky 2001 (aa1vl@arrl.net) * * This shared library provides an API for communicating * via serial interface to an FT-857 using the "CAT" interface. * The starting point for this code was Frank's ft847 implementation. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * Unimplemented features supported by the FT-857: * * - RIT ON/OFF without touching the RIT offset. This would * need frontend support (eg. a new RIG_FUNC_xxx) * * - DCS encoder/squelch ON/OFF, similar to RIG_FUNC_TONE/TSQL. * Needs frontend support. * * - RX status command returns info that is not used: * * - discriminator centered (yes/no flag) * - received ctcss/dcs matched (yes/no flag) * * - TX status command returns info that is not used: * * - high swr flag * * The manual also indicates that CTCSS and DCS codes can be set * separately for tx and rx, but this doesn't seem to work. It * doesn't work from front panel either. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #ifdef HAVE_SYS_TIME_H #include #endif #include "hamlib/rig.h" #include "serial.h" #include "yaesu.h" #include "ft857.h" #include "misc.h" #include "tones.h" #include "bandplan.h" /* Native ft857 cmd set prototypes. These are READ ONLY as each */ /* rig instance will copy from these and modify if required . */ /* Complete sequences (1) can be read and used directly as a cmd sequence . */ /* Incomplete sequences (0) must be completed with extra parameters */ /* eg: mem number, or freq etc.. */ static const yaesu_cmd_set_t ncmd[] = { { 1, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* lock on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x80 } }, /* lock off */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* ptt on */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x88 } }, /* ptt off */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* set freq */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main LSB */ { 1, { 0x01, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main USB */ { 1, { 0x02, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main CW */ { 1, { 0x03, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main CWR */ { 1, { 0x04, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main AM */ { 1, { 0x08, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main FM */ { 1, { 0x88, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main FM-N */ { 1, { 0x0a, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main DIG */ { 1, { 0x0c, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main PKT */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* clar on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x85 } }, /* clar off */ { 0, { 0x00, 0x00, 0x00, 0x00, 0xf5 } }, /* set clar freq */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x81 } }, /* toggle vfo a/b */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* split on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x82 } }, /* split off */ { 1, { 0x09, 0x00, 0x00, 0x00, 0x09 } }, /* set RPT shift MINUS */ { 1, { 0x49, 0x00, 0x00, 0x00, 0x09 } }, /* set RPT shift PLUS */ { 1, { 0x89, 0x00, 0x00, 0x00, 0x09 } }, /* set RPT shift SIMPLEX */ { 0, { 0x00, 0x00, 0x00, 0x00, 0xf9 } }, /* set RPT offset freq */ { 1, { 0x0a, 0x00, 0x00, 0x00, 0x0a } }, /* set DCS on */ { 1, { 0x0b, 0x00, 0x00, 0x00, 0x0a } }, /* set DCS decoder on */ { 1, { 0x0c, 0x00, 0x00, 0x00, 0x0a } }, /* set DCS encoder on */ { 1, { 0x2a, 0x00, 0x00, 0x00, 0x0a } }, /* set CTCSS on */ { 1, { 0x3a, 0x00, 0x00, 0x00, 0x0a } }, /* set CTCSS decoder on */ { 1, { 0x4a, 0x00, 0x00, 0x00, 0x0a } }, /* set CTCSS encoder on */ { 1, { 0x8a, 0x00, 0x00, 0x00, 0x0a } }, /* set CTCSS/DCS off */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0b } }, /* set CTCSS tone */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* set DCS code */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xe7 } }, /* get RX status */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xf7 } }, /* get TX status */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* get FREQ and MODE status */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* pwr wakeup sequence */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0f } }, /* pwr on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x8f } }, /* pwr off */ { 0, { 0x00, 0x00, 0x00, 0x00, 0xbb } }, /* eeprom read */ }; enum ft857_digi { FT857_DIGI_RTTY_L = 0, FT857_DIGI_RTTY_U, FT857_DIGI_PSK_L, FT857_DIGI_PSK_U, FT857_DIGI_USER_L, FT857_DIGI_USER_U, }; #define FT857_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_USB|\ RIG_MODE_LSB|RIG_MODE_RTTY|RIG_MODE_FM) #define FT857_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_USB|RIG_MODE_LSB) #define FT857_AM_FM_RX_MODES (RIG_MODE_AM|RIG_MODE_FM) #define FT857_OTHER_TX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_USB|\ RIG_MODE_LSB|RIG_MODE_RTTY|RIG_MODE_FM) #define FT857_AM_TX_MODES (RIG_MODE_AM) #define FT857_VFO_ALL (RIG_VFO_A|RIG_VFO_B) #define FT857_ANTS 0 static int ft857_send_icmd(RIG *rig, int index, unsigned char *data); const struct rig_caps ft857_caps = { .rig_model = RIG_MODEL_FT857, .model_name = "FT-857", .mfg_name = "Yaesu", .version = "0.4", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 38400, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT857_WRITE_DELAY, .post_write_delay = FT857_POST_WRITE_DELAY, .timeout = FT857_TIMEOUT, .retry = 0, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_LOCK | RIG_FUNC_TONE | RIG_FUNC_TSQL, .has_get_level = RIG_LEVEL_STRENGTH | RIG_LEVEL_RFPOWER, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, /* granularity */ .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = common_dcs_list, /* only 104 supported */ .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9990), .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, }, .vfo_ops = RIG_OP_TOGGLE, .rx_range_list1 = { {kHz(100),MHz(56), FT857_ALL_RX_MODES,-1,-1}, {MHz(76), MHz(108),RIG_MODE_WFM, -1,-1}, {MHz(118),MHz(164),FT857_ALL_RX_MODES,-1,-1}, {MHz(420),MHz(470),FT857_ALL_RX_MODES,-1,-1}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1,FT857_OTHER_TX_MODES, W(10),W(100),FT857_VFO_ALL,FT857_ANTS), /* AM class */ FRQ_RNG_HF(1,FT857_AM_TX_MODES, W(2.5),W(25),FT857_VFO_ALL,FT857_ANTS), FRQ_RNG_2m(1,FT857_OTHER_TX_MODES, W(5),W(50),FT857_VFO_ALL,FT857_ANTS), /* AM class */ FRQ_RNG_2m(1,FT857_AM_TX_MODES, W(2.5),W(25),FT857_VFO_ALL,FT857_ANTS), FRQ_RNG_70cm(1,FT857_OTHER_TX_MODES, W(2),W(20),FT857_VFO_ALL,FT857_ANTS), /* AM class */ FRQ_RNG_70cm(1,FT857_AM_TX_MODES, W(0.5),W(5),FT857_VFO_ALL,FT857_ANTS), RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(56), FT857_ALL_RX_MODES,-1,-1}, {MHz(76), MHz(108),RIG_MODE_WFM, -1,-1}, {MHz(118),MHz(164),FT857_ALL_RX_MODES,-1,-1}, {MHz(420),MHz(470),FT857_ALL_RX_MODES,-1,-1}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2,FT857_OTHER_TX_MODES, W(10),W(100),FT857_VFO_ALL,FT857_ANTS), /* AM class */ FRQ_RNG_HF(2,FT857_AM_TX_MODES, W(2.5),W(25),FT857_VFO_ALL,FT857_ANTS), FRQ_RNG_2m(2,FT857_OTHER_TX_MODES, W(5),W(50),FT857_VFO_ALL,FT857_ANTS), /* AM class */ FRQ_RNG_2m(2,FT857_AM_TX_MODES, W(2.5),W(25),FT857_VFO_ALL,FT857_ANTS), FRQ_RNG_70cm(2,FT857_OTHER_TX_MODES, W(2),W(20),FT857_VFO_ALL,FT857_ANTS), /* AM class */ FRQ_RNG_70cm(2,FT857_AM_TX_MODES, W(0.5),W(5),FT857_VFO_ALL,FT857_ANTS), RIG_FRNG_END, }, .tuning_steps = { {FT857_SSB_CW_RX_MODES,10}, {FT857_SSB_CW_RX_MODES,100}, {FT857_AM_FM_RX_MODES,10}, {FT857_AM_FM_RX_MODES,100}, RIG_TS_END, }, /* filter selection is not supported by CAT functions * per testing by Rich Newsom, WA4SXZ */ .filters = { // {RIG_MODE_SSB, kHz(2.2)}, // {RIG_MODE_CW, kHz(2.2)}, // {RIG_MODE_CWR, kHz(2.2)}, // {RIG_MODE_RTTY, kHz(2.2)}, // {RIG_MODE_AM, kHz(6)}, // {RIG_MODE_FM, kHz(15)}, // {RIG_MODE_PKTFM, kHz(15)}, // {RIG_MODE_FM, kHz(9)}, // {RIG_MODE_PKTFM, kHz(9)}, // {RIG_MODE_WFM, kHz(230)}, /* ?? */ RIG_FLT_END, }, .priv = NULL, .rig_init = ft857_init, .rig_cleanup = ft857_cleanup, .rig_open = ft857_open, .rig_close = ft857_close, .set_freq = ft857_set_freq, .get_freq = ft857_get_freq, .set_mode = ft857_set_mode, .get_mode = ft857_get_mode, .set_vfo = NULL, .get_vfo = NULL, .set_ptt = ft857_set_ptt, .get_ptt = ft857_get_ptt, .get_dcd = ft857_get_dcd, .set_rptr_shift = ft857_set_rptr_shift, .get_rptr_shift = NULL, .set_rptr_offs = ft857_set_rptr_offs, .get_rptr_offs = NULL, .set_split_freq = NULL, .get_split_freq = NULL, .set_split_mode = NULL, .get_split_mode = NULL, .set_split_vfo = ft857_set_split_vfo, .get_split_vfo = ft857_get_split_vfo, .set_rit = ft857_set_rit, .get_rit = NULL, .set_xit = NULL, .get_xit = NULL, .set_ts = NULL, .get_ts = NULL, .set_dcs_code = ft857_set_dcs_code, .get_dcs_code = NULL, .set_ctcss_tone = ft857_set_ctcss_tone, .get_ctcss_tone = NULL, .set_dcs_sql = ft857_set_dcs_sql, .get_dcs_sql = NULL, .set_ctcss_sql = ft857_set_ctcss_sql, .get_ctcss_sql = NULL, .set_powerstat = NULL, .get_powerstat = NULL, .reset = NULL, .set_ant = NULL, .get_ant = NULL, .set_level = NULL, .get_level = ft857_get_level, .set_func = ft857_set_func, .get_func = NULL, .set_parm = NULL, .get_parm = NULL, .vfo_op = ft857_vfo_op, }; /* ---------------------------------------------------------------------- */ int ft857_init(RIG *rig) { struct ft857_priv_data *p; rig_debug(RIG_DEBUG_VERBOSE,"ft857:ft857_init called \n"); if ((p = calloc(1, sizeof(struct ft857_priv_data))) == NULL) return -RIG_ENOMEM; /* Copy complete native cmd set to private cmd storage area */ memcpy(p->pcs, ncmd, sizeof(ncmd)); rig->state.priv = (void*) p; return RIG_OK; } int ft857_cleanup(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"ft857:ft857_cleanup called \n"); if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } int ft857_open(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"ft857:ft857_open called \n"); return RIG_OK; } int ft857_close(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"ft857:ft857_close called \n"); return RIG_OK; } /* ---------------------------------------------------------------------- */ static inline long timediff(struct timeval *tv1, struct timeval *tv2) { struct timeval tv; tv.tv_usec = tv1->tv_usec - tv2->tv_usec; tv.tv_sec = tv1->tv_sec - tv2->tv_sec; return ((tv.tv_sec * 1000L) + (tv.tv_usec / 1000L)); } static int check_cache_timeout(struct timeval *tv) { struct timeval curr; long t; if (tv->tv_sec == 0 && tv->tv_usec == 0) { rig_debug(RIG_DEBUG_VERBOSE, "ft857: cache invalid\n"); return 1; } gettimeofday(&curr, NULL); if ((t = timediff(&curr, tv)) < FT857_CACHE_TIMEOUT) { rig_debug(RIG_DEBUG_VERBOSE, "ft857: using cache (%ld ms)\n", t); return 0; } else { rig_debug(RIG_DEBUG_VERBOSE, "ft857: cache timed out (%ld ms)\n", t); return 1; } } static int ft857_read_eeprom(RIG *rig, unsigned short addr, unsigned char *out) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; unsigned char data[YAESU_CMD_LENGTH]; int n; memcpy(data, (char *)p->pcs[FT857_NATIVE_CAT_EEPROM_READ].nseq, YAESU_CMD_LENGTH); data[0] = addr >> 8; data[1] = addr & 0xfe; write_block(&rig->state.rigport, (char *) data, YAESU_CMD_LENGTH); if ((n = read_block(&rig->state.rigport, (char *) data, 2)) < 0) return n; if (n != 2) return -RIG_EIO; *out = data[addr % 2]; return RIG_OK; } static int ft857_get_status(RIG *rig, int status) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; struct timeval *tv; unsigned char *data; int len; int n; switch (status) { case FT857_NATIVE_CAT_GET_FREQ_MODE_STATUS: data = p->fm_status; len = YAESU_CMD_LENGTH; tv = &p->fm_status_tv; break; case FT857_NATIVE_CAT_GET_RX_STATUS: data = &p->rx_status; len = 1; tv = &p->rx_status_tv; break; case FT857_NATIVE_CAT_GET_TX_STATUS: data = &p->tx_status; len = 1; tv = &p->tx_status_tv; break; default: rig_debug(RIG_DEBUG_ERR, "ft857_get_status: Internal error!\n"); return -RIG_EINTERNAL; } serial_flush(&rig->state.rigport); write_block(&rig->state.rigport, (char *) p->pcs[status].nseq, YAESU_CMD_LENGTH); if ((n = read_block(&rig->state.rigport, (char *) data, len)) < 0) return n; if (n != len) return -RIG_EIO; if (status == FT857_NATIVE_CAT_GET_FREQ_MODE_STATUS) { if ((n = ft857_read_eeprom(rig, 0x0078, &p->fm_status[5])) < 0) return n; p->fm_status[5] >>= 5; } gettimeofday(tv, NULL); return RIG_OK; } /* ---------------------------------------------------------------------- */ int ft857_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; if (check_cache_timeout(&p->fm_status_tv)) if ((n = ft857_get_status(rig, FT857_NATIVE_CAT_GET_FREQ_MODE_STATUS)) < 0) return n; *freq = from_bcd_be(p->fm_status, 8) * 10; return -RIG_OK; } int ft857_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; if (check_cache_timeout(&p->fm_status_tv)) if ((n = ft857_get_status(rig, FT857_NATIVE_CAT_GET_FREQ_MODE_STATUS)) < 0) return n; switch (p->fm_status[4]) { case 0x00: *mode = RIG_MODE_LSB; break; case 0x01: *mode = RIG_MODE_USB; break; case 0x02: case 0x82: *mode = RIG_MODE_CW; break; case 0x03: case 0x83: *mode = RIG_MODE_CWR; break; case 0x04: *mode = RIG_MODE_AM; break; case 0x06: *mode = RIG_MODE_WFM; break; case 0x08: case 0x88: *mode = RIG_MODE_FM; break; case 0x0a: case 0x8a: *mode = RIG_MODE_RTTY; if (p->fm_status[5] == FT857_DIGI_RTTY_U) { *mode = RIG_MODE_RTTYR; } else if (p->fm_status[5] == FT857_DIGI_PSK_U || p->fm_status[5] == FT857_DIGI_USER_U) { *mode = RIG_MODE_PKTUSB; } else if (p->fm_status[5] == FT857_DIGI_PSK_L || p->fm_status[5] == FT857_DIGI_USER_L) { *mode = RIG_MODE_PKTLSB; } break; case 0x0c: case 0x8c: *mode = RIG_MODE_PKTFM; break; default: *mode = RIG_MODE_NONE; } *width = RIG_PASSBAND_NORMAL; return RIG_OK; } int ft857_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; if (check_cache_timeout(&p->tx_status_tv)) if ((n = ft857_get_status(rig, FT857_NATIVE_CAT_GET_TX_STATUS)) < 0) return n; *split = ((p->tx_status & 0x20) == 0) ? RIG_SPLIT_ON : RIG_SPLIT_OFF; return RIG_OK; } int ft857_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; if (check_cache_timeout(&p->tx_status_tv)) if ((n = ft857_get_status(rig, FT857_NATIVE_CAT_GET_TX_STATUS)) < 0) return n; *ptt = ((p->tx_status & 0x80) == 0); return RIG_OK; } static int ft857_get_pometer_level(RIG *rig, value_t *val) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; int n; if (check_cache_timeout(&p->tx_status_tv)) if ((n = ft857_get_status(rig, FT857_NATIVE_CAT_GET_TX_STATUS)) < 0) return n; /* Valid only if PTT is on */ if ((p->tx_status & 0x80) == 0) val->f = ((p->tx_status & 0x0F) / 15.0); else val->f = 0.0; return RIG_OK; } static int ft857_get_smeter_level(RIG *rig, value_t *val) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; int n; if (check_cache_timeout(&p->rx_status_tv)) if ((n = ft857_get_status(rig, FT857_NATIVE_CAT_GET_RX_STATUS)) < 0) return n; n = (p->rx_status & 0x0F) - 9; val->i = n * ((n > 0) ? 10 : 6); return RIG_OK; } int ft857_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; switch (level) { case RIG_LEVEL_STRENGTH: return ft857_get_smeter_level(rig, val); case RIG_LEVEL_RFPOWER: return ft857_get_pometer_level(rig, val); default: return -RIG_EINVAL; } return RIG_OK; } int ft857_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; if (check_cache_timeout(&p->rx_status_tv)) if ((n = ft857_get_status(rig, FT857_NATIVE_CAT_GET_RX_STATUS)) < 0) return n; /* TODO: consider bit 6 too ??? (CTCSS/DCS code match) */ if (p->rx_status & 0x80) *dcd = RIG_DCD_OFF; else *dcd = RIG_DCD_ON; return RIG_OK; } /* ---------------------------------------------------------------------- */ static int ft857_read_ack(RIG *rig) { #if (FT857_POST_WRITE_DELAY == 0) char dummy; int n; if ((n = read_block(&rig->state.rigport, &dummy, 1)) < 0) { rig_debug(RIG_DEBUG_ERR, "ft857: error reading ack\n"); return n; } rig_debug(RIG_DEBUG_TRACE,"ft857: ack received (%d)\n", dummy); if (dummy != 0) return -RIG_ERJCTED; #endif return RIG_OK; } /* * private helper function to send a private command sequence. * Must only be complete sequences. */ static int ft857_send_cmd(RIG *rig, int index) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; if (p->pcs[index].ncomp == 0) { rig_debug(RIG_DEBUG_VERBOSE, "ft857: Incomplete sequence\n"); return -RIG_EINTERNAL; } write_block(&rig->state.rigport, (char *) p->pcs[index].nseq, YAESU_CMD_LENGTH); return ft857_read_ack(rig); } /* * The same for incomplete commands. */ static int ft857_send_icmd(RIG *rig, int index, unsigned char *data) { struct ft857_priv_data *p = (struct ft857_priv_data *) rig->state.priv; unsigned char cmd[YAESU_CMD_LENGTH]; if (p->pcs[index].ncomp == 1) { rig_debug(RIG_DEBUG_VERBOSE, "ft857: Complete sequence\n"); return -RIG_EINTERNAL; } cmd[YAESU_CMD_LENGTH - 1] = p->pcs[index].nseq[YAESU_CMD_LENGTH - 1]; memcpy(cmd, data, YAESU_CMD_LENGTH - 1); write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); return ft857_read_ack(rig); } /* ---------------------------------------------------------------------- */ int ft857_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned char data[YAESU_CMD_LENGTH - 1]; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE,"ft857: requested freq = %"PRIfreq" Hz\n", freq); /* fill in the frequency */ to_bcd_be(data, (freq + 5) / 10, 8); return ft857_send_icmd(rig, FT857_NATIVE_CAT_SET_FREQ, data); } int ft857_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { int index; /* index of sequence to send */ if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE,"ft857: generic mode = %x \n", mode); switch(mode) { case RIG_MODE_AM: index = FT857_NATIVE_CAT_SET_MODE_AM; break; case RIG_MODE_CW: index = FT857_NATIVE_CAT_SET_MODE_CW; break; case RIG_MODE_USB: index = FT857_NATIVE_CAT_SET_MODE_USB; break; case RIG_MODE_LSB: index = FT857_NATIVE_CAT_SET_MODE_LSB; break; case RIG_MODE_RTTY: index = FT857_NATIVE_CAT_SET_MODE_DIG; break; case RIG_MODE_FM: index = FT857_NATIVE_CAT_SET_MODE_FM; break; case RIG_MODE_WFM: index = FT857_NATIVE_CAT_SET_MODE_FM; break; case RIG_MODE_CWR: index = FT857_NATIVE_CAT_SET_MODE_CWR; break; case RIG_MODE_PKTFM: index = FT857_NATIVE_CAT_SET_MODE_PKT; break; default: return -RIG_EINVAL; } if (width != RIG_PASSBAND_NORMAL) return -RIG_EINVAL; return ft857_send_cmd(rig, index); } int ft857_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { int index, n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft857: ft857_set_split_vfo called\n"); switch(split) { case RIG_SPLIT_ON: index = FT857_NATIVE_CAT_SPLIT_ON; break; case RIG_SPLIT_OFF: index = FT857_NATIVE_CAT_SPLIT_OFF; break; default: return -RIG_EINVAL; } n = ft857_send_cmd(rig, index); if (n < 0 && n != -RIG_ERJCTED) return n; return RIG_OK; } int ft857_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { int index, n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft857: ft857_set_ptt called\n"); switch(ptt) { case RIG_PTT_ON: index = FT857_NATIVE_CAT_PTT_ON; break; case RIG_PTT_OFF: index = FT857_NATIVE_CAT_PTT_OFF; break; default: return -RIG_EINVAL; } n = ft857_send_cmd(rig, index); if (n < 0 && n != -RIG_ERJCTED) return n; return RIG_OK; } int ft857_set_func(RIG *rig, vfo_t vfo, setting_t func, int status) { if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; switch (func) { case RIG_FUNC_LOCK: if (status) return ft857_send_cmd(rig, FT857_NATIVE_CAT_LOCK_ON); else return ft857_send_cmd(rig, FT857_NATIVE_CAT_LOCK_OFF); case RIG_FUNC_TONE: if (status) return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_ENC_ON); else return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF); case RIG_FUNC_TSQL: if (status) return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_ON); else return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF); #if 0 case RIG_FUNC_CODE: /* this doesn't exist */ if (status) return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_DCS_ENC_ON); else return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF); case RIG_FUNC_DSQL: /* this doesn't exist */ if (status) return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_DCS_ON); else return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF); #endif default: return -RIG_EINVAL; } } int ft857_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code) { unsigned char data[YAESU_CMD_LENGTH - 1]; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft857: set DCS code (%d)\n", code); if (code == 0) return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF); /* fill in the DCS code - the rig doesn't support separate codes... */ to_bcd_be(data, code, 4); to_bcd_be(data + 2, code, 4); if ((n = ft857_send_icmd(rig, FT857_NATIVE_CAT_SET_DCS_CODE, data)) < 0) return n; return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_DCS_ENC_ON); } int ft857_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone) { unsigned char data[YAESU_CMD_LENGTH - 1]; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft857: set CTCSS tone (%.1f)\n", tone / 10.0); if (tone == 0) return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF); /* fill in the CTCSS freq - the rig doesn't support separate tones... */ to_bcd_be(data, tone, 4); to_bcd_be(data + 2, tone, 4); if ((n = ft857_send_icmd(rig, FT857_NATIVE_CAT_SET_CTCSS_FREQ, data)) < 0) return n; return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_ENC_ON); } int ft857_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code) { unsigned char data[YAESU_CMD_LENGTH - 1]; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft857: set DCS sql (%d)\n", code); if (code == 0) return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF); /* fill in the DCS code - the rig doesn't support separate codes... */ to_bcd_be(data, code, 4); to_bcd_be(data + 2, code, 4); if ((n = ft857_send_icmd(rig, FT857_NATIVE_CAT_SET_DCS_CODE, data)) < 0) return n; return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_DCS_ON); } int ft857_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone) { unsigned char data[YAESU_CMD_LENGTH - 1]; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft857: set CTCSS sql (%.1f)\n", tone / 10.0); if (tone == 0) return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF); /* fill in the CTCSS freq - the rig doesn't support separate tones... */ to_bcd_be(data, tone, 4); to_bcd_be(data + 2, tone, 4); if ((n = ft857_send_icmd(rig, FT857_NATIVE_CAT_SET_CTCSS_FREQ, data)) < 0) return n; return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_CTCSS_ON); } int ft857_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t shift) { if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft857: set repeter shift = %i\n", shift); switch (shift) { case RIG_RPT_SHIFT_NONE: return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX); case RIG_RPT_SHIFT_MINUS: return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_RPT_SHIFT_MINUS); case RIG_RPT_SHIFT_PLUS: return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_RPT_SHIFT_PLUS); } return -RIG_EINVAL; } int ft857_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs) { unsigned char data[YAESU_CMD_LENGTH - 1]; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft857: set repeter offs = %li\n", offs); /* fill in the offset freq */ to_bcd_be(data, offs / 10, 8); return ft857_send_icmd(rig, FT857_NATIVE_CAT_SET_RPT_OFFSET, data); } int ft857_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { unsigned char data[YAESU_CMD_LENGTH - 1]; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft857: set rit = %li)\n", rit); /* fill in the RIT freq */ data[0] = (rit < 0) ? 255 : 0; data[1] = 0; to_bcd_be(data + 2, labs(rit) / 10, 4); if ((n = ft857_send_icmd(rig, FT857_NATIVE_CAT_SET_CLAR_FREQ, data)) < 0) return n; /* the rig rejects if these are repeated - don't confuse user with retcode */ if (rit == 0) ft857_send_cmd(rig, FT857_NATIVE_CAT_CLAR_OFF); else ft857_send_cmd(rig, FT857_NATIVE_CAT_CLAR_ON); return RIG_OK; } int ft857_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) { switch (op) { case RIG_OP_TOGGLE: return ft857_send_cmd(rig, FT857_NATIVE_CAT_SET_VFOAB); default: return -RIG_EINVAL; } return -RIG_EINVAL; } #if 0 /* * This doesn't seem to work on FT857. It might work with FT817 though. */ int ft857_set_powerstat(RIG *rig, powerstat_t status) { switch (status) { case RIG_POWER_OFF: return ft857_send_cmd(rig, FT857_NATIVE_CAT_PWR_OFF); case RIG_POWER_ON: return ft857_send_cmd(rig, FT857_NATIVE_CAT_PWR_ON); case RIG_POWER_STANDBY: default: return -RIG_EINVAL; } } #endif /* ---------------------------------------------------------------------- */ hamlib-1.2.15.3/yaesu/ft5000.c0000644000175000017500000002006112044564477012342 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft2000.c - (C) Nate Bargmann 2007 (n0nb at arrl.net) * (C) Stephane Fillod 2008-2010 * (C) Terry Embry 2008-2009 * * This shared library provides an API for communicating * via serial interface to an FT-DX5000 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "hamlib/rig.h" #include "bandplan.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "newcat.h" #include "ft5000.h" #include "idx_builtin.h" #include "tones.h" /* * ft5000 rigs capabilities. * Also this struct is READONLY! * */ const struct rig_caps ftdx5000_caps = { .rig_model = RIG_MODEL_FTDX5000, .model_name = "FT-DX5000", .mfg_name = "Yaesu", .version = NEWCAT_VER, .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, /* Default rate per manual */ .serial_rate_max = 38400, .serial_data_bits = 8, .serial_stop_bits = 1, /* Assumed since manual makes no mention */ .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = FTDX5000_WRITE_DELAY, .post_write_delay = FTDX5000_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = FTDX5000_FUNCS, .has_set_func = FTDX5000_FUNCS, .has_get_level = FTDX5000_LEVELS, .has_set_level = RIG_LEVEL_SET(FTDX5000_LEVELS), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, [LVL_CWPITCH] = { .min = { .i = 300 }, .max = { .i = 1050 }, .step = { .i = 50 } }, }, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, 20, RIG_DBLST_END, }, /* TBC */ .attenuator = { 6, 12, 18, RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(1000), .vfo_ops = FTDX5000_VFO_OPS, .targetable_vfo = RIG_TARGETABLE_FREQ|RIG_TARGETABLE_MODE, .transceive = RIG_TRN_OFF, /* May enable later as the 5000 has an Auto Info command */ .bank_qty = 0, .chan_desc_sz = 0, .str_cal = FTDX5000_STR_CAL, .chan_list = { { 1, 99, RIG_MTYPE_MEM, NEWCAT_MEM_CAP }, { 100, 117, RIG_MTYPE_EDGE, NEWCAT_MEM_CAP }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { /* General coverage + ham, ANT_5 is RX only antenna */ {kHz(30), MHz(60), FTDX5000_ALL_RX_MODES, -1, -1, FTDX5000_VFO_ALL, FTDX5000_TX_ANTS|RIG_ANT_5}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1, FTDX5000_OTHER_TX_MODES, W(5), W(200), FTDX5000_VFO_ALL, FTDX5000_TX_ANTS), FRQ_RNG_HF(1, FTDX5000_AM_TX_MODES, W(2), W(75), FTDX5000_VFO_ALL, FTDX5000_TX_ANTS), /* AM class */ FRQ_RNG_6m(1, FTDX5000_OTHER_TX_MODES, W(5), W(200), FTDX5000_VFO_ALL, FTDX5000_TX_ANTS), FRQ_RNG_6m(1, FTDX5000_AM_TX_MODES, W(2), W(75), FTDX5000_VFO_ALL, FTDX5000_TX_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30), MHz(60), FTDX5000_ALL_RX_MODES, -1, -1, FTDX5000_VFO_ALL, FTDX5000_TX_ANTS|RIG_ANT_5}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2, FTDX5000_OTHER_TX_MODES, W(5), W(200), FTDX5000_VFO_ALL, FTDX5000_TX_ANTS), FRQ_RNG_HF(2, FTDX5000_AM_TX_MODES, W(2), W(75), FTDX5000_VFO_ALL, FTDX5000_TX_ANTS), /* AM class */ FRQ_RNG_6m(2, FTDX5000_OTHER_TX_MODES, W(5), W(200), FTDX5000_VFO_ALL, FTDX5000_TX_ANTS), FRQ_RNG_6m(2, FTDX5000_AM_TX_MODES, W(2), W(75), FTDX5000_VFO_ALL, FTDX5000_TX_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {FTDX5000_SSB_CW_RX_MODES, Hz(10)}, /* Normal */ {FTDX5000_SSB_CW_RX_MODES, Hz(100)}, /* Fast */ {FTDX5000_AM_RX_MODES, Hz(100)}, /* Normal */ {FTDX5000_AM_RX_MODES, kHz(1)}, /* Fast */ {FTDX5000_FM_RX_MODES, Hz(100)}, /* Normal */ {FTDX5000_FM_RX_MODES, kHz(1)}, /* Fast */ RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {FTDX5000_CW_RTTY_PKT_RX_MODES, Hz(1800)}, /* Normal CW, RTTY, PKT/USER */ {FTDX5000_CW_RTTY_PKT_RX_MODES, Hz(500)}, /* Narrow CW, RTTY, PKT/USER */ {FTDX5000_CW_RTTY_PKT_RX_MODES, Hz(2400)}, /* Wide CW, RTTY, PKT/USER */ {RIG_MODE_SSB, Hz(2400)}, /* Normal SSB */ {RIG_MODE_SSB, Hz(1800)}, /* Narrow SSB */ {RIG_MODE_SSB, Hz(3000)}, /* Wide SSB */ {RIG_MODE_AM, Hz(9000)}, /* Normal AM */ {RIG_MODE_AM, Hz(6000)}, /* Narrow AM */ {FTDX5000_FM_RX_MODES, Hz(15000)}, /* Normal FM */ {FTDX5000_FM_RX_MODES, Hz(8000)}, /* Narrow FM */ RIG_FLT_END, }, .priv = NULL, .rig_init = newcat_init, .rig_cleanup = newcat_cleanup, .rig_open = newcat_open, /* port opened */ .rig_close = newcat_close, /* port closed */ .set_freq = newcat_set_freq, .get_freq = newcat_get_freq, .set_mode = newcat_set_mode, .get_mode = newcat_get_mode, .set_vfo = newcat_set_vfo, .get_vfo = newcat_get_vfo, .set_ptt = newcat_set_ptt, .get_ptt = newcat_get_ptt, .set_split_vfo = newcat_set_split_vfo, .get_split_vfo = newcat_get_split_vfo, .set_rit = newcat_set_rit, .get_rit = newcat_get_rit, .set_xit = newcat_set_xit, .get_xit = newcat_get_xit, .set_ant = newcat_set_ant, .get_ant = newcat_get_ant, .get_func = newcat_get_func, .set_func = newcat_set_func, .get_level = newcat_get_level, .set_level = newcat_set_level, .get_mem = newcat_get_mem, .set_mem = newcat_set_mem, .vfo_op = newcat_vfo_op, .get_info = newcat_get_info, .power2mW = newcat_power2mW, .mW2power = newcat_mW2power, .set_rptr_shift = newcat_set_rptr_shift, .get_rptr_shift = newcat_get_rptr_shift, .set_ctcss_tone = newcat_set_ctcss_tone, .get_ctcss_tone = newcat_get_ctcss_tone, .set_ctcss_sql = newcat_set_ctcss_sql, .get_ctcss_sql = newcat_get_ctcss_sql, .set_powerstat = newcat_set_powerstat, .get_powerstat = newcat_get_powerstat, .get_ts = newcat_get_ts, .set_ts = newcat_set_ts, .set_trn = newcat_set_trn, .get_trn = newcat_get_trn, .set_channel = newcat_set_channel, .get_channel = newcat_get_channel, }; hamlib-1.2.15.3/yaesu/ft857.h0000644000175000017500000001357512044564477012322 00000000000000/* * hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com) * * ft857.h - (C) Tomi Manninen 2003 (oh2bns@sral.fi) * * ...derived but heavily modified from: * * ft817.h - (C) Chris Karpinsky 2001 (aa1vl@arrl.net) * * This shared library provides an API for communicating * via serial interface to an FT-817 using the "CAT" interface. * The starting point for this code was Frank's ft847 implementation. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT857_H #define _FT857_H 1 /* * No need to wait between written characters. */ #define FT857_WRITE_DELAY 0 /* * Wait 'delay' milliseconds after writing a command sequence. * * Setting this to zero means no delay but wait for an acknowledgement * from the rig after a command. This is undocumented but seems to work. * It's also the most optimal way as long as it works... * * A non-zero value disables waiting for the ack. Processing a command * seems to take about 60 ms so set this to 80 or so to be safe. */ #define FT857_POST_WRITE_DELAY 0 /* * Read timeout. */ #define FT857_TIMEOUT 200 /* * The time the TX, RX and FREQ/MODE status are cached (in millisec). * This optimises the common case of doing eg. rig_get_freq() and * rig_get_mode() in a row. * * The timeout is deliberately set lower than the time taken to process * a single command (~ 60 ms) so that a sequence * * rig_get_freq(); * rig_set_freq(); * rig_get_freq(); * * doesn't return a bogus (cached) value in the last rig_get_freq(). */ #define FT857_CACHE_TIMEOUT 50 enum ft857_native_cmd_e { FT857_NATIVE_CAT_LOCK_ON = 0, FT857_NATIVE_CAT_LOCK_OFF, FT857_NATIVE_CAT_PTT_ON, FT857_NATIVE_CAT_PTT_OFF, FT857_NATIVE_CAT_SET_FREQ, FT857_NATIVE_CAT_SET_MODE_LSB, FT857_NATIVE_CAT_SET_MODE_USB, FT857_NATIVE_CAT_SET_MODE_CW, FT857_NATIVE_CAT_SET_MODE_CWR, FT857_NATIVE_CAT_SET_MODE_AM, FT857_NATIVE_CAT_SET_MODE_FM, FT857_NATIVE_CAT_SET_MODE_FM_N, FT857_NATIVE_CAT_SET_MODE_DIG, FT857_NATIVE_CAT_SET_MODE_PKT, FT857_NATIVE_CAT_CLAR_ON, FT857_NATIVE_CAT_CLAR_OFF, FT857_NATIVE_CAT_SET_CLAR_FREQ, FT857_NATIVE_CAT_SET_VFOAB, FT857_NATIVE_CAT_SPLIT_ON, FT857_NATIVE_CAT_SPLIT_OFF, FT857_NATIVE_CAT_SET_RPT_SHIFT_MINUS, FT857_NATIVE_CAT_SET_RPT_SHIFT_PLUS, FT857_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX, FT857_NATIVE_CAT_SET_RPT_OFFSET, FT857_NATIVE_CAT_SET_DCS_ON, FT857_NATIVE_CAT_SET_DCS_DEC_ON, FT857_NATIVE_CAT_SET_DCS_ENC_ON, FT857_NATIVE_CAT_SET_CTCSS_ON, FT857_NATIVE_CAT_SET_CTCSS_DEC_ON, FT857_NATIVE_CAT_SET_CTCSS_ENC_ON, FT857_NATIVE_CAT_SET_CTCSS_DCS_OFF, FT857_NATIVE_CAT_SET_CTCSS_FREQ, FT857_NATIVE_CAT_SET_DCS_CODE, FT857_NATIVE_CAT_GET_RX_STATUS, FT857_NATIVE_CAT_GET_TX_STATUS, FT857_NATIVE_CAT_GET_FREQ_MODE_STATUS, FT857_NATIVE_CAT_PWR_WAKE, FT857_NATIVE_CAT_PWR_ON, FT857_NATIVE_CAT_PWR_OFF, FT857_NATIVE_CAT_EEPROM_READ, FT857_NATIVE_SIZE /* end marker */ }; typedef enum ft857_native_cmd_e ft857_native_cmd_t; struct ft857_priv_data { yaesu_cmd_set_t pcs[FT857_NATIVE_SIZE]; /* TODO: why? */ /* rx status */ struct timeval rx_status_tv; unsigned char rx_status; /* tx status */ struct timeval tx_status_tv; unsigned char tx_status; /* freq & mode status */ struct timeval fm_status_tv; unsigned char fm_status[YAESU_CMD_LENGTH+1]; }; static int ft857_init(RIG *rig); static int ft857_open(RIG *rig); static int ft857_cleanup(RIG *rig); static int ft857_close(RIG *rig); static int ft857_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft857_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ft857_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ft857_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int ft857_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int ft857_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); // static int ft857_set_vfo(RIG *rig, vfo_t vfo); // static int ft857_get_vfo(RIG *rig, vfo_t *vfo); static int ft857_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); static int ft857_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); // static int ft857_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val); static int ft857_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val); static int ft857_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); // static int ft857_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status); // static int ft857_set_parm(RIG *rig, setting_t parm, value_t val); // static int ft857_get_parm(RIG *rig, setting_t parm, value_t *val); static int ft857_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code); static int ft857_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t code); static int ft857_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code); static int ft857_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone); static int ft857_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift); static int ft857_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs); static int ft857_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit); static int ft857_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); static int ft857_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op); // static int ft857_set_powerstat(RIG *rig, powerstat_t status); #endif /* _FT857_H */ hamlib-1.2.15.3/yaesu/yaesu.c0000644000175000017500000001231712044564477012557 00000000000000/* * hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com) * * yaesu.c - (C) Stephane Fillod 2001-2010 * * This shared library provides an API for communicating * via serial interface to a Yaesu rig * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "register.h" #include "yaesu.h" struct yaesu_id { rig_model_t model; int id1, id2; }; #define UNKNOWN_ID -1 /* * Identification number as returned by 0xFA opcode. * Note: On the FT736R, the 0xFA opcode sets CTCSS tone code * * Please, if the model number of your rig is listed as UNKNOWN_ID, * send the value to for inclusion. Thanks --SF */ static const struct yaesu_id yaesu_id_list[] = { { RIG_MODEL_FT1000, 0x10, 0x21 }, /* or 0x10, 0x00 ? */ { RIG_MODEL_FT990, 0x09, 0x90 }, { RIG_MODEL_FT890, 0x08, 0x41 }, { RIG_MODEL_FRG100, 0x03, 0x92 }, /* TBC, inconsistency in manual */ { RIG_MODEL_FT1000MP, 0x03, 0x93 }, { RIG_MODEL_FT1000MPMKV, 0x03, 0x93 }, /* or 0x10, 0x00 ? */ { RIG_MODEL_FT1000MPMKVFLD, 0x03, 0x93 }, { RIG_MODEL_VX1700, 0x06, 0x04 }, { RIG_MODEL_NONE, UNKNOWN_ID, UNKNOWN_ID }, /* end marker */ }; /* * initrigs_yaesu is called by rig_backend_load */ DECLARE_INITRIG_BACKEND(yaesu) { rig_debug(RIG_DEBUG_VERBOSE, "yaesu: %s called\n", __func__); rig_register(&ft100_caps); rig_register(&ft450_caps); rig_register(&ft736_caps); rig_register(&ft747_caps); rig_register(&ft757gx_caps); rig_register(&ft757gx2_caps); rig_register(&ft767gx_caps); rig_register(&ft817_caps); rig_register(&ft847_caps); rig_register(&ft857_caps); rig_register(&ft897_caps); rig_register(&ft840_caps); rig_register(&ft890_caps); rig_register(&ft900_caps); rig_register(&ft920_caps); rig_register(&ft950_caps); rig_register(&ft980_caps); rig_register(&ft990_caps); rig_register(&ft1000d_caps); rig_register(&ft1000mp_caps); rig_register(&ft1000mpmkv_caps); rig_register(&ft1000mpmkvfld_caps); rig_register(&ft2000_caps); rig_register(&ftdx5000_caps); rig_register(&ft9000_caps); rig_register(&frg100_caps); rig_register(&frg8800_caps); rig_register(&frg9600_caps); rig_register(&vr5000_caps); rig_register(&vx1700_caps); return RIG_OK; } /* * proberigs_yaesu * * Notes: * There's only one rig possible per port. * * rig_model_t probeallrigs_yaesu(port_t *port, rig_probe_func_t cfunc, rig_ptr_t data) */ DECLARE_PROBERIG_BACKEND(yaesu) { unsigned char idbuf[YAESU_CMD_LENGTH+1]; static const unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0xfa}; int id_len=-1, i, id1, id2; int retval=-1; int rates[] = { 4800, 57600, 9600, 38400, 0 }; /* possible baud rates */ int rates_idx; if (!port) return RIG_MODEL_NONE; if (port->type.rig != RIG_PORT_SERIAL) return RIG_MODEL_NONE; port->write_delay = port->post_write_delay = 20; port->parm.serial.stop_bits = 2; port->retry = 1; /* * try for all different baud rates */ for (rates_idx = 0; rates[rates_idx]; rates_idx++) { port->parm.serial.rate = rates[rates_idx]; port->timeout = 2*1000/rates[rates_idx] + 50; retval = serial_open(port); if (retval != RIG_OK) return RIG_MODEL_NONE; /* send READ STATUS cmd to rig */ retval = write_block(port, (char *) cmd, YAESU_CMD_LENGTH); id_len = read_block(port, (char *) idbuf, YAESU_CMD_LENGTH); close(port->fd); if (retval != RIG_OK || id_len < 0) continue; } if (retval != RIG_OK || id_len < 0) return RIG_MODEL_NONE; /* * reply should be [Flag1,Flag2,Flag3,ID1,ID2] */ if (id_len != 5 || id_len != 6) { idbuf[YAESU_CMD_LENGTH] = '\0'; rig_debug(RIG_DEBUG_WARN,"probe_yaesu: protocol error," " expected %d, received %d: %s\n", 6, id_len, idbuf); return RIG_MODEL_NONE; } id1 = idbuf[3]; id2 = idbuf[4]; for (i=0; yaesu_id_list[i].model != RIG_MODEL_NONE; i++) { if (id1 == yaesu_id_list[i].id1 && id2 == yaesu_id_list[i].id2) { rig_debug(RIG_DEBUG_VERBOSE,"probe_yaesu: " "found ID %02xH %02xH\n", id1, id2); if (cfunc) (*cfunc)(port, yaesu_id_list[i].model, data); return yaesu_id_list[i].model; } } /* * not found in known table.... * update yaesu_id_list[]! */ rig_debug(RIG_DEBUG_WARN,"probe_yaesu: found unknown device " "with ID %02xH %02xH, please report to Hamlib " "developers.\n", id1, id2); return RIG_MODEL_NONE; } hamlib-1.2.15.3/yaesu/ft897.h0000644000175000017500000000763412044564477012325 00000000000000/* * ft897.h - (C) Tomi Manninen 2003 (oh2bns@sral.fi) * * ...derived but heavily modified from: * * ft817.h - (C) Chris Karpinsky 2001 (aa1vl@arrl.net) * * This shared library provides an API for communicating * via serial interface to an FT-817 using the "CAT" interface. * The starting point for this code was Frank's ft847 implementation. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT897_H #define _FT897_H 1 /* * No need to wait between written characters. */ #define FT897_WRITE_DELAY 0 /* * Wait 'delay' milliseconds after writing a command sequence. * * Setting this to zero means no delay but wait for an acknowledgement * from the rig after a command. This is undocumented but seems to work. * It's also the most optimal way as long as it works... * * A non-zero value disables waiting for the ack. Processing a command * seems to take about 60 ms so set this to 80 or so to be safe. */ #define FT897_POST_WRITE_DELAY 0 /* * Read timeout. */ #define FT897_TIMEOUT 200 /* * The time the TX, RX and FREQ/MODE status are cached (in millisec). * This optimises the common case of doing eg. rig_get_freq() and * rig_get_mode() in a row. * * The timeout is deliberately set lower than the time taken to process * a single command (~ 60 ms) so that a sequence * * rig_get_freq(); * rig_set_freq(); * rig_get_freq(); * * doesn't return a bogus (cached) value in the last rig_get_freq(). */ #define FT897_CACHE_TIMEOUT 50 enum ft897_native_cmd_e { FT897_NATIVE_CAT_LOCK_ON = 0, FT897_NATIVE_CAT_LOCK_OFF, FT897_NATIVE_CAT_PTT_ON, FT897_NATIVE_CAT_PTT_OFF, FT897_NATIVE_CAT_SET_FREQ, FT897_NATIVE_CAT_SET_MODE_LSB, FT897_NATIVE_CAT_SET_MODE_USB, FT897_NATIVE_CAT_SET_MODE_CW, FT897_NATIVE_CAT_SET_MODE_CWR, FT897_NATIVE_CAT_SET_MODE_AM, FT897_NATIVE_CAT_SET_MODE_FM, FT897_NATIVE_CAT_SET_MODE_FM_N, FT897_NATIVE_CAT_SET_MODE_DIG, FT897_NATIVE_CAT_SET_MODE_PKT, FT897_NATIVE_CAT_CLAR_ON, FT897_NATIVE_CAT_CLAR_OFF, FT897_NATIVE_CAT_SET_CLAR_FREQ, FT897_NATIVE_CAT_SET_VFOAB, FT897_NATIVE_CAT_SPLIT_ON, FT897_NATIVE_CAT_SPLIT_OFF, FT897_NATIVE_CAT_SET_RPT_SHIFT_MINUS, FT897_NATIVE_CAT_SET_RPT_SHIFT_PLUS, FT897_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX, FT897_NATIVE_CAT_SET_RPT_OFFSET, FT897_NATIVE_CAT_SET_DCS_ON, FT897_NATIVE_CAT_SET_DCS_DEC_ON, FT897_NATIVE_CAT_SET_DCS_ENC_ON, FT897_NATIVE_CAT_SET_CTCSS_ON, FT897_NATIVE_CAT_SET_CTCSS_DEC_ON, FT897_NATIVE_CAT_SET_CTCSS_ENC_ON, FT897_NATIVE_CAT_SET_CTCSS_DCS_OFF, FT897_NATIVE_CAT_SET_CTCSS_FREQ, FT897_NATIVE_CAT_SET_DCS_CODE, FT897_NATIVE_CAT_GET_RX_STATUS, FT897_NATIVE_CAT_GET_TX_STATUS, FT897_NATIVE_CAT_GET_FREQ_MODE_STATUS, FT897_NATIVE_CAT_PWR_WAKE, FT897_NATIVE_CAT_PWR_ON, FT897_NATIVE_CAT_PWR_OFF, FT897_NATIVE_SIZE /* end marker */ }; typedef enum ft897_native_cmd_e ft897_native_cmd_t; struct ft897_priv_data { yaesu_cmd_set_t pcs[FT897_NATIVE_SIZE]; /* TODO: why? */ /* rx status */ struct timeval rx_status_tv; unsigned char rx_status; /* tx status */ struct timeval tx_status_tv; unsigned char tx_status; /* freq & mode status */ struct timeval fm_status_tv; unsigned char fm_status[YAESU_CMD_LENGTH]; }; #endif /* _FT897_H */ hamlib-1.2.15.3/yaesu/ft840.h0000644000175000017500000002417012044564477012303 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft840.h - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * (C) Stephane Fillod 2002, 2009 (fillods at users.sourceforge.net) * (C) Nate Bargmann 2002, 2003 (n0nb at arrl.net) * * This shared library provides an API for communicating * via serial interface to an FT-840 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT840_H #define _FT840_H 1 #define TRUE 1 #define FALSE 0 #define ON TRUE #define OFF FALSE #define FT840_VFO_ALL (RIG_VFO_A|RIG_VFO_B) /* Receiver caps */ #define FT840_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB) #define FT840_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB) #define FT840_AM_RX_MODES (RIG_MODE_AM) #define FT840_FM_RX_MODES (RIG_MODE_FM) /* TX caps */ #define FT840_OTHER_TX_MODES (RIG_MODE_CW| RIG_MODE_USB| RIG_MODE_LSB ) /* 100 W class */ #define FT840_AM_TX_MODES (RIG_MODE_AM ) /* set 25W max */ #define FT840_FUNC_ALL (RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN) /* fix */ /* * Other features (used by rig_caps) * */ #define FT840_ANTS 0 /* Returned data length in bytes */ #define FT840_MEM_CHNL_LENGTH 1 /* 0x10 P1 = 01 return size */ #define FT840_OP_DATA_LENGTH 19 /* 0x10 P1 = 03 return size */ #define FT840_VFO_DATA_LENGTH 18 /* 0x10 P1 = 03 return size -- A & B returned */ #define FT840_MEM_CHNL_DATA_LENGTH 19 /* 0x10 P1 = 04, P4 = 0x01-0x20 return size */ #define FT840_STATUS_FLAGS_LENGTH 5 /* 0xf7, 0xfa return size */ #define FT840_ALL_DATA_LENGTH 649 /* 0x10 P1 = 00 return size */ /* Timing values in mS */ #define FT840_PACING_INTERVAL 5 #define FT840_PACING_DEFAULT_VALUE 0 #define FT840_WRITE_DELAY 50 /* Delay sequential fast writes */ #define FT840_POST_WRITE_DELAY 5 /* Rough safe value for default timeout */ #define FT840_DEFAULT_READ_TIMEOUT 649 * ( 5 + (FT840_PACING_INTERVAL * FT840_PACING_DEFAULT_VALUE)) /* BCD coded frequency length */ #define FT840_BCD_DIAL 8 #define FT840_BCD_RIT 3 /* * 8N2 and 1 start bit = 11 bits at 4800 bps => effective byte * rate = 1 byte in 2.2917 msec => 649 bytes in 1487 msec * * delay for 28 bytes = (2.2917 + pace_interval) * 28 * * pace_interval time to read 28 bytes * ------------ ---------------------- * * 0 1487 msec * 1 2136 msec (backend default) * 2 2785 msec * 5 4732 msec * 255 167 sec * */ /* * Native FT840 functions. More to come :-) * */ enum ft840_native_cmd_e { FT840_NATIVE_SPLIT_OFF = 0, FT840_NATIVE_SPLIT_ON, FT840_NATIVE_RECALL_MEM, FT840_NATIVE_VFO_TO_MEM, FT840_NATIVE_VFO_A, FT840_NATIVE_VFO_B, FT840_NATIVE_MEM_TO_VFO, FT840_NATIVE_CLARIFIER_OPS, FT840_NATIVE_FREQ_SET, FT840_NATIVE_MODE_SET, FT840_NATIVE_PACING, FT840_NATIVE_PTT_OFF, FT840_NATIVE_PTT_ON, FT840_NATIVE_MEM_CHNL, FT840_NATIVE_OP_DATA, FT840_NATIVE_VFO_DATA, FT840_NATIVE_MEM_CHNL_DATA, FT840_NATIVE_TUNER_OFF, FT840_NATIVE_TUNER_ON, FT840_NATIVE_TUNER_START, FT840_NATIVE_READ_METER, FT840_NATIVE_READ_FLAGS, FT840_NATIVE_SIZE /* end marker, value indicates number of */ /* native cmd entries */ }; typedef enum ft840_native_cmd_e ft840_native_cmd_t; /* * Internal MODES - when setting modes via FT840_NATIVE_MODE_SET * */ #define MODE_SET_LSB 0x00 #define MODE_SET_USB 0x01 #define MODE_SET_CW_W 0x02 #define MODE_SET_CW_N 0x03 #define MODE_SET_AM_W 0x04 #define MODE_SET_AM_N 0x05 #define MODE_SET_FM 0x06 /* * Internal Clarifier parms - when setting clarifier via * FT840_NATIVE_CLARIFIER_OPS * * The manual seems to be incorrect with regard to P1 and P2 values * P1 = 0x00 clarifier off * P1 = 0x01 clarifier on * P1 = 0xff clarifier set * P2 = 0x00 clarifier up * P2 = 0xff clarifier down */ /* P1 values */ #define CLAR_RX_OFF 0x00 #define CLAR_RX_ON 0x01 #define CLAR_SET_FREQ 0xff /* P2 values */ #define CLAR_OFFSET_PLUS 0x00 #define CLAR_OFFSET_MINUS 0xff /* * Some useful offsets in the status update flags (offset) * SUMO--Status Update Memory Offset? * * SF_ bit tests are now grouped with flag bytes for ease of reference * * FIXME: complete flags and bits * * CAT command 0xFA requests the FT-840 to return its status flags. * These flags consist of 3 bytes (plus 2 filler bytes) and are documented * in the FT-840 manual on page 33. * */ #define FT840_SUMO_DISPLAYED_STATUS_0 0x00 /* Status flag byte 0 */ #define SF_GC (1<<1) /* General Coverage Reception selected */ #define SF_SPLIT (1<<2) /* Split active */ #define SF_MCK (1<<3) /* memory Checking in progress */ #define SF_MT (1<<4) /* Memory Tuning in progress */ #define SF_MR (1<<5) /* Memory Mode selected */ #define SF_A (0<<6) /* bit 6 clear, VFO A */ #define SF_B (1<<6) /* bit 6 set, VFO B */ #define SF_VFO (1<<7) /* bit 7 set, VFO A or B active */ #define SF_VFOA (SF_VFO|SF_A) /* bit 7 set, bit 6 clear, VFO A */ #define SF_VFOB (SF_VFO|SF_B) /* bit 7 set, bit 6 set, VFO B */ #define SF_VFO_MASK (SF_VFOB) /* bits 6 and 7 */ #define SF_MEM_MASK (SF_MCK|SF_MT|SF_MR) /* bits 3, 4 and 5 */ #define FT840_SUMO_DISPLAYED_STATUS_1 0x01 /* Status flag byte 1 */ #define FT840_SUMO_DISPLAYED_STATUS_2 0x02 /* Status flag byte 1 */ #define SF_PTT_OFF (0<<7) /* bit 7 set, PTT open */ #define SF_PTT_ON (1<<7) /* bit 7 set, PTT closed */ #define SF_PTT_MASK (SF_PTT_ON) /* * Offsets for VFO record retrieved via 0x10 P1 = 02, 03, 04 * * The FT-840 returns frequency and mode data via three seperate commands. * CAT command 0x10, P1 = 02 returns the current main and sub displays' data (19 bytes) * CAT command 0x10, P1 = 03 returns VFO A & B data (18 bytes) * CAT command 0x10, P1 = 04, P4 = 0x01-0x20 returns memory channel data (19 bytes) * In all cases the format is (from the FT-840 manual page 32): * * Offset Value * 0x00 Band Selection (BPF selection: 0x00 - 0x30 (bit 7 =1 on a blanked memory)) * 0x01 Operating Frequency (Hex value of display--Not BCD!) * 0x04 Clarifier Offset (signed value between -999d (0xfc19) and +999d (0x03e7)) * 0x06 Mode Data * 0x07 CTCSS tone code (0x00 - 0x20) * 0x08 Flags (Operating flags -- manual page 33) * * Memory Channel data has the same layout and offsets as the operating * data record. * When either of the 19 byte records is read (P1 = 02, 04), the offset is * +1 as the leading byte is the memory channel number. * The VFO data command (P1 = 03) returns 18 bytes and the VFO B data has * the same layout, but the offset starts at 0x09 and continues through 0x12 * */ #define FT840_SUMO_MEM_CHANNEL 0x00 /* Memory Channel from 0xfa, P1 = 1 */ #define FT840_SUMO_DISPLAYED_FREQ 0x02 /* Current main display, can be VFO A, Memory data, Memory tune (3 bytes) */ #define FT840_SUMO_DISPLAYED_CLAR 0x05 /* RIT offset -- current display */ #define FT840_SUMO_DISPLAYED_MODE 0x07 /* Current main display mode */ #define FT840_SUMO_DISPLAYED_FLAG 0x09 #define FT840_SUMO_VFO_A_FREQ 0x01 /* VFO A frequency, not necessarily currently displayed! */ #define FT840_SUMO_VFO_A_CLAR 0x04 /* RIT offset -- VFO A */ #define FT840_SUMO_VFO_A_MODE 0x06 /* VFO A mode, not necessarily currently displayed! */ #define FT840_SUMO_VFO_A_FLAG 0x08 #define FT840_SUMO_VFO_B_FREQ 0x0a /* Current sub display && VFO B */ #define FT840_SUMO_VFO_B_CLAR 0x0d /* RIT offset -- VFO B */ #define FT840_SUMO_VFO_B_MODE 0x0f /* Current sub display && VFO B */ #define FT840_SUMO_VFO_B_FLAG 0x11 /* * Read meter offset * * FT-840 returns the level of the S meter when in RX and ALC or PO or SWR * when in TX. The level is replicated in the first four bytes sent by the * rig with the final byte being a constant 0xf7 * * The manual states that the returned value will range between 0x00 and 0xff * while "in practice the highest value returned will be around 0xf0". The * manual is silent when this value is returned as my rig returns 0x00 for * S0, 0x44 for S9 and 0x9D for S9 +60. * */ #define FT840_SUMO_METER 0x00 /* Meter level */ /* * Narrow filter selection flag from offset 0x08 or 0x11 * in VFO/Memory Record * * used when READING modes from FT-840 * */ #define FLAG_AM_N (1<<6) #define FLAG_CW_N (1<<7) #define FLAG_MASK (FLAG_AM_N|FLAG_CW_N) /* * Mode Bitmap from offset 0x06 or 0x0f in VFO/Memory Record. * * used when READING modes from FT-840 * */ #define MODE_LSB 0x00 #define MODE_USB 0x01 #define MODE_CW 0x02 #define MODE_AM 0x03 #define MODE_FM 0x04 /* All relevant bits */ #define MODE_MASK (MODE_LSB|MODE_USB|MODE_CW|MODE_AM|MODE_FM) /* * Command string parameter offsets */ #define P1 3 #define P2 2 #define P3 1 #define P4 0 #endif /* _FT840_H */ hamlib-1.2.15.3/yaesu/ft817.c0000644000175000017500000007330412044564477012305 00000000000000/* * hamlib - (C) Frank Singleton 2000,2001 (vk3fcs@ix.netcom.com) * (C) Stephane Fillod 2000-2009 * * ft817.c - (C) Chris Karpinsky 2001 (aa1vl@arrl.net) * This shared library provides an API for communicating * via serial interface to an FT-817 using the "CAT" interface. * The starting point for this code was Frank's ft847 implementation. * * Then, Tommi OH2BNS improved the code a lot in the framework of the * FT-857 backend. These improvements have now (August 2005) been * copied back and adopted for the FT-817. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * Unimplemented features supported by the FT-817: * * - RIT ON/OFF without touching the RIT offset. This would * need frontend support (eg. a new RIG_FUNC_xxx) * * - RX status command returns info that is not used: * - discriminator centered (yes/no flag) * - received ctcss/dcs matched (yes/no flag) TBC * * - TX status command returns info that is not used: * - split on/off flag; actually this could have been used * for get_split_vfo, but the flag is valid only when * PTT is ON. * - high swr flag * * Todo / tocheck list (oz9aec): * - test get_dcd; rigctl does not support it? * - squelch * - the many "fixme" stuff around */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #ifdef HAVE_SYS_TIME_H #include #endif #include "hamlib/rig.h" #include "serial.h" #include "yaesu.h" #include "ft817.h" #include "misc.h" #include "tones.h" #include "bandplan.h" /* Native ft817 cmd set prototypes. These are READ ONLY as each */ /* rig instance will copy from these and modify if required . */ /* Complete sequences (1) can be read and used directly as a cmd sequence . */ /* Incomplete sequences (0) must be completed with extra parameters */ /* eg: mem number, or freq etc.. */ static const yaesu_cmd_set_t ncmd[] = { { 1, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* lock on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x80 } }, /* lock off */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* ptt on */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x88 } }, /* ptt off */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* set freq */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main LSB */ { 1, { 0x01, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main USB */ { 1, { 0x02, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main CW */ { 1, { 0x03, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main CWR */ { 1, { 0x04, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main AM */ { 1, { 0x08, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main FM */ { 1, { 0x88, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main FM-N */ { 1, { 0x0a, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main DIG */ { 1, { 0x0c, 0x00, 0x00, 0x00, 0x07 } }, /* mode set main PKT */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* clar on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x85 } }, /* clar off */ { 0, { 0x00, 0x00, 0x00, 0x00, 0xf5 } }, /* set clar freq */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x81 } }, /* toggle vfo a/b */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* split on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x82 } }, /* split off */ { 1, { 0x09, 0x00, 0x00, 0x00, 0x09 } }, /* set RPT shift MINUS */ { 1, { 0x49, 0x00, 0x00, 0x00, 0x09 } }, /* set RPT shift PLUS */ { 1, { 0x89, 0x00, 0x00, 0x00, 0x09 } }, /* set RPT shift SIMPLEX */ { 0, { 0x00, 0x00, 0x00, 0x00, 0xf9 } }, /* set RPT offset freq */ { 1, { 0x0a, 0x00, 0x00, 0x00, 0x0a } }, /* set DCS on */ { 1, { 0x2a, 0x00, 0x00, 0x00, 0x0a } }, /* set CTCSS on */ { 1, { 0x4a, 0x00, 0x00, 0x00, 0x0a } }, /* set CTCSS encoder on */ { 1, { 0x8a, 0x00, 0x00, 0x00, 0x0a } }, /* set CTCSS/DCS off */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0b } }, /* set CTCSS tone */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* set DCS code */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xe7 } }, /* get RX status */ { 1, { 0x00, 0x00, 0x00, 0x00, 0xf7 } }, /* get TX status */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* get FREQ and MODE status */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* pwr wakeup sequence */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0f } }, /* pwr on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x8f } }, /* pwr off */ }; #define FT817_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_PKTFM|\ RIG_MODE_USB|RIG_MODE_LSB|RIG_MODE_RTTY|RIG_MODE_FM) #define FT817_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_USB|RIG_MODE_LSB|RIG_MODE_RTTY) #define FT817_CWN_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_RTTY) #define FT817_AM_FM_RX_MODES (RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_PKTFM) #define FT817_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_USB|\ RIG_MODE_LSB|RIG_MODE_RTTY|RIG_MODE_FM) #define FT817_AM_TX_MODES (RIG_MODE_AM) #define FT817_VFO_ALL (RIG_VFO_A|RIG_VFO_B) #define FT817_ANTS 0 #define FT817_STR_CAL { 16, \ { \ { 0x00, -54 }, /* S0 */ \ { 0x01, -48 }, \ { 0x02, -42 }, \ { 0x03, -36 }, \ { 0x04, -30 }, \ { 0x05, -24 }, \ { 0x06, -18 }, \ { 0x07, -12 }, \ { 0x08, -6 }, \ { 0x09, 0 }, /* S9 */ \ { 0x0A, 10 }, /* +10 */ \ { 0x0B, 20 }, /* +20 */ \ { 0x0C, 30 }, /* +30 */ \ { 0x0D, 40 }, /* +40 */ \ { 0x0E, 50 }, /* +50 */ \ { 0x0F, 60 } /* +60 */ \ } } const struct rig_caps ft817_caps = { .rig_model = RIG_MODEL_FT817, .model_name = "FT-817", .mfg_name = "Yaesu", .version = "0.5.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 38400, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT817_WRITE_DELAY, .post_write_delay = FT817_POST_WRITE_DELAY, .timeout = FT817_TIMEOUT, .retry = 0, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_LOCK | RIG_FUNC_TONE | RIG_FUNC_TSQL, .has_get_level = RIG_LEVEL_STRENGTH | RIG_LEVEL_RAWSTR | RIG_LEVEL_RFPOWER, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = {}, /* granularity */ .parm_gran = {}, .ctcss_list = common_ctcss_list, .dcs_list = common_dcs_list, /* only 104 out of 106 supported */ .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(9990), .max_xit = Hz(0), .max_ifshift = Hz(0), .vfo_ops = RIG_OP_TOGGLE, .targetable_vfo = 0, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, .rx_range_list1 = { {kHz(100),MHz(56), FT817_ALL_RX_MODES,-1,-1}, {MHz(76), MHz(108),RIG_MODE_WFM, -1,-1}, {MHz(118),MHz(164),FT817_ALL_RX_MODES,-1,-1}, {MHz(420),MHz(470),FT817_ALL_RX_MODES,-1,-1}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1, FT817_OTHER_TX_MODES, W(0.5), W(5), FT817_VFO_ALL, FT817_ANTS), FRQ_RNG_HF(1, FT817_AM_TX_MODES, W(0.5),W(1.5), FT817_VFO_ALL, FT817_ANTS), FRQ_RNG_6m(1, FT817_OTHER_TX_MODES, W(0.5), W(5), FT817_VFO_ALL, FT817_ANTS), FRQ_RNG_6m(1, FT817_AM_TX_MODES, W(0.5),W(1.5), FT817_VFO_ALL, FT817_ANTS), FRQ_RNG_2m(1, FT817_OTHER_TX_MODES, W(0.5),W(5),FT817_VFO_ALL,FT817_ANTS), FRQ_RNG_2m(1, FT817_AM_TX_MODES, W(0.5),W(1.5),FT817_VFO_ALL,FT817_ANTS), FRQ_RNG_70cm(1, FT817_OTHER_TX_MODES, W(0.5),W(5),FT817_VFO_ALL,FT817_ANTS), FRQ_RNG_70cm(1, FT817_AM_TX_MODES, W(0.5),W(1.5),FT817_VFO_ALL,FT817_ANTS), RIG_FRNG_END, }, .rx_range_list2 = { {kHz(100),MHz(56), FT817_ALL_RX_MODES,-1,-1}, {MHz(76), MHz(108),RIG_MODE_WFM, -1,-1}, {MHz(118),MHz(164),FT817_ALL_RX_MODES,-1,-1}, {MHz(420),MHz(470),FT817_ALL_RX_MODES,-1,-1}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2, FT817_OTHER_TX_MODES, W(0.5), W(5), FT817_VFO_ALL, FT817_ANTS), FRQ_RNG_HF(2, FT817_AM_TX_MODES, W(0.5),W(1.5), FT817_VFO_ALL, FT817_ANTS), /* FIXME: 60 meters in US version */ FRQ_RNG_6m(2, FT817_OTHER_TX_MODES, W(0.5), W(5), FT817_VFO_ALL, FT817_ANTS), FRQ_RNG_6m(2, FT817_AM_TX_MODES, W(0.5),W(1.5), FT817_VFO_ALL, FT817_ANTS), FRQ_RNG_2m(2, FT817_OTHER_TX_MODES, W(0.5),W(5),FT817_VFO_ALL,FT817_ANTS), FRQ_RNG_2m(2, FT817_AM_TX_MODES, W(0.5),W(1.5),FT817_VFO_ALL,FT817_ANTS), FRQ_RNG_70cm(2, FT817_OTHER_TX_MODES, W(0.5),W(5),FT817_VFO_ALL,FT817_ANTS), FRQ_RNG_70cm(2, FT817_AM_TX_MODES, W(0.5),W(1.5),FT817_VFO_ALL,FT817_ANTS), RIG_FRNG_END, }, .tuning_steps = { {FT817_SSB_CW_RX_MODES,Hz(10)}, {FT817_AM_FM_RX_MODES|RIG_MODE_WFM,Hz(100)}, RIG_TS_END, }, .filters = { {FT817_SSB_CW_RX_MODES, kHz(2.2)}, /* normal passband */ {FT817_CWN_RX_MODES, 500}, /* CW and RTTY narrow */ {RIG_MODE_AM, kHz(6)}, /* AM normal */ {RIG_MODE_FM|RIG_MODE_PKTFM, kHz(9)}, {RIG_MODE_WFM, kHz(15)}, RIG_FLT_END, }, .str_cal = FT817_STR_CAL, .priv = NULL, .rig_init = ft817_init, .rig_cleanup = ft817_cleanup, .rig_open = ft817_open, .rig_close = ft817_close, .set_freq = ft817_set_freq, .get_freq = ft817_get_freq, .set_mode = ft817_set_mode, .get_mode = ft817_get_mode, .set_vfo = NULL, .get_vfo = NULL, .set_ptt = ft817_set_ptt, .get_ptt = ft817_get_ptt, .get_dcd = ft817_get_dcd, .set_rptr_shift = ft817_set_rptr_shift, .get_rptr_shift = NULL, .set_rptr_offs = ft817_set_rptr_offs, .get_rptr_offs = NULL, .set_split_freq = NULL, .get_split_freq = NULL, .set_split_mode = NULL, .get_split_mode = NULL, .set_split_vfo = ft817_set_split_vfo, .get_split_vfo = NULL, /* possible, but works only if PTT is ON */ .set_rit = ft817_set_rit, .get_rit = NULL, .set_xit = NULL, .get_xit = NULL, .set_ts = NULL, .get_ts = NULL, .set_dcs_code = ft817_set_dcs_code, .get_dcs_code = NULL, .set_tone = NULL, .get_tone = NULL, .set_ctcss_tone = ft817_set_ctcss_tone, .get_ctcss_tone = NULL, .set_dcs_sql = ft817_set_dcs_sql, .get_dcs_sql = NULL, .set_tone_sql = NULL, .get_tone_sql = NULL, .set_ctcss_sql = ft817_set_ctcss_sql, .get_ctcss_sql = NULL, .power2mW = ft817_power2mW, .mW2power = ft817_mW2power, .set_powerstat = ft817_set_powerstat, .get_powerstat = NULL, .reset = NULL, .set_ant = NULL, .get_ant = NULL, .set_level = NULL, .get_level = ft817_get_level, .set_func = ft817_set_func, .get_func = NULL, .set_parm = NULL, .get_parm = NULL, .set_ext_level = NULL, .get_ext_level = NULL, .set_ext_parm = NULL, .get_ext_parm = NULL, .set_conf = NULL, .get_conf = NULL, .send_dtmf = NULL, .recv_dtmf = NULL, .send_morse = NULL, .set_bank = NULL, .set_mem = NULL, .get_mem = NULL, .vfo_op = ft817_vfo_op, .scan = NULL, .set_trn = NULL, .get_trn = NULL, .decode_event = NULL, .set_channel = NULL, .get_channel = NULL, /* there are some more */ }; /* ---------------------------------------------------------------------- */ int ft817_init (RIG *rig) { struct ft817_priv_data *p; rig_debug (RIG_DEBUG_VERBOSE,"ft817: ft817_init called \n"); if ((p = calloc(1, sizeof(struct ft817_priv_data))) == NULL) return -RIG_ENOMEM; /* Copy complete native cmd set to private cmd storage area */ memcpy(p->pcs, ncmd, sizeof(ncmd)); rig->state.priv = (void*) p; return RIG_OK; } int ft817_cleanup (RIG *rig) { rig_debug (RIG_DEBUG_VERBOSE,"ft817: ft817_cleanup called \n"); if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } int ft817_open (RIG *rig) { rig_debug (RIG_DEBUG_VERBOSE,"ft817: ft817_open called \n"); return RIG_OK; } int ft817_close (RIG *rig) { rig_debug (RIG_DEBUG_VERBOSE,"ft817: ft817_close called \n"); return RIG_OK; } /* ---------------------------------------------------------------------- */ static inline long timediff(struct timeval *tv1, struct timeval *tv2) { struct timeval tv; tv.tv_usec = tv1->tv_usec - tv2->tv_usec; tv.tv_sec = tv1->tv_sec - tv2->tv_sec; return ((tv.tv_sec * 1000L) + (tv.tv_usec / 1000L)); } static int check_cache_timeout(struct timeval *tv) { struct timeval curr; long t; if (tv->tv_sec == 0 && tv->tv_usec == 0) { rig_debug(RIG_DEBUG_VERBOSE, "ft817: cache invalid\n"); return 1; } gettimeofday(&curr, NULL); if ((t = timediff(&curr, tv)) < FT817_CACHE_TIMEOUT) { rig_debug(RIG_DEBUG_VERBOSE, "ft817: using cache (%ld ms)\n", t); return 0; } else { rig_debug(RIG_DEBUG_VERBOSE, "ft817: cache timed out (%ld ms)\n", t); return 1; } } static int ft817_get_status(RIG *rig, int status) { struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv; struct timeval *tv; unsigned char *data; int len; int n; switch (status) { case FT817_NATIVE_CAT_GET_FREQ_MODE_STATUS: data = p->fm_status; len = YAESU_CMD_LENGTH; tv = &p->fm_status_tv; break; case FT817_NATIVE_CAT_GET_RX_STATUS: data = &p->rx_status; len = 1; tv = &p->rx_status_tv; break; case FT817_NATIVE_CAT_GET_TX_STATUS: data = &p->tx_status; len = 1; tv = &p->tx_status_tv; break; default: rig_debug(RIG_DEBUG_ERR, "ft817_get_status: Internal error!\n"); return -RIG_EINTERNAL; } serial_flush(&rig->state.rigport); write_block(&rig->state.rigport, (char *) p->pcs[status].nseq, YAESU_CMD_LENGTH); if ((n = read_block(&rig->state.rigport, (char *) data, len)) < 0) return n; if (n != len) return -RIG_EIO; gettimeofday(tv, NULL); return RIG_OK; } /* ---------------------------------------------------------------------- */ int ft817_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; if (check_cache_timeout(&p->fm_status_tv)) if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_FREQ_MODE_STATUS)) < 0) return n; *freq = from_bcd_be(p->fm_status, 8) * 10; return -RIG_OK; } int ft817_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; if (check_cache_timeout(&p->fm_status_tv)) if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_FREQ_MODE_STATUS)) < 0) return n; /* set normal width now, narrow will override this later */ *width = RIG_PASSBAND_NORMAL; switch (p->fm_status[4]) { case 0x00: *mode = RIG_MODE_LSB; break; case 0x01: *mode = RIG_MODE_USB; break; case 0x02: *mode = RIG_MODE_CW; break; case 0x03: *mode = RIG_MODE_CWR; break; case 0x04: *mode = RIG_MODE_AM; break; case 0x06: *mode = RIG_MODE_WFM; break; case 0x08: *mode = RIG_MODE_FM; break; case 0x0A: *mode = RIG_MODE_RTTY; break; case 0x0C: *mode = RIG_MODE_PKTFM; break; /* "extra modes" which are not documented in the manual */ case 0x82: *mode = RIG_MODE_CW; *width = rig_passband_narrow (rig, RIG_MODE_CW); break; case 0x83: *mode = RIG_MODE_CWR; *width = rig_passband_narrow (rig, RIG_MODE_CW); break; case 0x8A: *mode = RIG_MODE_RTTY; *width = rig_passband_narrow (rig, RIG_MODE_CW); break; default: *mode = RIG_MODE_NONE; } return RIG_OK; } int ft817_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; if (check_cache_timeout(&p->tx_status_tv)) if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_TX_STATUS)) < 0) return n; *ptt = ((p->tx_status & 0x80) == 0); return RIG_OK; } static int ft817_get_pometer_level(RIG *rig, value_t *val) { struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv; int n; if (check_cache_timeout(&p->tx_status_tv)) if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_TX_STATUS)) < 0) return n; /* Valid only if PTT is on. FT-817 returns the number of bars in the lowest 4 bits */ if ((p->tx_status & 0x80) == 0) { /* the rig has 10 bars on its display */ val->f = (p->tx_status & 0x0F) / 10.0; } else { val->f = 0.0; } return RIG_OK; } /* frontend will always use RAWSTR+cal_table */ static int ft817_get_smeter_level(RIG *rig, value_t *val) { struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv; int n; if (check_cache_timeout(&p->rx_status_tv)) if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_RX_STATUS)) < 0) return n; //n = (p->rx_status & 0x0F) - 9; //val->i = n * ((n > 0) ? 10 : 6); /* S-meter value is returned in the lower 4 bits. 0x00 = S0 (-54dB) 0x01 = S1 0x02 = S2 ... 0x09 = S9 (0dB) 0x0A = S9+10 (10dB) 0x0B = S9+20 and so on */ n = (p->rx_status & 0x0F); if (n < 0x0A) { val->i = (6*n)-54; } else { val->i = 10*(n-9); } return RIG_OK; } static int ft817_get_raw_smeter_level(RIG *rig, value_t *val) { struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv; int n; if (check_cache_timeout(&p->rx_status_tv)) if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_RX_STATUS)) < 0) return n; val->i = p->rx_status & 0x0F; return RIG_OK; } int ft817_get_level (RIG *rig, vfo_t vfo, setting_t level, value_t *val) { if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; switch (level) { case RIG_LEVEL_STRENGTH: /* The front-end will always call for RAWSTR and use the cal_table */ return ft817_get_smeter_level(rig, val); break; case RIG_LEVEL_RAWSTR: return ft817_get_raw_smeter_level(rig, val); break; case RIG_LEVEL_RFPOWER: return ft817_get_pometer_level(rig, val); break; default: return -RIG_EINVAL; } return RIG_OK; } int ft817_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) { struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; if (check_cache_timeout(&p->rx_status_tv)) if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_RX_STATUS)) < 0) return n; /* TODO: consider bit 6 too ??? (CTCSS/DCS code match) */ if (p->rx_status & 0x80) *dcd = RIG_DCD_OFF; else *dcd = RIG_DCD_ON; return RIG_OK; } /* ---------------------------------------------------------------------- */ static int ft817_read_ack(RIG *rig) { #if (FT817_POST_WRITE_DELAY == 0) char dummy; int n; if ((n = read_block(&rig->state.rigport, &dummy, 1)) < 0) { rig_debug(RIG_DEBUG_ERR, "ft817: error reading ack\n"); return n; } rig_debug(RIG_DEBUG_TRACE,"ft817: ack received (%d)\n", dummy); if (dummy != 0) return -RIG_ERJCTED; #endif return RIG_OK; } /* * private helper function to send a private command sequence. * Must only be complete sequences. */ static int ft817_send_cmd(RIG *rig, int index) { struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv; if (p->pcs[index].ncomp == 0) { rig_debug(RIG_DEBUG_VERBOSE, "ft817: Incomplete sequence\n"); return -RIG_EINTERNAL; } write_block(&rig->state.rigport, (char *) p->pcs[index].nseq, YAESU_CMD_LENGTH); return ft817_read_ack(rig); } /* * The same for incomplete commands. */ static int ft817_send_icmd(RIG *rig, int index, unsigned char *data) { struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv; unsigned char cmd[YAESU_CMD_LENGTH]; if (p->pcs[index].ncomp == 1) { rig_debug(RIG_DEBUG_VERBOSE, "ft817: Complete sequence\n"); return -RIG_EINTERNAL; } cmd[YAESU_CMD_LENGTH - 1] = p->pcs[index].nseq[YAESU_CMD_LENGTH - 1]; memcpy(cmd, data, YAESU_CMD_LENGTH - 1); write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); return ft817_read_ack(rig); } /* ---------------------------------------------------------------------- */ int ft817_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned char data[YAESU_CMD_LENGTH - 1]; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE,"ft817: requested freq = %"PRIfreq" Hz\n", freq); /* fill in the frequency */ to_bcd_be(data, (freq + 5) / 10, 8); return ft817_send_icmd(rig, FT817_NATIVE_CAT_SET_FREQ, data); } int ft817_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { int index; /* index of sequence to send */ if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE,"ft817: generic mode = %x \n", mode); switch(mode) { case RIG_MODE_AM: index = FT817_NATIVE_CAT_SET_MODE_AM; break; case RIG_MODE_CW: index = FT817_NATIVE_CAT_SET_MODE_CW; break; case RIG_MODE_USB: index = FT817_NATIVE_CAT_SET_MODE_USB; break; case RIG_MODE_LSB: index = FT817_NATIVE_CAT_SET_MODE_LSB; break; case RIG_MODE_RTTY: index = FT817_NATIVE_CAT_SET_MODE_DIG; break; case RIG_MODE_FM: index = FT817_NATIVE_CAT_SET_MODE_FM; break; case RIG_MODE_WFM: /* can not be set, it is implicit when changing band */ // index = FT817_NATIVE_CAT_SET_MODE_FM; return -RIG_EINVAL; break; case RIG_MODE_CWR: index = FT817_NATIVE_CAT_SET_MODE_CWR; break; case RIG_MODE_PKTFM: index = FT817_NATIVE_CAT_SET_MODE_PKT; break; default: return -RIG_EINVAL; } /* just ignore passband */ /* if (width != RIG_PASSBAND_NORMAL) */ /* return -RIG_EINVAL; */ return ft817_send_cmd(rig, index); } int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { int index, n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft817: ft817_set_ptt called\n"); switch(ptt) { case RIG_PTT_ON: index = FT817_NATIVE_CAT_PTT_ON; break; case RIG_PTT_OFF: index = FT817_NATIVE_CAT_PTT_OFF; break; default: return -RIG_EINVAL; } n = ft817_send_cmd(rig, index); if (n < 0 && n != -RIG_ERJCTED) return n; return RIG_OK; } int ft817_set_func (RIG *rig, vfo_t vfo, setting_t func, int status) { if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; switch (func) { case RIG_FUNC_LOCK: if (status) return ft817_send_cmd (rig, FT817_NATIVE_CAT_LOCK_ON); else return ft817_send_cmd (rig, FT817_NATIVE_CAT_LOCK_OFF); case RIG_FUNC_TONE: if (status) return ft817_send_cmd (rig, FT817_NATIVE_CAT_SET_CTCSS_ENC_ON); else return ft817_send_cmd (rig, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF); case RIG_FUNC_TSQL: if (status) return ft817_send_cmd (rig, FT817_NATIVE_CAT_SET_CTCSS_ON); else return ft817_send_cmd (rig, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF); default: return -RIG_EINVAL; } } int ft817_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code) { unsigned char data[YAESU_CMD_LENGTH - 1]; /* int n; */ if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft817: set DCS code (%d)\n", code); if (code == 0) return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF); /* fill in the DCS code - the rig doesn't support separate codes... */ to_bcd_be(data, code, 4); to_bcd_be(data + 2, code, 4); /* FT-817 does not have the DCS_ENC_ON command, so we just set the tone here */ /* if ((n = ft817_send_icmd(rig, FT817_NATIVE_CAT_SET_DCS_CODE, data)) < 0) */ /* return n; */ /* return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_DCS_ENC_ON); */ return ft817_send_icmd(rig, FT817_NATIVE_CAT_SET_DCS_CODE, data); } int ft817_set_dcs_sql (RIG *rig, vfo_t vfo, tone_t code) { unsigned char data[YAESU_CMD_LENGTH - 1]; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft817: set DCS sql (%d)\n", code); if (code == 0) return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF); /* fill in the DCS code - the rig doesn't support separate codes... */ to_bcd_be(data, code, 4); to_bcd_be(data + 2, code, 4); if ((n = ft817_send_icmd(rig, FT817_NATIVE_CAT_SET_DCS_CODE, data)) < 0) return n; return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_DCS_ON); } int ft817_set_ctcss_tone (RIG *rig, vfo_t vfo, tone_t tone) { unsigned char data[YAESU_CMD_LENGTH - 1]; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft817: set CTCSS tone (%.1f)\n", tone / 10.0); if (tone == 0) return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF); /* fill in the CTCSS freq - the rig doesn't support separate tones... */ to_bcd_be(data, tone, 4); to_bcd_be(data + 2, tone, 4); if ((n = ft817_send_icmd(rig, FT817_NATIVE_CAT_SET_CTCSS_FREQ, data)) < 0) return n; return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_CTCSS_ENC_ON); } int ft817_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone) { unsigned char data[YAESU_CMD_LENGTH - 1]; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft817: set CTCSS sql (%.1f)\n", tone / 10.0); if (tone == 0) return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_CTCSS_DCS_OFF); /* fill in the CTCSS freq - the rig doesn't support separate tones... */ to_bcd_be(data, tone, 4); to_bcd_be(data + 2, tone, 4); if ((n = ft817_send_icmd(rig, FT817_NATIVE_CAT_SET_CTCSS_FREQ, data)) < 0) return n; return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_CTCSS_ON); } int ft817_set_rptr_shift (RIG *rig, vfo_t vfo, rptr_shift_t shift) { /* Note: this doesn't have effect unless FT817 is in FM mode although the command is accepted in any mode. */ if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft817: set repeter shift = %i\n", shift); switch (shift) { case RIG_RPT_SHIFT_NONE: return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX); case RIG_RPT_SHIFT_MINUS: return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_RPT_SHIFT_MINUS); case RIG_RPT_SHIFT_PLUS: return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_RPT_SHIFT_PLUS); } return -RIG_EINVAL; } int ft817_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t offs) { unsigned char data[YAESU_CMD_LENGTH - 1]; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft817: set repeter offs = %li\n", offs); /* fill in the offset freq */ to_bcd_be(data, offs / 10, 8); return ft817_send_icmd(rig, FT817_NATIVE_CAT_SET_RPT_OFFSET, data); } int ft817_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) { unsigned char data[YAESU_CMD_LENGTH - 1]; int n; if (vfo != RIG_VFO_CURR) return -RIG_ENTARGET; rig_debug(RIG_DEBUG_VERBOSE, "ft817: set rit = %li)\n", rit); /* fill in the RIT freq */ data[0] = (rit < 0) ? 255 : 0; data[1] = 0; to_bcd_be(data + 2, labs(rit) / 10, 4); if ((n = ft817_send_icmd(rig, FT817_NATIVE_CAT_SET_CLAR_FREQ, data)) < 0) return n; /* the rig rejects if these are repeated - don't confuse user with retcode */ if (rit == 0) ft817_send_cmd(rig, FT817_NATIVE_CAT_CLAR_OFF); else ft817_send_cmd(rig, FT817_NATIVE_CAT_CLAR_ON); return RIG_OK; } int ft817_set_powerstat(RIG *rig, powerstat_t status) { switch (status) { case RIG_POWER_OFF: return ft817_send_cmd(rig, FT817_NATIVE_CAT_PWR_OFF); case RIG_POWER_ON: return ft817_send_cmd(rig, FT817_NATIVE_CAT_PWR_ON); case RIG_POWER_STANDBY: default: return -RIG_EINVAL; } } int ft817_vfo_op (RIG *rig, vfo_t vfo, vfo_op_t op) { switch (op) { case RIG_OP_TOGGLE: return ft817_send_cmd(rig, FT817_NATIVE_CAT_SET_VFOAB); default: return -RIG_EINVAL; } } /* FIXME: this function silently ignores the vfo args and just turns split ON or OFF. */ int ft817_set_split_vfo (RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { int index, n; /* if (vfo != RIG_VFO_CURR) */ /* return -RIG_ENTARGET; */ rig_debug(RIG_DEBUG_VERBOSE, "ft817: ft817_set_split_vfo called\n"); switch (split) { case RIG_SPLIT_ON: index = FT817_NATIVE_CAT_SPLIT_ON; break; case RIG_SPLIT_OFF: index = FT817_NATIVE_CAT_SPLIT_OFF; break; default: return -RIG_EINVAL; } n = ft817_send_cmd (rig, index); if (n < 0 && n != -RIG_ERJCTED) return n; return RIG_OK; } /* FIXME: currently ignores mode and freq */ /* No documentation on how to interpret it but the max number of bars on the display is 10 and I measure: 8 bars = 5W 5 bars = 2.5W 3 bars = 1W 1 bar = 0.5W */ int ft817_power2mW (RIG *rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode) { *mwpower = (int) (power*6000); return RIG_OK; } /* FIXME: currently ignores mode and freq */ int ft817_mW2power (RIG *rig, float *power, unsigned int mwpower, freq_t freq, rmode_t mode) { *power = mwpower/6000.0; return RIG_OK; } /* ---------------------------------------------------------------------- */ hamlib-1.2.15.3/yaesu/Makefile.am0000644000175000017500000000172712044564477013324 00000000000000## Process this file with automake to produce Makefile.in ## Yeasu radios that use the legacy CAT commands YAESUSRC = ft100.c ft747.c ft817.c ft847.c ft890.c ft900.c ft920.c \ ft1000mp.c ft857.c ft897.c ft990.c frg8800.c \ ft757gx.c ft736.c frg100.c frg9600.c ft1000d.c \ vr5000.c ft767gx.c ft840.c ft980.c vx1700.c ## Yaesu radios that use the new Kenwood style CAT commands NEWCATSRC = newcat.c ft450.c ft950.c ft2000.c ft9000.c ft5000.c pkglib_LTLIBRARIES = hamlib-yaesu.la hamlib_yaesu_la_SOURCES = $(YAESUSRC) $(NEWCATSRC) yaesu.c hamlib_yaesu_la_LDFLAGS = -no-undefined -module -avoid-version hamlib_yaesu_la_LIBADD = $(top_builddir)/lib/libmisc.la \ @MATH_LIBS@ \ $(top_builddir)/src/libhamlib.la EXTRA_DIST = README.ft890 README.ft920 noinst_HEADERS = ft100.h ft747.h ft817.h ft847.h ft890.h ft900.h ft920.h \ ft1000mp.h ft857.h ft897.h ft990.h yaesu.h \ ft757gx.h ft767gx.h ft450.h ft950.h ft2000.h ft9000.h ft5000.h \ ft840.h vx1700.h newcat.h hamlib-1.2.15.3/yaesu/ft2000.h0000644000175000017500000001066412044564477012354 00000000000000/* * hamlib - (C) Frank Singleton 2000 (javabear at users.sourceforge.net) * * ft2000.h - (C) Nate Bargmann 2007 (n0nb at arrl.net) * (C) Stephane Fillod 2008 * * This shared library provides an API for communicating * via serial interface to an FT-2000 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT2000_H #define _FT2000_H 1 #if 0 #define TRUE 1 #define FALSE 0 #define ON TRUE #define OFF FALSE #endif #define FT2000_VFO_ALL (RIG_VFO_A|RIG_VFO_B) /* Receiver caps */ #define FT2000_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|\ RIG_MODE_RTTY|RIG_MODE_RTTYR|\ RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM) #define FT2000_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|\ RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB) #define FT2000_AM_RX_MODES (RIG_MODE_AM) #define FT2000_FM_RX_MODES (RIG_MODE_FM|RIG_MODE_PKTFM) #define FT2000_CW_RTTY_PKT_RX_MODES (RIG_MODE_RTTY|RIG_MODE_RTTYR|\ RIG_MODE_PKTUSB|RIG_MODE_PKTLSB|RIG_MODE_CW|RIG_MODE_CWR) /* TRX caps */ #define FT2000_OTHER_TX_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_RTTY| \ RIG_MODE_PKTLSB|RIG_MODE_PKTUSB|RIG_MODE_PKTFM) /* 100 W class */ #define FT2000_AM_TX_MODES (RIG_MODE_AM) /* set 25W max */ /* TBC */ #define FT2000_LEVELS (RIG_LEVEL_ATT|RIG_LEVEL_PREAMP|\ RIG_LEVEL_ALC|RIG_LEVEL_RAWSTR|RIG_LEVEL_SWR|\ RIG_LEVEL_RFPOWER|RIG_LEVEL_RF|RIG_LEVEL_SQL|\ RIG_LEVEL_MICGAIN|RIG_LEVEL_IF|RIG_LEVEL_CWPITCH|\ RIG_LEVEL_KEYSPD|RIG_LEVEL_AF|RIG_LEVEL_AGC|\ RIG_LEVEL_METER|RIG_LEVEL_BKINDL|RIG_LEVEL_SQL|\ RIG_LEVEL_VOXGAIN|RIG_LEVEL_VOXDELAY|RIG_LEVEL_COMP|\ RIG_LEVEL_ANTIVOX|RIG_LEVEL_NR|RIG_LEVEL_NOTCHF) /* TBC */ #define FT2000_FUNCS (RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_LOCK|\ RIG_FUNC_MON|RIG_FUNC_NB|RIG_FUNC_NR|RIG_FUNC_VOX|\ RIG_FUNC_FBKIN|RIG_FUNC_COMP|RIG_FUNC_ANF|RIG_FUNC_MN) /* TBC */ #define FT2000_VFO_OPS (RIG_OP_TUNE|RIG_OP_CPY|RIG_OP_XCHG|\ RIG_OP_UP|RIG_OP_DOWN|RIG_OP_BAND_UP|RIG_OP_BAND_DOWN|\ RIG_OP_TO_VFO|RIG_OP_FROM_VFO|RIG_OP_TOGGLE) /* TBC */ #define FT2000_STR_CAL { 16, \ { \ { 0, -54 }, /* S0 */ \ { 12, -48 }, /* S1 */ \ { 27, -42 }, /* S2 */ \ { 40, -36 }, /* S3 */ \ { 55, -30 }, /* S4 */ \ { 65, -24 }, /* S5 */ \ { 80, -18 }, /* S6 */ \ { 95, -12 }, /* S7 */ \ { 112, -6 }, /* S8 */ \ { 130, 0 }, /* S9 */ \ { 150, 10 }, /* +10 */ \ { 172, 20 }, /* +20 */ \ { 190, 30 }, /* +30 */ \ { 220, 40 }, /* +40 */ \ { 240, 50 }, /* +50 */ \ { 255, 60 }, /* +60 */ \ } } /* * Other features (used by rig_caps) * */ #define FT2000_TX_ANTS (RIG_ANT_1|RIG_ANT_2) #define FT2000_MEM_CHNL_LENGTH 1 /* 0x10 P1 = 01 return size */ #define FT2000_OP_DATA_LENGTH 19 /* 0x10 P1 = 03 return size */ #define FT2000_VFO_DATA_LENGTH 18 /* 0x10 P1 = 03 return size -- A & B returned */ #define FT2000_MEM_CHNL_DATA_LENGTH 19 /* 0x10 P1 = 04, P4 = 0x01-0x20 return size */ #define FT2000_STATUS_FLAGS_LENGTH 5 /* 0xf7, 0xfa return size */ #define FT2000_ALL_DATA_LENGTH 649 /* 0x10 P1 = 00 return size */ /* Timing values in mS */ // #define FT2000_PACING_INTERVAL 5 // #define FT2000_PACING_DEFAULT_VALUE 0 /* Delay between bytes sent to FT-2000 * Should not exceed value set in CAT TOT menu (rig default is 10 mSec) */ #define FT2000_WRITE_DELAY 0 /* Delay sequential fast writes */ #define FT2000_POST_WRITE_DELAY 5 #endif /* _FT2000_H */ hamlib-1.2.15.3/yaesu/ft9000.c0000644000175000017500000001772012044564477012356 00000000000000/* * hamlib - (C) Frank Singleton 9000 (javabear at users.sourceforge.net) * * ft9000.c - (C) Nate Bargmann 2007 (n0nb at arrl.net) * (C) Stephane Fillod 2008 * (C) Terry Embry 2008-2009 * * This shared library provides an API for communicating * via serial interface to an FT-9000 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "hamlib/rig.h" #include "bandplan.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "newcat.h" #include "ft9000.h" #include "idx_builtin.h" #include "tones.h" /* * ft9000 rigs capabilities. * Also this struct is READONLY! * */ const struct rig_caps ft9000_caps = { .rig_model = RIG_MODEL_FT9000, .model_name = "FTDX-9000", .mfg_name = "Yaesu", .version = NEWCAT_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, /* Default rate per manual */ .serial_rate_max = 38400, .serial_data_bits = 8, .serial_stop_bits = 1, /* Assumed since manual makes no mention */ .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_HARDWARE, .write_delay = FT9000_WRITE_DELAY, .post_write_delay = FT9000_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = FT9000_FUNCS, .has_set_func = FT9000_FUNCS, .has_get_level = FT9000_LEVELS, .has_set_level = RIG_LEVEL_SET(FT9000_LEVELS), .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .level_gran = { [LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } }, [LVL_CWPITCH] = { .min = { .i = 300 }, .max = { .i = 1050 }, .step = { .i = 50 } }, }, .ctcss_list = common_ctcss_list, .dcs_list = NULL, .preamp = { 10, 20, RIG_DBLST_END, }, /* TBC */ .attenuator = { 6, 12, 18, RIG_DBLST_END, }, .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(1000), .vfo_ops = FT9000_VFO_OPS, .targetable_vfo = RIG_TARGETABLE_FREQ|RIG_TARGETABLE_MODE, .transceive = RIG_TRN_OFF, /* May enable later as the 9000 has an Auto Info command */ .bank_qty = 0, .chan_desc_sz = 0, .str_cal = FT9000_STR_CAL, .chan_list = { /* TBC */ { 1, 99, RIG_MTYPE_MEM, NEWCAT_MEM_CAP }, { 100, 117, RIG_MTYPE_EDGE, NEWCAT_MEM_CAP }, /* two by two */ RIG_CHAN_END, }, .rx_range_list1 = { /* General coverage + ham */ {kHz(30), MHz(60), FT9000_ALL_RX_MODES, -1, -1, FT9000_VFO_ALL, FT9000_TX_ANTS|RIG_ANT_5}, RIG_FRNG_END, }, .tx_range_list1 = { FRQ_RNG_HF(1, FT9000_OTHER_TX_MODES, W(5), W(400), FT9000_VFO_ALL, FT9000_TX_ANTS), FRQ_RNG_HF(1, FT9000_AM_TX_MODES, W(2), W(100), FT9000_VFO_ALL, FT9000_TX_ANTS), /* AM class */ FRQ_RNG_6m(1, FT9000_OTHER_TX_MODES, W(5), W(400), FT9000_VFO_ALL, FT9000_TX_ANTS), FRQ_RNG_6m(1, FT9000_AM_TX_MODES, W(2), W(100), FT9000_VFO_ALL, FT9000_TX_ANTS), /* AM class */ RIG_FRNG_END, }, .rx_range_list2 = { {kHz(30), MHz(56), FT9000_ALL_RX_MODES, -1, -1, FT9000_VFO_ALL, FT9000_TX_ANTS|RIG_ANT_5}, RIG_FRNG_END, }, .tx_range_list2 = { FRQ_RNG_HF(2, FT9000_OTHER_TX_MODES, W(5), W(400), FT9000_VFO_ALL, FT9000_TX_ANTS), FRQ_RNG_HF(2, FT9000_AM_TX_MODES, W(2), W(100), FT9000_VFO_ALL, FT9000_TX_ANTS), /* AM class */ FRQ_RNG_6m(2, FT9000_OTHER_TX_MODES, W(5), W(400), FT9000_VFO_ALL, FT9000_TX_ANTS), FRQ_RNG_6m(2, FT9000_AM_TX_MODES, W(2), W(100), FT9000_VFO_ALL, FT9000_TX_ANTS), /* AM class */ RIG_FRNG_END, }, .tuning_steps = { {FT9000_SSB_CW_RX_MODES, Hz(10)}, /* Normal */ {FT9000_SSB_CW_RX_MODES, Hz(100)}, /* Fast */ {FT9000_AM_RX_MODES, Hz(100)}, /* Normal */ {FT9000_AM_RX_MODES, kHz(1)}, /* Fast */ {FT9000_FM_RX_MODES, Hz(100)}, /* Normal */ {FT9000_FM_RX_MODES, kHz(1)}, /* Fast */ RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {FT9000_CW_RTTY_PKT_RX_MODES, Hz(1800)}, /* Normal CW, RTTY, PKT/USER */ {FT9000_CW_RTTY_PKT_RX_MODES, Hz(500)}, /* Narrow CW, RTTY, PKT/USER */ {FT9000_CW_RTTY_PKT_RX_MODES, Hz(2400)}, /* Wide CW, RTTY, PKT/USER */ {RIG_MODE_SSB, Hz(2400)}, /* Normal SSB */ {RIG_MODE_SSB, Hz(1800)}, /* Narrow SSB */ {RIG_MODE_SSB, Hz(3000)}, /* Wide SSB */ {RIG_MODE_AM, Hz(6000)}, /* Normal AM */ {RIG_MODE_AM, Hz(3000)}, /* Narrow AM */ {FT9000_FM_RX_MODES, Hz(12000)}, /* Normal FM */ {FT9000_FM_RX_MODES, Hz(8000)}, /* Narrow FM */ RIG_FLT_END, }, .priv = NULL, .rig_init = newcat_init, .rig_cleanup = newcat_cleanup, .rig_open = newcat_open, /* port opened */ .rig_close = newcat_close, /* port closed */ .set_freq = newcat_set_freq, .get_freq = newcat_get_freq, .set_mode = newcat_set_mode, .get_mode = newcat_get_mode, .set_vfo = newcat_set_vfo, .get_vfo = newcat_get_vfo, .set_ptt = newcat_set_ptt, .get_ptt = newcat_get_ptt, .set_split_vfo = newcat_set_split_vfo, .get_split_vfo = newcat_get_split_vfo, .set_rit = newcat_set_rit, .get_rit = newcat_get_rit, .set_xit = newcat_set_xit, .get_xit = newcat_get_xit, .set_ant = newcat_set_ant, .get_ant = newcat_get_ant, .get_func = newcat_get_func, .set_func = newcat_set_func, .get_level = newcat_get_level, .set_level = newcat_set_level, .get_mem = newcat_get_mem, .set_mem = newcat_set_mem, .vfo_op = newcat_vfo_op, .get_info = newcat_get_info, .power2mW = newcat_power2mW, .mW2power = newcat_mW2power, .set_rptr_shift = newcat_set_rptr_shift, .get_rptr_shift = newcat_get_rptr_shift, .set_ctcss_tone = newcat_set_ctcss_tone, .get_ctcss_tone = newcat_get_ctcss_tone, .set_ctcss_sql = newcat_set_ctcss_sql, .get_ctcss_sql = newcat_get_ctcss_sql, .set_powerstat = newcat_set_powerstat, .get_powerstat = newcat_get_powerstat, .get_ts = newcat_get_ts, .set_ts = newcat_set_ts, .set_trn = newcat_set_trn, .get_trn = newcat_get_trn, .set_channel = newcat_set_channel, .get_channel = newcat_get_channel, }; hamlib-1.2.15.3/yaesu/ft767gx.h0000644000175000017500000000321112044564477012643 00000000000000/* * hamlib - (C) Frank Singleton 2000 (vk3fcs@@ix.netcom.com) * * ft767gx.h - (C) Frank Singleton 2000 (vk3fcs@@ix.netcom.com) * adapted from ft757gx.h by Steve Conklin * This shared library provides an API for communicating * via serial interface to an FT-767GX using the "CAT" interface * box (FIF-232C) or similar (max232 + some capacitors :-) * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT767GX_H #define _FT767GX_H 1 #define FT767GX_STATUS_UPDATE_DATA_LENGTH 86 #define FT767GX_PACING_INTERVAL 5 #define FT767GX_PACING_DEFAULT_VALUE 0 #define FT767GX_WRITE_DELAY 50 /* Sequential fast writes confuse my FT767GX without this delay */ #define FT767GX_POST_WRITE_DELAY 5 /* Rough safe value for default timeout */ #define FT767GX_DEFAULT_READ_TIMEOUT 345 * ( 3 + (FT767GX_PACING_INTERVAL * FT767GX_PACING_DEFAULT_VALUE)) #endif /* _FT767GX_H */ hamlib-1.2.15.3/yaesu/frg8800.c0000644000175000017500000001523712044564477012533 00000000000000/* * frg8800.c - (C) Stephane Fillod 2002-2004 * * This shared library provides an API for communicating * via serial interface to an FRG-8800 using the "CAT" interface * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "yaesu.h" /* Private helper function prototypes */ #define FRG8800_MODES (RIG_MODE_CW|RIG_MODE_SSB|RIG_MODE_AM|RIG_MODE_FM|RIG_MODE_WFM) #define FRG8800_VFOS (RIG_VFO_A) #define FRG8800_ANTS 0 static int frg8800_open(RIG *rig); static int frg8800_close(RIG *rig); static int frg8800_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int frg8800_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int frg8800_set_powerstat(RIG *rig, powerstat_t status); /* * frg8800 rigs capabilities. * Also this struct is READONLY! * */ const struct rig_caps frg8800_caps = { .rig_model = RIG_MODEL_FRG8800, .model_name = "FRG-8800", .mfg_name = "Yaesu", .version = "0.2", .copyright = "LGPL", .status = RIG_STATUS_UNTESTED, .rig_type = RIG_TYPE_RECEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = 0, .post_write_delay = 300, .timeout = 2000, .retry = 0, .has_get_func = RIG_FUNC_NONE, .has_set_func = RIG_FUNC_NONE, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .vfo_ops = RIG_OP_NONE, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(0), .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = RIG_TARGETABLE_FREQ, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { RIG_CHAN_END, }, .rx_range_list1 = { {kHz(150), MHz(29.999), FRG8800_MODES, -1, -1, FRG8800_VFOS, FRG8800_ANTS }, {MHz(118), MHz(173.999), FRG8800_MODES, -1, -1, FRG8800_VFOS, FRG8800_ANTS }, RIG_FRNG_END, }, /* Region 1 rx ranges */ .tx_range_list1 = { RIG_FRNG_END, }, /* region 1 TX ranges */ .rx_range_list2 = { {kHz(150), MHz(29.999), FRG8800_MODES, -1, -1, FRG8800_VFOS, FRG8800_ANTS }, {MHz(118), MHz(173.999), FRG8800_MODES, -1, -1, FRG8800_VFOS, FRG8800_ANTS }, RIG_FRNG_END, }, /* Region 2 rx ranges */ .tx_range_list2 = { RIG_FRNG_END, }, /* region 2 TX ranges */ .tuning_steps = { {FRG8800_MODES, Hz(25)}, RIG_TS_END, }, /* mode/filter list, remember: order matters! */ .filters = { {RIG_MODE_AM, kHz(6)}, {RIG_MODE_SSB|RIG_MODE_CW|RIG_MODE_AM, kHz(2.7)}, {RIG_MODE_CW, Hz(500)}, {RIG_MODE_FM, kHz(12.5)}, {RIG_MODE_WFM, kHz(230)}, /* optional unit */ RIG_FLT_END, }, .rig_open = frg8800_open, .rig_close = frg8800_close, .set_freq = frg8800_set_freq, .set_mode = frg8800_set_mode, .set_powerstat = frg8800_set_powerstat, }; #define MODE_SET_AM 0x00 #define MODE_SET_LSB 0x01 #define MODE_SET_USB 0x02 #define MODE_SET_CW 0x03 #define MODE_SET_FM 0x0c #define MODE_SET_FMW 0x04 /* * frg8800_open routine * */ int frg8800_open(RIG *rig) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x00}; rig_debug(RIG_DEBUG_TRACE, "frg8800: frg8800_open called\n"); /* send Ext Cntl ON: Activate CAT */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int frg8800_close(RIG *rig) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x80, 0x00}; rig_debug(RIG_DEBUG_TRACE, "frg8800: frg8800_close called\n"); /* send Ext Cntl OFF: Deactivate CAT */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int frg8800_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x01}; rig_debug(RIG_DEBUG_TRACE,"frg8800: frg8800_set_freq called\n"); /* store bcd format in cmd (LSB) */ to_bcd(cmd, freq/10, 8); /* Byte1: 100Hz's and 25Hz step code */ cmd[0] = ( cmd[0]&0xf0 ) | ( 1 << ((((long long)freq)%100)/25) ); /* Frequency set */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int frg8800_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x80}; unsigned char md; rig_debug(RIG_DEBUG_TRACE,"frg8800: frg8800_set_mode called %x\n", mode); /* * translate mode from generic to frg8800 specific */ switch(mode) { case RIG_MODE_AM: md = MODE_SET_AM; break; case RIG_MODE_CW: md = MODE_SET_CW; break; case RIG_MODE_USB: md = MODE_SET_USB; break; case RIG_MODE_LSB: md = MODE_SET_LSB; break; case RIG_MODE_FM: md = MODE_SET_FM; break; case RIG_MODE_WFM: md = MODE_SET_FMW; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } if (width != RIG_PASSBAND_NORMAL && width < rig_passband_normal(rig, mode)) { md |= 0x08; } cmd[3] = md; /* Mode set */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } int frg8800_set_powerstat(RIG *rig, powerstat_t status) { unsigned char cmd[YAESU_CMD_LENGTH] = { 0x00, 0x00, 0x00, 0x00, 0x80}; rig_debug(RIG_DEBUG_TRACE,"frg8800: frg8800_set_powerstat called\n"); cmd[3] = status == RIG_POWER_OFF ? 0xff : 0xfe; /* Frequency set */ return write_block(&rig->state.rigport, (char *) cmd, YAESU_CMD_LENGTH); } hamlib-1.2.15.3/yaesu/ft747.c0000644000175000017500000005350012044564477012303 00000000000000/* * hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com) * (C) Stephane Fillod 2000-2010 * * ft747.c - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com) * This shared library provides an API for communicating * via serial interface to an FT-747GX using the "CAT" interface * box (FIF-232C) or similar * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* * TODO - FS * * 1. rationalise code, more helper functions [started] * 2. get_channel, set_func/get_func * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include /* String function definitions */ #include /* UNIX standard function definitions */ #include "hamlib/rig.h" #include "serial.h" #include "misc.h" #include "yaesu.h" #include "ft747.h" /* Private helper function prototypes */ static int ft747_get_update_data(RIG *rig); static int ft747_send_priv_cmd(RIG *rig, unsigned char ci); /* Native ft747 cmd set prototypes. These are READ ONLY as each */ /* rig instance will copy from these and modify if required . */ /* Complete sequences (1) can be read and used directly as a cmd sequence . */ /* Incomplete sequences (0) must be completed with extra parameters */ /* eg: mem number, or freq etc.. */ static const yaesu_cmd_set_t ft747_ncmd[] = { { 1, { 0x00, 0x00, 0x00, 0x00, 0x01 } }, /* split = off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x01 } }, /* split = on */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x02 } }, /* recall memory*/ { 0, { 0x00, 0x00, 0x00, 0x00, 0x03 } }, /* vfo to memory*/ { 1, { 0x00, 0x00, 0x00, 0x00, 0x04 } }, /* dial lock = off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x04 } }, /* dial lock = on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x05 } }, /* select vfo A */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x05 } }, /* select vfo B */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x06 } }, /* memory to vfo*/ { 1, { 0x00, 0x00, 0x00, 0x00, 0x07 } }, /* up 500 khz */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x08 } }, /* down 500 khz */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x09 } }, /* clarify off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x09 } }, /* clarify on */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0a } }, /* set freq */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0c } }, /* mode set LSB */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0c } }, /* mode set USB */ { 1, { 0x00, 0x00, 0x00, 0x02, 0x0c } }, /* mode set CWW */ { 1, { 0x00, 0x00, 0x00, 0x03, 0x0c } }, /* mode set CWN */ { 1, { 0x00, 0x00, 0x00, 0x04, 0x0c } }, /* mode set AMW */ { 1, { 0x00, 0x00, 0x00, 0x05, 0x0c } }, /* mode set AMN */ { 1, { 0x00, 0x00, 0x00, 0x06, 0x0c } }, /* mode set FMW */ { 1, { 0x00, 0x00, 0x00, 0x07, 0x0c } }, /* mode set FMN */ { 0, { 0x00, 0x00, 0x00, 0x00, 0x0e } }, /* pacing set */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x0f } }, /* ptt off */ { 1, { 0x00, 0x00, 0x00, 0x01, 0x0f } }, /* ptt on */ { 1, { 0x00, 0x00, 0x00, 0x00, 0x10 } }, /* request update from rig */ }; /* * Receiver caps */ #define FT747_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB) #define FT747_SSB_CW_RX_MODES (RIG_MODE_CW|RIG_MODE_USB|RIG_MODE_LSB) #define FT747_AM_RX_MODES (RIG_MODE_AM) #define FT747_FM_RX_MODES (RIG_MODE_FM) /* * TX caps */ #define FT747_OTHER_TX_MODES (RIG_MODE_CW| RIG_MODE_USB| RIG_MODE_LSB ) /* 100 W class */ #define FT747_AM_TX_MODES (RIG_MODE_AM ) /* set 25W max */ /* * no opcode for RIG_FUNC_FAGC|RIG_FUNC_NB|RIG_FUNC_COMP|RIG_FUNC_VOX|RIG_FUNC_TONE|RIG_FUNC_TSQL|RIG_FUNC_SBKIN|RIG_FUNC_FBKIN * TODO: LOCK */ #define FT747_FUNC_ALL (RIG_FUNC_LOCK) #define FT747_VFOS (RIG_VFO_A|RIG_VFO_B) /* * FT747 channel caps. * Last 2 channels don't have split memory */ #define FT747_SPLIT_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .split = 1, \ .tx_freq = 1, \ .tx_mode = 1, \ .tx_width = 1, \ .funcs = RIG_FUNC_LOCK, \ } #define FT747_NOSPLIT_MEM_CAP { \ .freq = 1, \ .mode = 1, \ .width = 1, \ .funcs = RIG_FUNC_LOCK, \ } /* * Private data * */ struct ft747_priv_data { unsigned char p_cmd[YAESU_CMD_LENGTH]; /* private copy of 1 constructed CAT cmd */ unsigned char update_data[FT747_STATUS_UPDATE_DATA_LENGTH]; /* returned data */ struct timeval status_tv; }; /* * ft747 rigs capabilities. * Also this struct is READONLY! */ const struct rig_caps ft747_caps = { .rig_model = RIG_MODEL_FT747, .model_name = "FT-747GX", .mfg_name = "Yaesu", .version = "0.4.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_MOBILE, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, .port_type = RIG_PORT_SERIAL, .serial_rate_min = 4800, .serial_rate_max = 4800, .serial_data_bits = 8, .serial_stop_bits = 2, .serial_parity = RIG_PARITY_NONE, .serial_handshake = RIG_HANDSHAKE_NONE, .write_delay = FT747_WRITE_DELAY, .post_write_delay = FT747_POST_WRITE_DELAY, .timeout = 2000, .retry = 0, .has_get_func = FT747_FUNC_ALL, .has_set_func = FT747_FUNC_ALL, .has_get_level = RIG_LEVEL_NONE, .has_set_level = RIG_LEVEL_NONE, .has_get_parm = RIG_PARM_NONE, .has_set_parm = RIG_PARM_NONE, .ctcss_list = NULL, .dcs_list = NULL, .preamp = { RIG_DBLST_END, }, .attenuator = { RIG_DBLST_END, }, .max_rit = Hz(0), /* 9999 */ .max_xit = Hz(0), .max_ifshift = Hz(0), .targetable_vfo = 0, .transceive = RIG_TRN_OFF, .bank_qty = 0, .chan_desc_sz = 0, .chan_list = { { 0, 17, RIG_MTYPE_MEM, FT747_SPLIT_MEM_CAP }, { 18, 19, RIG_MTYPE_MEM, FT747_NOSPLIT_MEM_CAP }, RIG_CHAN_END, }, .rx_range_list1 = { RIG_FRNG_END, }, /* FIXME: enter region 1 setting */ .tx_range_list1 = { RIG_FRNG_END, }, .rx_range_list2 = { { .start = kHz(100), .end = 29999900, .modes = FT747_ALL_RX_MODES,.low_power = -1,.high_power = -1, .vfo = FT747_VFOS}, RIG_FRNG_END, }, /* rx range */ .tx_range_list2 = { {kHz(1500),1999900,FT747_OTHER_TX_MODES,.low_power = 5000,.high_power = 100000, .vfo = FT747_VFOS}, /* 100W class */ {.start = kHz(1500),.end = 1999900,FT747_AM_TX_MODES,.low_power = 2000,.high_power = 25000, .vfo = FT747_VFOS}, /* 25W class */ {.start = kHz(3500),3999900,FT747_OTHER_TX_MODES,5000,100000,FT747_VFOS}, {.start = kHz(3500),3999900,FT747_AM_TX_MODES,2000,25000,FT747_VFOS}, {.start = kHz(7000),7499900,FT747_OTHER_TX_MODES,5000,100000,FT747_VFOS}, {.start = kHz(7000),7499900,FT747_AM_TX_MODES,2000,25000,FT747_VFOS}, {.start = MHz(10),10499900,FT747_OTHER_TX_MODES,5000,100000,FT747_VFOS}, {.start = MHz(10),10499900,FT747_AM_TX_MODES,2000,25000,FT747_VFOS}, {.start = MHz(14),14499900,FT747_OTHER_TX_MODES,5000,100000,FT747_VFOS}, {.start = MHz(14),14499900,FT747_AM_TX_MODES,2000,25000,FT747_VFOS}, {.start = MHz(18),18499900,FT747_OTHER_TX_MODES,5000,100000,FT747_VFOS}, {.start = MHz(18),18499900,FT747_AM_TX_MODES,2000,25000,FT747_VFOS}, {.start = MHz(21),21499900,FT747_OTHER_TX_MODES,5000,100000,FT747_VFOS}, {.start = MHz(21),21499900,FT747_AM_TX_MODES,2000,25000,FT747_VFOS}, {.start = kHz(24500),24999900,FT747_OTHER_TX_MODES,5000,100000,FT747_VFOS}, {.start = kHz(24500),24999900,FT747_AM_TX_MODES,2000,25000,FT747_VFOS}, {.start = MHz(28),29999900,FT747_OTHER_TX_MODES,5000,100000,FT747_VFOS}, {.start = MHz(28),29999900,FT747_AM_TX_MODES,2000,25000,FT747_VFOS}, RIG_FRNG_END, }, .tuning_steps = { {FT747_SSB_CW_RX_MODES,25}, /* fast off */ {FT747_SSB_CW_RX_MODES,2500}, /* fast on */ {FT747_AM_RX_MODES,kHz(1)}, /* fast off */ {FT747_AM_RX_MODES,kHz(10)}, /* fast on */ {FT747_FM_RX_MODES,kHz(5)}, /* fast off */ {FT747_FM_RX_MODES,12500}, /* fast on */ RIG_TS_END, }, /* mode/filter list, .remember = order matters! */ .filters = { {RIG_MODE_SSB, kHz(2.2)}, /* standard SSB filter bandwidth */ {RIG_MODE_CW, kHz(1.8)}, /* normal CW filter */ {RIG_MODE_CW, kHz(0.5)}, /* CW filter with narrow selection */ {RIG_MODE_AM, kHz(6)}, /* normal AM filter */ {RIG_MODE_AM, kHz(2.4)}, /* AM filter with narrow selection */ {RIG_MODE_FM, kHz(19)}, /* FM wide filter, with optional FM unit. */ {RIG_MODE_FM, kHz(8)}, /* FM with optional FM unit */ RIG_FLT_END, }, .priv = NULL, /* private data */ .rig_init = ft747_init, .rig_cleanup = ft747_cleanup, .rig_open = ft747_open, /* port opened */ .rig_close = ft747_close, /* port closed */ .set_freq = ft747_set_freq, /* set freq */ .get_freq = ft747_get_freq, /* get freq */ .set_mode = ft747_set_mode, /* set mode */ .get_mode = ft747_get_mode, /* get mode */ .set_vfo = ft747_set_vfo, /* set vfo */ .get_vfo = ft747_get_vfo, /* get vfo */ .set_split_vfo = ft747_set_split, /* set split */ .get_split_vfo = ft747_get_split, /* get split */ .set_ptt = ft747_set_ptt, /* set ptt */ .get_ptt = ft747_get_ptt, /* get ptt */ .set_mem = ft747_set_mem, /* set mem */ .get_mem = ft747_get_mem, /* get mem */ }; /* * _init * */ int ft747_init(RIG *rig) { struct ft747_priv_data *p; p = (struct ft747_priv_data*)malloc(sizeof(struct ft747_priv_data)); if (!p) /* whoops! memory shortage! */ return -RIG_ENOMEM; rig_debug(RIG_DEBUG_VERBOSE,"ft747:ft747_init called \n"); memset(p, 0, sizeof(struct ft747_priv_data)); rig->state.priv = (void*)p; return RIG_OK; } /* * ft747_cleanup routine * the serial port is closed by the frontend */ int ft747_cleanup(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "ft747: _cleanup called\n"); if (rig->state.priv) free(rig->state.priv); rig->state.priv = NULL; return RIG_OK; } /* * ft747_open routine * */ int ft747_open(RIG *rig) { struct rig_state *rig_s; struct ft747_priv_data *p; int ret; rig_s = &rig->state; p = (struct ft747_priv_data*)rig_s->priv; rig_debug(RIG_DEBUG_VERBOSE,"ft747:rig_open: write_delay = %i msec \n", rig_s->rigport.write_delay); rig_debug(RIG_DEBUG_VERBOSE,"ft747:rig_open: post_write_delay = %i msec \n", rig_s->rigport.post_write_delay); /* * Copy native cmd PACING to private cmd storage area */ memcpy(&p->p_cmd,&ft747_ncmd[FT_747_NATIVE_PACING].nseq,YAESU_CMD_LENGTH); p->p_cmd[3] = FT747_PACING_DEFAULT_VALUE; /* get pacing value, and store in private cmd */ rig_debug(RIG_DEBUG_VERBOSE,"ft747: read pacing = %i \n",FT747_PACING_DEFAULT_VALUE); /* send PACING cmd to rig, once for all */ ret = write_block(&rig_s->rigport, (char*)p->p_cmd, YAESU_CMD_LENGTH); if (ret < 0) return ret; rig_force_cache_timeout(&p->status_tv); return RIG_OK; } /* * ft747_close routine * */ int ft747_close(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE,"ft747:ft747_close called \n"); return RIG_OK; } /* * Example of wrapping backend function inside frontend API * */ int ft747_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { struct rig_state *rig_s; struct ft747_priv_data *p; unsigned char *cmd; /* points to sequence to send */ p = (struct ft747_priv_data*)rig->state.priv; rig_s = &rig->state; rig_debug(RIG_DEBUG_VERBOSE,"ft747: requested freq = %"PRIfreq" Hz \n", freq); /* * Copy native cmd freq_set to private cmd storage area */ memcpy(&p->p_cmd,&ft747_ncmd[FT_747_NATIVE_FREQ_SET].nseq,YAESU_CMD_LENGTH); /* store bcd format in p_cmd (LSB), round to nearest 25th Hz */ to_bcd(p->p_cmd, (freq+12)/10, 8); rig_debug(RIG_DEBUG_VERBOSE,"ft747: requested freq after conversion = %"PRIll" Hz \n", from_bcd(p->p_cmd,8)* 10 ); rig_force_cache_timeout(&p->status_tv); cmd = p->p_cmd; /* get native sequence */ return write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH); } /* * Return Freq for a given VFO */ int ft747_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { struct ft747_priv_data *p; freq_t f; int ret; rig_debug(RIG_DEBUG_VERBOSE,"ft747:ft747_get_freq called\n"); p = (struct ft747_priv_data*)rig->state.priv; ret = ft747_get_update_data(rig); /* get whole shebang from rig */ if (ret < 0) return ret; switch(vfo) { case RIG_VFO_CURR: /* grab freq and convert */ f = from_bcd_be(&(p->update_data[FT747_SUMO_DISPLAYED_FREQ]),10); break; case RIG_VFO_A: f = from_bcd_be(&(p->update_data[FT747_SUMO_VFO_A_FREQ]),10); break; case RIG_VFO_B: f = from_bcd_be(&(p->update_data[FT747_SUMO_VFO_B_FREQ]),10); break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } rig_debug(RIG_DEBUG_VERBOSE,"ft747: freq = %"PRIfreq" Hz for VFO = %s\n", f, rig_strvfo(vfo)); (*freq) = f; /* return diplayed frequency */ return RIG_OK; } /* * set mode : eg AM, CW etc for a given VFO * */ int ft747_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width ) { unsigned char cmd_index; /* index of sequence to send */ pbwidth_t width_normal; width_normal = rig_passband_normal(rig, mode); if (width == RIG_PASSBAND_NORMAL) width = width_normal; /* * translate mode from generic to ft747 specific */ rig_debug(RIG_DEBUG_VERBOSE,"ft747: generic mode = %x \n", mode); switch(mode) { case RIG_MODE_AM: if (width < width_normal) cmd_index = FT_747_NATIVE_MODE_SET_AMN; else cmd_index = FT_747_NATIVE_MODE_SET_AMW; break; case RIG_MODE_CW: if (width < width_normal) cmd_index = FT_747_NATIVE_MODE_SET_CWN; else cmd_index = FT_747_NATIVE_MODE_SET_CWW; break; case RIG_MODE_USB: cmd_index = FT_747_NATIVE_MODE_SET_USB; break; case RIG_MODE_LSB: cmd_index = FT_747_NATIVE_MODE_SET_LSB; break; case RIG_MODE_FM: if (width < width_normal) cmd_index = FT_747_NATIVE_MODE_SET_FMN; else cmd_index = FT_747_NATIVE_MODE_SET_FMW; break; default: return -RIG_EINVAL; /* sorry, wrong MODE */ } rig_debug(RIG_DEBUG_VERBOSE,"ft747: cmd_index = %i \n", cmd_index); rig_force_cache_timeout(&((struct ft747_priv_data*)rig->state.priv)->status_tv); /* * phew! now send cmd to rig */ return ft747_send_priv_cmd(rig,cmd_index); } int ft747_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) { struct ft747_priv_data *p; unsigned char mymode; /* ft747 mode */ int ret; p = (struct ft747_priv_data*)rig->state.priv; ret = ft747_get_update_data(rig); /* get whole shebang from rig */ if (ret < 0) return ret; mymode = p->update_data[FT747_SUMO_DISPLAYED_MODE]; mymode &= MODE_MASK; /* mask out bits 5 and 6 */ rig_debug(RIG_DEBUG_VERBOSE,"ft747: mymode = %x \n", mymode); /* * translate mode from ft747 to generic. */ switch(mymode & 0x1f) { case MODE_FM: (*mode) = RIG_MODE_FM; break; case MODE_AM: (*mode) = RIG_MODE_AM; break; case MODE_CW: (*mode) = RIG_MODE_CW; break; case MODE_USB: (*mode) = RIG_MODE_USB; break; case MODE_LSB: (*mode) = RIG_MODE_LSB; break; default: return -RIG_EPROTO; /* sorry, unknown mode */ break; } if (mymode & MODE_NAR) *width = rig_passband_narrow(rig, *mode); else *width = rig_passband_normal(rig, *mode); return RIG_OK; } /* * set vfo and store requested vfo for later RIG_VFO_CURR * requests. * */ int ft747_set_vfo(RIG *rig, vfo_t vfo) { struct ft747_priv_data *p; unsigned char cmd_index; /* index of sequence to send */ p = (struct ft747_priv_data*)rig->state.priv; switch(vfo) { case RIG_VFO_VFO: case RIG_VFO_CURR: return RIG_OK; case RIG_VFO_A: cmd_index = FT_747_NATIVE_VFO_A; break; case RIG_VFO_B: cmd_index = FT_747_NATIVE_VFO_B; break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } rig_force_cache_timeout(&p->status_tv); return ft747_send_priv_cmd(rig,cmd_index); } int ft747_get_vfo(RIG *rig, vfo_t *vfo) { struct ft747_priv_data *p; unsigned char status; /* ft747 status flag */ int ret; p = (struct ft747_priv_data*)rig->state.priv; ret = ft747_get_update_data(rig); /* get whole shebang from rig */ if (ret < 0) return ret; status = p->update_data[FT747_SUMO_DISPLAYED_STATUS]; status &= SF_VFOAB; /* check VFO bit*/ rig_debug(RIG_DEBUG_VERBOSE,"ft747: vfo status = %x \n", status); /* * translate vfo status from ft747 to generic. */ if (status) { rig_debug(RIG_DEBUG_VERBOSE,"ft747: VFO = B \n"); (*vfo) = RIG_VFO_B; return RIG_OK; } else { rig_debug(RIG_DEBUG_VERBOSE,"ft747: VFO = A \n"); (*vfo) = RIG_VFO_A; return RIG_OK; } } int ft747_set_split(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { unsigned char cmd_index; /* index of sequence to send */ cmd_index = split == RIG_SPLIT_ON ? FT_747_NATIVE_SPLIT_ON : FT_747_NATIVE_SPLIT_OFF; rig_force_cache_timeout(&((struct ft747_priv_data*)rig->state.priv)->status_tv); return ft747_send_priv_cmd(rig,cmd_index); } int ft747_get_split(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { struct ft747_priv_data *p; unsigned char status; /* ft747 status flag */ int ret; p = (struct ft747_priv_data*)rig->state.priv; ret = ft747_get_update_data(rig); /* get whole shebang from rig */ if (ret < 0) return ret; status = p->update_data[FT747_SUMO_DISPLAYED_STATUS]; if (((status & SF_VFOAB) && (status & SF_RXTX)) || (!(status & SF_VFOAB) && !(status & SF_RXTX))) *tx_vfo = RIG_VFO_B; else *tx_vfo = RIG_VFO_A; return RIG_OK; } int ft747_set_ptt(RIG *rig,vfo_t vfo, ptt_t ptt) { unsigned char cmd_index; /* index of sequence to send */ switch(ptt) { case RIG_PTT_OFF: cmd_index = FT_747_NATIVE_PTT_OFF; break; case RIG_PTT_ON: cmd_index = FT_747_NATIVE_PTT_ON; break; default: return -RIG_EINVAL; /* sorry, wrong VFO */ } rig_force_cache_timeout(&((struct ft747_priv_data*)rig->state.priv)->status_tv); /* * phew! now send cmd to rig */ return ft747_send_priv_cmd(rig,cmd_index); } int ft747_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { struct ft747_priv_data *p; unsigned char status; /* ft747 mode */ int ret; p = (struct ft747_priv_data*)rig->state.priv; ret = ft747_get_update_data(rig); /* get whole shebang from rig */ if (ret < 0) return ret; status = p->update_data[FT747_SUMO_DISPLAYED_STATUS]; status = status & SF_RXTX; /* check RXTX bit*/ rig_debug(RIG_DEBUG_VERBOSE,"ft747: ptt status = %x \n", status); /* * translate mode from ft747 to generic. */ if (status) { rig_debug(RIG_DEBUG_VERBOSE,"ft747: PTT = ON \n"); (*ptt) = RIG_PTT_ON; return RIG_OK; } else { rig_debug(RIG_DEBUG_VERBOSE,"ft747: PTT = OFF \n"); (*ptt) = RIG_PTT_OFF; return RIG_OK; } } int ft747_set_mem(RIG *rig, vfo_t vfo, int ch) { struct ft747_priv_data *p; p = (struct ft747_priv_data*)rig->state.priv; if (ch < 0 || ch > 0x13) return -RIG_EINVAL; /* * Copy native cmd freq_set to private cmd storage area */ memcpy(&p->p_cmd,&ft747_ncmd[FT_747_NATIVE_RECALL_MEM].nseq,YAESU_CMD_LENGTH); p->p_cmd[3] = ch; rig_force_cache_timeout(&p->status_tv); return write_block(&rig->state.rigport, (char *) p->p_cmd, YAESU_CMD_LENGTH); } int ft747_get_mem(RIG *rig, vfo_t vfo, int *ch) { struct ft747_priv_data *p; unsigned char mem_nb; int ret; p = (struct ft747_priv_data*)rig->state.priv; ret = ft747_get_update_data(rig); /* get whole shebang from rig */ if (ret < 0) return ret; mem_nb = p->update_data[FT747_SUMO_DISPLAYED_MEM]; if (mem_nb > 0x13) return -RIG_EPROTO; *ch = mem_nb; return RIG_OK; } /* * private helper function. Retrieves update data from rig. * using buffer indicated in *priv struct. * * need to use this when doing ft747_get_* stuff */ static int ft747_get_update_data(RIG *rig) { hamlib_port_t *rigport; struct ft747_priv_data *p; char last_byte; int port_timeout; int ret; p = (struct ft747_priv_data*)rig->state.priv; rigport = &rig->state.rigport; if (!rig_check_cache_timeout(&p->status_tv, FT747_CACHE_TIMEOUT)) return RIG_OK; serial_flush(rigport); /* send UPDATE comand to fetch data*/ ret = ft747_send_priv_cmd(rig,FT_747_NATIVE_UPDATE); if (ret < 0) return ret; ret = read_block(rigport, (char *) p->update_data, FT747_STATUS_UPDATE_DATA_LENGTH); if (ret < 0) return ret; /* update cache date */ gettimeofday(&p->status_tv, NULL); port_timeout = rigport->timeout; rigport->timeout = 100; /* ms */ /* read sometimes-missing last byte (345th), but don't fail */ read_block(rigport, &last_byte, 1); rigport->timeout = port_timeout; return RIG_OK; } /* * private helper function to send a private command * sequence . Must only be complete sequences. */ static int ft747_send_priv_cmd(RIG *rig, unsigned char ci) { struct rig_state *rig_s; unsigned char *cmd; /* points to sequence to send */ unsigned char cmd_index; /* index of sequence to send */ rig_s = &rig->state; cmd_index = ci; /* get command */ if (! ft747_ncmd[cmd_index].ncomp) { rig_debug(RIG_DEBUG_VERBOSE,"ft747: Attempt to send incomplete sequence \n"); return -RIG_EINVAL; } cmd = (unsigned char *) ft747_ncmd[cmd_index].nseq; /* get native sequence */ return write_block(&rig_s->rigport, (char *) cmd, YAESU_CMD_LENGTH); } hamlib-1.2.15.3/yaesu/ft847.h0000644000175000017500000001450712044564477012315 00000000000000/* * hamlib - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com) * (C) Stephane Fillod 2000-2010 * * ft847.h - (C) Frank Singleton 2000 (vk3fcs@ix.netcom.com) * (C) Stephane Fillod 2000-2010 * * This shared library provides an API for communicating * via serial interface to an FT-847 using the "CAT" interface. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef _FT847_H #define _FT847_H 1 #define FT847_WRITE_DELAY 50 /* Sequential fast writes may confuse FT847 without this delay */ #define FT847_POST_WRITE_DELAY 50 /* Rough safe value for default timeout */ #define FT847_DEFAULT_READ_TIMEOUT 2000 /* * Native FT847 functions. This is what I have to work with :-) * */ enum ft847_native_cmd_e { /* Set commands to the rig */ FT_847_NATIVE_CAT_ON = 0, FT_847_NATIVE_CAT_OFF, FT_847_NATIVE_CAT_PTT_ON, FT_847_NATIVE_CAT_PTT_OFF, FT_847_NATIVE_CAT_SAT_MODE_ON, FT_847_NATIVE_CAT_SAT_MODE_OFF, FT_847_NATIVE_CAT_SET_FREQ_MAIN, FT_847_NATIVE_CAT_SET_FREQ_SAT_RX_VFO, FT_847_NATIVE_CAT_SET_FREQ_SAT_TX_VFO, FT_847_NATIVE_CAT_SET_MODE_MAIN_LSB, /* MAIN VFO */ FT_847_NATIVE_CAT_SET_MODE_MAIN_USB, FT_847_NATIVE_CAT_SET_MODE_MAIN_CW, FT_847_NATIVE_CAT_SET_MODE_MAIN_CWR, FT_847_NATIVE_CAT_SET_MODE_MAIN_AM, FT_847_NATIVE_CAT_SET_MODE_MAIN_FM, FT_847_NATIVE_CAT_SET_MODE_MAIN_CWN, FT_847_NATIVE_CAT_SET_MODE_MAIN_CWRN, FT_847_NATIVE_CAT_SET_MODE_MAIN_AMN, FT_847_NATIVE_CAT_SET_MODE_MAIN_FMN, FT_847_NATIVE_CAT_SET_MODE_SAT_RX_LSB, /* SAT RX VFO */ FT_847_NATIVE_CAT_SET_MODE_SAT_RX_USB, FT_847_NATIVE_CAT_SET_MODE_SAT_RX_CW, FT_847_NATIVE_CAT_SET_MODE_SAT_RX_CWR, FT_847_NATIVE_CAT_SET_MODE_SAT_RX_AM, FT_847_NATIVE_CAT_SET_MODE_SAT_RX_FM, FT_847_NATIVE_CAT_SET_MODE_SAT_RX_CWN, FT_847_NATIVE_CAT_SET_MODE_SAT_RX_CWRN, FT_847_NATIVE_CAT_SET_MODE_SAT_RX_AMN, FT_847_NATIVE_CAT_SET_MODE_SAT_RX_FMN, FT_847_NATIVE_CAT_SET_MODE_SAT_TX_LSB, /* SAT TX VFO */ FT_847_NATIVE_CAT_SET_MODE_SAT_TX_USB, FT_847_NATIVE_CAT_SET_MODE_SAT_TX_CW, FT_847_NATIVE_CAT_SET_MODE_SAT_TX_CWR, FT_847_NATIVE_CAT_SET_MODE_SAT_TX_AM, FT_847_NATIVE_CAT_SET_MODE_SAT_TX_FM, FT_847_NATIVE_CAT_SET_MODE_SAT_TX_CWN, FT_847_NATIVE_CAT_SET_MODE_SAT_TX_CWRN, FT_847_NATIVE_CAT_SET_MODE_SAT_TX_AMN, FT_847_NATIVE_CAT_SET_MODE_SAT_TX_FMN, FT_847_NATIVE_CAT_SET_DCS_ON_MAIN, /* MAIN CTCSS/DCS */ FT_847_NATIVE_CAT_SET_CTCSS_ENC_DEC_ON_MAIN, FT_847_NATIVE_CAT_SET_CTCSS_ENC_ON_MAIN, FT_847_NATIVE_CAT_SET_CTCSS_DCS_OFF_MAIN, FT_847_NATIVE_CAT_SET_DCS_ON_SAT_RX, /* SAT RX CTCSS/DCS */ FT_847_NATIVE_CAT_SET_CTCSS_ENC_DEC_ON_SAT_RX, FT_847_NATIVE_CAT_SET_CTCSS_ENC_ON_SAT_RX, FT_847_NATIVE_CAT_SET_CTCSS_DCS_OFF_SAT_RX, FT_847_NATIVE_CAT_SET_DCS_ON_SAT_TX, /* SAT TX CTCSS/DCS */ FT_847_NATIVE_CAT_SET_CTCSS_ENC_DEC_ON_SAT_TX, FT_847_NATIVE_CAT_SET_CTCSS_ENC_ON_SAT_TX, FT_847_NATIVE_CAT_SET_CTCSS_DCS_OFF_SAT_TX, FT_847_NATIVE_CAT_SET_CTCSS_FREQ_MAIN, /* CTCSS Freq */ FT_847_NATIVE_CAT_SET_CTCSS_FREQ_SAT_RX, FT_847_NATIVE_CAT_SET_CTCSS_FREQ_SAT_TX, FT_847_NATIVE_CAT_SET_DCS_CODE_MAIN, /* DCS code */ FT_847_NATIVE_CAT_SET_DCS_CODE_SAT_RX, FT_847_NATIVE_CAT_SET_DCS_CODE_SAT_TX, FT_847_NATIVE_CAT_SET_RPT_SHIFT_MINUS, /* RPT SHIFT */ FT_847_NATIVE_CAT_SET_RPT_SHIFT_PLUS, FT_847_NATIVE_CAT_SET_RPT_SHIFT_SIMPLEX, FT_847_NATIVE_CAT_SET_RPT_OFFSET, /* RPT Offset frequency */ /* Get info from the rig */ FT_847_NATIVE_CAT_GET_RX_STATUS, FT_847_NATIVE_CAT_GET_TX_STATUS, FT_847_NATIVE_CAT_GET_FREQ_MODE_STATUS_MAIN, FT_847_NATIVE_CAT_GET_FREQ_MODE_STATUS_SAT_RX, FT_847_NATIVE_CAT_GET_FREQ_MODE_STATUS_SAT_TX, FT_847_NATIVE_SIZE /* end marker, value indicates number of */ /* native cmd entries */ }; typedef enum ft847_native_cmd_e ft847_native_cmd_t; /* * ft847 instance - private data * */ struct ft847_priv_data { split_t sat_mode; unsigned char rx_status; /* tx returned data */ unsigned char tx_status; /* rx returned data */ }; /* * API local implementation */ static int ft847_init(RIG *rig); static int ft847_open(RIG *rig); static int ft847_cleanup(RIG *rig); static int ft847_close(RIG *rig); static int ft847_set_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft847_get_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ft847_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); /* select mode */ static int ft847_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); /* get mode */ static int ft847_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); static int ft847_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo); static int ft847_set_split_freq(RIG *rig, vfo_t vfo, freq_t freq); static int ft847_get_split_freq(RIG *rig, vfo_t vfo, freq_t *freq); static int ft847_set_split_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width); static int ft847_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width); static int ft847_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt); static int ft847_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt); static int ft847_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd); static int ft847_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t * val); static int ft847_set_func(RIG *rig, vfo_t vfo, setting_t func, int status); static int ft847_set_ctcss_tone (RIG *rig, vfo_t vfo, tone_t tone); static int ft847_set_ctcss_sql (RIG *rig, vfo_t vfo, tone_t tone); static int ft847_set_dcs_sql (RIG *rig, vfo_t vfo, tone_t code); static int ft847_set_rptr_shift (RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift); static int ft847_set_rptr_offs (RIG *rig, vfo_t vfo, shortfreq_t rptr_offs); #endif /* _FT847_H */ hamlib-1.2.15.3/ltmain.sh0000755000175000017500000073337712044564516011774 00000000000000# Generated from ltmain.m4sh. # ltmain.sh (GNU libtool) 2.2.6b # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print informational messages (default) # --version print version information # -h, --help print short or long help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . PROGRAM=ltmain.sh PACKAGE=libtool VERSION="2.2.6b Debian-2.2.6b-2" TIMESTAMP="" package_revision=1.3017 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # NLS nuisances: We save the old values to restore during execute mode. # Only set LANG and LC_ALL to C if already set. # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done $lt_unset CDPATH : ${CP="cp -f"} : ${ECHO="echo"} : ${EGREP="/bin/grep -E"} : ${FGREP="/bin/grep -F"} : ${GREP="/bin/grep"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SED="/bin/sed"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } # Generated shell functions inserted here. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: # In the unlikely event $progname began with a '-', it would play havoc with # func_echo (imagine progname=-n), so we prepend ./ in that case: func_dirname_and_basename "$progpath" progname=$func_basename_result case $progname in -*) progname=./$progname ;; esac # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=: for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname${mode+: }$mode: $*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` done my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "X$my_tmpdir" | $Xsed } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "X$1" | $Xsed \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_version # Echo version message to standard output and exit. func_version () { $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $SED -n '/^# Usage:/,/# -h/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" $ECHO $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help # Echo long help message to standard output and exit. func_help () { $SED -n '/^# Usage:/,/# Report bugs to/ { s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ p }' < "$progpath" exit $? } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { func_error "missing argument for $1" exit_cmd=exit } exit_cmd=: # Check that we have a working $ECHO. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then # Yippee, $ECHO works! : else # Restart under the correct shell, and then maybe $ECHO will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # Parse options once, thoroughly. This comes as soon as possible in # the script to make things like `libtool --version' happen quickly. { # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Parse non-mode specific arguments: while test "$#" -gt 0; do opt="$1" shift case $opt in --config) func_config ;; --debug) preserve_args="$preserve_args $opt" func_echo "enabling shell trace mode" opt_debug='set -x' $opt_debug ;; -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break execute_dlfiles="$execute_dlfiles $1" shift ;; --dry-run | -n) opt_dry_run=: ;; --features) func_features ;; --finish) mode="finish" ;; --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break case $1 in # Valid mode arguments: clean) ;; compile) ;; execute) ;; finish) ;; install) ;; link) ;; relink) ;; uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac mode="$1" shift ;; --preserve-dup-deps) opt_duplicate_deps=: ;; --quiet|--silent) preserve_args="$preserve_args $opt" opt_silent=: ;; --verbose| -v) preserve_args="$preserve_args $opt" opt_silent=false ;; --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break preserve_args="$preserve_args $opt $1" func_enable_tag "$1" # tagname is set here shift ;; # Separate optargs to long options: -dlopen=*|--mode=*|--tag=*) func_opt_split "$opt" set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} shift ;; -\?|-h) func_usage ;; --help) opt_help=: ;; --version) func_version ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) nonopt="$opt" break ;; esac done case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_duplicate_deps ;; esac # Having warned about all mis-specified options, bail out if # anything was wrong. $exit_cmd $EXIT_FAILURE } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } ## ----------- ## ## Main. ## ## ----------- ## $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi test -z "$mode" && func_fatal_error "error: you must specify a MODE." # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$mode' for more information." } # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_ltwrapper_scriptname_result="" if func_ltwrapper_executable_p "$1"; then func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" fi } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_quote_for_eval "$arg" CC_quoted="$CC_quoted $func_quote_for_eval_result" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_quote_for_eval "$arg" CC_quoted="$CC_quoted $func_quote_for_eval_result" done case "$@ " in " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T <?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi removelist="$removelist $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist removelist="$removelist $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir command="$command -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" fi # Suppress compiler output if we already did a PIC compilation. command="$command$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$mode'" ;; esac $ECHO $ECHO "Try \`$progname --help' for more information about other modes." exit $? } # Now that we've collected a possible --mode arg, show help if necessary $opt_help && func_mode_help # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $execute_dlfiles; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_quote_for_eval "$file" args="$args $func_quote_for_eval_result" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" $ECHO "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS $ECHO "X----------------------------------------------------------------------" | $Xsed $ECHO "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done $ECHO $ECHO "If you ever happen to want to link against installed libraries" $ECHO "in a given directory, LIBDIR, you must either use libtool, and" $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" $ECHO "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" $ECHO " during execution" fi if test -n "$runpath_var"; then $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" $ECHO " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $ECHO $ECHO "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" $ECHO "pages." ;; *) $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac $ECHO "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS } test "$mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $ECHO "X$nonopt" | $GREP shtool >/dev/null; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" install_prog="$install_prog$func_quote_for_eval_result" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" install_prog="$install_prog $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for progfile in $progfiles; do func_verbose "extracting global C symbols from \`$progfile'" $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" } done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" fi $ECHO >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; " case $host in *cygwin* | *mingw* | *cegcc* ) $ECHO >> "$output_objdir/$my_dlsyms" "\ /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */" lt_dlsym_const= ;; *osf5*) echo >> "$output_objdir/$my_dlsyms" "\ /* This system does not cope well with relocations in const data */" lt_dlsym_const= ;; *) lt_dlsym_const=const ;; esac $ECHO >> "$output_objdir/$my_dlsyms" "\ extern $lt_dlsym_const lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; $lt_dlsym_const lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac $ECHO >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) symtab_cflags="$symtab_cflags $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper_part1 [arg=no] # # Emit the first part of a libtool wrapper script on stdout. # For more information, see the description associated with # func_emit_wrapper(), below. func_emit_wrapper_part1 () { func_emit_wrapper_part1_arg1=no if test -n "$1" ; then func_emit_wrapper_part1_arg1=$1 fi $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then ECHO=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then # Yippee, \$ECHO works! : else # Restart under the correct shell, and then maybe \$ECHO will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $ECHO "\ # Find the directory that this script lives in. thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done " } # end: func_emit_wrapper_part1 # func_emit_wrapper_part2 [arg=no] # # Emit the second part of a libtool wrapper script on stdout. # For more information, see the description associated with # func_emit_wrapper(), below. func_emit_wrapper_part2 () { func_emit_wrapper_part2_arg1=no if test -n "$1" ; then func_emit_wrapper_part2_arg1=$1 fi $ECHO "\ # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # end: func_emit_wrapper_part2 # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=no if test -n "$1" ; then func_emit_wrapper_arg1=$1 fi # split this up so that func_emit_cwrapperexe_src # can call each part independently. func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" } # func_to_host_path arg # # Convert paths to host format when used with build tools. # Intended for use with "native" mingw (where libtool itself # is running under the msys shell), or in the following cross- # build environments: # $build $host # mingw (msys) mingw [e.g. native] # cygwin mingw # *nix + wine mingw # where wine is equipped with the `winepath' executable. # In the native mingw case, the (msys) shell automatically # converts paths for any non-msys applications it launches, # but that facility isn't available from inside the cwrapper. # Similar accommodations are necessary for $host mingw and # $build cygwin. Calling this function does no harm for other # $host/$build combinations not listed above. # # ARG is the path (on $build) that should be converted to # the proper representation for $host. The result is stored # in $func_to_host_path_result. func_to_host_path () { func_to_host_path_result="$1" if test -n "$1" ; then case $host in *mingw* ) lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' case $build in *mingw* ) # actually, msys # awkward: cmd appends spaces to result lt_sed_strip_trailing_spaces="s/[ ]*\$//" func_to_host_path_tmp1=`( cmd //c echo "$1" |\ $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ $SED -e "$lt_sed_naive_backslashify"` ;; *cygwin* ) func_to_host_path_tmp1=`cygpath -w "$1"` func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ $SED -e "$lt_sed_naive_backslashify"` ;; * ) # Unfortunately, winepath does not exit with a non-zero # error code, so we are forced to check the contents of # stdout. On the other hand, if the command is not # found, the shell will set an exit code of 127 and print # *an error message* to stdout. So we must check for both # error code of zero AND non-empty stdout, which explains # the odd construction: func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ $SED -e "$lt_sed_naive_backslashify"` else # Allow warning below. func_to_host_path_result="" fi ;; esac if test -z "$func_to_host_path_result" ; then func_error "Could not determine host path corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_path_result="$1" fi ;; esac fi } # end: func_to_host_path # func_to_host_pathlist arg # # Convert pathlists to host format when used with build tools. # See func_to_host_path(), above. This function supports the # following $build/$host combinations (but does no harm for # combinations not listed here): # $build $host # mingw (msys) mingw [e.g. native] # cygwin mingw # *nix + wine mingw # # Path separators are also converted from $build format to # $host format. If ARG begins or ends with a path separator # character, it is preserved (but converted to $host format) # on output. # # ARG is a pathlist (on $build) that should be converted to # the proper representation on $host. The result is stored # in $func_to_host_pathlist_result. func_to_host_pathlist () { func_to_host_pathlist_result="$1" if test -n "$1" ; then case $host in *mingw* ) lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_to_host_pathlist_tmp2="$1" # Once set for this call, this variable should not be # reassigned. It is used in tha fallback case. func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ $SED -e 's|^:*||' -e 's|:*$||'` case $build in *mingw* ) # Actually, msys. # Awkward: cmd appends spaces to result. lt_sed_strip_trailing_spaces="s/[ ]*\$//" func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ $SED -e "$lt_sed_naive_backslashify"` ;; *cygwin* ) func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ $SED -e "$lt_sed_naive_backslashify"` ;; * ) # unfortunately, winepath doesn't convert pathlists func_to_host_pathlist_result="" func_to_host_pathlist_oldIFS=$IFS IFS=: for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do IFS=$func_to_host_pathlist_oldIFS if test -n "$func_to_host_pathlist_f" ; then func_to_host_path "$func_to_host_pathlist_f" if test -n "$func_to_host_path_result" ; then if test -z "$func_to_host_pathlist_result" ; then func_to_host_pathlist_result="$func_to_host_path_result" else func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" fi fi fi IFS=: done IFS=$func_to_host_pathlist_oldIFS ;; esac if test -z "$func_to_host_pathlist_result" ; then func_error "Could not determine the host path(s) corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This may break if $1 contains DOS-style drive # specifications. The fix is not to complicate the expression # below, but for the user to provide a working wine installation # with winepath so that path translation in the cross-to-mingw # case works properly. lt_replace_pathsep_nix_to_dos="s|:|;|g" func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ $SED -e "$lt_replace_pathsep_nix_to_dos"` fi # Now, add the leading and trailing path separators back case "$1" in :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" ;; esac case "$1" in *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" ;; esac ;; esac fi } # end: func_to_host_pathlist # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include # define setmode _setmode #else # include # include # ifdef __CYGWIN__ # include # define HAVE_SETENV # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif # endif #endif #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif #ifdef _MSC_VER # define S_IXUSR _S_IEXEC # define stat _stat # ifndef _INTPTR_T_DEFINED # define intptr_t int # endif #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifdef __CYGWIN__ # define FOPEN_WB "wb" #endif #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #undef LTWRAPPER_DEBUGPRINTF #if defined DEBUGWRAPPER # define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args static void ltwrapper_debugprintf (const char *fmt, ...) { va_list args; va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } #else # define LTWRAPPER_DEBUGPRINTF(args) #endif const char *program_name = NULL; void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_fatal (const char *message, ...); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_opt_process_env_set (const char *arg); void lt_opt_process_env_prepend (const char *arg); void lt_opt_process_env_append (const char *arg); int lt_split_name_value (const char *arg, char** name, char** value); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); static const char *script_text_part1 = EOF func_emit_wrapper_part1 yes | $SED -e 's/\([\\"]\)/\\\1/g' \ -e 's/^/ "/' -e 's/$/\\n"/' echo ";" cat <"))); for (i = 0; i < newargc; i++) { LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); } EOF case $host_os in mingw*) cat <<"EOF" /* execv doesn't actually work on mingw as expected on unix */ rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); if (rval == -1) { /* failed to start process */ LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); return 127; } return rval; EOF ;; *) cat <<"EOF" execv (lt_argv_zero, newargz); return rval; /* =127, but avoids unused variable warning */ EOF ;; esac cat <<"EOF" } void * xmalloc (size_t num) { void *p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char) name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable (const char *path) { struct stat st; LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!")); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!")); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", tmp_pathspec)); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { char *errstr = strerror (errno); lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal ("Could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } void lt_setenv (const char *name, const char *value) { LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", (name ? name : ""), (value ? value : ""))); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } int lt_split_name_value (const char *arg, char** name, char** value) { const char *p; int len; if (!arg || !*arg) return 1; p = strchr (arg, (int)'='); if (!p) return 1; *value = xstrdup (++p); len = strlen (arg) - strlen (*value); *name = XMALLOC (char, len); strncpy (*name, arg, len-1); (*name)[len - 1] = '\0'; return 0; } void lt_opt_process_env_set (const char *arg) { char *name = NULL; char *value = NULL; if (lt_split_name_value (arg, &name, &value) != 0) { XFREE (name); XFREE (value); lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); } lt_setenv (name, value); XFREE (name); XFREE (value); } void lt_opt_process_env_prepend (const char *arg) { char *name = NULL; char *value = NULL; char *new_value = NULL; if (lt_split_name_value (arg, &name, &value) != 0) { XFREE (name); XFREE (value); lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); } new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); XFREE (name); XFREE (value); } void lt_opt_process_env_append (const char *arg) { char *name = NULL; char *value = NULL; char *new_value = NULL; if (lt_split_name_value (arg, &name, &value) != 0) { XFREE (name); XFREE (value); lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); } new_value = lt_extend_str (getenv (name), value, 1); lt_setenv (name, new_value); XFREE (new_value); XFREE (name); XFREE (value); } void lt_update_exe_path (const char *name, const char *value) { LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", (name ? name : ""), (value ? value : ""))); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", (name ? name : ""), (value ? value : ""))); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF } # end: func_emit_cwrapperexe_src # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) deplibs="$deplibs $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) weak_libs="$weak_libs $arg" prev= continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname '-L' '' "$arg" dir=$func_stripname_result if test -z "$dir"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot) compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" arg="$arg $wl$func_quote_for_eval_result" compiler_flags="$compiler_flags $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" arg="$arg $wl$func_quote_for_eval_result" compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" linker_flags="$linker_flags $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -F/path gives path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" compiler_flags="$compiler_flags $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_duplicate_deps ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= case $lib in *.la) func_source "$lib" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` case " $weak_libs " in *" $deplib_base "*) ;; *) deplibs="$deplibs $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" newlib_search_path="$newlib_search_path $func_stripname_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" newlib_search_path="$newlib_search_path $func_stripname_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" dir=$func_stripname_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $ECHO $ECHO "*** Warning: Trying to link with static lib archive $deplib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have" $ECHO "*** because the file extensions .$libext of this argument makes me believe" $ECHO "*** that it is just a static archive that I should not use here." else $ECHO $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" newlib_search_path="$newlib_search_path $func_stripname_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) temp_rpath="$temp_rpath$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded notinst_deplibs="$notinst_deplibs $lib" need_relink=no ;; *) if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then $ECHO if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $ECHO $ECHO "*** And there doesn't seem to be a static archive available" $ECHO "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $ECHO $ECHO "*** Warning: This system can not link to static lib archive $lib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $ECHO "*** But as you try to build a module library, libtool will still create " $ECHO "*** a static module, that should work as long as the dlopening application" $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $ECHO $ECHO "*** However, this would only work if libtool was able to extract symbol" $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" $ECHO "*** not find such a program. So, this module is probably useless." $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if $opt_duplicate_deps ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_dirname "$deplib" "" "." dir="$func_dirname_result" # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else $ECHO $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type \`$version_type'" ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" libobjs="$libobjs $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $ECHO $ECHO "*** Warning: linker path does not have real file for library $a_deplib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have" $ECHO "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $ECHO $ECHO "*** Warning: linker path does not have real file for library $a_deplib." $ECHO "*** I have the capability to make that library automatically link in when" $ECHO "*** you link to this library. But I can only do this if you have a" $ECHO "*** shared version of the library, which you do not appear to have" $ECHO "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` done fi if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | $GREP . >/dev/null; then $ECHO if test "X$deplibs_check_method" = "Xnone"; then $ECHO "*** Warning: inter-library dependencies are not supported in this platform." else $ECHO "*** Warning: inter-library dependencies are not known to be supported." fi $ECHO "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $ECHO $ECHO "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" $ECHO "*** a static module, that should work as long as the dlopening" $ECHO "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $ECHO $ECHO "*** However, this would only work if libtool was able to extract symbol" $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" $ECHO "*** not find such a program. So, this module is probably useless." $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $ECHO "*** The inter-library dependencies that have been dropped here will be" $ECHO "*** automatically added whenever a program is linked with this library" $ECHO "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $ECHO $ECHO "*** Since this library must not contain undefined symbols," $ECHO "*** because either the platform does not support them or" $ECHO "*** it was explicitly requested with -no-undefined," $ECHO "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" delfiles="$delfiles $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" func_len " $cmd" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then func_show_eval "$cmd" 'exit $?' skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$ECHO "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" $ECHO 'INPUT (' > $output for obj in $save_libobjs do $ECHO "$obj" >> $output done $ECHO ')' >> $output delfiles="$delfiles $output" elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do $ECHO "$obj" >> $output done delfiles="$delfiles $output" output=$firstobj\"$file_list_spec$output\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=$obj func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi delfiles="$delfiles $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles libobjs="$libobjs $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *cegcc) # Disable wrappers for cegcc, we are cross compiling anyway. wrappers_required=no ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $ECHO for shipping. if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then oldobjs="$oldobjs $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $dlprefiles oldobjs="$oldobjs $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else $ECHO "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlfiles="$newdlfiles $libdir/$name" ;; *) newdlfiles="$newdlfiles $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" newdlprefiles="$newdlprefiles $libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$mode" = link || test "$mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) RM="$RM $arg"; rmforce=yes ;; -*) RM="$RM $arg" ;; *) files="$files $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= origobjdir="$objdir" for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then objdir="$origobjdir" else objdir="$dir/$origobjdir" fi func_basename "$file" name="$func_basename_result" test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result rmfiles="$rmfiles $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$mode" = uninstall || test "$mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 hamlib-1.2.15.3/configure0000755000175000017500000237036412044564543012053 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.67 for Hamlib 1.2.15.3. # # Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: hamlib-developer@lists.sourceforge.net about your $0: system, including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$lt_ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` ;; esac ECHO=${lt_ECHO-echo} if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then # Yippee, $ECHO works! : else # Restart under the correct shell. exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <<_LT_EOF $* _LT_EOF exit 0 fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test -z "$lt_ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if { echo_test_string=`eval $cmd`; } 2>/dev/null && { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null then break fi done fi if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$ECHO" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. ECHO='print -r' elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} else # Try using printf. ECHO='printf %s\n' if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL ECHO="$CONFIG_SHELL $0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. ECHO=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. lt_ECHO=$ECHO if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" fi test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='Hamlib' PACKAGE_TARNAME='hamlib' PACKAGE_VERSION='1.2.15.3' PACKAGE_STRING='Hamlib 1.2.15.3' PACKAGE_BUGREPORT='hamlib-developer@lists.sourceforge.net' PACKAGE_URL='http://www.hamlib.org' ac_unique_file="include/hamlib/rig.h" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS INCLUDES BINDING_LIB_TARGETS BINDING_LIST BINDING_UNINSTALL BINDING_INSTALL_EXEC BINDING_DISTCHECK BINDING_DISTCLEAN BINDING_CLEAN BINDING_CHECK BINDING_ALL BINDINGS SWIG cf_with_bindings ROT_BACKENDEPS ROT_BACKENDLNK ROT_BACKEND_LIST BACKENDEPS BACKENDLNK BACKEND_LIST cf_with_rpcgen LIBUSB_LIBS LIBUSB_CFLAGS HAVE_USRP_FALSE HAVE_USRP_TRUE ENABLE_CXX_FALSE ENABLE_CXX_TRUE USRP_LIBS USRP_CFLAGS ENABLE_PYTHON_FALSE ENABLE_PYTHON_TRUE PYTHON_EXTRA_LDFLAGS PYTHON_EXTRA_LIBS PYTHON_SITE_PKG PYTHON_LDFLAGS PYTHON_CPPFLAGS pkgpyexecdir pyexecdir pkgpythondir pythondir PYTHON_PLATFORM PYTHON_EXEC_PREFIX PYTHON_PREFIX PYTHON_VERSION PYTHON TCL_SHLIB_SUFFIX TCL_INCLUDE_SPEC TCL_LIB_SPEC ENABLE_TCL_FALSE ENABLE_TCL_TRUE TCL_LIB_FILE TCL_SRC_DIR TCL_BIN_DIR PERL_INC_DIR cf_with_cxx RIGMATRIX LIBXML2_LIBS LIBXML2_CFLAGS WINEXELDFLAGS WINLDFLAGS OSXLDFLAGS AM_LDFLAGS LIBLTDL INCLTDL CXXCPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL lt_ECHO RANLIB AR NM ac_ct_DUMPBIN DUMPBIN LD FGREP SED LIBTOOL OBJDUMP DLLTOOL AS ALLOCA MATH_LIBS NET_LIBS PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CC acx_pthread_config host_os host_vendor host_cpu host build_os build_vendor build_cpu build LIBOBJS EGREP GREP PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG LN_S CPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC hamlibdocdir ABI_VERSION INSIDE_GNOME_COMMON_FALSE INSIDE_GNOME_COMMON_TRUE MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_maintainer_mode enable_dependency_tracking with_warnings enable_shared enable_static with_pic enable_fast_install with_gnu_ld enable_libtool_lock with_rigmatrix with_cxx_binding with_perl_binding with_perl_inc enable_tcl_binding with_tcl with_python_binding with_winradio with_usrp with_rpc_backends ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CXX CXXFLAGS CCC CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR CXXCPP LIBXML2_CFLAGS LIBXML2_LIBS PYTHON_VERSION USRP_CFLAGS USRP_LIBS LIBUSB_CFLAGS LIBUSB_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Hamlib 1.2.15.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/hamlib] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Hamlib 1.2.15.3:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0') --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-tcl-binding Build Tcl binding and demo (default: no) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-warnings Turn on warnings --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-rigmatrix Generate rigmatrix tool (requires libgd) --without-cxx-binding do not build C++ binding and demo --with-perl-binding build perl binding and demo --with-perl-inc directory containing perl includes --with-tcl=PATH directory containing tcl configuration (tclConfig.sh) --with-python-binding build python binding and demo --without-winradio do not build winradio backend --with-usrp build USRP backend --without-rpc-backends do not build rpcrig and rpcrot backends Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags CPP C preprocessor PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path CXXCPP C++ preprocessor LIBXML2_CFLAGS C compiler flags for LIBXML2, overriding pkg-config LIBXML2_LIBS linker flags for LIBXML2, overriding pkg-config PYTHON_VERSION The installed Python version to use, for example '2.3'. This string will be appended to the Python interpreter canonical name. USRP_CFLAGS C compiler flags for USRP, overriding pkg-config USRP_LIBS linker flags for USRP, overriding pkg-config LIBUSB_CFLAGS C compiler flags for LIBUSB, overriding pkg-config LIBUSB_LIBS linker flags for LIBUSB, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . Hamlib home page: . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF Hamlib configure 1.2.15.3 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ----------------------------------------------------- ## ## Report this to hamlib-developer@lists.sourceforge.net ## ## ----------------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_compile # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_func # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_type # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_decl # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_cxx_try_link cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Hamlib $as_me 1.2.15.3, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5 ; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ## ------------------------ ## ## Automake Initialisation. ## ## ------------------------ ## am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=hamlib VERSION=1.2.15.3 # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' ac_config_headers="$ac_config_headers include/config.h" # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac AM_BACKSLASH='\' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE ## ------------------------------- ## ## Hamlib specific configuration. ## ## ------------------------------- ## ABI_VERSION=2 if test x = y; then INSIDE_GNOME_COMMON_TRUE= INSIDE_GNOME_COMMON_FALSE='#' else INSIDE_GNOME_COMMON_TRUE='#' INSIDE_GNOME_COMMON_FALSE= fi test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" for k in macros ; do ACLOCAL="$ACLOCAL -I $k" ; done cat >>confdefs.h <<_ACEOF #define ABI_VERSION $ABI_VERSION _ACEOF hamlibdocdir=$datadir/doc/hamlib ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5 ; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5 ; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5 ; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if test "${ac_cv_prog_cxx_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5 ; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" if test $ac_cv_c_compiler_gnu = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 $as_echo_n "checking whether $CC needs -traditional... " >&6; } if test "${ac_cv_prog_gcc_traditional+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_pattern="Autoconf.*'x'" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 $as_echo "$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if test "${ac_cv_c_const+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if test "${ac_cv_c_inline+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether user wants warnings" >&5 $as_echo_n "checking whether user wants warnings... " >&6; } # Check whether --with-warnings was given. if test "${with_warnings+set}" = set; then : withval=$with_warnings; lf_warnings=yes else lf_warnings=no fi lf_warnings=yes # hard code for now -eb { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lf_warnings" >&5 $as_echo "$lf_warnings" >&6; } cc_warning_flags="-Wall" cxx_warning_flags="-Wall -Woverloaded-virtual" if test $lf_warnings = yes then if test -n "${CC}" then echo 'void f(){}' > conftest.c for i in $cc_warning_flags do { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts $i" >&5 $as_echo_n "checking whether $CC accepts $i... " >&6; } if test -z "`${CC} $i -c conftest.c 2>&1`" then CFLAGS="${CFLAGS} $i" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi done rm -f conftest.c conftest.o fi if test -n "${CXX}" then echo 'void f(){}' > conftest.cc for i in $cxx_warning_flags do { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts $i" >&5 $as_echo_n "checking whether $CXX accepts $i... " >&6; } if test -z "`${CXX} $i -c conftest.cc 2>&1`" then CXXFLAGS="${CXXFLAGS} $i" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi done rm -f conftest.cc conftest.o fi fi if test "x$CC" != xcc; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 $as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&5' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi rm -f core conftest* fi if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h fi # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } if eval "test \"\${$as_ac_Header+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_ac_Header=yes" else eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$as_ac_Header { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if test "${ac_cv_search_opendir+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' dir; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then : break fi done if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if test "${ac_cv_search_opendir+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' x; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then : break fi done if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in alloca.h argz.h malloc.h memory.h string.h strings.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in stdlib.h values.h rpc/rpc.h rpc/rpcent.h net/errno.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in fcntl.h sys/ioctl.h sys/time.h sys/param.h unistd.h getopt.h errno.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/ioccom.h sgtty.h term.h termio.h termios.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in linux/ppdev.h linux/parport.h linux/ioctl.h linux/hidraw.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dev/ppbus/ppi.h dev/ppbus/ppbconf.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/socket.h netinet/in.h netdb.h arpa/inet.h ws2tcpip.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if test "${ac_cv_header_time+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi for ac_header in sys/types.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default" if test "x$ac_cv_header_sys_types_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_TYPES_H 1 _ACEOF fi done for ac_header in windows.h do : ac_fn_c_check_header_mongrel "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default" if test "x$ac_cv_header_windows_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_WINDOWS_H 1 _ACEOF fi done for ac_header in winioctl.h winbase.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " #if HAVE_WINDOWS_H #include #endif " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in getopt getopt_long usleep sleep gettimeofday do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_type "$LINENO" "struct timezone" "ac_cv_type_struct_timezone" " #if HAVE_SYS_TYPES_H # include #endif #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif " if test "x$ac_cv_type_struct_timezone" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TIMEZONE 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" " #if HAVE_SYS_TYPES_H # include #endif #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif " if test "x$ac_cv_type_ssize_t" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SSIZE_T 1 _ACEOF fi ac_fn_c_check_func "$LINENO" "getopt" "ac_cv_func_getopt" if test "x$ac_cv_func_getopt" = x""yes; then : $as_echo "#define HAVE_GETOPT 1" >>confdefs.h else case " $LIBOBJS " in *" getopt.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS getopt.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long" if test "x$ac_cv_func_getopt_long" = x""yes; then : $as_echo "#define HAVE_GETOPT_LONG 1" >>confdefs.h else case " $LIBOBJS " in *" getopt_long.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS getopt_long.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "usleep" "ac_cv_func_usleep" if test "x$ac_cv_func_usleep" = x""yes; then : $as_echo "#define HAVE_USLEEP 1" >>confdefs.h else case " $LIBOBJS " in *" usleep.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS usleep.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" if test "x$ac_cv_func_gettimeofday" = x""yes; then : $as_echo "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h else case " $LIBOBJS " in *" gettimeofday.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS gettimeofday.$ac_objext" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Sleep" >&5 $as_echo_n "checking for Sleep... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { Sleep(0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_SSLEEP 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if test "${ac_cv_build+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if test "${ac_cv_host+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 $as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_join (); int main () { return pthread_join (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : acx_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 $as_echo "$acx_pthread_ok" >&6; } if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # ... -mt is also the pthreads flag for HP/aCC # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthreads/-mt/ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 $as_echo_n "checking whether pthreads work without any flags... " >&6; } ;; -*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5 $as_echo_n "checking whether pthreads work with $flag... " >&6; } PTHREAD_CFLAGS="$flag" ;; pthread-config) # Extract the first word of "pthread-config", so it can be a program name with args. set dummy pthread-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_acx_pthread_config+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$acx_pthread_config"; then ac_cv_prog_acx_pthread_config="$acx_pthread_config" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_acx_pthread_config="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no" fi fi acx_pthread_config=$ac_cv_prog_acx_pthread_config if test -n "$acx_pthread_config"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_config" >&5 $as_echo "$acx_pthread_config" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test x"$acx_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5 $as_echo_n "checking for the pthreads library -l$flag... " >&6; } PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : acx_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 $as_echo "$acx_pthread_ok" >&6; } if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 $as_echo_n "checking for joinable pthread attribute... " >&6; } attr_name=unknown for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int attr=$attr; return attr; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : attr_name=$attr; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5 $as_echo "$attr_name" >&6; } if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then cat >>confdefs.h <<_ACEOF #define PTHREAD_CREATE_JOINABLE $attr_name _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5 $as_echo_n "checking if more special flags are required for pthreads... " >&6; } flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${flag}" >&5 $as_echo "${flag}" >&6; } if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with xlc_r or cc_r if test x"$GCC" != xyes; then for ac_prog in xlc_r cc_r do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$PTHREAD_CC"; then ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PTHREAD_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PTHREAD_CC=$ac_cv_prog_PTHREAD_CC if test -n "$PTHREAD_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 $as_echo "$PTHREAD_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PTHREAD_CC" && break done test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}" else PTHREAD_CC=$CC fi else PTHREAD_CC="$CC" fi # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then $as_echo "#define HAVE_PTHREAD 1" >>confdefs.h : else acx_pthread_ok=no fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$acx_pthread_ok" = xyes; then CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}" CXXFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking POSIX termios" >&5 $as_echo_n "checking POSIX termios... " >&6; } if test "${ac_cv_sys_posix_termios+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { /* SunOS 4.0.3 has termios.h but not the library calls. */ tcgetattr(0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_sys_posix_termios=yes else ac_cv_sys_posix_termios=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_posix_termios" >&5 $as_echo "$ac_cv_sys_posix_termios" >&6; } INCLUDES="${INCLUDES} -I\$(top_srcdir)/include -I\$(top_srcdir)/src -I\$(top_srcdir)/lib" ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if test "${ac_cv_header_time+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "siginfo_t" "ac_cv_type_siginfo_t" "#include " if test "x$ac_cv_type_siginfo_t" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SIGINFO_T 1 _ACEOF fi # The following comes from SC_TCL_LINK_LIBS # we redefine them here because we want a separate NET_LIBS var #-------------------------------------------------------------------- # On a few very rare systems, all of the libm.a stuff is # already in libc.a. Set compiler flags accordingly. #-------------------------------------------------------------------- ac_fn_c_check_func "$LINENO" "sin" "ac_cv_func_sin" if test "x$ac_cv_func_sin" = x""yes; then : MATH_LIBS="" else MATH_LIBS="-lm" fi #-------------------------------------------------------------------- # Interactive UNIX requires -linet instead of -lsocket, plus it # needs net/errno.h to define the socket-related error codes. #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -linet" >&5 $as_echo_n "checking for main in -linet... " >&6; } if test "${ac_cv_lib_inet_main+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-linet $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_inet_main=yes else ac_cv_lib_inet_main=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_main" >&5 $as_echo "$ac_cv_lib_inet_main" >&6; } if test "x$ac_cv_lib_inet_main" = x""yes; then : LIBS="$LIBS -linet" fi #-------------------------------------------------------------------- # Check for the existence of the -lsocket and -lnsl libraries. # The order here is important, so that they end up in the right # order in the command line generated by make. Here are some # special considerations: # 1. Use "connect" and "accept" to check for -lsocket, and # "gethostbyname" to check for -lnsl. # 2. Use each function name only once: can't redo a check because # autoconf caches the results of the last check and won't redo it. # 3. Use -lnsl and -lsocket only if they supply procedures that # aren't already present in the normal libraries. This is because # IRIX 5.2 has libraries, but they aren't needed and they're # bogus: they goof up name resolution if used. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. # To get around this problem, check for both libraries together # if -lsocket doesn't work by itself. #-------------------------------------------------------------------- hl_checkBoth=0 hl_oldLibs=$LIBS ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" if test "x$ac_cv_func_connect" = x""yes; then : hl_checkSocket=0 else hl_checkSocket=1 fi if test "$hl_checkSocket" = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lsocket" >&5 $as_echo_n "checking for main in -lsocket... " >&6; } if test "${ac_cv_lib_socket_main+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_main=yes else ac_cv_lib_socket_main=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_main" >&5 $as_echo "$ac_cv_lib_socket_main" >&6; } if test "x$ac_cv_lib_socket_main" = x""yes; then : NET_LIBS="$NET_LIBS -lsocket" else hl_checkBoth=1 fi fi if test "$hl_checkBoth" = 1; then hl2_oldLibs=$LIBS LIBS="$LIBS -lsocket -lnsl" ac_fn_c_check_func "$LINENO" "accept" "ac_cv_func_accept" if test "x$ac_cv_func_accept" = x""yes; then : hl_checkNsl=0 else LIBS=$hl2_oldLibs fi fi ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" if test "x$ac_cv_func_gethostbyname" = x""yes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lnsl" >&5 $as_echo_n "checking for main in -lnsl... " >&6; } if test "${ac_cv_lib_nsl_main+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_main=yes else ac_cv_lib_nsl_main=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_main" >&5 $as_echo "$ac_cv_lib_nsl_main" >&6; } if test "x$ac_cv_lib_nsl_main" = x""yes; then : NET_LIBS="$NET_LIBS -lnsl" fi fi # Winsock2 ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" if test "x$ac_cv_func_gethostbyname" = x""yes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lws2_32" >&5 $as_echo_n "checking for main in -lws2_32... " >&6; } if test "${ac_cv_lib_ws2_32_main+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lws2_32 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ws2_32_main=yes else ac_cv_lib_ws2_32_main=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ws2_32_main" >&5 $as_echo "$ac_cv_lib_ws2_32_main" >&6; } if test "x$ac_cv_lib_ws2_32_main" = x""yes; then : NET_LIBS="$NET_LIBS -lws2_32" fi fi LIBS="$LIBS $NET_LIBS" ac_fn_c_check_type "$LINENO" "struct addrinfo" "ac_cv_type_struct_addrinfo" " #if HAVE_NETDB_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #elif HAVE_WS2TCPIP_H # include #endif " if test "x$ac_cv_type_struct_addrinfo" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_ADDRINFO 1 _ACEOF fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #if HAVE_NETDB_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #elif HAVE_WS2TCPIP_H # include #endif #include int main () { getaddrinfo("", "", NULL, NULL); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_getaddrinfo=yes $as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h else ac_cv_func_getaddrinfo=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_fn_c_check_decl "$LINENO" "gai_strerror" "ac_cv_have_decl_gai_strerror" " #include #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_NETDB_H #include #endif #ifdef HAVE_WS2TCPIP_H #include #endif #include " if test "x$ac_cv_have_decl_gai_strerror" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GAI_STRERROR $ac_have_decl _ACEOF ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo" if test "x$ac_cv_func_getaddrinfo" = x""yes; then : $as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h else case " $LIBOBJS " in *" getaddrinfo.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS getaddrinfo.$ac_objext" ;; esac fi LIBS=$hl_oldLibs { $as_echo "$as_me:${as_lineno-$LINENO}: checking for syslog in -lsyslog" >&5 $as_echo_n "checking for syslog in -lsyslog... " >&6; } if test "${ac_cv_lib_syslog_syslog+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsyslog $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char syslog (); int main () { return syslog (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_syslog_syslog=yes else ac_cv_lib_syslog_syslog=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_syslog_syslog" >&5 $as_echo "$ac_cv_lib_syslog_syslog" >&6; } if test "x$ac_cv_lib_syslog_syslog" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSYSLOG 1 _ACEOF LIBS="-lsyslog $LIBS" fi # OS/2 needs this for ac_func in atexit snprintf select memmove memset do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in strcasecmp strchr strdup strerror strrchr strstr strtol do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in cfmakeraw setitimer ioctl sigaction do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } if test "${ac_cv_working_alloca_h+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_working_alloca_h=yes else ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 $as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then $as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } if test "${ac_cv_func_alloca_works+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_alloca_works=yes else ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 $as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then $as_echo "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext $as_echo "#define C_ALLOCA 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } if test "${ac_cv_os_cray+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined CRAY && ! defined CRAY2 webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then : ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 $as_echo "$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } if test "${ac_cv_c_stack_direction+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_c_stack_direction=0 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction () { static char *addr = 0; auto char dummy; if (addr == 0) { addr = &dummy; return find_stack_direction (); } else return (&dummy > addr) ? 1 : -1; } int main () { return find_stack_direction () < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_stack_direction=1 else ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 $as_echo "$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi #AC_FUNC_MALLOC for ac_func in vprintf do : ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" if test "x$ac_cv_func_vprintf" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VPRINTF 1 _ACEOF ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" if test "x$ac_cv_func__doprnt" = x""yes; then : $as_echo "#define HAVE_DOPRNT 1" >>confdefs.h fi fi done case " $LIBOBJS " in *" termios.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS termios.$ac_objext" ;; esac case " $LIBOBJS " in *" dummy.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS dummy.$ac_objext" ;; esac ## ------------------------ ## ## libtool Initialisation. ## ## ------------------------ ## ## N.b. LT_INIT([dlopen], [win32-dll]) does not work for older libtool case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.2.6b' macro_revision='1.3017' ltmain="$ac_aux_dir/ltmain.sh" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if test "${ac_cv_path_SED+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if test "${ac_cv_path_FGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if test "${lt_cv_path_LD+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if test "${lt_cv_prog_gnu_ld+set}" = set; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if test "${lt_cv_path_NM+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$ac_tool_prefix"; then for ac_prog in "dumpbin -symbols" "link -dump -symbols" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_DUMPBIN+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in "dumpbin -symbols" "link -dump -symbols" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if test "${lt_cv_nm_interface+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:7675: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:7678: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:7681: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if test "${lt_cv_sys_max_cmd_len+set}" = set; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ = "XX$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if test "${lt_cv_ld_reload_flag+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OBJDUMP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if test "${lt_cv_deplibs_check_method+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AR+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="${ac_tool_prefix}ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi else AR="$ac_cv_prog_AR" fi test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ const struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line 8872 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if test "${lt_cv_cc_needs_belf+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_DSYMUTIL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_NMEDIT+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_LIPO+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OTOOL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OTOOL64+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if test "${lt_cv_apple_cc_single_mod+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if test "${lt_cv_ld_exported_symbols_list+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if test "${ac_cv_prog_cxx_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if test "${ac_cv_prog_CXXCPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} _lt_caught_CXX_error=yes; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else _lt_caught_CXX_error=yes fi # Set options enable_dlopen=yes enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AS+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AS="${ac_tool_prefix}as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 $as_echo "$AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AS"; then ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_AS+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AS="as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 $as_echo "$ac_ct_AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AS" = x; then AS="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS fi else AS="$ac_cv_prog_AS" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_DLLTOOL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_OBJDUMP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi ;; esac test -z "$AS" && AS=as test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$OBJDUMP" && OBJDUMP=objdump # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; pic_mode="$withval" else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if test "${lt_cv_objdir+set}" = set; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:10958: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:10962: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl*) # IBM XL C 8.0/Fortran 10.1 on PPC lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 $as_echo "$lt_prog_compiler_pic" >&6; } # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if test "${lt_cv_prog_compiler_pic_works+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:11297: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:11301: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if test "${lt_cv_prog_compiler_static_works+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test "${lt_cv_prog_compiler_c_o+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:11402: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:11406: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test "${lt_cv_prog_compiler_c_o+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:11457: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:11461: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu) link_all_deplibs=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag= tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' fix_srcfile_path='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes=yes ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='' link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=echo archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo(void) {} _ACEOF if ac_fn_c_try_link "$LINENO"; then : archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then archive_cmds_need_lc=no else archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 $as_echo "$archive_cmds_need_lc" >&6; } ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` else lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = x""yes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if test "${ac_cv_lib_dld_shl_load+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if test "${ac_cv_lib_svld_dlopen+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = x""yes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if test "${ac_cv_lib_dld_dld_link+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = x""yes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if test "${lt_cv_dlopen_self+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line 13841 "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if test "${lt_cv_dlopen_self_static+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line 13937 "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= compiler_needs_object_CXX=no export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_flag_spec_ld_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no inherit_rpath_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if test "${lt_cv_path_LD+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if test "${lt_cv_prog_gnu_ld+set}" = set; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes file_list_spec_CXX='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec_CXX='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty # executable. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared # libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported whole_archive_flag_spec_CXX='' link_all_deplibs_CXX=yes allow_undefined_flag_CXX="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=echo archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" if test "$lt_cv_apple_cc_single_mod" != "yes"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi else ld_shlibs_CXX=no fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd[12]*) # C++ shared libraries reported to be fairly broken before # switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; gnu*) ;; hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [1-5]* | *pgcpp\ [1-5]*) prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 will use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; xl*) # IBM XL 8.0 on PPC, with GNU ld hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object_CXX=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) ld_shlibs_CXX=yes ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='${wl}-E' whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=echo else ld_shlibs_CXX=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) case $host in osf3*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $RM -f confest.$objext # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_CXX='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; xlc* | xlC*) # IBM XL 8.0 on PPC lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-qpic' lt_prog_compiler_static_CXX='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_CXX" >&5 $as_echo "$lt_prog_compiler_pic_CXX" >&6; } # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:15893: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:15897: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_CXX=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if test "${lt_cv_prog_compiler_static_works_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:15992: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:15996: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:16044: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:16048: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' ;; linux* | k*bsd*-gnu) link_all_deplibs_CXX=no ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then archive_cmds_need_lc_CXX=no else archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc_CXX" >&5 $as_echo "$archive_cmds_need_lc_CXX" >&6; } ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 $as_echo "$hardcode_action_CXX" >&6; } if test "$hardcode_action_CXX" = relink || test "$inherit_rpath_CXX" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_commands="$ac_config_commands libtool" # Only expand once: INCLTDL="" LIBLTDL="-lltdl" case "$host_os" in freebsd*) INCLUDES="-I/usr/local/include ${INCLUDES}" AM_LDFLAGS="${AM_LDFLAGS} -L/usr/local/lib" ;; darwin* | rhapsody*) # Trick from http://fink.sourceforge.net/doc/porting/ # TODO: check the compiler actually does support these options CFLAGS="${CFLAGS} -no-cpp-precomp" CXXFLAGS="${CXXFLAGS} -no-cpp-precomp" # Tell the OS X linker to allocate enough space inside the # libhamlib.X.dylib shared object for install_name_tool(1) to # work. This is useful when including hamlib in an app bundle. OSXLDFLAGS="-Wl,-headerpad_max_install_names" ;; mingw* | pw32* | cygwin*) WINLDFLAGS="-Wl,--output-def,libhamlib.def -Wl,--add-stdcall-alias" # Prerequisite for Mingw build (import and build internal ./libltdl): # $ libtoolize --ltdl # $ ( cd libltdl; ./configure --host=i586-mingw32msvc && make ) # Use internal ./libltdl during configure: CFLAGS="${CFLAGS} -I./libltdl" # use internal $(top_builddir)/libltdl during build: INCLTDL="-I\$(top_builddir)/libltdl" # - use internal $(top_builddir)/libltdl during build and library 'ltdlc': LIBLTDL="-L\$(top_builddir)/libltdl -lltdlc" # Enable ld's "auto import" for executables WINEXELDFLAGS="-Wl,--enable-auto-import" ;; esac ac_fn_c_check_header_mongrel "$LINENO" "ltdl.h" "ac_cv_header_ltdl_h" "$ac_includes_default" if test "x$ac_cv_header_ltdl_h" = x""yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else as_fn_error $? "ltdl.h not found. Please install the libltdl development files package which provides /usr/include/ltdl.h (perhaps called 'libltdl-dev' or 'libltdl-devel')." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C99 struct/array initializers are supported" >&5 $as_echo_n "checking whether C99 struct/array initializers are supported... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { struct{char a;int b;}s[8]={[3]={.b=5}}; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else as_fn_error $? "\"\" \"You need a C99 compliant C compiler that supports struct/array intializers.\" \"Have you considered GCC lately?.\"" "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext; pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBXML2" >&5 $as_echo_n "checking for LIBXML2... " >&6; } if test -n "$LIBXML2_CFLAGS"; then pkg_cv_LIBXML2_CFLAGS="$LIBXML2_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libxml-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBXML2_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$LIBXML2_LIBS"; then pkg_cv_LIBXML2_LIBS="$LIBXML2_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libxml-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBXML2_LIBS=`$PKG_CONFIG --libs "libxml-2.0" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then LIBXML2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libxml-2.0" 2>&1` else LIBXML2_PKG_ERRORS=`$PKG_CONFIG --print-errors "libxml-2.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBXML2_PKG_ERRORS" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libxml-2.0 pkg-config not found, XML support will be disabled" >&5 $as_echo "$as_me: WARNING: libxml-2.0 pkg-config not found, XML support will be disabled" >&2;} elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libxml-2.0 pkg-config not found, XML support will be disabled" >&5 $as_echo "$as_me: WARNING: libxml-2.0 pkg-config not found, XML support will be disabled" >&2;} else LIBXML2_CFLAGS=$pkg_cv_LIBXML2_CFLAGS LIBXML2_LIBS=$pkg_cv_LIBXML2_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_XML2 1" >>confdefs.h fi # Check whether --with-rigmatrix was given. if test "${with_rigmatrix+set}" = set; then : withval=$with_rigmatrix; for ac_header in gd.h do : ac_fn_c_check_header_mongrel "$LINENO" "gd.h" "ac_cv_header_gd_h" "$ac_includes_default" if test "x$ac_cv_header_gd_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GD_H 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdImageCreate in -lgd" >&5 $as_echo_n "checking for gdImageCreate in -lgd... " >&6; } if test "${ac_cv_lib_gd_gdImageCreate+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgd -lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gdImageCreate (); int main () { return gdImageCreate (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_gd_gdImageCreate=yes else ac_cv_lib_gd_gdImageCreate=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gd_gdImageCreate" >&5 $as_echo "$ac_cv_lib_gd_gdImageCreate" >&6; } if test "x$ac_cv_lib_gd_gdImageCreate" = x""yes; then : enable_rigmatrix=yes else enable_rigmatrix=no fi fi done else enable_rigmatrix=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build rigmatrix" >&5 $as_echo_n "checking whether to build rigmatrix... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_rigmatrix" >&5 $as_echo "$enable_rigmatrix" >&6; } if test "${enable_rigmatrix}" = "no"; then RIGMATRIX= else RIGMATRIX="rigmatrix" fi BACKEND_LIST="icom kenwood aor yaesu dummy pcr alinco uniden tentec kachina jrc drake lowe rft rs kit skanti prm80 tapr flexradio wj racal tuner adat" ROT_BACKEND_LIST="dummy easycomm fodtrack gs232a heathkit kit rotorez sartek spid ars m2 amsat ts7400 celestron" BINDINGS="" BINDING_ALL="" BINDING_CHECK="" BINDING_CLEAN="" BINDING_DISTCLEAN="" BINDING_DISTCHECK="" BINDING_INSTALL_EXEC="" BINDING_UNINSTALL="" BINDING_LIST="" BINDING_LIB_TARGETS="" # TODO: check whether CXX is functional # Extract the first word of ""${CXX}"", so it can be a program name with args. set dummy "${CXX}"; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_cf_with_cxx+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$cf_with_cxx"; then ac_cv_prog_cf_with_cxx="$cf_with_cxx" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_cf_with_cxx="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_cf_with_cxx" && ac_cv_prog_cf_with_cxx="no" fi fi cf_with_cxx=$ac_cv_prog_cf_with_cxx if test -n "$cf_with_cxx"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cf_with_cxx" >&5 $as_echo "$cf_with_cxx" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build C++ binding and demo" >&5 $as_echo_n "checking whether to build C++ binding and demo... " >&6; } # Check whether --with-cxx-binding was given. if test "${with_cxx_binding+set}" = set; then : withval=$with_cxx_binding; cf_with_cxx_binding=$withval else cf_with_cxx_binding=$cf_with_cxx fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cf_with_cxx_binding" >&5 $as_echo "$cf_with_cxx_binding" >&6; } if test "${cf_with_cxx_binding}" = "yes" ; then BINDINGS="${BINDINGS} c++" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build perl binding and demo" >&5 $as_echo_n "checking whether to build perl binding and demo... " >&6; } # Check whether --with-perl-binding was given. if test "${with_perl_binding+set}" = set; then : withval=$with_perl_binding; cf_with_perl_binding=$withval else cf_with_perl_binding=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cf_with_perl_binding" >&5 $as_echo "$cf_with_perl_binding" >&6; } if test "${cf_with_perl_binding}" = "yes" ; then # we reset no_perl in case something fails here no_perl=true # Check whether --with-perl-inc was given. if test "${with_perl_inc+set}" = set; then : withval=$with_perl_inc; with_perl_inc=${withval} fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl headers" >&5 $as_echo_n "checking for perl headers... " >&6; } if test "${ac_cv_c_perl_inc+set}" = set; then : $as_echo_n "(cached) " >&6 else # First check to see if --with-perl-inc was specified. if test x"${with_perl_inc}" != x ; then if test -f "${with_perl_inc}/perl.h" ; then ac_cv_c_perl_inc=`(cd ${with_perl_inc}; pwd)` else as_fn_error $? "${with_perl_inc} directory doesn't contain perl.h" "$LINENO" 5 fi fi # then check for a private Perl installation if test x"${ac_cv_c_perl_inc}" = x ; then eval `perl -V:archlibexp` if test -f "${archlibexp}/CORE/perl.h" ; then ac_cv_c_perl_inc=`(cd ${archlibexp}/CORE; pwd)` else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ${with_perl_inc} directory doesn't contain perl.h" >&5 $as_echo "$as_me: WARNING: ${with_perl_inc} directory doesn't contain perl.h" >&2;} fi fi fi if test x"${ac_cv_c_perl_inc}" = x ; then PERL_INC_DIR= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find Perl header files" >&5 $as_echo "$as_me: WARNING: Can't find Perl header files" >&2;} else no_perl= PERL_INC_DIR=${ac_cv_c_perl_inc} { $as_echo "$as_me:${as_lineno-$LINENO}: result: found $PERL_INC_DIR" >&5 $as_echo "found $PERL_INC_DIR" >&6; } fi BINDING_LIST="${BINDING_LIST} perl" BINDING_ALL="${BINDING_ALL} all-perl" BINDING_CHECK="${BINDING_CHECK} check-perl" BINDING_CLEAN="${BINDING_CLEAN} clean-perl" BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-perl" BINDING_DISTCHECK="${BINDING_DISTCHECK} distcheck-perl" BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-perl" BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-perl" fi # Tcl bindings { $as_echo "$as_me:${as_lineno-$LINENO}: checking Whether to build Tcl bindings and demos" >&5 $as_echo_n "checking Whether to build Tcl bindings and demos... " >&6; } # Check whether --enable-tcl-binding was given. if test "${enable_tcl_binding+set}" = set; then : enableval=$enable_tcl_binding; build_tcl=$enableval else build_tcl=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $build_tcl" >&5 $as_echo "$build_tcl" >&6; } if test x"${build_tcl}" = "xyes"; then # # Ok, lets find the tcl configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-tcl # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true # Check whether --with-tcl was given. if test "${with_tcl+set}" = set; then : withval=$with_tcl; with_tclconfig=${withval} fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5 $as_echo_n "checking for Tcl configuration... " >&6; } if test "${ac_cv_c_tclconfig+set}" = set; then : $as_echo_n "(cached) " >&6 else # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` else as_fn_error $? "${with_tclconfig} directory doesn't contain tclConfig.sh" "$LINENO" 5 fi fi # then check for a private Tcl installation if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ../tcl \ `ls -dr ../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \ ../../tcl \ `ls -dr ../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \ ../../../tcl \ `ls -dr ../../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break fi done fi # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -dr /usr/lib/tcl[8-9].[0-9]* 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i; pwd)` break fi done fi # check in a few other private locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ${srcdir}/../tcl \ `ls -dr ${srcdir}/../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break fi done fi fi if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find Tcl configuration definitions" >&5 $as_echo "$as_me: WARNING: Can't find Tcl configuration definitions" >&2;} else no_tcl= TCL_BIN_DIR=${ac_cv_c_tclconfig} { $as_echo "$as_me:${as_lineno-$LINENO}: result: found $TCL_BIN_DIR/tclConfig.sh" >&5 $as_echo "found $TCL_BIN_DIR/tclConfig.sh" >&6; } fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 $as_echo_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh... " >&6; } if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: loading" >&5 $as_echo "loading" >&6; } . $TCL_BIN_DIR/tclConfig.sh else { $as_echo "$as_me:${as_lineno-$LINENO}: result: file not found" >&5 $as_echo "file not found" >&6; } fi # # The eval is required to do the TCL_DBGX substitution in the # TCL_LIB_FILE variable # eval TCL_LIB_FILE=${TCL_LIB_FILE} eval TCL_LIB_FLAG=${TCL_LIB_FLAG} tcl_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC" for ac_header in tcl.h do : ac_fn_c_check_header_mongrel "$LINENO" "tcl.h" "ac_cv_header_tcl_h" "$ac_includes_default" if test "x$ac_cv_header_tcl_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_TCL_H 1 _ACEOF else as_fn_error $? "Unable to find Tcl headers" "$LINENO" 5 fi done CPPFLAGS=$tcl_save_CPPFLAGS BINDING_LIST="${BINDING_LIST} tcl" BINDING_ALL="${BINDING_ALL} all-tcl" BINDING_CHECK="${BINDING_CHECK} check-tcl" BINDING_CLEAN="${BINDING_CLEAN} clean-tcl" BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-tcl" BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-tcl" BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-tcl" BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(tcl_ltlib)" fi if test x"${build_tcl}" = "xyes"; then ENABLE_TCL_TRUE= ENABLE_TCL_FALSE='#' else ENABLE_TCL_TRUE='#' ENABLE_TCL_FALSE= fi # TODO: require "${ac_cv_header_sys_socket_h}" = "no" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build python binding and demo" >&5 $as_echo_n "checking whether to build python binding and demo... " >&6; } # Check whether --with-python-binding was given. if test "${with_python_binding+set}" = set; then : withval=$with_python_binding; cf_with_python_binding=$withval else cf_with_python_binding=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cf_with_python_binding" >&5 $as_echo "$cf_with_python_binding" >&6; } if test "${cf_with_python_binding}" = "yes" ; then if test -n "$PYTHON"; then # If the user set $PYTHON, use it and don't search something else. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $PYTHON version >= 2.1" >&5 $as_echo_n "checking whether $PYTHON version >= 2.1... " >&6; } prog="import sys # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. # map returns an iterator in Python 3.0 and a list in 2.x minver = list(map(int, '2.1'.split('.'))) + [0, 0, 0] minverhex = 0 # xrange is not present in Python 3.0 and range returns an iterator for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] sys.exit(sys.hexversion < minverhex)" if { echo "$as_me:$LINENO: $PYTHON -c "$prog"" >&5 ($PYTHON -c "$prog") >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else as_fn_error $? "too old" "$LINENO" 5 fi am_display_PYTHON=$PYTHON else # Otherwise, try each interpreter until we find one that satisfies # VERSION. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a Python interpreter with version >= 2.1" >&5 $as_echo_n "checking for a Python interpreter with version >= 2.1... " >&6; } if test "${am_cv_pathless_PYTHON+set}" = set; then : $as_echo_n "(cached) " >&6 else for am_cv_pathless_PYTHON in python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do test "$am_cv_pathless_PYTHON" = none && break prog="import sys # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. # map returns an iterator in Python 3.0 and a list in 2.x minver = list(map(int, '2.1'.split('.'))) + [0, 0, 0] minverhex = 0 # xrange is not present in Python 3.0 and range returns an iterator for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] sys.exit(sys.hexversion < minverhex)" if { echo "$as_me:$LINENO: $am_cv_pathless_PYTHON -c "$prog"" >&5 ($am_cv_pathless_PYTHON -c "$prog") >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then : break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_pathless_PYTHON" >&5 $as_echo "$am_cv_pathless_PYTHON" >&6; } # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. if test "$am_cv_pathless_PYTHON" = none; then PYTHON=: else # Extract the first word of "$am_cv_pathless_PYTHON", so it can be a program name with args. set dummy $am_cv_pathless_PYTHON; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PYTHON+set}" = set; then : $as_echo_n "(cached) " >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 $as_echo "$PYTHON" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi am_display_PYTHON=$am_cv_pathless_PYTHON fi if test "$PYTHON" = :; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON version" >&5 $as_echo_n "checking for $am_display_PYTHON version... " >&6; } if test "${am_cv_python_version+set}" = set; then : $as_echo_n "(cached) " >&6 else am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5 $as_echo "$am_cv_python_version" >&6; } PYTHON_VERSION=$am_cv_python_version PYTHON_PREFIX='${prefix}' PYTHON_EXEC_PREFIX='${exec_prefix}' { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON platform" >&5 $as_echo_n "checking for $am_display_PYTHON platform... " >&6; } if test "${am_cv_python_platform+set}" = set; then : $as_echo_n "(cached) " >&6 else am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform" >&5 $as_echo "$am_cv_python_platform" >&6; } PYTHON_PLATFORM=$am_cv_python_platform { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON script directory" >&5 $as_echo_n "checking for $am_display_PYTHON script directory... " >&6; } if test "${am_cv_python_pythondir+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "x$prefix" = xNONE then am_py_prefix=$ac_default_prefix else am_py_prefix=$prefix fi am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null || echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"` case $am_cv_python_pythondir in $am_py_prefix*) am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` ;; *) case $am_py_prefix in /usr|/System*) ;; *) am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages ;; esac ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir" >&5 $as_echo "$am_cv_python_pythondir" >&6; } pythondir=$am_cv_python_pythondir pkgpythondir=\${pythondir}/$PACKAGE { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $am_display_PYTHON extension module directory" >&5 $as_echo_n "checking for $am_display_PYTHON extension module directory... " >&6; } if test "${am_cv_python_pyexecdir+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "x$exec_prefix" = xNONE then am_py_exec_prefix=$am_py_prefix else am_py_exec_prefix=$exec_prefix fi am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null || echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"` case $am_cv_python_pyexecdir in $am_py_exec_prefix*) am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` ;; *) case $am_py_exec_prefix in /usr|/System*) ;; *) am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages ;; esac ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir" >&5 $as_echo "$am_cv_python_pyexecdir" >&6; } pyexecdir=$am_cv_python_pyexecdir pkgpyexecdir=\${pyexecdir}/$PACKAGE fi # # Allow the use of a (user set) custom python version # # Extract the first word of "python[$PYTHON_VERSION]", so it can be a program name with args. set dummy python$PYTHON_VERSION; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PYTHON+set}" = set; then : $as_echo_n "(cached) " >&6 else case $PYTHON in [\\/]* | ?:[\\/]*) ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PYTHON=$ac_cv_path_PYTHON if test -n "$PYTHON"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 $as_echo "$PYTHON" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$PYTHON"; then as_fn_error $? "Cannot find python$PYTHON_VERSION in your system path" "$LINENO" 5 PYTHON_VERSION="" fi # # Check for a version of Python >= 2.1.0 # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python >= '2.1.0'" >&5 $as_echo_n "checking for a version of Python >= '2.1.0'... " >&6; } ac_supports_python_ver=`$PYTHON -c "import sys; \ ver = sys.version.split ()[0]; \ print (ver >= '2.1.0')"` if test "$ac_supports_python_ver" != "True"; then if test -z "$PYTHON_NOVERSIONCHECK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? " This version of the AC_PYTHON_DEVEL macro doesn't work properly with versions of Python before 2.1.0. You may need to re-run configure, setting the variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. Moreover, to disable this check, set PYTHON_NOVERSIONCHECK to something else than an empty string. See \`config.log' for more details" "$LINENO" 5 ; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: skip at user request" >&5 $as_echo "skip at user request" >&6; } fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi # # if the macro parameter ``version'' is set, honour it # if test -n ""; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python " >&5 $as_echo_n "checking for a version of Python ... " >&6; } ac_supports_python_ver=`$PYTHON -c "import sys; \ ver = sys.version.split ()[0]; \ print (ver )"` if test "$ac_supports_python_ver" = "True"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "this package requires Python . If you have it installed, but it isn't the default Python interpreter in your system path, please pass the PYTHON_VERSION variable to configure. See \`\`configure --help'' for reference. " "$LINENO" 5 PYTHON_VERSION="" fi fi # # Check if you have distutils, else fail # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5 $as_echo_n "checking for the distutils Python package... " >&6; } ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` if test -z "$ac_distutils_result"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "cannot import Python module \"distutils\". Please check your Python installation. The error was: $ac_distutils_result" "$LINENO" 5 PYTHON_VERSION="" fi # # Check for Python include path # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python include path" >&5 $as_echo_n "checking for Python include path... " >&6; } if test -z "$PYTHON_CPPFLAGS"; then python_path=`$PYTHON -c "import distutils.sysconfig; \ print (distutils.sysconfig.get_python_inc ());"` if test -n "${python_path}"; then python_path="-I$python_path" fi PYTHON_CPPFLAGS=$python_path fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_CPPFLAGS" >&5 $as_echo "$PYTHON_CPPFLAGS" >&6; } # # Check for Python library path # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library path" >&5 $as_echo_n "checking for Python library path... " >&6; } if test -z "$PYTHON_LDFLAGS"; then # (makes two attempts to ensure we've got a version number # from the interpreter) ac_python_version=`cat<>confdefs.h <<_ACEOF #define HAVE_PYTHON "$ac_python_version" _ACEOF # First, the library directory: ac_python_libdir=`cat<&5 $as_echo "$PYTHON_LDFLAGS" >&6; } # # Check for site packages # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python site-packages path" >&5 $as_echo_n "checking for Python site-packages path... " >&6; } if test -z "$PYTHON_SITE_PKG"; then PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ print (distutils.sysconfig.get_python_lib(0,0));"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_SITE_PKG" >&5 $as_echo "$PYTHON_SITE_PKG" >&6; } # # libraries which must be linked in when embedding # { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra libraries" >&5 $as_echo_n "checking python extra libraries... " >&6; } # Do not reference LOCALMODLIBS, else it will add libraries to our # link line (e.g -lssl) which are not necessarily installed. if test -z "$PYTHON_EXTRA_LIBS"; then PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ print (conf('LIBS'))"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LIBS" >&5 $as_echo "$PYTHON_EXTRA_LIBS" >&6; } # # linking flags needed when embedding # { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra linking flags" >&5 $as_echo_n "checking python extra linking flags... " >&6; } if test -z "$PYTHON_EXTRA_LDFLAGS"; then PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ conf = distutils.sysconfig.get_config_var; \ print (conf('LINKFORSHARED'))"` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LDFLAGS" >&5 $as_echo "$PYTHON_EXTRA_LDFLAGS" >&6; } # # final check to see if everything compiles alright # { $as_echo "$as_me:${as_lineno-$LINENO}: checking consistency of all components of python development environment" >&5 $as_echo_n "checking consistency of all components of python development environment... " >&6; } # save current global flags #### #### Why does this macro expect ac_save_LIBS and ac_save_CPPFLAGS to #### be set? configure doesn't appear to set them automatically, #### so this macro trashes any pre-set CPPFLAGS and LIBS when it runs! #### Hack to fix that: ac_save_LIBS="$LIBS" ac_save_CPPFLAGS="$CPPFLAGS" #### #### LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS" CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { Py_Initialize(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : pythonexists=yes else pythonexists=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # turn back to default flags CPPFLAGS="$ac_save_CPPFLAGS" LIBS="$ac_save_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pythonexists" >&5 $as_echo "$pythonexists" >&6; } if test ! "x$pythonexists" = "xyes"; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? " Could not link test program to Python. Maybe the main Python library has been installed in some non-standard library path. If so, pass it to configure, via the LDFLAGS environment variable. Example: ./configure LDFLAGS=\"-L/usr/non-standard-path/python/lib\" ============================================================================ ERROR! You probably have to install the development version of the Python package for your distribution. The exact name of this package varies among them. ============================================================================ See \`config.log' for more details" "$LINENO" 5 ; } PYTHON_VERSION="" fi # # all done! # BINDING_LIST="${BINDING_LIST} python" BINDING_ALL="${BINDING_ALL} all-py" BINDING_CHECK="${BINDING_CHECK} check-py" BINDING_CLEAN="${BINDING_CLEAN} clean-py" BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-py" BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-py" BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-py" BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(python_ltlib)" fi if test x"${cf_with_python_binding}" = "xyes"; then ENABLE_PYTHON_TRUE= ENABLE_PYTHON_FALSE='#' else ENABLE_PYTHON_TRUE='#' ENABLE_PYTHON_FALSE= fi # Winradio only under Linux (until someone port it on other os) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build winradio backend" >&5 $as_echo_n "checking whether to build winradio backend... " >&6; } # Check whether --with-winradio was given. if test "${with_winradio+set}" = set; then : withval=$with_winradio; cf_with_winradio="no" else cf_with_winradio="yes" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cf_with_winradio" >&5 $as_echo "$cf_with_winradio" >&6; } if test "${cf_with_winradio}" = "yes" ; then BACKEND_LIST="$BACKEND_LIST winradio" fi if test "${cf_with_cxx}" = "yes" ; then # stuff that requires C++ support { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build USRP backend" >&5 $as_echo_n "checking whether to build USRP backend... " >&6; } # Check whether --with-usrp was given. if test "${with_usrp+set}" = set; then : withval=$with_usrp; cf_with_usrp=$withval else cf_with_usrp="no" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cf_with_usrp" >&5 $as_echo "$cf_with_usrp" >&6; } if test "${cf_with_usrp}" = "yes" ; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for USRP" >&5 $as_echo_n "checking for USRP... " >&6; } if test -n "$USRP_CFLAGS"; then pkg_cv_USRP_CFLAGS="$USRP_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"usrp >= 0.8\""; } >&5 ($PKG_CONFIG --exists --print-errors "usrp >= 0.8") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_USRP_CFLAGS=`$PKG_CONFIG --cflags "usrp >= 0.8" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$USRP_LIBS"; then pkg_cv_USRP_LIBS="$USRP_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"usrp >= 0.8\""; } >&5 ($PKG_CONFIG --exists --print-errors "usrp >= 0.8") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_USRP_LIBS=`$PKG_CONFIG --libs "usrp >= 0.8" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then USRP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "usrp >= 0.8" 2>&1` else USRP_PKG_ERRORS=`$PKG_CONFIG --print-errors "usrp >= 0.8" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$USRP_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (usrp >= 0.8) were not met: $USRP_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables USRP_CFLAGS and USRP_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables USRP_CFLAGS and USRP_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5 ; } else USRP_CFLAGS=$pkg_cv_USRP_CFLAGS USRP_LIBS=$pkg_cv_USRP_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_USRP 1" >>confdefs.h fi fi fi if test x"${cf_with_cxx}" = "xyes"; then ENABLE_CXX_TRUE= ENABLE_CXX_FALSE='#' else ENABLE_CXX_TRUE='#' ENABLE_CXX_FALSE= fi if test x"${cf_with_usrp}" = "xyes"; then HAVE_USRP_TRUE= HAVE_USRP_FALSE='#' else HAVE_USRP_TRUE='#' HAVE_USRP_FALSE= fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBUSB" >&5 $as_echo_n "checking for LIBUSB... " >&6; } if test -n "$LIBUSB_CFLAGS"; then pkg_cv_LIBUSB_CFLAGS="$LIBUSB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb >= 0.1\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb >= 0.1") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBUSB_CFLAGS=`$PKG_CONFIG --cflags "libusb >= 0.1" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$LIBUSB_LIBS"; then pkg_cv_LIBUSB_LIBS="$LIBUSB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb >= 0.1\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb >= 0.1") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBUSB_LIBS=`$PKG_CONFIG --libs "libusb >= 0.1" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then LIBUSB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libusb >= 0.1" 2>&1` else LIBUSB_PKG_ERRORS=`$PKG_CONFIG --print-errors "libusb >= 0.1" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBUSB_PKG_ERRORS" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libusb pkg-config not found, USB backends will be disabled" >&5 $as_echo "$as_me: WARNING: libusb pkg-config not found, USB backends will be disabled" >&2;} elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libusb pkg-config not found, USB backends will be disabled" >&5 $as_echo "$as_me: WARNING: libusb pkg-config not found, USB backends will be disabled" >&2;} else LIBUSB_CFLAGS=$pkg_cv_LIBUSB_CFLAGS LIBUSB_LIBS=$pkg_cv_LIBUSB_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi CFLAGS="${CFLAGS} ${LIBUSB_CFLAGS}" CXXFLAGS="${CXXFLAGS} ${LIBUSB_CFLAGS}" for ac_header in usb.h do : ac_fn_c_check_header_mongrel "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default" if test "x$ac_cv_header_usb_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_USB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build USB backends" >&5 $as_echo_n "checking whether to build USB backends... " >&6; } if test x"${LIBUSB_LIBS}" = x; then cf_with_libusb="no" else cf_with_libusb="yes" $as_echo "#define HAVE_LIBUSB 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cf_with_libusb" >&5 $as_echo "$cf_with_libusb" >&6; } # prepare backend dependencies before adding rpcrig and rpcrot dirs # otherwise parallel 'make -jn' will fail for be in ${BACKEND_LIST} ; do BACKENDEPS="${BACKENDEPS} \$(top_builddir)/${be}/hamlib-${be}.la" done # prepare backend dependencies before adding rpcrig and rpcrot dirs # otherwise parallel 'make -jn' will fail for be in ${ROT_BACKEND_LIST} ; do ROT_BACKENDEPS="${ROT_BACKENDEPS} \$(top_builddir)/${be}/hamlib-${be}.la" done # Extract the first word of "rpcgen", so it can be a program name with args. set dummy rpcgen; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_cf_with_rpcgen+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$cf_with_rpcgen"; then ac_cv_prog_cf_with_rpcgen="$cf_with_rpcgen" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_cf_with_rpcgen="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_cf_with_rpcgen" && ac_cv_prog_cf_with_rpcgen="no" fi fi cf_with_rpcgen=$ac_cv_prog_cf_with_rpcgen if test -n "$cf_with_rpcgen"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cf_with_rpcgen" >&5 $as_echo "$cf_with_rpcgen" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build rpc backends" >&5 $as_echo_n "checking whether to build rpc backends... " >&6; } # RPCRig must be the last one added to BACKEND_LIST # because it links against other backends (build order) if test "${ac_cv_header_rpc_rpc_h}" = "yes" -a "${cf_with_rpcgen}" = "yes"; then cf_with_rpc=yes else cf_with_rpc=no fi # Check whether --with-rpc-backends was given. if test "${with_rpc_backends+set}" = set; then : withval=$with_rpc_backends; cf_with_rpc_backends=$withval else cf_with_rpc_backends=$cf_with_rpc fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cf_with_rpc_backends" >&5 $as_echo "$cf_with_rpc_backends" >&6; } if test "${cf_with_rpc_backends}" = "yes"; then BACKEND_LIST="$BACKEND_LIST rpcrig" ROT_BACKEND_LIST="$ROT_BACKEND_LIST rpcrot" fi # dlopen force or preopen self for static version ? BACKENDLNK="-dlopen force" for be in ${BACKEND_LIST} ; do BACKENDLNK="${BACKENDLNK} -dlopen \$(top_builddir)/${be}/hamlib-${be}.la" done # dlopen force or preopen self for static version ? ROT_BACKENDLNK="-dlopen force" for be in ${ROT_BACKEND_LIST} ; do ROT_BACKENDLNK="${ROT_BACKENDLNK} -dlopen \$(top_builddir)/${be}/hamlib-${be}.la" done # Extract the first word of "swig", so it can be a program name with args. set dummy swig; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_cf_with_bindings+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$cf_with_bindings"; then ac_cv_prog_cf_with_bindings="$cf_with_bindings" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_cf_with_bindings="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_cf_with_bindings" && ac_cv_prog_cf_with_bindings="no" fi fi cf_with_bindings=$ac_cv_prog_cf_with_bindings if test -n "$cf_with_bindings"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cf_with_bindings" >&5 $as_echo "$cf_with_bindings" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "${cf_with_bindings}" = "yes"; then cf_with_bindings=no # Extract the first word of "swig", so it can be a program name with args. set dummy swig; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_SWIG+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$SWIG"; then ac_cv_prog_SWIG="$SWIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_SWIG="`which swig`" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi SWIG=$ac_cv_prog_SWIG if test -n "$SWIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG" >&5 $as_echo "$SWIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$SWIG" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find 'swig' program" >&5 $as_echo "$as_me: WARNING: cannot find 'swig' program" >&2;} SWIG=false elif test -n "1.3.22" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SWIG version" >&5 $as_echo_n "checking for SWIG version... " >&6; } swig_version=`$SWIG -version 2>&1 | \ awk '/^SWIG Version [0-9]+\.[0-9]+\.[0-9]+.*$/ { split($3,a,"[^.0-9]"); print a[1] }'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $swig_version" >&5 $as_echo "$swig_version" >&6; } if test -n "$swig_version" ; then swig_version=`echo $swig_version | \ awk '{ split($1,a,"\."); print a[1]*1000000+a[2]*1000+a[3] }' 2>/dev/null` swig_required_version=`echo 1.3.22 | \ awk '{ split($1,a,"\."); print a[1]*1000000+a[2]*1000+a[3] }' 2>/dev/null` if test $swig_required_version -gt $swig_version ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SWIG version 1.3.22 required" >&5 $as_echo "$as_me: WARNING: SWIG version 1.3.22 required" >&2;} SWIG=false fi else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine SWIG version" >&5 $as_echo "$as_me: WARNING: cannot determine SWIG version" >&2;} SWIG=false fi fi if test "${SWIG}" != "false" -a "x${BINDING_ALL}" != "x"; then BINDINGS="${BINDINGS} bindings" cf_with_bindings=yes fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build bindings" >&5 $as_echo_n "checking whether to build bindings... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cf_with_bindings" >&5 $as_echo "$cf_with_bindings" >&6; } ac_config_files="$ac_config_files Makefile macros/Makefile include/Makefile lib/Makefile dummy/Makefile yaesu/Makefile icom/Makefile aor/Makefile kenwood/Makefile winradio/Makefile pcr/Makefile alinco/Makefile uniden/Makefile tentec/Makefile kachina/Makefile jrc/Makefile drake/Makefile lowe/Makefile rft/Makefile rs/Makefile kit/Makefile tapr/Makefile skanti/Makefile prm80/Makefile wj/Makefile racal/Makefile tuner/Makefile ars/Makefile easycomm/Makefile fodtrack/Makefile gs232a/Makefile heathkit/Makefile spid/Makefile sartek/Makefile rpcrig/Makefile rpcrot/Makefile src/Makefile c++/Makefile bindings/Makefile bindings/hamlibvb.bas tests/Makefile doc/Makefile doc/hamlib.cfg rotorez/Makefile flexradio/Makefile m2/Makefile amsat/Makefile adat/Makefile ts7400/Makefile celestron/Makefile scripts/Makefile hamlib.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INSIDE_GNOME_COMMON_TRUE}" && test -z "${INSIDE_GNOME_COMMON_FALSE}"; then as_fn_error $? "conditional \"INSIDE_GNOME_COMMON\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_TCL_TRUE}" && test -z "${ENABLE_TCL_FALSE}"; then as_fn_error $? "conditional \"ENABLE_TCL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_PYTHON_TRUE}" && test -z "${ENABLE_PYTHON_FALSE}"; then as_fn_error $? "conditional \"ENABLE_PYTHON\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_CXX_TRUE}" && test -z "${ENABLE_CXX_FALSE}"; then as_fn_error $? "conditional \"ENABLE_CXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_USRP_TRUE}" && test -z "${HAVE_USRP_FALSE}"; then as_fn_error $? "conditional \"HAVE_USRP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by Hamlib $as_me 1.2.15.3, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to . Hamlib home page: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ Hamlib config.status 1.2.15.3 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' AS='`$ECHO "X$AS" | $Xsed -e "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "X$DLLTOOL" | $Xsed -e "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' compiler_lib_search_dirs='`$ECHO "X$compiler_lib_search_dirs" | $Xsed -e "$delay_single_quote_subst"`' predep_objects='`$ECHO "X$predep_objects" | $Xsed -e "$delay_single_quote_subst"`' postdep_objects='`$ECHO "X$postdep_objects" | $Xsed -e "$delay_single_quote_subst"`' predeps='`$ECHO "X$predeps" | $Xsed -e "$delay_single_quote_subst"`' postdeps='`$ECHO "X$postdeps" | $Xsed -e "$delay_single_quote_subst"`' compiler_lib_search_path='`$ECHO "X$compiler_lib_search_path" | $Xsed -e "$delay_single_quote_subst"`' LD_CXX='`$ECHO "X$LD_CXX" | $Xsed -e "$delay_single_quote_subst"`' old_archive_cmds_CXX='`$ECHO "X$old_archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' compiler_CXX='`$ECHO "X$compiler_CXX" | $Xsed -e "$delay_single_quote_subst"`' GCC_CXX='`$ECHO "X$GCC_CXX" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "X$lt_prog_compiler_no_builtin_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_wl_CXX='`$ECHO "X$lt_prog_compiler_wl_CXX" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_pic_CXX='`$ECHO "X$lt_prog_compiler_pic_CXX" | $Xsed -e "$delay_single_quote_subst"`' lt_prog_compiler_static_CXX='`$ECHO "X$lt_prog_compiler_static_CXX" | $Xsed -e "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "X$lt_cv_prog_compiler_c_o_CXX" | $Xsed -e "$delay_single_quote_subst"`' archive_cmds_need_lc_CXX='`$ECHO "X$archive_cmds_need_lc_CXX" | $Xsed -e "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_CXX='`$ECHO "X$enable_shared_with_static_runtimes_CXX" | $Xsed -e "$delay_single_quote_subst"`' export_dynamic_flag_spec_CXX='`$ECHO "X$export_dynamic_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' whole_archive_flag_spec_CXX='`$ECHO "X$whole_archive_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' compiler_needs_object_CXX='`$ECHO "X$compiler_needs_object_CXX" | $Xsed -e "$delay_single_quote_subst"`' old_archive_from_new_cmds_CXX='`$ECHO "X$old_archive_from_new_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_CXX='`$ECHO "X$old_archive_from_expsyms_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' archive_cmds_CXX='`$ECHO "X$archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' archive_expsym_cmds_CXX='`$ECHO "X$archive_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' module_cmds_CXX='`$ECHO "X$module_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' module_expsym_cmds_CXX='`$ECHO "X$module_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' with_gnu_ld_CXX='`$ECHO "X$with_gnu_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`' allow_undefined_flag_CXX='`$ECHO "X$allow_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`' no_undefined_flag_CXX='`$ECHO "X$no_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_CXX='`$ECHO "X$hardcode_libdir_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_ld_CXX='`$ECHO "X$hardcode_libdir_flag_spec_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_libdir_separator_CXX='`$ECHO "X$hardcode_libdir_separator_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_direct_CXX='`$ECHO "X$hardcode_direct_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_direct_absolute_CXX='`$ECHO "X$hardcode_direct_absolute_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_minus_L_CXX='`$ECHO "X$hardcode_minus_L_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_shlibpath_var_CXX='`$ECHO "X$hardcode_shlibpath_var_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_automatic_CXX='`$ECHO "X$hardcode_automatic_CXX" | $Xsed -e "$delay_single_quote_subst"`' inherit_rpath_CXX='`$ECHO "X$inherit_rpath_CXX" | $Xsed -e "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "X$link_all_deplibs_CXX" | $Xsed -e "$delay_single_quote_subst"`' fix_srcfile_path_CXX='`$ECHO "X$fix_srcfile_path_CXX" | $Xsed -e "$delay_single_quote_subst"`' always_export_symbols_CXX='`$ECHO "X$always_export_symbols_CXX" | $Xsed -e "$delay_single_quote_subst"`' export_symbols_cmds_CXX='`$ECHO "X$export_symbols_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' exclude_expsyms_CXX='`$ECHO "X$exclude_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`' include_expsyms_CXX='`$ECHO "X$include_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`' prelink_cmds_CXX='`$ECHO "X$prelink_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`' file_list_spec_CXX='`$ECHO "X$file_list_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "X$hardcode_action_CXX" | $Xsed -e "$delay_single_quote_subst"`' compiler_lib_search_dirs_CXX='`$ECHO "X$compiler_lib_search_dirs_CXX" | $Xsed -e "$delay_single_quote_subst"`' predep_objects_CXX='`$ECHO "X$predep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`' postdep_objects_CXX='`$ECHO "X$postdep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`' predeps_CXX='`$ECHO "X$predeps_CXX" | $Xsed -e "$delay_single_quote_subst"`' postdeps_CXX='`$ECHO "X$postdeps_CXX" | $Xsed -e "$delay_single_quote_subst"`' compiler_lib_search_path_CXX='`$ECHO "X$compiler_lib_search_path_CXX" | $Xsed -e "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # Quote evaled strings. for var in SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ deplibs_check_method \ file_magic_cmd \ AR \ AR_FLAGS \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ SHELL \ ECHO \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_wl \ lt_prog_compiler_pic \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ fix_srcfile_path \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ whole_archive_flag_spec_CXX \ compiler_needs_object_CXX \ with_gnu_ld_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_flag_spec_ld_CXX \ hardcode_libdir_separator_CXX \ fix_srcfile_path_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ compiler_lib_search_dirs_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX; do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Fix-up fallback echo if it was mangled by the above quoting rules. case \$lt_ECHO in *'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` ;; esac ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "macros/Makefile") CONFIG_FILES="$CONFIG_FILES macros/Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "dummy/Makefile") CONFIG_FILES="$CONFIG_FILES dummy/Makefile" ;; "yaesu/Makefile") CONFIG_FILES="$CONFIG_FILES yaesu/Makefile" ;; "icom/Makefile") CONFIG_FILES="$CONFIG_FILES icom/Makefile" ;; "aor/Makefile") CONFIG_FILES="$CONFIG_FILES aor/Makefile" ;; "kenwood/Makefile") CONFIG_FILES="$CONFIG_FILES kenwood/Makefile" ;; "winradio/Makefile") CONFIG_FILES="$CONFIG_FILES winradio/Makefile" ;; "pcr/Makefile") CONFIG_FILES="$CONFIG_FILES pcr/Makefile" ;; "alinco/Makefile") CONFIG_FILES="$CONFIG_FILES alinco/Makefile" ;; "uniden/Makefile") CONFIG_FILES="$CONFIG_FILES uniden/Makefile" ;; "tentec/Makefile") CONFIG_FILES="$CONFIG_FILES tentec/Makefile" ;; "kachina/Makefile") CONFIG_FILES="$CONFIG_FILES kachina/Makefile" ;; "jrc/Makefile") CONFIG_FILES="$CONFIG_FILES jrc/Makefile" ;; "drake/Makefile") CONFIG_FILES="$CONFIG_FILES drake/Makefile" ;; "lowe/Makefile") CONFIG_FILES="$CONFIG_FILES lowe/Makefile" ;; "rft/Makefile") CONFIG_FILES="$CONFIG_FILES rft/Makefile" ;; "rs/Makefile") CONFIG_FILES="$CONFIG_FILES rs/Makefile" ;; "kit/Makefile") CONFIG_FILES="$CONFIG_FILES kit/Makefile" ;; "tapr/Makefile") CONFIG_FILES="$CONFIG_FILES tapr/Makefile" ;; "skanti/Makefile") CONFIG_FILES="$CONFIG_FILES skanti/Makefile" ;; "prm80/Makefile") CONFIG_FILES="$CONFIG_FILES prm80/Makefile" ;; "wj/Makefile") CONFIG_FILES="$CONFIG_FILES wj/Makefile" ;; "racal/Makefile") CONFIG_FILES="$CONFIG_FILES racal/Makefile" ;; "tuner/Makefile") CONFIG_FILES="$CONFIG_FILES tuner/Makefile" ;; "ars/Makefile") CONFIG_FILES="$CONFIG_FILES ars/Makefile" ;; "easycomm/Makefile") CONFIG_FILES="$CONFIG_FILES easycomm/Makefile" ;; "fodtrack/Makefile") CONFIG_FILES="$CONFIG_FILES fodtrack/Makefile" ;; "gs232a/Makefile") CONFIG_FILES="$CONFIG_FILES gs232a/Makefile" ;; "heathkit/Makefile") CONFIG_FILES="$CONFIG_FILES heathkit/Makefile" ;; "spid/Makefile") CONFIG_FILES="$CONFIG_FILES spid/Makefile" ;; "sartek/Makefile") CONFIG_FILES="$CONFIG_FILES sartek/Makefile" ;; "rpcrig/Makefile") CONFIG_FILES="$CONFIG_FILES rpcrig/Makefile" ;; "rpcrot/Makefile") CONFIG_FILES="$CONFIG_FILES rpcrot/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "c++/Makefile") CONFIG_FILES="$CONFIG_FILES c++/Makefile" ;; "bindings/Makefile") CONFIG_FILES="$CONFIG_FILES bindings/Makefile" ;; "bindings/hamlibvb.bas") CONFIG_FILES="$CONFIG_FILES bindings/hamlibvb.bas" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "doc/hamlib.cfg") CONFIG_FILES="$CONFIG_FILES doc/hamlib.cfg" ;; "rotorez/Makefile") CONFIG_FILES="$CONFIG_FILES rotorez/Makefile" ;; "flexradio/Makefile") CONFIG_FILES="$CONFIG_FILES flexradio/Makefile" ;; "m2/Makefile") CONFIG_FILES="$CONFIG_FILES m2/Makefile" ;; "amsat/Makefile") CONFIG_FILES="$CONFIG_FILES amsat/Makefile" ;; "adat/Makefile") CONFIG_FILES="$CONFIG_FILES adat/Makefile" ;; "ts7400/Makefile") CONFIG_FILES="$CONFIG_FILES ts7400/Makefile" ;; "celestron/Makefile") CONFIG_FILES="$CONFIG_FILES celestron/Makefile" ;; "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; "hamlib.pc") CONFIG_FILES="$CONFIG_FILES hamlib.pc" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="CXX " # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Assembler program. AS=$AS # DLL creation program. DLLTOOL=$DLLTOOL # Object dumper program. OBJDUMP=$OBJDUMP # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method == "file_magic". file_magic_cmd=$lt_file_magic_cmd # The archiver. AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name of the directory that contains temporary libtool files. objdir=$objdir # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that does not interpret backslashes. ECHO=$lt_ECHO # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into a binary # during linking. This must work even if \$libdir does not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) case $xsi_shell in yes) cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac } # func_basename file func_basename () { func_basename_result="${1##*/}" } # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}" } # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). func_stripname () { # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"} } # func_opt_split func_opt_split () { func_opt_split_opt=${1%%=*} func_opt_split_arg=${1#*=} } # func_lo2o object func_lo2o () { case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac } # func_xform libobj-or-source func_xform () { func_xform_result=${1%.*}.lo } # func_arith arithmetic-term... func_arith () { func_arith_result=$(( $* )) } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=${#1} } _LT_EOF ;; *) # Bourne compatible functions. cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_basename file func_basename () { func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; esac } # sed scripts: my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^-[^=]*=//' # func_opt_split func_opt_split () { func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` } # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` } # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` } # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "$@"` } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } _LT_EOF esac case $lt_shell_append in yes) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$1+=\$2" } _LT_EOF ;; *) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$1=\$$1\$2" } _LT_EOF ;; esac sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: CXX # The linker used to build libraries. LD=$lt_LD_CXX # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_CXX # A language specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU compiler? with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_CXX # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_CXX # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # If ld is used when linking, flag to hardcode \$libdir into a binary # during linking. This must work even if \$libdir does not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_CXX # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_CXX # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path=$lt_fix_srcfile_path_CXX # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_CXX postdep_objects=$lt_postdep_objects_CXX predeps=$lt_predeps_CXX postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # ### END LIBTOOL TAG CONFIG: CXX _LT_EOF ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi echo \ "---------------------------------------------------------------------- ${PACKAGE_NAME} Version ${PACKAGE_VERSION} configuration: Prefix ${prefix} Compiler ${CC} ${CFLAGS} ${CPPFLAGS} Package features: With C++ binding ${cf_with_cxx_binding} With Perl binding ${cf_with_perl_binding} With Python binding ${cf_with_python_binding} With TCL binding ${build_tcl} Enable Rig Matrix ${enable_rigmatrix} Enable WinRadio ${cf_with_winradio} Enable USRP ${cf_with_usrp} Enable USB backends ${cf_with_libusb} Enable RPC backends ${cf_with_rpc_backends} Enable shared libs ${enable_shared} Enable static libs ${enable_static} -----------------------------------------------------------------------" hamlib-1.2.15.3/depcomp0000755000175000017500000004426712044564547011523 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2009-04-28.21; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free # Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, 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 General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u="sed s,\\\\\\\\,/,g" depmode=msvisualcpp fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: